projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Interim magic number replacement.
[open-adventure.git]
/
Makefile
diff --git
a/Makefile
b/Makefile
index 11795079fab5059db4464689c51006a790280439..43f1f9514caa1c1286ec093cbb47e5147d92d307 100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-24,67
+24,78
@@
#
# To build with save/resume disabled, pass CCFLAGS="-D ADVENT_NOSAVE"
#
# To build with save/resume disabled, pass CCFLAGS="-D ADVENT_NOSAVE"
-.PHONY: debug indent release refresh dist linty html clean
+VERS=$(shell sed -n <NEWS '/^[0-9]/s/:.*//p' | head -1)
-VERS=1.0
+.PHONY: debug indent release refresh dist linty html clean
+.PHONY: check coverage
CC?=gcc
CC?=gcc
-CCFLAGS+=-std=c99 -D
_DEFAULT_SOURCE -Wpedantic -g
+CCFLAGS+=-std=c99 -D
_DEFAULT_SOURCE -DVERSION=\"$(VERS)\" -Wpedantic -O2
LIBS=
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
LIBS=-lrt
endif
LIBS=
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
LIBS=-lrt
endif
-OBJS=main.o init.o actions.o score.o misc.o saveresume.o common.o
-SOURCES=$(OBJS:.o=.c) dungeon.c advent.h common.h adventure.text Makefile control linenoise/linenoise.[ch] newdungeon.py
+OBJS=main.o init.o actions.o score.o misc.o saveresume.o
+CHEAT_OBJS=cheat.o init.o actions.o score.o misc.o saveresume.o
+SOURCES=$(OBJS:.o=.c) advent.h adventure.yaml Makefile control linenoise/linenoise.[ch] make_dungeon.py
.c.o:
$(CC) $(CCFLAGS) $(DBX) -c $<
.c.o:
$(CC) $(CCFLAGS) $(DBX) -c $<
-advent: $(OBJS) linenoise.o
newdb
.o
- $(CC) $(CCFLAGS) $(DBX) -o advent $(OBJS)
newdb
.o linenoise.o $(LDFLAGS) $(LIBS)
+advent: $(OBJS) linenoise.o
dungeon
.o
+ $(CC) $(CCFLAGS) $(DBX) -o advent $(OBJS)
dungeon
.o linenoise.o $(LDFLAGS) $(LIBS)
-main.o: advent.h d
atabase.h common.h newdb.h
+main.o: advent.h d
ungeon.h linenoise.o
-init.o: advent.h d
atabase.h common.h newdb
.h
+init.o: advent.h d
ungeon
.h
-actions.o: advent.h d
atabase.h common.h newdb
.h
+actions.o: advent.h d
ungeon
.h
-score.o: advent.h d
atabase.h common.h newdb
.h
+score.o: advent.h d
ungeon
.h
-misc.o: advent.h d
atabase.h common.h newdb
.h
+misc.o: advent.h d
ungeon
.h
-saveresume.o: advent.h database.h common.h newdb.h
+cheat.o: advent.h dungeon.h linenoise.o
-
common.o: comm
on.h
+
saveresume.o: advent.h dunge
on.h
-
newdb.o: newdb.c newdb
.h
- $(CC) $(CCFLAGS) $(DBX) -c
newdb
.c
+
dungeon.o: dungeon.c dungeon
.h
+ $(CC) $(CCFLAGS) $(DBX) -c
dungeon
.c
-d
atabase.h: dungeon
- ./dungeon
+d
ungeon.c dungeon.h: make_dungeon.py adventure.yaml
+ python3 make_dungeon.py
-newdb.c newdb.h:
- python3 newdungeon.py
-
-linenoise.o: linenoise/linenoise.h
+linenoise.o: linenoise/linenoise.h
+ @test -s linenoise/linenoise.h || { echo -e "linenoise not present. Try:\n\
+ git submodule update --recursive --remote --init"; exit 1; }
$(CC) -c linenoise/linenoise.c
$(CC) -c linenoise/linenoise.c
-dungeon: dungeon.o common.o
- $(CC) $(CCFLAGS) -o $@ dungeon.o common.o
+linenoise-dbg: linenoise/linenoise.h
+ @test -s linenoise/linenoise.h || { echo -e "linenoise not present. Try:\n\
+ git submodule update --recursive --remote --init"; exit 1; }
+ $(CC) $(CCFLAGS) -c linenoise/linenoise.c
clean:
clean:
- rm -f *.o advent
*.html database.h dungeon
*.gcno *.gcda
- rm -f
newdb.c newdb
.h
+ rm -f *.o advent
cheat *.html
*.gcno *.gcda
+ rm -f
dungeon.c dungeon
.h
rm -f README advent.6 MANIFEST *.tar.gz
rm -f *~
rm -f .*~
rm -f README advent.6 MANIFEST *.tar.gz
rm -f *~
rm -f .*~
+ rm -rf coverage advent.info
cd tests; $(MAKE) --quiet clean
cd tests; $(MAKE) --quiet clean
-check: advent
+
+cheat: $(CHEAT_OBJS) linenoise.o dungeon.o
+ $(CC) $(CCFLAGS) $(DBX) -o cheat $(CHEAT_OBJS) linenoise.o dungeon.o $(LDFLAGS) $(LIBS)
+
+check: advent cheat
cd tests; $(MAKE) --quiet
cd tests; $(MAKE) --quiet
+coverage: debug cheat
+ cd tests; $(MAKE) coverage --quiet
+
.SUFFIXES: .adoc .html .6
# Requires asciidoc and xsltproc/docbook stylesheets.
.SUFFIXES: .adoc .html .6
# Requires asciidoc and xsltproc/docbook stylesheets.
@@
-115,7
+126,7
@@
indent:
release: advent-$(VERS).tar.gz advent.html history.html hints.html notes.html
shipper version=$(VERS) | sh -e -x
release: advent-$(VERS).tar.gz advent.html history.html hints.html notes.html
shipper version=$(VERS) | sh -e -x
-refresh: advent.html
+refresh: advent.html
notes.html history.html
shipper -N -w version=$(VERS) | sh -e -x
dist: advent-$(VERS).tar.gz
shipper -N -w version=$(VERS) | sh -e -x
dist: advent-$(VERS).tar.gz
@@
-138,8
+149,10
@@
linty: CCFLAGS += -Wwrite-strings
linty: CCFLAGS += -Wunreachable-code
linty: CCFLAGS += -Winit-self
linty: CCFLAGS += -Wpointer-arith
linty: CCFLAGS += -Wunreachable-code
linty: CCFLAGS += -Winit-self
linty: CCFLAGS += -Wpointer-arith
-linty: CCFLAGS +=-O2
linty: advent
linty: advent
-debug: CCFLAGS += -O0 --coverage -g
-debug: advent
+debug: CCFLAGS += -O0 --coverage -ggdb
+debug: linty
+debug: cheat
+
+debug-ln: linenoise-dbg debug