From: John Marino Date: Sat, 28 Nov 2015 01:39:15 +0000 (+0100) Subject: make(1): Create two more custom variables to speed up dports X-Git-Tag: v4.6.0rc~1300 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/a4cce4724800c9180e886281d6ba9952f7690528 make(1): Create two more custom variables to speed up dports I've added two new static values to bmake: .MAKE.DF.OSREL This will currently return "4.5" .MAKE.DF.VERSION This will currently return "400500". It matches what was in place on /usr/src/sys/sys/param.h during the last buildworld. Every dport runs piped shell commands to get these values. After iterating through the entire ports tree several times, I noticed a large presence of awk in process list. After modifying bmake and then modifying dports locally, the iteration runs 15% faster. There are other optimizations that can be done, but that's out of scope of this commit. --- diff --git a/contrib/bmake/bmake.1 b/contrib/bmake/bmake.1 index e0cbe4670a..5718be231a 100644 --- a/contrib/bmake/bmake.1 +++ b/contrib/bmake/bmake.1 @@ -905,6 +905,15 @@ The parent process-id of The compiler CCVER that built the .Dx world. +.It Va .MAKE.DF.OSREL +The +.Dx +version when the world was built. It is in the "." +format and it used by DPorts. +.It Va .MAKE.DF.VERSION +The value of __DragonFly_version when the +.Dx +world was built. It is used by DPorts. .It Va MAKE_PRINT_VAR_ON_ERROR When .Nm diff --git a/contrib/bmake/main.c b/contrib/bmake/main.c index 71b5496960..1f8f9f0cdf 100644 --- a/contrib/bmake/main.c +++ b/contrib/bmake/main.c @@ -1043,6 +1043,8 @@ main(int argc, char **argv) snprintf(tmp, sizeof(tmp), "%u", getppid()); Var_Set(".MAKE.PPID", tmp, VAR_GLOBAL, 0); Var_Set(".MAKE.BUILT.BY", CCVER, VAR_GLOBAL, 0); + Var_Set(".MAKE.DF.VERSION", DFVER, VAR_GLOBAL, 0); + Var_Set(".MAKE.DF.OSREL", OSREL, VAR_GLOBAL, 0); } if (makelevel > 0) { char pn[1024]; diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile index 82b442c88e..f6a8665f19 100644 --- a/usr.bin/bmake/Makefile +++ b/usr.bin/bmake/Makefile @@ -28,6 +28,13 @@ DEFAULT_SYS_PATH = ${.CURDIR}/../../share/mk DEFAULT_SYS_PATH = /usr/share/mk:.../share/mk .endif +# move vital dports information to bmake for performance reasons +DFLYVERSION!= awk '/^\#define[[:blank:]]__DragonFly_version/ {print $$3}' \ + < ${.CURDIR}/../../sys/sys/param.h +OSREL!= echo ${DFLYVERSION} | \ + awk '{a=int($$1/100000); b=int(($$1-(a*100000))/100); \ + print a "." b}' + WARNS?= 4 CPPFLAGS+= -DUSE_EMALLOC @@ -40,6 +47,7 @@ CFLAGS+= -I${.OBJDIR} CFLAGS+= -I${srcdir} CFLAGS+= -DHAVE_CONFIG_H CFLAGS+= -DCCVER=\"${CCVER}\" +CFLAGS+= -DDFVER=\"${DFLYVERSION}\" -DOSREL=\"${OSREL}\" CFLAGS+= ${XDEFS} CFLAGS+= ${CFLAGS_${.TARGET:T}} CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T}}