aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-11-27 13:10:29 +0100
committerMattias Andrée <maandree@operamail.com>2015-11-27 13:10:29 +0100
commit7ee4dc372cbb0b273ea4bfba026ad0f0e35266d3 (patch)
tree6e1f8abc4c9ed18f1d9aa2f941a9e61ae62bc5f9 /Makefile
parentfix dist (diff)
downloadbfind-7ee4dc372cbb0b273ea4bfba026ad0f0e35266d3.tar.gz
bfind-7ee4dc372cbb0b273ea4bfba026ad0f0e35266d3.tar.bz2
bfind-7ee4dc372cbb0b273ea4bfba026ad0f0e35266d3.tar.xz
improve makefile
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--Makefile120
1 files changed, 87 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index bab560f..98953ee 100644
--- a/Makefile
+++ b/Makefile
@@ -1,37 +1,71 @@
PREFIX = /usr
BIN = /bin
DATA = /share
-LICENSES = $(DATA)/licenses
+BINDIR = $(PREFIX)/bin
+DATADIR = $(PREFIX)/share
+INFODIR = $(DATADIR)/info
+DOCDIR = $(DATADIR)/doc
+LICENSEDIR = $(DATADIR)/licenses
+
COMMAND = bfind
PKGNAME = bfind
-PY3_SHEBANG = /usr/bin/env/ python3
+PY3_SHEBANG = /usr/bin/env python3
+
+.PHONY: default
+default: cmd info
+
.PHONY: all
all: cmd doc
.PHONY: cmd
-cmd: bfind
+cmd: bin/bfind
+
+bin/bfind: src/bfind.py
+ @mkdir -p bin
+ cp $< $@
+ sed -i 's:/usr/bin/env/ python3:$(PY3_SHEBANG):' "$@"
.PHONY: doc
-doc: info
+doc: info pdf dvi ps
.PHONY: info
-info: bfind.info.gz
-
-%.info.gz: info/%.texinfo.install
- makeinfo "$<"
- gzip -9 -f "$*.info"
-
-info/%.texinfo.install: info/%.texinfo
- cp "$<" "$@"
- sed -i 's:^@set COMMAND bfind:@set COMMAND $(COMMAND):g' "$@"
-
-bfind: src/bfind.py
- cp "$<" "$@"
- sed -i 's:/usr/bin/env/ python3:$(PY3_SHEBANG):' "$@"
-
+info: bin/bfind.info
+bin/%.info: doc/info/%.texinfo
+ @mkdir -p bin
+ $(MAKEINFO) $<
+ mv $*.info $@
+
+.PHONY: pdf
+pdf: bin/bfind.pdf
+bin/%.pdf: doc/info/%.texinfo
+ @! test -d obj/pdf || rm -rf obj/pdf
+ @mkdir -p bin obj/pdf
+ cd obj/pdf && texi2pdf ../../"$<" < /dev/null
+ mv obj/pdf/$*.pdf $@
+
+.PHONY: dvi
+dvi: bin/bfind.dvi
+bin/%.dvi: doc/info/%.texinfo
+ @! test -d obj/dvi || rm -rf obj/dvi
+ @mkdir -p bin obj/dvi
+ cd obj/dvi && $(TEXI2DVI) ../../"$<" < /dev/null
+ mv obj/dvi/$*.dvi $@
+
+.PHONY: ps
+ps: bin/bfind.ps
+bin/%.ps: doc/info/%.texinfo
+ @! test -d obj/ps || rm -rf obj/ps
+ @mkdir -p bin obj/ps
+ cd obj/ps && texi2pdf --ps ../../"$<" < /dev/null
+ mv obj/ps/$*.ps $@
+
+
+
+.PHONY: install-default
+install-default: install-core install-info
.PHONY: install
install: install-core install-doc
@@ -40,34 +74,54 @@ install: install-core install-doc
install-core: install-cmd install-license
.PHONY: install-cmd
-install-cmd: bfind
- install -d -- "$(DESTDIR)$(PREFIX)$(BIN)"
- install -m755 -- bfind "$(DESTDIR)$(PREFIX)$(BIN)/$(COMMAND)"
+install-cmd: bin/bfind
+ install -dm755 -- "$(DESTDIR)$(BINDIR)"
+ install -m755 -- $< "$(DESTDIR)$(BINDIR)/$(COMMAND)"
.PHONY: install-license
install-license:
- install -d -- "$(DESTDIR)$(PREFIX)$(LICENSES)/$(PKGNAME)"
- install -m644 -- COPYING LICENSE "$(DESTDIR)$(PREFIX)$(LICENSES)/$(PKGNAME)"
+ install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ install -m644 -- COPYING LICENSE "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
.PHONY: install-doc
-install-doc: install-info
+install-doc: install-info install-pdf install-dvi install-ps
.PHONY: install-info
-install-info: bfind.info.gz
- install -dm755 -- "$(DESTDIR)$(PREFIX)$(DATA)/info"
- install -m644 bfind.info.gz -- "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info.gz"
+install-info: bin/bfind.info
+ install -dm755 -- "$(DESTDIR)$(INFODIR)"
+ install -m644 $< -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info"
+
+.PHONY: install-pdf
+install-pdf: bin/bfind.pdf
+ install -dm755 -- "$(DESTDIR)$(DOCDIR)"
+ install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).pdf"
+
+.PHONY: install-dvi
+install-dvi: bin/bfind.dvi
+ install -dm755 -- "$(DESTDIR)$(DOCDIR)"
+ install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi"
+
+.PHONY: install-ps
+install-ps: bin/bfind.ps
+ install -dm755 -- "$(DESTDIR)$(DOCDIR)"
+ install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps"
+
.PHONY: uninstall
uninstall:
- -rm -- "$(DESTDIR)$(PREFIX)$(BIN)/$(COMMAND)"
- -rm -- "$(DESTDIR)$(PREFIX)$(LICENSES)/$(PKGNAME)/COPYING"
- -rm -- "$(DESTDIR)$(PREFIX)$(LICENSES)/$(PKGNAME)/LICENSE"
- -rm -d -- "$(DESTDIR)$(PREFIX)$(LICENSES)/$(PKGNAME)"
- -rm -- "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info.gz"
+ -rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
+ -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING"
+ -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"
+ -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ -rm -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info"
+ -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).pdf"
+ -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi"
+ -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps"
+
.PHONY: clean
clean:
- -rm -- bfind bfind.info.gz info/*.install
+ -rm -r obj bin