diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-11-07 11:17:49 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-11-07 11:17:49 -0500 |
commit | 040111e9d8419456255816600784a496febd57b0 (patch) | |
tree | 7ce4740bb52e1416b483b4d4703880101568862b /Makefile | |
parent | d308ec64174aeeccd75a14df6b91c1a789fe7e5b (diff) |
add a Makefile to install everythingv20121107
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 68 |
1 files changed, 68 insertions, 0 deletions
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 |