03c9a3d35fa1022496de502d4a69b7f028b167d5
[open-adventure.git] / Makefile
1 # Makefile for the open-source release of adventure 2.5
2
3 CC?=gcc
4 CCFLAGS=-std=c99 -O0 --coverage
5 LIBS=
6 UNAME_S := $(shell uname -s)
7 ifeq ($(UNAME_S),Linux)
8         LIBS=-lrt
9 endif
10
11 OBJS=main.o init.o actions1.o actions2.o score.o misc.o database.o
12 DOCS=COPYING NEWS README TODO advent.adoc history.adoc index.adoc hints.adoc
13 SOURCES=$(OBJS:.o=.c) advent.h funcs.h adventure.text $(DOCS) control
14
15 .c.o:
16         $(CC) $(CCFLAGS) $(DBX) -c $<
17
18 advent: $(OBJS) database.o
19         $(CC) $(CCFLAGS) $(DBX) -o advent $(OBJS) $(LIBS)
20
21 main.o:         advent.h funcs.h database.h
22
23 init.o:         advent.h funcs.h database.h
24
25 actions1.o:     advent.h funcs.h database.h
26
27 actions2.o:     advent.h funcs.h
28
29 score.o:        advent.h database.h
30
31 misc.o:         advent.h database.h
32
33 database.o:     database.h
34
35 funcs.h:        database.h
36
37 compile: compile.c
38         $(CC) $(CCFLAGS) -o $@ $<
39
40 database.c database.h: compile adventure.text
41         ./compile
42         $(CC) $(CCFLAGS) $(DBX) -c database.c
43
44 clean:
45         rm -f *.o advent *.html advent.6 database.[ch] compile *.gcno *.gcda
46         cd tests; $(MAKE) --quiet clean
47
48 check: advent
49         cd tests; $(MAKE) --quiet
50
51 .SUFFIXES: .adoc .html
52
53 # Requires asciidoc and xsltproc/docbook stylesheets.
54 .adoc.6: advent.adoc
55         a2x --doctype manpage --format manpage $<
56 .adoc.html: advent.adoc
57         asciidoc $<
58
59 advent-$(VERS).tar.gz: $(SOURCES) advent.6
60         tar --transform='s:^:advent-$(VERS)/:' --show-transformed-names -cvzf advent-$(VERS).tar.gz $(SOURCES) advent.6
61
62 dist: advent-$(VERS).tar.gz
63
64 release: advent-$(VERS).tar.gz advent.html
65         shipper version=$(VERS) | sh -e -x
66
67 refresh: advent.html
68         shipper -N -w version=$(VERS) | sh -e -x