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