-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
65 lines (49 loc) · 1.85 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
CC = g++
FLAG = -Wall -Werror -g -std=c++2a
STATIC_LINK_STD = -static -static-libgcc
MAIN_SRC = main.cpp
MAIN_OUT = erebus
UI_SRC = ui.cpp
UI_OUT = erebus-ui
EREBUS_SRC = ./src/erebus.cpp
EREBUS_OBJ = erebus.o
EREBUS_OUT_STATIC_LIB = liberebus.a
EREBUS_OUT_SHARED_LIB = liberebus.so
EREBUS_SHARED_FLAG = -lerebus
EREBUS_UI_FLAG = -lraylib -lopengl32 -lgdi32 -lwinmm
LINKER_PATH = -L./dist
all: build
./$(MAIN_OUT)
# Create dist directory if not exists
mkdir-dist:
([ ! -e ./dist ] && mkdir dist) || [ -e ./dist ]
debug: build
gdb ./$(MAIN_OUT)
clean:
rm ./$(MAIN_OUT)
rm ./$(UI_OUT)
rm ./dist/*.a
build-ui: erebus-build-staticlib
$(CC) $(UI_SRC) -o $(UI_OUT) $(EREBUS_UI_FLAG) $(LINKER_PATH) $(EREBUS_SHARED_FLAG) $(STATIC_LINK_STD)
build: erebus-build-staticlib
$(CC) $(MAIN_SRC) -o $(MAIN_OUT) $(FLAG) $(LINKER_PATH) $(EREBUS_SHARED_FLAG)
build-static: erebus-build-staticlib
$(CC) $(MAIN_SRC) -o $(MAIN_OUT) $(FLAG) $(LINKER_PATH) $(EREBUS_SHARED_FLAG) $(STATIC_LINK_STD)
# Make sure you have emscripten
# Also put wasm compiled of raylib to the libs directory
# build-web: erebus-build-weblib
# Probably also need to use raylib.h too
build-web:
em++ ./ui.cpp ./src/erebus.cpp ./dist/liberebusweb.a ./libs/libraylib.a -o ./web/index.html -s USE_GLFW=3 -DPLATFORM_WEB -s ASSERTIONS=2 -Wall -sEXPORT_EXCEPTION_HANDLING_HELPERS -fwasm-exceptions --profiling-funcs
# em++ ./ui.cpp ./src/erebus.cpp ./dist/liberebusweb.a ./libs/libraylib.a -o ./web/index.html -s USE_GLFW=3 -DPLATFORM_WEB -s ASSERTIONS=2 -Os
erebus-build-lib:
make erebus-build-staticlib
erebus-build-staticlib: mkdir-dist
$(CC) $(EREBUS_SRC) -c -o ./$(EREBUS_OBJ) $(FLAG)
ar rcs ./dist/$(EREBUS_OUT_STATIC_LIB) ./$(EREBUS_OBJ)
rm ./$(EREBUS_OBJ)
erebus-clean:
rm ./$(EREBUS_OBJ)
# erebus-build-weblib:
# em++ ./src/erebus.cpp -c dist/erebusweb.o
# emar rcs dist/liberebusweb.a dist/erebusweb.o