1 # Makefile for the open-source release of adventure 2.5
6 CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE
8 UNAME_S := $(shell uname -s)
9 ifeq ($(UNAME_S),Linux)
13 OBJS=main.o init.o actions1.o actions2.o score.o misc.o
14 SOURCES=$(OBJS:.o=.c) dungeon.c advent.h funcs.h sizes.h adventure.text Makefile control linenoise/linenoise.h
17 $(CC) $(CCFLAGS) $(DBX) -c $<
19 advent: $(OBJS) database.o linenoise.o
20 $(CC) $(CCFLAGS) $(DBX) -o advent $(OBJS) database.o $(LDFLAGS) $(LIBS)
22 main.o: advent.h funcs.h database.h database.c sizes.h
24 init.o: advent.h funcs.h database.h database.c sizes.h
26 actions1.o: advent.h funcs.h database.h database.c sizes.h
28 actions2.o: advent.h funcs.h database.h database.c sizes.h
30 score.o: advent.h database.h database.c sizes.h
32 misc.o: advent.h database.h database.c sizes.h
34 database.o: database.c database.h sizes.h
35 $(CC) $(CCFLAGS) $(DBX) -c database.c
37 database.c database.h: dungeon
40 linenoise.o: linenoise/linenoise.h
41 $(CC) $(CCFLAGS) $(DBX) -c linenoise/linenoise.c
44 $(CC) $(CCFLAGS) -o $@ $<
47 rm -f *.o advent *.html database.[ch] dungeon *.gcno *.gcda
48 rm -f README advent.6 MANIFEST *.tar.gz
50 cd tests; $(MAKE) --quiet clean
53 cd tests; $(MAKE) --quiet
55 .SUFFIXES: .adoc .html .6
57 # Requires asciidoc and xsltproc/docbook stylesheets.
59 a2x --doctype manpage --format manpage $<
65 html: advent.html history.html hints.html
67 # README.adoc exists because that filename is magic on GitLab.
68 DOCS=COPYING NEWS README.adoc TODO advent.adoc history.adoc hints.adoc advent.6
69 TESTFILES=tests/*.log tests/*.chk tests/README tests/decheck tests/Makefile
71 # Can't use GNU tar's --transform, needs to build under Alpine Linux.
72 # This is a requirement for testing dist in GitLab's CI pipeline
73 advent-$(VERS).tar.gz: $(SOURCES) $(DOCS)
74 @find $(SOURCES) $(DOCS) $(TESTFILES) -print | sed s:^:advent-$(VERS)/: >MANIFEST
75 @(ln -s . advent-$(VERS))
76 (tar -T MANIFEST -czvf advent-$(VERS).tar.gz)
79 release: advent-$(VERS).tar.gz advent.html history.html hints.html
80 shipper version=$(VERS) | sh -e -x
83 shipper -N -w version=$(VERS) | sh -e -x
85 dist: advent-$(VERS).tar.gz
87 debug: CCFLAGS += -O0 --coverage