Do not link on every make invocation
authorAndreas Zwinkau <zwinkau@kit.edu>
Mon, 19 Dec 2011 14:45:50 +0000 (15:45 +0100)
committerAndreas Zwinkau <zwinkau@kit.edu>
Mon, 19 Dec 2011 14:45:50 +0000 (15:45 +0100)
Previously, ld had to be called, because the static libfirm might have
been updated.

Note the little hack, which apparently makes GNU Make re-evaluated the
Makefile, whenever the phony libfirm_subdir goal has been executed:

> Makefile: libfirm_subdir

Makefile

index ba0c42b..a381bd3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -71,7 +71,7 @@ Q = @
 
 all: $(GOAL)
 
-.PHONY: all bootstrap bootstrap2 bootstrape clean selfcheck splint $(FIRM_HOME)/$(LIBFIRM_FILE)
+.PHONY: all bootstrap bootstrap2 bootstrape clean selfcheck splint libfirm_subdir
 
 -include $(DEPENDS)
 
@@ -93,7 +93,11 @@ UNUSED := $(shell \
 DIRS   := $(sort $(dir $(OBJECTS)))
 UNUSED := $(shell mkdir -p $(DIRS) $(DIRS:$(BUILDDIR)/%=$(BUILDDIR)/cpb/%) $(DIRS:$(BUILDDIR)/%=$(BUILDDIR)/cpb2/%) $(DIRS:$(BUILDDIR)/%=$(BUILDDIR)/cpbe/%))
 
-$(FIRM_HOME)/$(LIBFIRM_FILE):
+# Build libFirm in subdirectory
+$(FIRM_HOME)/$(LIBFIRM_FILE): libfirm_subdir
+## Re-evaluate Makefile after libfirm_subdir has been executed
+Makefile: libfirm_subdir
+libfirm_subdir:
 ifeq "$(wildcard $(FIRM_HOME) )" ""
        @echo 'Download and extract libfirm tarball ...'
        $(Q)curl -s -L "${FIRM_URL}" -o "libfirm-$(FIRM_VERSION).tar.bz2"