From 040111e9d8419456255816600784a496febd57b0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 7 Nov 2012 11:17:49 -0500 Subject: add a Makefile to install everything --- Makefile | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..802117a --- /dev/null +++ b/Makefile @@ -0,0 +1,68 @@ +# 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 + +################################################################################ + +pseudo-packages=abslibre-tools chroot-tools fullpkg mips64el-tools pr-tools toru +packages=libretools libretools-pr libretools-mips64el + +libretools=abslibre-tools chroot-tools fullpkg toru misc +libretools-pr=pr-tools +libretools-mips64el=mips64el-tools + +################################################################################ + +all: PHONY libretools +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 '$<' '$@' + +$(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)) + +.SECONDEXPANSION: +$(packages): %: PHONY $$($$*) +$(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 +PHONY: +.PHONY: FORCE PHONY -- cgit v1.2.2