build: FAST_DEPEND default (kernel first, then world)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

build: FAST_DEPEND default (kernel first, then world)

Bryan Drewery-6
Hi,

WITH_FAST_DEPEND makes 'make depend' mostly a NOP and pushes the
dependency generation to the compilation phase which saves around 35%
time in the kernel build.  Various bugs have been found with the
implementation and all but 1 are now fixed.  The last is not including
the dependency files via .depend (really .MAKE.DEPENDFILE) which make
considers special when finding missing targets (it would be nice if make
had something like a .dinclude to flag any file with this magic).  I
have a fix in testing that I plan to commit today.

I would like to enable FAST_DEPEND by default in the kernel build.

I have been asked to also remove the old mkdep version of 'make depend'.
 I am unsure on this as I think it may be useful for some people for the
sake of debugging.  However it does entail running the preprocessor and
given you can compile the entire kernel in minutes usually it may not be
worth keeping this as opposed to just compiling to generate them.
Keeping a behavior of generating the depend files pre-compile or
without-compile is my only real question here.  I could likely work this
without-compile behavior into the FAST_DEPEND method to avoid needing
mkdep entirely.

The old code is horrendous, slow, and easily wrong and hard to maintain.

Some of the code that would be removed:

sys/conf/kern.post.mk

> .depend: .PRECIOUS ${SRCS}
> .if ${MK_FAST_DEPEND} == "no"
>         rm -f ${.TARGET}.tmp
> # C files
>         ${MAKE} -V CFILES_NORMAL -V SYSTEM_CFILES -V GEN_CFILES | \
>             CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${CFLAGS}
>         ${MAKE} -V CFILES_CDDL | \
>             CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ZFS_CFLAGS} \
>             ${FBT_CFLAGS} ${DTRACE_CFLAGS}
>         ${MAKE} -V CFILES_LINUXKPI | \
>             CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp \
>                 ${CFLAGS} ${LINUXKPI_INCLUDES}
>         ${MAKE} -V CFILES_OFED -V CFILES_MLX5 | \
>             CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp \
>                 ${CFLAGS} ${OFEDINCLUDES}
> # Assembly files
>         ${MAKE} -V SFILES_NORMAL | \
>             CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ASM_CFLAGS}
>         ${MAKE} -V SFILES_CDDL | \
>             CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ZFS_ASM_CFLAGS}
>         mv ${.TARGET}.tmp ${.TARGET}
> .else
>         { \
>           echo '.for __dependfile in $${DEPENDFILES_OBJS}'; \
>           echo '.sinclude "$${__dependfile}"'; \
>           echo '.endfor'; \
>         } > ${.TARGET}
> .endif
(the for loop is a pending fix for the .depend issue)

sys/conf/kern.pre.mk

> .if ${MK_FAST_DEPEND} == "no" && (make(depend) || make(kernel-depend))        
>
> # This hack lets us use the ipfilter code without spamming a new
> # include path into contrib'ed source files.
> INCLUDES+= -I$S/contrib/ipfilter
>
> # ... and the same for ath
> INCLUDES+= -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal
>
> # ... and the same for the NgATM stuff
> INCLUDES+= -I$S/contrib/ngatm
>
> # ... and the same for vchiq
> INCLUDES+= -I$S/contrib/vchiq
>
> # ... and the same for twa
> INCLUDES+= -I$S/dev/twa
>
> # ... and the same for cxgb and cxgbe
> INCLUDES+= -I$S/dev/cxgb -I$S/dev/cxgbe
>
> .endif

As for world, it is far larger and impacts ports.  So I am still taking
it slow there.  I do want to enable it by default and make the same
decisions there in the future.


--
Regards,
Bryan Drewery


signature.asc (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: build: FAST_DEPEND default (kernel first, then world)

Bryan Drewery-6
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 1/27/16 11:27 AM, Bryan Drewery wrote:
> I have been asked to also remove the old mkdep version of 'make
> depend'.

I should note some of the bugs with the old 'mkdep' method that are
fixed by the FAST_DEPEND method, for world.

1. CXXFLAGS/CFLAGS are not passed properly from Makefile.inc1 for
external toolchain with gcc. A DEPFLAGS hack was added to address
this. The problem being that we pass CFLAGS via CC="${CC} ${CFLAGS}"
from Makefile.inc1 rather than a CFLAGS_APPEND that mkdep can pick up.
2. CFLAGS=-include was ignored in mkdep until r294370.
3. Avoiding ccache for mkdep involves annoying hacks that broke
someone's build (unfixed)
4. ccache can't benefit from mkdep
5. Similar to -include, we only pass certain flags to mkdep which is a
maintenance problem.
6. It hides dependency problems due to 'requiring' running 'make
depend' before build. A goal with FAST_DEPEND is to not need this,
which has proven to be fine.  DPSRCS was widely abused and fixed. It
should not even exist really, it's not needed.

- --
Regards,
Bryan Drewery
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQEcBAEBCgAGBQJWqmDVAAoJEDXXcbtuRpfPd6gH/1EqBsKQGn8qApzVUHJnrzGL
lJGbD+zZVY2RjmpChMLYA4cJu0lA9edKB2oj5pIQWXDZK6rO2Q7ekAElVE64gnDw
UsMeAi6v0m5/UwSGvLYHW1Nm7q/j0JTcIKXRpbseI3a40Gervdxmswrw0vGGWBEp
Hg+nfeiiEFjR84lBvfwynoHjtGb3ovakPo6lGVVNHD5LIpEwuSxaldWb99uoPbDt
h5iqWICvVbR4ugxEstGdPnx/6bMof+WngiQssc+8ZEiDQ0uuXneI7fyFaEd3MYCZ
+LdswwPA1cJPpDmCif/fRxDWoCAQum0HGPGB2bkXRdwERMOVltRsiDEWr/kM6Ko=
=mCSt
-----END PGP SIGNATURE-----
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"