[patch] DEBUG_FLAGS cleanup

Konstantin Belousov kostikbel at gmail.com
Wed Jan 23 10:06:06 UTC 2013


On Wed, Jan 23, 2013 at 09:23:41AM +0100, Erik Cederstrand wrote:
> Hello folks,
> 
> Attached is a patch to clean up unconditional use of "-g" in Makefiles, instead respecting the global DEBUG_FLAGS setting.
> 
> I need this as part of my quest to support deterministic builds. Currently, debug information contains stuff like timestamps, absolute paths etc. that make binaries non-deterministic, and Clang lacks the necessary flags to rectify this. So I'd like DEBUG_FLAGS="" to actually work everywhere.
> 
> I'd be thankful for feedback and help committing the changes if it's OK.
> 
> Thanks,
> Erik
> 

> Index: head/usr.bin/tar/Makefile
> ===================================================================
> --- head/usr.bin/tar/Makefile	(revision 242791)
> +++ head/usr.bin/tar/Makefile	(working copy)
> @@ -38,7 +38,6 @@
>  CFLAGS+=	-I${LIBARCHIVEDIR}/libarchive_fe
>  SYMLINKS=	bsdtar ${BINDIR}/tar
>  MLINKS=	bsdtar.1 tar.1
> -DEBUG_FLAGS=-g
>  
>  .PHONY: check test clean-test
>  check test: $(PROG) bsdtar.1.gz
> Index: head/gnu/usr.bin/cc/cc_tools/Makefile
> ===================================================================
> --- head/gnu/usr.bin/cc/cc_tools/Makefile	(revision 242791)
> +++ head/gnu/usr.bin/cc/cc_tools/Makefile	(working copy)
> @@ -6,7 +6,7 @@
>  
>  .include "../Makefile.inc"
>  
> -CFLAGS+=	-g
> +CFLAGS+=	$(DEBUG_FLAGS)
>  CFLAGS+=	-DGENERATOR_FILE -DHAVE_CONFIG_H
>  
>  # Override LIBIBERTY set by Makefile.inc, We use our own for

This fragment catched my eye, and it is typical for the patch.
Why do you  need to add DEBUG_FLAGS to the CFLAGS manually ?
Wouldn't share/mk magic do this automatically ?

If not, I think that it should be considered to fix the remaining
cases where DEBUG_FLAGS are not added in the common mk code, instead
of sprinkling the additions all over the place ?

I think that the cleanup you performed is needed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20130123/e695d809/attachment.sig>


More information about the freebsd-toolchain mailing list