aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-11-27 22:28:04 +0100
committerMattias Andrée <maandree@operamail.com>2015-11-27 22:28:04 +0100
commit8b4a1cbc91f8efeb32ba05f0694fc8f4c3aa97d9 (patch)
tree9c1e1dd91c36a9856a04c5e90f7e3c881a02522d
parentupdate dist (diff)
downloadmongoclock-8b4a1cbc91f8efeb32ba05f0694fc8f4c3aa97d9.tar.gz
mongoclock-8b4a1cbc91f8efeb32ba05f0694fc8f4c3aa97d9.tar.bz2
mongoclock-8b4a1cbc91f8efeb32ba05f0694fc8f4c3aa97d9.tar.xz
improve makefile
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--Makefile130
1 files changed, 106 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index de9ebe0..6d0750b 100644
--- a/Makefile
+++ b/Makefile
@@ -4,12 +4,18 @@
# without any warranty.
PREFIX = /usr
-DATA = /share
BIN = /bin
+DATA = /share
+BINDIR = $(PREFIX)$(BIN)
+DATADIR = $(PREFIX)$(DATA)
+DOCDIR = $(DATADIR)/doc
+INFODIR = $(DATADIR)/info
+MANDIR = $(DATADIR)/man
+MAN1DIR = $(MANDIR)/man1
+LICENSEDIR = $(DATADIR)/licenses
+
PKGNAME = mongoclock
COMMAND = mongoclock
-LICENSES = $(PREFIX)$(DATA)
-
GPP = gpp
@@ -32,16 +38,18 @@ OPTIMISE = -O2
FLAGS = $(OPTIMISE) -std=$(STD) $(WARN) $(FFLAGS)
-all: mongoclock doc
-doc: info
+.PHONY: default
+default: command info
-info: mongoclock.info
+.PHONY: all
+all: command doc
-%.info: info/%.texinfo
- makeinfo "$<"
+.PHONY: base
+base: command
-mongoclock: bin/mongoclock
+.PHONY: command
+command: bin/mongoclock
bin/mongoclock: obj/mongoclock.o
mkdir -p bin
@@ -54,28 +62,102 @@ obj/mongoclock.c: src/mongoclock.c
mkdir -p obj
$(GPP) -s '$$' -i $< -o $@
-install: install-cmd install-license install-info
+.PHONY: doc
+doc: info pdf dvi ps
+
+.PHONY: info
+info: bin/mongoclock.info
+
+.PHONY: info
+info: bin/mongoclock.info
+bin/%.info: doc/info/%.texinfo
+ @mkdir -p bin
+ $(MAKEINFO) $<
+ mv $*.info $@
+
+.PHONY: pdf
+pdf: bin/mongoclock.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/mongoclock.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/mongoclock.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 $@
+
+
-install-cmd: bin/mongoclock
- install -dm755 "$(DESTDIR)$(PREFIX)$(BIN)"
- install -dm755 "$(DESTDIR)$(PREFIX)$(LIBEXEC)"
- install -m755 bin/mongoclock "$(DESTDIR)$(PREFIX)$(BIN)/$(COMMAND)"
+.PHONY: install
+install: install-base install-info
+.PHONY: install-all
+install-all: install-base install-doc
+
+.PHONY: install-base
+install-base: install-cmd install-license
+
+.PHONY: install-command
+install-command: bin/mongoclock
+ install -dm755 -- "$(DESTDIR)$(BINDIR)"
+ install -m755 $< -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
+
+.PHONY: install-license
install-license:
- install -dm755 "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
- install -m644 COPYING "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
+ install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ install -m644 COPYING -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+
+.PHONY: install-doc
+install-doc: install-info install-pdf install-dvi install-ps
+
+.PHONY: install-info
+install-info: bin/mongoclock.info
+ install -dm755 -- "$(DESTDIR)$(INFODIR)"
+ install -m644 $< -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info"
+
+.PHONY: install-pdf
+install-pdf: bin/mongoclock.pdf
+ install -dm755 -- "$(DESTDIR)$(DOCDIR)"
+ install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).pdf"
-install-info: mongoclock.info
- install -dm755 "$(DESTDIR)$(PREFIX)$(DATA)/info"
- install -m644 mongoclock.info "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info"
+.PHONY: install-dvi
+install-dvi: bin/mongoclock.dvi
+ install -dm755 -- "$(DESTDIR)$(DOCDIR)"
+ install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi"
+.PHONY: install-ps
+install-ps: bin/mongoclock.ps
+ install -dm755 -- "$(DESTDIR)$(DOCDIR)"
+ install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps"
+
+
+
+.PHONY: uninstall
uninstall:
- -rm -- "$(DESTDIR)$(PREFIX)$(BIN)/$(COMMAND)"
- -rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/COPYING"
- -rmdir -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
- -rm -- "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info"
+ -rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
+ -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING"
+ -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 -f bin obj mongoclock.info
+ -rm -f bin obj