This repository has been archived by the owner on Jun 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
72 lines (57 loc) · 1.74 KB
/
Makefile
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
# Compilers
CC ?= gcc
CXX ?= g++
# Lua options
LUAC ?= $(shell pkg-config --cflags lua)
LUAL ?= $(shell pkg-config --libs lua)
# Linker flags
LDLIBS := $(LUAL)
SHARED := -shared
INCLUDEDIRS := -I libs/eigen -I libs/libigl/include
# Compilation flags
CFLAGS := $(LUAC) -fPIC -O3 -W -Wall -Werror -Wextra -std=c99
CXXFLAGS := $(LUAC) -fPIC -O3 -W -Wall -Werror -Wextra -std=c++11 $(INCLUDEDIRS)
# All targets
TARGETS := \
components/ca/ca \
components/ca/ca.so \
components/mds/mds \
components/sfp/sfp \
components/voronoi/voronoi \
h3mapgen.love
# Meta
.PHONY: homm3lua
all: homm3lua $(TARGETS)
# Rules
FILES_CA := $(subst .cpp,.o,$(shell find components/ca -name '*.cpp'))
components/ca/ca: $(FILES_CA)
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDLIBS)
components/ca/ca.so: $(FILES_CA)
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDLIBS) $(SHARED)
FILES_MDS := $(subst .cpp,.o,$(shell find components/mds -name '*.cpp'))
components/mds/mds: $(FILES_MDS)
$(CXX) -o $@ $^ $(CXXFLAGS)
FILES_SFP := $(subst .c,.o,$(shell find components/sfp -name '*.c'))
components/sfp/sfp: $(FILES_SFP)
$(CXX) -o $@ $^ $(CFLAGS) $(LDLIBS)
FILES_VORONOI := $(subst .cpp,.o,$(shell find components/voronoi -name '*.cpp'))
components/voronoi/voronoi: $(FILES_VORONOI)
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDLIBS)
h3mapgen.love: components/gui/*.lua libs/*.lua $(shell find libs/luigi/luigi)
$(RM) $@
cp components/gui/conf.lua conf.lua
cp components/gui/main.lua main.lua
zip -9 -q -r $@ $(subst components/gui/,,$^) \
-x "*.git*" \
-x "*libs/luigi/luigi/backend/ffisdl*" \
-x "*libs/luigi/luigi/theme/dark*"
$(RM) conf.lua main.lua
homm3lua:
$(MAKE) -C libs/homm3lua
# Helpers
clean:
$(MAKE) -C libs/homm3lua clean
$(RM) components/*/*.o
$(RM) -r output
distclean: clean
$(RM) $(TARGETS)