]> mj.ucw.cz Git - paperjam.git/blob - Makefile
dd2ec24b528ede12d813a93104d52c5eeb1f0139
[paperjam.git] / Makefile
1 VERSION=0.1
2 YEAR=2018
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)
5
6 CXXFLAGS=-O2 -Wall -Wextra -Wno-parentheses -std=gnu++11 -g
7
8 all: paperjam paperjam.1 paperjam.1.html
9
10 MODULES=paperjam pdf-tools parse cmds pdf
11 OBJS=$(addsuffix .o, $(MODULES))
12
13 paperjam: $(OBJS)
14         $(LD) -o $@ $^ $(LDLIBS)
15 paperjam: LDLIBS += -lqpdf -lpaper
16 paperjam: LD=$(CXX)
17
18 $(OBJS): jam.h pdf-tools.h
19
20 paperjam.o: CXXFLAGS += -DVERSION='"$(VERSION)"' -DYEAR='"$(YEAR)"' -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_COMMIT='"$(BUILD_COMMIT)"'
21
22 paperjam.1: paperjam.1.txt
23         a2x -f manpage $<
24
25 # The dependency on paperjam.1 is there to serialize both calls of asciidoc,
26 # which does not name temporary files safely.
27 paperjam.1.html: paperjam.1.txt paperjam.1
28         a2x -f xhtml -D . $<
29
30 clean:
31         rm -f *.o
32         rm -f paperjam
33
34 release:
35         git tag v$(VERSION)
36         git push --tags
37         git archive --format=tar --prefix=paperjam-$(VERSION)/ HEAD | gzip >paperjam-$(VERSION).tar.gz
38         rsync paperjam-$(VERSION).tar.gz atrey:ftp/linux/
39         ssh jw 'cd web && bin/release-prog paperjam $(VERSION)'
40
41 .PHONY: all clean release