aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 05bc3b24589362842afe18e6257406098378c52f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
CC=g++
LIBS=
CFLAGS=-c -Wall -fPIC -std=c++20
LDFLAGS=
SOURCES=src/armor.cc src/creature.cc src/dmtool.cc src/entry.cc src/feature.cc src/item.cc src/settings.cc src/spellcasting.cc src/spell.cc src/utils.cc src/weapon.cc 
OBJECTS=$(SOURCES:.cc=.o)
LIBRARY=
EXECUTABLE=dmtool
ifeq ($(PREFIX),)
    PREFIX := /usr
endif

all: $(SOURCES) $(EXECUTABLE)

parsed: parser/scrapeToJson.py parser/utils.py
	python parser/scrapeToJson.py
	touch parsed/

install: $(EXECUTABLE) parsed
	install -d $(DESTDIR)$(PREFIX)/share/dmtool/
	cp -r parsed/* $(DESTDIR)$(PREFIX)/share/dmtool/
	install -d $(DESTDIR)$(PREFIX)/bin/
	install -m 755 $(EXECUTABLE) $(DESTDIR)$(PREFIX)/bin/

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(OBJECTS) -o $@ $(LDFLAGS) 


src/armor.o: src/armor.cc src/armor.h src/item.h src/json.hpp src/entry.h \
 src/jsonable.h src/utils.h src/creature.h src/rules.h
	$(CC) $(CFLAGS) $< -o $@ 

src/creature.o: src/creature.cc src/creature.h src/json.hpp src/rules.h \
 src/jsonable.h src/utils.h src/entry.h src/dice.h src/feature.h \
 src/weapon.h src/item.h src/armor.h
	$(CC) $(CFLAGS) $< -o $@ 

src/dmtool.o: src/dmtool.cc src/entry.h src/json.hpp src/jsonable.h \
 src/utils.h src/settings.h
	$(CC) $(CFLAGS) $< -o $@ 

src/entry.o: src/entry.cc src/entry.h src/json.hpp src/jsonable.h \
 src/utils.h src/feature.h src/item.h src/spell.h src/creature.h \
 src/rules.h
	$(CC) $(CFLAGS) $< -o $@ 

src/feature.o: src/feature.cc src/json.hpp src/feature.h src/entry.h \
 src/jsonable.h src/utils.h src/spellcasting.h src/spell.h src/rules.h
	$(CC) $(CFLAGS) $< -o $@ 

src/item.o: src/item.cc src/json.hpp src/item.h src/entry.h \
 src/jsonable.h src/utils.h src/weapon.h src/armor.h
	$(CC) $(CFLAGS) $< -o $@ 

src/settings.o: src/settings.cc src/settings.h
	$(CC) $(CFLAGS) $< -o $@ 

src/spellcasting.o: src/spellcasting.cc src/spellcasting.h src/feature.h \
 src/json.hpp src/entry.h src/jsonable.h src/utils.h src/spell.h \
 src/rules.h src/creature.h
	$(CC) $(CFLAGS) $< -o $@ 

src/spell.o: src/spell.cc src/spell.h src/json.hpp src/entry.h \
 src/jsonable.h src/utils.h
	$(CC) $(CFLAGS) $< -o $@ 

src/utils.o: src/utils.cc src/utils.h src/json.hpp src/settings.h
	$(CC) $(CFLAGS) $< -o $@ 

src/weapon.o: src/weapon.cc src/weapon.h src/item.h src/json.hpp \
 src/entry.h src/jsonable.h src/utils.h src/creature.h src/rules.h
	$(CC) $(CFLAGS) $< -o $@ 

clean:
	rm -f src/*.o $(LIBRARY) $(EXECUTABLE)