From 84b43eba5659e9eecb66f9769e49b02200d319aa Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Tue, 7 May 2019 16:51:53 -0700 Subject: Add -s to LDFLAGS instead of running strip manually during bootstrap Otherwise, stage3 is always considered out of date. --- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index bcb7dcf..1157ffe 100644 --- a/Makefile +++ b/Makefile @@ -59,17 +59,19 @@ $(objdir)/tree.o : tree.c util.h $(stagedeps) ; $(CC) $(CFLAGS) $(objdir)/type.o : type.c util.h cc.h $(stagedeps) ; $(CC) $(CFLAGS) -c -o $@ type.c $(objdir)/util.o : util.c util.h $(stagedeps) ; $(CC) $(CFLAGS) -c -o $@ util.c +# Make sure stage2 and stage3 binaries are stripped by adding -s to +# LDFLAGS. Otherwise they will contain paths to object files, which +# differ between stages. + .PHONY: stage2 stage2: all @mkdir -p $@ - $(MAKE) objdir=$@ stagedeps='cc cc-qbe' CC=$(objdir)/cc - strip $@/cc $@/cc-qbe + $(MAKE) objdir=$@ stagedeps='cc cc-qbe' CC=$(objdir)/cc LDFLAGS='$(LDFLAGS) -s' .PHONY: stage3 stage3: stage2 @mkdir -p $@ - $(MAKE) objdir=$@ stagedeps='stage2/cc stage2/cc-qbe' CC=$(objdir)/stage2/cc - strip $@/cc $@/cc-qbe + $(MAKE) objdir=$@ stagedeps='stage2/cc stage2/cc-qbe' CC=$(objdir)/stage2/cc LDFLAGS='$(LDFLAGS) -s' .PHONY: bootstrap bootstrap: stage2 stage3 -- cgit v1.2.3