Externals/common.mk - Fixed depenency issues
[tpg/acess2.git] / Externals / common.mk
index 7a86c40..3264a19 100644 (file)
@@ -33,6 +33,7 @@ HOST=$(BFD)-acess_proxy-elf
 # [?]ARCHIVE : Optional forced archive (Defaults to latest)
 # [?]CONFIGURE_LINE : Command to create makefile (defaults to autotools configure)
 # [?]NOBDIR : Set to non-empty to disable use of a separate build dir
+# [?]AUTORECONF : Set to non-empty to regenerate ./configure
 
 
 BTARGETS ?= all
@@ -80,15 +81,28 @@ $(DIR): $(ARCHIVE)
 
 $(DIR)/%: patches/%.patch
        @echo [PATCH] $@
+       @tar -xf $(ARCHIVE) $@
        @patch $@ $<
 
 $(DIR)/%: patches/%
        @echo [CP] $@
+       @mkdir -p $(dir $@)
        @cp $< $@
 
-_patch: $(DIR) $(addprefix $(DIR)/,$(PATCHES))
+PATCHED_FILES := $(addprefix $(DIR)/,$(PATCHES))
+_patch: $(DIR) $(PATCHED_FILES)
 
-$(BDIR)/Makefile: _patch ../common.mk Makefile 
+CONFIGSCRIPT := $(BDIR)/$(firstword $(CONFIGURE_LINE))
+PATCHED_ACFILES := $(filter %/configure.in %/config.sub, $(PATCHED_FILES))
+$(warning $(CONFIGSCRIPT): $(PATCHED_ACFILES))
+
+$(CONFIGSCRIPT): $(PATCHED_ACFILES)
+ifeq ($(AUTORECONF),)
+else
+       cd $(DIR) && autoreconf --force --install
+endif
+
+$(BDIR)/Makefile: _patch $(CONFIGSCRIPT) ../common.mk Makefile 
        mkdir -p $(BDIR)
        cd $(BDIR) && $(CONFIGURE_LINE)
 

UCC git Repository :: git.ucc.asn.au