1 # Makefile for the open-source release of adventure 2.5
3 # Note: If you're building from the repository rather than the source tarball,
4 # do this to get the linenoise library where you can use it:
6 # git submodule update --recursive --remote --init
8 # Therafter, you can update it like this:
10 # git submodule update --recursive --remote
12 # but this should seldom be necessary as that library is pretty stable.
17 CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE -g
19 UNAME_S := $(shell uname -s)
20 ifeq ($(UNAME_S),Linux)
24 OBJS=main.o init.o actions.o score.o misc.o saveresume.o common.o newdb.o
25 SOURCES=$(OBJS:.o=.c) dungeon.c advent.h common.h adventure.text Makefile control linenoise/linenoise.[ch]
28 $(CC) $(CCFLAGS) $(DBX) -c $<
30 advent: $(OBJS) database.o linenoise.o
31 $(CC) $(CCFLAGS) $(DBX) -o advent $(OBJS) database.o linenoise.o $(LDFLAGS) $(LIBS)
33 main.o: advent.h database.h database.c common.h
35 init.o: advent.h database.h database.c common.h
37 actions.o: advent.h database.h database.c common.h
39 score.o: advent.h database.h database.c common.h
41 misc.o: advent.h database.h database.c common.h newdb.h
43 saveresume.o: advent.h database.h database.c common.h
47 database.o: database.c database.h common.h
48 $(CC) $(CCFLAGS) $(DBX) -c database.c
52 database.c database.h: dungeon
55 linenoise.o: linenoise/linenoise.h
56 $(CC) $(CCFLAGS) $(DBX) -c linenoise/linenoise.c
58 dungeon: dungeon.o common.o
59 $(CC) $(CCFLAGS) -o $@ dungeon.o common.o
62 rm -f *.o advent *.html database.[ch] dungeon *.gcno *.gcda
63 rm -f README advent.6 MANIFEST *.tar.gz
65 cd tests; $(MAKE) --quiet clean
68 cd tests; $(MAKE) --quiet
70 .SUFFIXES: .adoc .html .6
72 # Requires asciidoc and xsltproc/docbook stylesheets.
74 a2x --doctype manpage --format manpage $<
80 html: advent.html history.html hints.html
82 # README.adoc exists because that filename is magic on GitLab.
83 DOCS=COPYING NEWS README.adoc TODO advent.adoc history.adoc notes.adoc hints.adoc advent.6
84 TESTFILES=tests/*.log tests/*.chk tests/README tests/decheck tests/Makefile
86 # Can't use GNU tar's --transform, needs to build under Alpine Linux.
87 # This is a requirement for testing dist in GitLab's CI pipeline
88 advent-$(VERS).tar.gz: $(SOURCES) $(DOCS)
89 @find $(SOURCES) $(DOCS) $(TESTFILES) -print | sed s:^:advent-$(VERS)/: >MANIFEST
90 @(ln -s . advent-$(VERS))
91 (tar -T MANIFEST -czvf advent-$(VERS).tar.gz)
94 release: advent-$(VERS).tar.gz advent.html history.html hints.html notes.html
95 shipper version=$(VERS) | sh -e -x
98 shipper -N -w version=$(VERS) | sh -e -x
100 dist: advent-$(VERS).tar.gz
102 debug: CCFLAGS += -O0 --coverage