-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
116 lines (56 loc) · 1.89 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
all: hdll demo
hdll: outputs/gh.hdll
outputs/gh.hdll: $(shell find sources/c -name "*.c") sources/c/gen/core.c Sconstruct inputs
@mkdir -p outputs
@scons
@touch $@
#
sources/c/gen/core.c: $(shell find sources/generator -name "*.hx") sources/generator/run.hxml inputs
@make generate
#
generate:
@cd sources/generator && haxe run.hxml
#
regenerate:
@rm -rf sources/c/gen
@rm -rf sources/lib/sources.core
@rm -rf sources/lib/sources.objects
@make generate
#
define check_env
@test ${$1} || ( echo "$1 is not set"; exit 1 )
endef
demo_edit: demo; $(call check_env,GODOT_BIN) @cd demo && ${GODOT_BIN} --editor
demo_run: demo; $(call check_env,GODOT_BIN) @cd demo && ${GODOT_BIN}
demo: demo/libhl.dylib demo/gh.hdll demo/hlboot.dat
demo/libhl.dylib: inputs/hashlink/libhl.dylib ; @cp $< $@
demo/gh.hdll: outputs/gh.hdll ; @cp $< $@
demo/hlboot.dat: $(shell find sources/lib -name "*.hx") $(shell find demo -name "*.hx") demo/build.hxml
@cd demo && haxe build.hxml
#
define clone_git
@mkdir -p $1
@cd $1 && git init
@cd $1 && git remote add origin [email protected]:$2.git
@cd $1 && git fetch --depth 1 origin $(if $3,$3,master)
@cd $1 && git checkout FETCH_HEAD
endef
inputs: inputs/godot inputs/godot-headers inputs/hashlink inputs/hashlink/libhl.dylib
inputs/godot: ; $(call clone_git,$@,godotengine/godot,3.3-stable)
inputs/godot-headers: ; $(call clone_git,$@,godotengine/godot-headers,3.3)
inputs/hashlink: ; $(call clone_git,$@,HaxeFoundation/hashlink)
inputs/hashlink/libhl.dylib:
$(error hashlink in inputs folder needs to be compiled, instructions can be found in its readme)
#
clean:
@rm -rf outputs
@rm -rf sources/c/gen
@rm -rf sources/lib/sources.core
@rm -rf sources/lib/sources.objects
@rm -f demo/gh.hdll demo/hlboot.dat
#
reset: clean
@rm -rf inputs
@rm -f demo/libhl.dylib
#
.PHONY: all hdll generate regenerate demo_edit demo_run clean reset