-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
66 lines (49 loc) · 2 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
SRC_F := $(shell find src -name *.c) $(shell find libs -name *.c)
SRC_CPP := $(shell find libs/soloud/src -name *.cpp)
OBJ_FOR_CLEAN_F := $(shell find ./src -name *.o)
SRC_O := $(patsubst %.c,%.o,$(SRC_F))
SRC_CPP_O := $(patsubst %.cpp,%.o,$(SRC_CPP))
LIBS := -lpthread -lm -lglfw -lGL -lstdc++ -ldl -lasound
FLAGS_DEBUG := -g -O0 -w
FLAGS__DEBUG := -O3
FLAGS := -Wall -Wextra -Ilibs/include -Ilibs/soloud/include
# Vars for emscripten build
EMSC_CFLAGS := -O2 -s -Wall -D_DEFAULT_SOURCE -DWITH_MINIAUDIO=1 -s MIN_WEBGL_VERSION=2 -Wno-missing-braces -s OFFSCREEN_FRAMEBUFFER=1 -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0 -s USE_GLFW=3 -sFULL_ES3 -s TOTAL_MEMORY=67108864 --preload-file assets -v -D OS_WEB
EMSC_CC := emcc
TARGET := bin/main.bin
.PONY: clean web statistics
all: clean $(SRC_O) $(SRC_CPP_O) copy_assets
gcc $(FLAGS_DEBUG) $(FLAGS) $(SRC_O) $(SRC_CPP_O) -o $(TARGET) $(LIBS)
run_main: all
$(TARGET)
%.o: %.c
gcc -c $(FLAGS_DEBUG) $(FLAGS) $^ -o $@
%.o: %.cpp
gcc -c $(FLAGS_RELEASE) $(FLAGS) -lstdc++ -ldl -lasound -DWITH_ALSA=1 $^ -o $@
main.bin: clean src/mainNew.c
gcc -g -O0 src/mainNew.c -lm -o main.bin
web:
rm -rf docs
mkdir docs
emcc -O0 -g -Ilibs/include -Ilibs/soloud/include -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0 -DWITH_MINIAUDIO=1 -s USE_GLFW=3 -s ALLOW_MEMORY_GROWTH=1 -s MAX_WEBGL_VERSION=2 --preload-file assets -s MIN_WEBGL_VERSION=2 -g4 --source-map-base https://weremsoft.github.io/MS-DOS-frame-buffer-game-engine/ $(SRC_F) $(SRC_CPP) -o docs/index.html
cp -r src docs
clean:
rm -rf $(OBJ_FOR_CLEAN_F)
rm -rf $(TARGET)
rm -rf bin/assets
rm -rf html/**/*.*
rm -rf ./main.bin
deep_clean: clean
rm -rf $(SRC_CPP_O)
copy_assets:
cp -r assets bin
statistics_old:
echo >> metrics.txt
git log -1 --format="%H - %s" >> metrics.txt
pmccabe -vt src/main.c >> metrics.txt
statistics:
echo >> metrics.txt
git log -1 --format="%H - %s" >> metrics.txt
complexity --histogram --score --thresh=3 `ls src/*.c` >> metrics.txt
create_report:
sed -e '/Total/,/-/!d' metrics.txt