summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile46
1 files changed, 15 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index 802117a..4e255ef 100644
--- a/Makefile
+++ b/Makefile
@@ -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