-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
81 lines (57 loc) · 2.03 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
73
74
75
76
77
78
79
80
81
include localMakefile
# FUNCTIONS
# arg1 = c-source-filename
CSRC2CLIB = $(patsubst csrc/%.c,bin/$(PLATFORM)/%.so,$(dir $(1))lib$(notdir $(1)))
# arg1 = c-source-filename, arg2 = lib-filename
define CRULE
$(2): $(1)
mkdir -p "$(dir $(2))"
gcc -ansi -o "$(2)" -fPIC -shared "$(1)" `sdl-config --cflags` -lGL
endef
# VARIABLES
ifeq "$(shell lsb_release -i | grep -o Arch)" "Arch"
PYTHON = "python2"
else
PYTHON = "python"
endif
PLATFORM := $(shell $(PYTHON) -B pfinfo.py)
CMODS := $(wildcard csrc/*.c) $(wildcard csrc/*/*.c)
CLIBS := $(foreach cmod,$(CMODS),$(call CSRC2CLIB,$(cmod)))
PYMODS = $(subst ./,,$(shell cd pysrc; find . -name \*.py; cd ..))
PYBINS = $(foreach pymod,$(PYMODS),pybin/$(pymod)c)
.PHONY : yasc gfx cbin pybin clean totalclean
yasc: gfx cbin pybin
gfx: gfx/terrain/grass.png gfx/protosettler.png
gfx/terrain/grass.png: render/terrain/grass.png
mkdir -p "$(dir $@)"
$(PYTHON) scripts/postprocess_texture.py "$^" "$@"
gfx/protosettler.png: render/protosettler/noshd-0001.png render/protosettler/onlshd-0001.png
mkdir -p "$(dir $@)"
$(PYTHON) scripts/postprocess_settler.py "$(dir $<)" "$@" 1 156
render/terrain/grass.png: blender/terrain/grass.blend
$(BLENDER) -b "$^" -o "$(subst .png,,$@)" -f 1
mv "$(subst .png,0001.png,$@)" "$@"
render/protosettler/noshd-0001.png: blender/protosettler/protosettler.blend
mkdir -p "$(dir $@)"
$(BLENDER) -b "$^" -o "$(subst 0001.png,,$@)" -P blender/protosettler/ConfOnlySettler -s 1 -e 156 -a
render/protosettler/onlshd-0001.png: blender/protosettler/protosettler.blend
mkdir -p "$(dir $@)"
$(BLENDER) -b "$^" -o "$(subst 0001.png,,$@)" -P blender/protosettler/ConfOnlyShadow -s 1 -e 156 -a
cbin: $(CLIBS)
$(foreach cmod,$(CMODS),$(eval $(call CRULE,$(cmod),$(call CSRC2CLIB,$(cmod)))))
pybin: $(PYBINS)
pybin/%.pyc: pysrc/%.py
mkdir -p "$(dir $@)"
$(PYTHON) pyc.py "$^" "$@"
clean:
-rm -r bin
-rm -r pybin
totalclean:
-rm -r render
-rm -r gfx
-rm -r bin
-rm -r pybin
-rm -r doc/pysrc
epydoc:
mkdir -p doc
epydoc --html pysrc -o doc/pysrc --config epydoc.conf --parse-only -v