3 BUILD_DATE:=$(shell date '+%Y-%m-%d')
4 BUILD_COMMIT:=$(shell if git rev-parse >/dev/null 2>/dev/null ; then git describe --always --tags ; else echo '<unknown>' ; fi)
9 MANDIR=$(PREFIX)/share/man
11 CXXFLAGS=-O2 -Wall -Wextra -Wno-parentheses -std=gnu++11 -g
13 all: paperjam paperjam.1 paperjam.1.html
15 MODULES=paperjam pdf-tools parse cmds pdf
16 OBJS=$(addsuffix .o, $(MODULES))
19 $(LD) -o $@ $^ $(LDLIBS)
20 paperjam: LDLIBS += -lqpdf -lpaper
23 $(OBJS): jam.h pdf-tools.h
25 paperjam.o: CXXFLAGS += -DVERSION='"$(VERSION)"' -DYEAR='"$(YEAR)"' -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_COMMIT='"$(BUILD_COMMIT)"'
27 paperjam.1: paperjam.1.txt
30 # The dependency on paperjam.1 is there to serialize both calls of asciidoc,
31 # which does not name temporary files safely.
32 paperjam.1.html: paperjam.1.txt paperjam.1
38 rm -f paperjam.1 paperjam.1.html docbook-xsl.css
42 install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
43 install -s paperjam $(DESTDIR)$(BINDIR)/
44 install -m 644 paperjam.1 $(DESTDIR)$(MANDIR)/man1/
49 git archive --format=tar --prefix=paperjam-$(VERSION)/ HEAD | gzip >paperjam-$(VERSION).tar.gz
50 rsync paperjam-$(VERSION).tar.gz atrey:ftp/linux/
51 rsync paperjam.1.html jw:web/static/sw/paperjam/
52 ssh jw 'cd web && bin/release-prog paperjam $(VERSION)'
54 .PHONY: all clean release