]> mj.ucw.cz Git - paperjam.git/blob - Makefile
TODO: a4r paper
[paperjam.git] / Makefile
1 VERSION=1.2
2 YEAR=2022
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 DESTDIR=
7 PREFIX=/usr/local
8 BINDIR=$(PREFIX)/bin
9 MANDIR=$(PREFIX)/share/man
10
11 CXXFLAGS=-O2 -Wall -Wextra -Wno-parentheses -std=gnu++17 -g
12
13 all: paperjam paperjam.1 paperjam.1.html
14
15 MODULES=paperjam pdf-tools parse cmds pdf
16 OBJS=$(addsuffix .o, $(MODULES))
17
18 paperjam: $(OBJS)
19         $(LD) -o $@ $^ $(LDLIBS)
20 paperjam: LDLIBS += -lqpdf -lpaper
21 paperjam: LD=$(CXX)
22
23 $(OBJS): jam.h pdf-tools.h
24
25 paperjam.o: CXXFLAGS += -DVERSION='"$(VERSION)"' -DYEAR='"$(YEAR)"' -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_COMMIT='"$(BUILD_COMMIT)"'
26
27 paperjam.1: paperjam.1.txt
28         a2x -f manpage $<
29
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
33         a2x -f xhtml -D . $<
34
35 clean:
36         rm -f *.o
37         rm -f paperjam
38         rm -f paperjam.1 paperjam.1.html docbook-xsl.css
39         rm -f *.tar.gz
40
41 install: all
42         install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
43         install -s paperjam $(DESTDIR)$(BINDIR)/
44         install -m 644 paperjam.1 $(DESTDIR)$(MANDIR)/man1/
45
46 release:
47         git tag v$(VERSION)
48         git push --tags
49         git archive --format=tar --prefix=paperjam-$(VERSION)/ HEAD | gzip >paperjam-$(VERSION).tar.gz
50         rsync paperjam-$(VERSION).tar.gz jw:/home/ftp/pub/mj/linux/
51         rsync paperjam.1.html jw:web/static/sw/paperjam/
52         ssh jw 'cd web && bin/release-prog paperjam $(VERSION)'
53
54 .PHONY: all clean release