-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (50 loc) · 1.25 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
# Set it to 1 for da Web
web = 1
cc = clang
build = build
bin = main
c_src = $(wildcard src/*.c)
h_src = $(wildcard src/*.h)
output = $(build)/$(bin)
test_src = $(wildcard test/*.c)
macros = -DSOKOL_GLCORE
headers = -Isokol -Isokol/util -IHandmadeMath
libs = -lGL -ldl -lm -lX11 -lasound -lXi -lXcursor
ifeq ($(OS), Windows_NT)
platform := win32
else
uname := $(shell uname -s)
ifeq ($(uname), Linux)
platform := linux
endif
ifeq ($(uname), Darwin)
platform := osx
endif
endif
shader_bin = sokol-tools-bin/bin/$(platform)/sokol-shdc
shader_src = $(wildcard src/shaders/*.glsl)
shader_out = $(foreach shader, $(subst src/shaders, src/shaders_h, $(shader_src)), $(shader).h)
shader_lang := glsl430
ifeq ($(web), 1)
cc := emcc
shader_lang := glsl300es
macros := -DSOKOL_GLES3
bin := index
libs := -sUSE_WEBGL2 --shell-file=res/shell.html
output := $(build)/$(bin).html
endif
src/shaders_h/%.h: $(shader_src)
$(shader_bin) -i $< -o $@ -l $(shader_lang)
default:
make clean
make shader
make source
source: $(output)
shader: $(shader_out)
$(output): $(c_src) $(h_src)
bear -- $(cc) -o $(output) $(c_src) $(headers) $(libs) $(macros)
test:
$(cc) -o $(build)/test tests/parser_test.c src/parser.c -I./src/
clean:
rm -f src/shaders_h/*
rm -f build/*