| 1 | # -*- make -*- |
| 2 | BASE=.. |
| 3 | SUBDIR=vendor |
| 4 | |
| 5 | # Bring in the default rules |
| 6 | include ../buildlib/defaults.mak |
| 7 | |
| 8 | all headers library binary program doc manpages docbook test update-po startup dirs: current |
| 9 | all: all/subdirs |
| 10 | binary: binary/subdirs |
| 11 | doc: doc/subdirs |
| 12 | clean: clean/subdirs |
| 13 | veryclean: veryclean/subdirs |
| 14 | dirs: dirs/subdirs |
| 15 | manpages: manpages/subdirs |
| 16 | |
| 17 | all/subdirs binary/subdirs doc/subdirs dirs/subdirs manpages/subdirs clean/subdirs veryclean/subdirs: |
| 18 | test ! -e current/makefile || $(MAKE) -C current $(patsubst %/subdirs,%,$@) |
| 19 | test ! -e current/makefile.auto || $(MAKE) -C current -f makefile.auto $(patsubst %/subdirs,%,$@) |
| 20 | |
| 21 | current: |
| 22 | rm -f $@ |
| 23 | # search for an exact match to use the correct sources.list example |
| 24 | find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do \ |
| 25 | if dpkg-vendor --is $$DISTRO; then \ |
| 26 | ln -s $$DISTRO $@; \ |
| 27 | break; \ |
| 28 | fi; \ |
| 29 | done |
| 30 | # if we haven't found a specific, look for a deriving |
| 31 | # we do ubuntu and debian last as those are the biggest families |
| 32 | # and would therefore potentially 'shadow' smaller families |
| 33 | # (especially debian as it sorts quiet early) |
| 34 | if ! test -e $@; then \ |
| 35 | find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do \ |
| 36 | if [ "$$DISTRO" = 'debian' -o "$$DISTRO" = 'ubuntu' ]; then continue; fi; \ |
| 37 | if dpkg-vendor --derives-from $$DISTRO; then \ |
| 38 | ln -s $$DISTRO $@; \ |
| 39 | break; \ |
| 40 | fi; \ |
| 41 | done; \ |
| 42 | test -e $@ || \ |
| 43 | (dpkg-vendor --derives-from ubuntu && cp ln -s ubuntu $@ ) || \ |
| 44 | ln -s debian $@; \ |
| 45 | fi |
| 46 | if test ! -e current/makefile; then \ |
| 47 | sed "s#@@VENDOR@@#$(notdir $(shell readlink -f current))#" vendor.makefile > current/makefile.auto; \ |
| 48 | fi |
| 49 | |
| 50 | .PHONY: clean veryclean all binary vendor |
| 51 | |
| 52 | clean: clean/current |
| 53 | |
| 54 | clean/current: clean/subdirs |
| 55 | rm -f current/makefile.auto current |