| 1 | PREFIX = $(HOME) |
| 2 | LDFLAGS = -lcurses |
| 3 | CFLAGS = -g '-DVERSION="$(VERSION)"' -Wall |
| 4 | PROGS = tig |
| 5 | DOCS = tig.1.txt tig.1 tig.1.html |
| 6 | VERSION = $(shell git-describe) |
| 7 | |
| 8 | all: $(PROGS) |
| 9 | docs: $(DOCS) |
| 10 | |
| 11 | install: all |
| 12 | for prog in $(PROGS); do \ |
| 13 | install $$prog $(PREFIX)/bin; \ |
| 14 | done |
| 15 | |
| 16 | install-docs: docs |
| 17 | for doc in $(DOCS); do \ |
| 18 | case "$$doc" in \ |
| 19 | *.1) install $$doc $(PREFIX)/man/man1 ;; \ |
| 20 | esac \ |
| 21 | done |
| 22 | |
| 23 | clean: |
| 24 | rm -f $(PROGS) $(DOCS) |
| 25 | |
| 26 | .PHONY: all docs install clean |
| 27 | |
| 28 | tig: tig.c |
| 29 | |
| 30 | tig.1.txt: tig.c |
| 31 | sed -n '/\/\*\*/,/\*\*\//p' < $< | \ |
| 32 | sed 's/.*\*\*\///' | \ |
| 33 | sed '/^[^*]*\*\*/d' | \ |
| 34 | sed 's/\*\///;s/^[^*]*\* *//' > $@ |
| 35 | |
| 36 | %.1.html : %.1.txt |
| 37 | asciidoc -b xhtml11 -d manpage $< |
| 38 | |
| 39 | %.1.xml : %.1.txt |
| 40 | asciidoc -b docbook -d manpage $< |
| 41 | |
| 42 | %.1 : %.1.xml |
| 43 | xmlto man $< |