summaryrefslogtreecommitdiff
path: root/vendor/makefile
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-02-24 00:25:29 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-03-13 13:57:34 +0100
commitfa19cc9573aac19cfbf43364d4b5660c9ab645bc (patch)
treea2e24bd5efb311d6e1c637de2b34219dba9c7459 /vendor/makefile
parent9ec748ff103840c4c65471ca00d3b72984131ce4 (diff)
autogenerate makefile for vendor system
It can be useful to have a whole makefile available for vendor setup, but by providing a basic one we can deal with the simple cases more easily (and changes to the system are presumably easier).
Diffstat (limited to 'vendor/makefile')
-rw-r--r--vendor/makefile38
1 files changed, 24 insertions, 14 deletions
diff --git a/vendor/makefile b/vendor/makefile
index 619c603fb..0701a03eb 100644
--- a/vendor/makefile
+++ b/vendor/makefile
@@ -14,11 +14,9 @@ veryclean: veryclean/subdirs
dirs: dirs/subdirs
manpages: manpages/subdirs
-all/subdirs binary/subdirs doc/subdirs dirs/subdirs manpages/subdirs:
- $(MAKE) -C current $(patsubst %/subdirs,%,$@)
-
-clean/subdirs veryclean/subdirs:
- test ! -e current || $(MAKE) -C current $(patsubst %/subdirs,%,$@)
+all/subdirs binary/subdirs doc/subdirs dirs/subdirs manpages/subdirs clean/subdirs veryclean/subdirs:
+ test ! -e current/makefile || $(MAKE) -C current $(patsubst %/subdirs,%,$@)
+ test ! -e current/makefile.auto || $(MAKE) -C current -f makefile.auto $(patsubst %/subdirs,%,$@)
current:
rm -f $@
@@ -29,17 +27,29 @@ current:
break; \
fi; \
done
- # if we haven't found a specific, look for a deriving in hardcoded order
- test -e $@ || \
- (dpkg-vendor --derives-from ubuntu && cp ln -s ubuntu $@ ) || \
- (dpkg-vendor --derives-from tanglu && cp ln -s tanglu $@ ) || \
- ln -s debian $@
+ # if we haven't found a specific, look for a deriving
+ # we do ubuntu and debian last as those are the biggest families
+ # and would therefore potentially 'shadow' smaller families
+ # (especially debian as it sorts quiet early)
+ if ! test -e $@; then \
+ find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do \
+ if [ "$$DISTRO" = 'debian' -o "$$DISTRO" = 'ubuntu' ]; then continue; fi; \
+ if dpkg-vendor --derives-from $$DISTRO; then \
+ ln -s $$DISTRO $@; \
+ break; \
+ fi; \
+ done; \
+ test -e $@ || \
+ (dpkg-vendor --derives-from ubuntu && cp ln -s ubuntu $@ ) || \
+ ln -s debian $@; \
+ fi
+ if test ! -e current/makefile; then \
+ sed "s#@@VENDOR@@#$(notdir $(shell readlink -f current))#" vendor.makefile > current/makefile.auto; \
+ fi
.PHONY: clean veryclean all binary vendor
-.NOPARALLEL:
clean: clean/current
-clean/current:
- test ! -e current || $(MAKE) -C current clean
- rm -f current
+clean/current: clean/subdirs
+ rm -f current/makefile.auto current