-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
40 lines (32 loc) · 1.03 KB
/
makefile
File metadata and controls
40 lines (32 loc) · 1.03 KB
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
FLAGS=-std=c11 -O3 -Wall -Iinc -Iinc/raylib
EMCC_FLAGS=-s USE_GLFW=3 -s ASYNCIFY --shell-file web/shell.html
SANITIZE=-fsanitize=address
# SANITIZE=
SRCS=$(wildcard src/*.c)
OBJS=$(patsubst src/%.c,obj/%.o,$(SRCS))
WEBOBJS=$(patsubst src/%.c,obj/web_%.o,$(SRCS))
# main executable
bsp: $(OBJS)
clang $(SANITIZE) -o $@ -Iinc $^ -Llib -lraylib -framework Cocoa -framework IOKit
# runs main executable on web
wasm: $(WEBOBJS)
emcc -o web/game.html $^ lib/libraylib.a $(EMCC_FLAGS)
@echo "\n\033[01;32m URL: http://localhost:8442/game.html \033[00m\n"
@python3 -m http.server --directory web 8442
# run raylib example files on web (usage: make ex<example number>)
ex%: examples/%.c
@mkdir -p example
clang -o example/$@ $(FLAGS) $(SANITIZE) $< -lraylib
@example/$@
obj/%.o: src/%.c
@mkdir -p obj
clang -c $(FLAGS) $(SANITIZE) $< -o $@
obj/web_%.o: src/%.c
@mkdir -p obj
emcc -c $(FLAGS) $< -o $@
# memory check
check: bsp
MallocStackLogging=YES leaks --atExit -q -- ./bsp
# all unwanted files listed in .gitignore
clean:
@git clean -dfX