diff options
-rw-r--r-- | Makefile | 46 | ||||
-rw-r--r-- | common.mk | 37 | ||||
-rw-r--r-- | doc/Makefile | 2 | ||||
-rw-r--r-- | src/Makefile | 3 | ||||
-rw-r--r-- | src/abslibre-tools/Makefile | 3 | ||||
-rw-r--r-- | src/chroot-tools/Makefile | 3 | ||||
-rw-r--r-- | src/fullpkg/Makefile | 3 | ||||
-rw-r--r-- | src/mips64el-tools/Makefile | 3 | ||||
-rw-r--r-- | src/pr-tools/Makefile | 3 | ||||
-rw-r--r-- | src/toru/Makefile | 3 |
10 files changed, 75 insertions, 31 deletions
@@ -15,52 +15,36 @@ docdir=$(datarootdir)/doc ################################################################################ +# these are directories pseudo-packages=abslibre-tools chroot-tools fullpkg mips64el-tools pr-tools toru -packages=libretools libretools-pr libretools-mips64el +# these are the resulting packages +packages=libretools libretools-pr libretools-mips64el +# and which directories they contains libretools=abslibre-tools chroot-tools fullpkg toru misc libretools-pr=pr-tools libretools-mips64el=mips64el-tools ################################################################################ -all: PHONY libretools +all: PHONY build +build: PHONY build-libretools build-doc install: PHONY install-libretools install-doc -install-doc: $(patsubst doc/%,$(DESTDIR)$(docdir)/libretools/%,$(wildcard doc/*)) - -$(DESTDIR)$(docdir)/libretools/%: doc/% - install -Dm644 '$<' '$@' - -$(DESTDIR)$(sysconfdir)/libretools.conf: src/libretools.conf - install -Dm644 '$<' '$@' +%-doc: PHONY doc + $(MAKE) -C doc $* +%-misc: PHONY src + $(MAKE) -C src $* -$(foreach pkg,$(pseudo-packages) ., \ -$(eval \ -$(DESTDIR)$(bindir)/%: src/$(pkg)/%; \ - install -Dm755 '$$<' '$$@' \ -) \ -$(eval \ -$(DESTDIR)$(sysconfdir)/libretools.d/%: src/$(pkg)/%; \ - install -Dm644 '$$<' '$$@' \ -)) - -################################################################################ - -progs = $(shell find src/$1 -maxdepth 1 -type f -executable -printf '%f\n') -confs = $(shell find src/$1 -maxdepth 1 -type f -not -executable -printf '%f\n') -files = $(addprefix $(DESTDIR)$2/,$(call progs,$1)) \ - $(addprefix $(DESTDIR)$3/,$(call confs,$1)) +build-%: PHONY src/% + $(MAKE) -C src/$* build +install-%: PHONY src/% + $(MAKE) -C src/$* install .SECONDEXPANSION: -$(packages): %: PHONY $$($$*) +$(addprefix build-, $(packages)): build-%: PHONY $$(addprefix build-, $$($$*)) $(addprefix install-,$(packages)): install-%: PHONY $$(addprefix install-,$$($$*)) -$(pseudo-packages) misc: %: PHONY -$(addprefix install-,$(pseudo-packages)): install-%: PHONY $$(call files,$$*,$(bindir),$(sysconfdir)/libretools.d) -# special cases -install-misc: PHONY $(call files,.,$(bindir),$(sysconfdir)) - ################################################################################ FORCE: PHONY diff --git a/common.mk b/common.mk new file mode 100644 index 0000000..6248b80 --- /dev/null +++ b/common.mk @@ -0,0 +1,37 @@ +# Configuration +DESTDIR= + +#prefix=/usr/local +prefix=/usr +exec_prefix=$(prefix) +datarootdir=$(prefix)/share + +bindir=$(exec_prefix)/bin +sbindir=$(exec_prefix)/sbin +#sysconfdir=$(prefix)/etc +sysconfdir=/etc +datadir=$(datarootdir) +docdir=$(datarootdir)/doc + +################################################################################ +progs = $(shell find . -maxdepth 1 -type f -executable -printf '%f\n') +confs = $(shell find . -maxdepth 1 -type f -not -executable -printf '%f\n'|fgrep -v Makefile) +files = $(addprefix $(DESTDIR)$(libre_execdir)/,$(progs)) \ + $(addprefix $(DESTDIR)$(libre_datadir)/,$(confs)) + +all: PHONY build + +build: PHONY + +install: PHONY $(files) + +$(DESTDIR)$(libre_execdir)/%: % + install -Dm755 '$<' '$@' +$(DESTDIR)$(libre_datadir)/%: % + install -Dm755 '$<' '$@' + +################################################################################ + +FORCE: PHONY +PHONY: +.PHONY: FORCE PHONY diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..7af3750 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,2 @@ +libre_datadir=$(docdir)/libretools +include ../common.mk diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..ff8d399 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(bindir) +libre_datadir=$(sysconfdir) +include ../common.mk diff --git a/src/abslibre-tools/Makefile b/src/abslibre-tools/Makefile new file mode 100644 index 0000000..f2cec54 --- /dev/null +++ b/src/abslibre-tools/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(bindir) +libre_datadir=$(sysconfdir)/libretools.d +include ../../common.mk diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile new file mode 100644 index 0000000..3ae95ea --- /dev/null +++ b/src/chroot-tools/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(sbindir) +libre_datadir=$(sysconfdir)/libretools.d +include ../../common.mk diff --git a/src/fullpkg/Makefile b/src/fullpkg/Makefile new file mode 100644 index 0000000..f2cec54 --- /dev/null +++ b/src/fullpkg/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(bindir) +libre_datadir=$(sysconfdir)/libretools.d +include ../../common.mk diff --git a/src/mips64el-tools/Makefile b/src/mips64el-tools/Makefile new file mode 100644 index 0000000..f2cec54 --- /dev/null +++ b/src/mips64el-tools/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(bindir) +libre_datadir=$(sysconfdir)/libretools.d +include ../../common.mk diff --git a/src/pr-tools/Makefile b/src/pr-tools/Makefile new file mode 100644 index 0000000..f2cec54 --- /dev/null +++ b/src/pr-tools/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(bindir) +libre_datadir=$(sysconfdir)/libretools.d +include ../../common.mk diff --git a/src/toru/Makefile b/src/toru/Makefile new file mode 100644 index 0000000..f2cec54 --- /dev/null +++ b/src/toru/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(bindir) +libre_datadir=$(sysconfdir)/libretools.d +include ../../common.mk |