-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
93 lines (73 loc) · 3.51 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
CXX = emcc
TARGET = skolaris
BUILD_DIR = build
ifeq "${MAKECMDGOALS}" "skolarisDebug"
BUILD_DIR = build_debug
CFLAGSBUILD = -gsource-map -D_DEBUG -pthread -sDISABLE_EXCEPTION_CATCHING=0
LDFLAGSBUILD = -sDEMANGLE_SUPPORT -sDISABLE_EXCEPTION_CATCHING=0 --source-map-base https://localhost/SkolarisUI.Web/Plugin/src/ -gsource-map -sASSERTIONS=2 -sSAFE_HEAP
else
CFLAGSBUILD = -DNDEBUG -O3 -pthread -flto
LDFLAGSBUILD = -O3 -flto
endif
ifeq "${MAKECMDGOALS}" "skolarisOneThread"
BUILD_DIR = build_one_thread
CFLAGSBUILD = -DNDEBUG -O3 -DUSE_ONE_THREAD -flto
endif
ifeq "${MAKECMDGOALS}" "skolarisOneThreadDebug"
BUILD_DIR = build_one_thread_debug
CFLAGSBUILD = -gsource-map -D_DEBUG -DUSE_ONE_THREAD -sDISABLE_EXCEPTION_CATCHING=0
LDFLAGSBUILD = -sDEMANGLE_SUPPORT -sDISABLE_EXCEPTION_CATCHING=0 --source-map-base https://localhost/SkolarisUI.Web/Plugin/src/ -gsource-map -sASSERTIONS=2 -sSAFE_HEAP
endif
#$(info $$BUILD_DIR is [${BUILD_DIR}])
MKDIR_P = @mkdir -p
INCBOOST = /usr/local/include
INCCTOOLHU = /usr/local/include/ctoolhu
INCLOCALSEARCH = /usr/local/include/localsearch
INCDIRS = -I${INCBOOST} -I${INCCTOOLHU} -I${INCLOCALSEARCH}
CFLAGS = -Wall -std=c++20 -fexperimental-library -fno-rtti ${INCDIRS} -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_NO_RTTI -DBOOST_NO_TYPEID -MMD -MP -Wno-deprecated-builtins
LDFLAGS = -sALLOW_MEMORY_GROWTH -sINITIAL_MEMORY=64Mb -sMODULARIZE=1 -sTEXTDECODER=2 -sEXPORTED_FUNCTIONS='["_malloc", "_free"]' --shell-file src/html_template/shell_minimal.html
LDFLAGSONETHREAD = -sEXPORT_NAME=SkolarisOneThreadModule -sEXPORTED_RUNTIME_METHODS='["cwrap", "lengthBytesUTF8", "stringToUTF8"]'
LDFLAGSMULTITHREAD = -pthread -sPTHREAD_POOL_SIZE='navigator.hardwareConcurrency+2' -sEXPORT_NAME=SkolarisModule -sEXPORTED_RUNTIME_METHODS='["cwrap", "lengthBytesUTF8", "stringToUTF8", "PThread"]'
LDFLAGSUNUSED = -sVERBOSE=1
SOURCES_CC = $(wildcard src/*.cc)
SOURCES_CPP = \
$(wildcard src/gascheduler/src/*.cpp) \
$(wildcard src/gascheduler/src/plugin/algorithm_builder.cpp) \
$(wildcard src/gascheduler/src/timetable/*.cpp) \
$(wildcard src/gascheduler/src/timetable/algorithm/*.cpp) \
$(wildcard src/gascheduler/src/timetable/analysis/*.cpp) \
$(wildcard src/gascheduler/src/timetable/constraints/*.cpp) \
$(wildcard src/gascheduler/src/timetable/fitness/*.cpp) \
$(wildcard src/gascheduler/src/timetable/model/*.cpp) \
$(wildcard src/gascheduler/src/timetable/solution/*.cpp)
SOURCES = $(SOURCES_CC) $(SOURCES_CPP)
OBJS = $(SOURCES:%=$(BUILD_DIR)/%.o)
DEPS = $(OBJS:.o=.d)
$(BUILD_DIR)/%.cc.o: %.cc
$(MKDIR_P) $(dir $@)
$(CXX) $(CFLAGS) $(CFLAGSBUILD) -c $< -o $@
$(BUILD_DIR)/%.cpp.o: %.cpp
$(MKDIR_P) $(dir $@)
$(CXX) $(CFLAGS) $(CFLAGSBUILD) -c $< -o $@
skolaris: $(OBJS)
$(MKDIR_P) release
$(CXX) $(OBJS) -o release/skolaris.html $(LDFLAGS) $(LDFLAGSMULTITHREAD) $(LDFLAGSBUILD)
skolarisDebug: $(OBJS)
$(MKDIR_P) debug
$(CXX) $(OBJS) -o debug/skolaris.html $(LDFLAGS) $(LDFLAGSMULTITHREAD) $(LDFLAGSBUILD)
skolarisOneThread: $(OBJS)
$(MKDIR_P) release
$(CXX) $(OBJS) -o release/skolarisOneThread.html $(LDFLAGS) $(LDFLAGSONETHREAD) $(LDFLAGSBUILD)
skolarisOneThreadDebug: $(OBJS)
$(MKDIR_P) debug
$(CXX) $(OBJS) -o debug/skolarisOneThread.html $(LDFLAGS) $(LDFLAGSONETHREAD) $(LDFLAGSBUILD)
-include $(DEPS)
.PHONY: clean
clean:
@rm -rf build build_debug build_one_thread build_one_thread_debug release debug
.PHONY: install
install:
cp release/skolaris.* release/skolarisOneThread.* ~/Public/skolaris_wasm/release
.PHONY: install_debug
install_debug:
cp debug/skolaris.* debug/skolarisOneThread.* ~/Public/skolaris_wasm/debug