forked from aboood40091/FFL-Testing
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.emscripten
75 lines (57 loc) · 2.61 KB
/
Makefile.emscripten
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
# Default compiler and flags
# Prepend toolchain prefix that you can choose
CXX := $(TOOLCHAIN_PREFIX)em++
INCLUDES := -Irio/include -Iffl/include -Iinclude $(INCLUDES)
# ninTexUtils is added conditionally later
# --- Definitions
# MLC path is where it expects "sys" and "usr" to be,
# , where it can open the database and resource files
# FFL_NO_OPEN_DATABASE_FILE: will not try to open database files
# all others: databases or functionality that is not used
# FFL_NO_FS: just means that, on top of no db, we will open and provide the resource file ourselves
# TODO: neeeed a good way to set debug and release!!!
# NOTE: emscripten needs NDEBUG because it is 32 bit i think
DEFS := -DRIO_DEBUG -DNDEBUG -DRIO_NO_CONTROLLERS_WIN -DFFL_NO_FS -DFFL_NO_DATABASE_FILE -DFFL_NO_MIDDLE_DB -DFFL_NO_DATABASE_RANDOM -DFFL_NO_DRAW_MASK_TWICE $(DEFS) -DRIO_GLES -DFFL_NO_NINTEXUTILS
# Binary name which you can change if you want
EXEC := ffl_testing_2_debug64.html
ifeq (,$(findstring FFL_NO_NINTEXUTILS, $(DEFS)))
INCLUDES += -IninTexUtils/include
endif
# Build for debug by default, use C++17, catch all errors
CXXFLAGS := -g -std=c++17 -Wall -Wno-unused-private-field -Wno-missing-braces $(CXXFLAGS) $(INCLUDES) $(PKG_CONFIG_CFLAGS_OUTPUT) $(DEFS)
LDFLAGS := -sINITIAL_MEMORY=22937600 -sALLOW_MEMORY_GROWTH -sMAX_WEBGL_VERSION=2 -sUSE_GLFW=3 -sUSE_ZLIB=1 --embed-file fs --preload-file FFLResHigh.dat --embed-file place_ffsd_files_here $(LDFLAGS)
# Source directories
# glob all files in here for now
ifeq (,$(findstring FFL_NO_NINTEXUTILS, $(DEFS)))
# then FFL_NO_NINTEXUTILS is NOT defined
NINTEXUTILS_SRC := $(shell find ninTexUtils/src/ninTexUtils -name '*.c' -o -name '*.cpp')
endif
RIO_SRC := $(shell find rio/src -name '*.cpp')
FFL_SRC := $(shell find ffl/src -name '*.cpp')
SHADER ?= src/Shader.cpp
# Main source
SRC := src/main.cpp src/Model.cpp src/RootTask.cpp $(SHADER)
# Object files
NINTEXUTILS_OBJ := $(NINTEXUTILS_SRC:.c=.o)
NINTEXUTILS_OBJ := $(NINTEXUTILS_OBJ:.cpp=.o)
RIO_OBJ := $(RIO_SRC:.cpp=.o)
FFL_OBJ := $(FFL_SRC:.cpp=.o)
OBJ := $(SRC:.cpp=.o)
# --- Targets
# Default target
all: $(EXEC)
# TODO: add git submodule update --init --recursive, maybe?
# TODO: or a reminder if you did not init the submodules and the folders don't have content?
# Linking the executable
$(EXEC): $(NINTEXUTILS_OBJ) $(RIO_OBJ) $(FFL_OBJ) $(OBJ)
$(CXX) $^ -o $@ $(CXXFLAGS) $(LDFLAGS)
# Compiling source files
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
%.o: %.c
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean up
clean:
rm -f $(NINTEXUTILS_OBJ) $(RIO_OBJ) $(FFL_OBJ) $(OBJ) $(EXEC) src/Shader*.o build/*.o build/*.d build/*.map
# Phony targets
.PHONY: all clean