forked from CLimber-Rong/stamon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (68 loc) · 1.48 KB
/
Makefile
File metadata and controls
83 lines (68 loc) · 1.48 KB
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
# 可以更改$(COMPILER)以及$(REMOVE)来自定义编译环境
COMPILER = g++
STRIP = strip
UPX = upx
REMOVE = del
STD = c++17
LINK = -I include/interface \
-I include/stdc_implemented \
-I src/ast \
-I src/data_type \
-I src/vm \
-I src/ir \
-I src/compiler \
-I src/sfn \
-I src/action \
-I src/exception \
-I src/config \
-I src \
-lm
# 以下指令用于编译发行版
# -static选项让编译的程序更通用,但是程序体积更大,删去可以缩小程序体积
release:
# 自定义生成可执行文件名(默认为stamon.exe)
xcopy src\bin-include bin\include /s /e /y /i
$(COMPILER) src/Main.cpp \
-o bin/stamon.exe \
-O2 \
-std=$(STD) \
-static \
$(LINK)
$(STRIP) -s bin/stamon.exe
release_win:
# 编译Windows版本
xcopy src\bin-include bin\include /s /e /y /i
$(COMPILER) src/Main.cpp \
-o bin/stamon.exe \
-O2 \
-std=$(STD) \
-static \
$(LINK)
$(STRIP) -s bin/stamon.exe
release_linux:
# 编译Linux版本
mkdir -p "bin/include"
cp -r -T src/bin-include bin/include
$(COMPILER) src/Main.cpp \
-o bin/stamon \
-O2 \
-std=$(STD) \
-static \
$(LINK)
$(STRIP) -s bin/stamon
release_macos:
# 编译MacOS版本
mkdir -p "bin/include"
cp -r "src/bin-include/" "bin/include"
$(COMPILER) src/Main.cpp \
-o bin/stamon \
-O2 \
-std=$(STD) \
$(LINK)
$(STRIP) bin/stamon
zip_release_win:
$(UPX) --best --lzma bin/stamon.exe
zip_release_linux:
$(UPX) --best --lzma bin/stamon
zip_release_macos:
$(UPX) --best --lzma bin/stamon