aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-05-07 16:51:53 -0700
committerMichael Forney <mforney@mforney.org>2019-05-07 16:55:13 -0700
commit84b43eba5659e9eecb66f9769e49b02200d319aa (patch)
treeb56057f72611f000e10bc2ae4f1b82a3d6d8be35 /Makefile
parent0be5457bca301cb46971d1b343904ba3c760fca1 (diff)
Add -s to LDFLAGS instead of running strip manually during bootstrap
Otherwise, stage3 is always considered out of date.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files 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