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.
14 # You will also need Python 3 YAML. Under Debian or ubuntu:
16 # apt-get install python3-yaml
18 # If you have pip installed,
22 # If you are using MacPorts on OS X:
23 # port install py3{5,6}-yaml as appropriate for your Python 3 version.
25 # To build with save/resume disabled, pass CCFLAGS="-D ADVENT_NOSAVE"
30 CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE -Wpedantic
32 UNAME_S := $(shell uname -s)
33 ifeq ($(UNAME_S),Linux)
37 OBJS=main.o init.o actions.o score.o misc.o saveresume.o common.o
38 SOURCES=$(OBJS:.o=.c) dungeon.c advent.h common.h adventure.text Makefile control linenoise/linenoise.[ch] newdungeon.py
41 $(CC) $(CCFLAGS) $(DBX) -c $<
43 advent: $(OBJS) linenoise.o newdb.o
44 $(CC) $(CCFLAGS) $(DBX) -o advent $(OBJS) newdb.o linenoise.o $(LDFLAGS) $(LIBS)
46 main.o: advent.h database.h common.h newdb.h
48 init.o: advent.h database.h common.h newdb.h
50 actions.o: advent.h database.h common.h newdb.h
52 score.o: advent.h database.h common.h newdb.h
54 misc.o: advent.h database.h common.h newdb.h
56 saveresume.o: advent.h database.h common.h newdb.h
60 newdb.o: newdb.c newdb.h
61 $(CC) $(CCFLAGS) $(DBX) -c newdb.c
69 linenoise.o: linenoise/linenoise.h
70 $(CC) -c linenoise/linenoise.c
72 dungeon: dungeon.o common.o
73 $(CC) $(CCFLAGS) -o $@ dungeon.o common.o
76 rm -f *.o advent *.html database.h dungeon *.gcno *.gcda
78 rm -f README advent.6 MANIFEST *.tar.gz
81 cd tests; $(MAKE) --quiet clean
84 cd tests; $(MAKE) --quiet
86 .SUFFIXES: .adoc .html .6
88 # Requires asciidoc and xsltproc/docbook stylesheets.
90 a2x --doctype manpage --format manpage $<
96 html: advent.html history.html hints.html
98 # README.adoc exists because that filename is magic on GitLab.
99 DOCS=COPYING NEWS README.adoc TODO advent.adoc history.adoc notes.adoc hints.adoc advent.6
100 TESTFILES=tests/*.log tests/*.chk tests/README tests/decheck tests/Makefile
102 # Can't use GNU tar's --transform, needs to build under Alpine Linux.
103 # This is a requirement for testing dist in GitLab's CI pipeline
104 advent-$(VERS).tar.gz: $(SOURCES) $(DOCS)
105 @find $(SOURCES) $(DOCS) $(TESTFILES) -print | sed s:^:advent-$(VERS)/: >MANIFEST
106 @(ln -s . advent-$(VERS))
107 (tar -T MANIFEST -czvf advent-$(VERS).tar.gz)
111 astyle -n -A3 --pad-header --min-conditional-indent=1 --pad-oper *.c
113 release: advent-$(VERS).tar.gz advent.html history.html hints.html notes.html
114 shipper version=$(VERS) | sh -e -x
117 shipper -N -w version=$(VERS) | sh -e -x
119 dist: advent-$(VERS).tar.gz
121 linty: CCFLAGS += -W -Wall -Wextra -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wshadow -Wfloat-equal -Wcast-align -Wwrite-strings -Waggregate-return -Wcast-qual -Wswitch-enum -Wwrite-strings -Wunreachable-code -Winit-self -Wpointer-arith -O2
124 debug: CCFLAGS += -O0 --coverage -g