-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
70 lines (54 loc) · 1.35 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
MAKEFLAGS += -j12
CXX := em++
SRCF := src/core
TEMP := obj
TARGET := src/lib
SRC := $(wildcard $(SRCF)/*.cpp) $(wildcard $(SRCF)/*/*.cpp) $(wildcard $(SRCF)/*/*/*.cpp)
OBJ := $(patsubst $(SRCF)/%.cpp,$(TEMP)/%.o,$(SRC))
DEP := $(patsubst $(SRCF)/%.cpp,$(TEMP)/%.d,$(SRC))
OUT := ref
CPPFLAGS := -I$(SRCF) -std=c++17
CXXFLAGS := -O3
LDFLAGS :=\
-lidbfs.js\
-sINITIAL_MEMORY=50MB\
-sALLOW_MEMORY_GROWTH\
-sASYNCIFY=1\
-sMIN_SAFARI_VERSION=120000\
-sASSERTIONS\
-sMAXIMUM_MEMORY=4GB\
-sEXPORTED_RUNTIME_METHODS=setValue\
-sEXPORT_ES6=1\
-sENVIRONMENT=worker
WASM := $(TARGET)/$(OUT).wasm
ifeq ($(OS),Windows_NT)
# Error is still possible in parallel running, so we add extra protection
MK = -@if not exist "$(@D)" mkdir "$(@D)" 2> NUL
RM = rmdir /s /q
else
MK = @mkdir -p "$(@D)"
endif
.PHONY: all
all: $(WASM)
$(WASM): $(OBJ)
$(MK)
@echo Compiling [33m$(WASM)[0m
@$(LINK.cc) $(USRFLAGS) -o $(TARGET)/$(OUT).js $(OBJ)
@echo [33mWebAssembly compile complete![0m
$(TEMP)/%.o: $(SRCF)/%.cpp
$(MK)
@echo Compiling [32m$<[0m
@$(COMPILE.cc) -MMD -c $< -o $@
$(TEMP)/main.o: $(SRCF)/main.cpp $(SRCF)/RFVersion.h
$(MK)
@echo Compiling [32m$<[0m
@$(COMPILE.cc) -MMD -c $< -o $@
# Ignoring old dependencies that were removed
%.h: ;
%.d: ;
$(SRCF)/RFVersion.h: package.json
@pnpm gulp syncVer -S
-include $(DEP)
.PHONY: clean
clean:
@$(RM) $(TEMP)