[Midnightbsd-cvs] mports [17104] trunk/Mk/bsd.port.subdir.mk: update bsd.port.subdir.mk to be faster

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 14 13:48:47 EDT 2014


Revision: 17104
          http://svnweb.midnightbsd.org/mports/?rev=17104
Author:   laffer1
Date:     2014-09-14 13:48:46 -0400 (Sun, 14 Sep 2014)
Log Message:
-----------
update bsd.port.subdir.mk to be faster

Modified Paths:
--------------
    trunk/Mk/bsd.port.subdir.mk

Modified: trunk/Mk/bsd.port.subdir.mk
===================================================================
--- trunk/Mk/bsd.port.subdir.mk	2014-09-14 17:01:11 UTC (rev 17103)
+++ trunk/Mk/bsd.port.subdir.mk	2014-09-14 17:48:46 UTC (rev 17104)
@@ -38,11 +38,22 @@
 #		Search for ports using either 'make search key=<keyword>'
 #		or 'make search name=<keyword>'.
 
+PORTSDIR?=		/usr/mports
+TEMPLATES?=		${PORTSDIR}/Templates
+.if defined(PORTSTOP)
+README=			${TEMPLATES}/README.top
+.else
+README=			${TEMPLATES}/README.category
+.endif
+MOVEDDIR?=		${PORTSDIR}
+MOVEDFILE?=		MOVED
+INDEXDIR?=		${PORTSDIR}
+INDEXFILE?=		INDEX-${OSVERSION:C/([0-9]).*/\1/}
 
+.include "${PORTSDIR}/Mk/components/commands.mk"
+
 .MAIN: all
 
-.include "${PORTSDIR}/Mk/components/commands.mk"
-
 .if !defined(DEBUG_FLAGS)
 STRIP?=	-s
 .endif
@@ -57,15 +68,18 @@
 .endif
 
 .if !defined(OSVERSION)
-OSVERSION!= ${SYSCTL} -n kern.osreldate
+.if exists(/usr/include/sys/param.h)
+OSVERSION!=	${AWK} '/^\#define[[:blank:]]__MidnightBSD_version/ {print $$3}' < /usr/include/sys/param.h
+.elif exists(${SRC_BASE}/sys/sys/param.h)
+OSVERSION!=${AWK} '/^\#define[[:blank:]]__MidnightBSD_version/ {print $$3}' < ${SRC_BASE}/sys/sys/param.h
+.else
+OSVERSION!=	${SYSCTL} -n kern.osreldate
 .endif
-.if !defined(PORTOBJFORMAT)
-PORTOBJFORMAT?= elf
 .endif
 .endif
 
 .if !defined(_OSRELEASE)
-_OSRELEASE!=			uname -r
+_OSRELEASE!=			${UNAME} -r
 .endif
 .if !defined(OSREL)
 OSREL=	${_OSRELEASE:C/[-(].*//}
@@ -91,11 +105,7 @@
 .if !defined(UID)
 UID!=	${ID} -u
 .endif
-LOCALBASE?=	${DESTDIR}${LOCALBASE_REL}
-SED?=		${DESTDIR}/usr/bin/sed
 
-ECHO_MSG?=	echo
-
 # local customization of the ports tree
 .if exists(${.CURDIR}/Makefile.local)
 .include "${.CURDIR}/Makefile.local"
@@ -185,7 +195,7 @@
 realinstall: beforeinstall ${SUBDIR:S/^/_/:S/$/.realinstall/}
 .endif
 
-IGNOREDIR=	CVS Mk Packages Templates Tools Distfiles pkg
+IGNOREDIR=	Mk Packages Templates Tools Distfiles pkg
 
 .if !target(checksubdirs)
 .if defined(PORTSTOP)
@@ -207,13 +217,13 @@
 	      fi; \
 	    done; \
 	    if [ $$found = 0 ]; then \
-	      ${ECHO} "Warning: directory $$d not in SUBDIR"; \
+	      ${ECHO_MSG} "Warning: directory $$d not in SUBDIR"; \
 	    fi; \
 	  fi; \
 	done
 	@for s in ${SUBDIR}; do \
 	  if ! [ -d ${.CURDIR}/$$s ]; then \
-	    ${ECHO} "Warning: directory $$s in SUBDIR does not exist"; \
+	    ${ECHO_MSG} "Warning: directory $$s in SUBDIR does not exist"; \
 	  fi \
 	done
 .endif
@@ -284,7 +294,6 @@
 .endif
 .endif
 
-
 .if !target(readme)
 readme:
 	@${RM} -f README.html
@@ -291,20 +300,8 @@
 	@${MAKE} README.html
 .endif
 
-PORTSDIR ?= /usr/mports
-TEMPLATES ?= ${PORTSDIR}/Templates
-.if defined(PORTSTOP)
-README=	${TEMPLATES}/README.top
-.else
-README=	${TEMPLATES}/README.category
-.endif
-COMMENTFILE?=	${.CURDIR}/pkg/COMMENT
-DESCR?=		${.CURDIR}/pkg-descr
-INDEXDIR?=	${PORTSDIR}
-INDEXFILE?=	INDEX-${OSVERSION:C/([0-9]).*/\1/}
+HTMLIFY=	${SED} -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</g'
 
-HTMLIFY=	sed -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</g'
-
 package-name:
 	@${ECHO_CMD} ${.CURDIR} | ${SED} -e 's^.*/^^'
 
@@ -332,8 +329,8 @@
 .else
 	@> $@.tmp4
 .endif
-	@cat ${README} | \
-		sed -e 's/%%CATEGORY%%/'"`basename ${.CURDIR}`"'/g' \
+	@${CAT} ${README} | \
+		${SED} -e 's/%%CATEGORY%%/'"`basename ${.CURDIR}`"'/g' \
 			-e '/%%COMMENT%%/r$@.tmp4' \
 			-e '/%%COMMENT%%/d' \
 			-e '/%%DESCR%%/r$@.tmp3' \
@@ -454,8 +451,8 @@
 	    } \
 	  } \
 	  { \
-            if (match($$2, "^/usr/mports/[^/]*/[^/]*$$") > 0) \
-              sub("^/usr/mports", "${PORTSDIR}", $$2); \
+	    if (match($$2, "^/usr/mports/[^/]*/[^/]*$$") > 0) \
+	      sub("^/usr/mports", "${PORTSDIR}", $$2); \
 	    if (substr($$2, 1, therelen) != there) \
 	      next; \
 	    for (i in parms) \



More information about the Midnightbsd-cvs mailing list