diff options
author | Maciej Żenczykowski <maze@google.com> | 2010-10-25 14:09:16 -0700 |
---|---|---|
committer | maximilian attems <max@stro.at> | 2010-10-30 15:08:52 +0200 |
commit | f2e2504990780d3a469c76ea23b43aa311d3ce8f (patch) | |
tree | c6f0921146b940217cf7123830c84ff6966b8394 | |
parent | 4ab18ef09eba716bf70a37558483dadbe044b33f (diff) | |
download | klibc-f2e2504990780d3a469c76ea23b43aa311d3ce8f.tar.gz |
[klibc] kbuild: enable reproducible builds
This adds a new setting: KBUILD_REPRODUCIBLE
If it is non-empty, ar and ranlib will be called in such
a way that timestamps do not affect the build output.
This allows one to get perfectly reproducible builds.
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: maximilian attems <max@stro.at>
-rw-r--r-- | scripts/Kbuild.klibc | 15 | ||||
-rw-r--r-- | usr/klibc/Kbuild | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc index 79d196f2429ae..fb399f5046ac4 100644 --- a/scripts/Kbuild.klibc +++ b/scripts/Kbuild.klibc @@ -93,11 +93,16 @@ KLIBCMINOR := $(shell cut -d. -f2 $(srctree)/usr/klibc/version) KLIBCLD := $(LD) KLIBCCC := $(CC) KLIBCAR := $(AR) -KLIBCRANLIB := $(RANLIB) + +# klibc-ar is a macro that invokes KLIBCAR and takes 2 arguments of ar commands. +# The second will be used for reproducible builds, the first otherwise. +klibc-ar = $(KLIBCAR) $(if $(KBUILD_REPRODUCIBLE),$(2),$(1)) + +KLIBCRANLIB := $(call klibc-ar,s,Ds) KLIBCSTRIP := $(STRIP) KLIBCNM := $(NM) -KLIBCOBJCOPY := $(OBJCOPY) -KLIBCOBJDUMP := $(OBJDUMP) +KLIBCOBJCOPY := $(OBJCOPY) +KLIBCOBJDUMP := $(OBJDUMP) # klibc include paths KLIBCCPPFLAGS := -nostdinc -iwithprefix include \ @@ -265,8 +270,8 @@ ifdef lib-target quiet_cmd_link_o_target = LD $@ # If the list of objects to link is empty, just create an empty lib.a cmd_link_o_target = $(if $(strip $(lib-y)),\ - rm -f $@; $(KLIBCAR) cru $@ $(filter $(lib-y), $^),\ - rm -f $@; $(KLIBCAR) crs $@) + rm -f $@; $(call klibc-ar,cru,Dcr) $@ $(filter $(lib-y), $^),\ + rm -f $@; $(call klibc-ar,crs,Dcrs) $@) $(lib-target): $(lib-y) FORCE $(call if_changed,link_o_target) diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild index ab5212b7eff15..af4036708ba51 100644 --- a/usr/klibc/Kbuild +++ b/usr/klibc/Kbuild @@ -109,7 +109,7 @@ klib-o-files = $(shell cat $(obj)/klib.list \ targets += libc.a __static_init.o quiet_cmd_libc = KLIBCAR $@ cmd_libc = rm -f $@; \ - $(KLIBCAR) cq $@ \ + $(call klibc-ar,cq,Dcq) $@ \ $(call objectify,__static_init.o) $(klib-o-files); \ $(KLIBCRANLIB) $@ |