#
# 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
CC?=gcc
-CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE -Wpedantic -O2
+CCFLAGS+=-std=c99 -D_DEFAULT_SOURCE -DVERSION=\"$(VERS)\" -Wpedantic -O2
LIBS=
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
advent: $(OBJS) linenoise.o dungeon.o
$(CC) $(CCFLAGS) $(DBX) -o advent $(OBJS) dungeon.o linenoise.o $(LDFLAGS) $(LIBS)
-main.o: advent.h dungeon.h
+main.o: linenoise-gitmodule advent.h dungeon.h
init.o: advent.h dungeon.h
misc.o: advent.h dungeon.h
-cheat.o: advent.h dungeon.h
+cheat.o: linenoise-gitmodule advent.h dungeon.h
saveresume.o: advent.h dungeon.h
dungeon.c dungeon.h: make_dungeon.py adventure.yaml
python3 make_dungeon.py
-linenoise.o: linenoise/linenoise.h
+linenoise-gitmodule:
+ test -s linenoise/linenoise.h || { echo "\nlinenoise not present. Try: \n\n\tgit submodule update --recursive --remote --init\n"; exit 1; }
+
+linenoise.o: linenoise-gitmodule linenoise/linenoise.h
$(CC) -c linenoise/linenoise.c
-linenoise-dbg: linenoise/linenoise.h
+linenoise-dbg: linenoise-gitmodule linenoise/linenoise.h
$(CC) $(CCFLAGS) -c linenoise/linenoise.c
clean: