This repository has been archived by the owner on Jun 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
120 lines (96 loc) · 3.76 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
ANAME = RCL
CC = gcc
FLEX = flex
FLEX_OPTS = -pRCL
BISON = bison
BISON_OPTS = -t -pRCL -v
CCFLAGS_WARNS = -Wno-discarded-qualifiers \
-Wno-unused-parameter \
-Wno-unused-value \
-Wno-return-type \
-Wno-unused-function \
-Wno-unused-label \
-Wno-missing-braces \
-Wno-strict-aliasing \
-Wno-parentheses \
-Wno-unused-variable \
-Wno-address-of-packed-member \
-Wno-array-bounds
CCFLAGS_OPTIMIZE = -ftree-loop-distribution \
-faggressive-loop-optimizations \
-fno-leading-underscore \
-floop-parallelize-all \
-enable-thread-safe \
-ftree-vectorize \
-funroll-loops \
-fstdarg-opt \
-fcombine-stack-adjustments \
-fsplit-loops \
-ftree-loop-if-convert \
-O2
CCFLAGS_SIMD = -mavx2 -mssse3
CCFLAGS_MISC = -g -Wall -static -Iinclude
CCFLAGS = ${CCFLAGS_MISC} ${CCFLAGS_WARNS} ${CCFLAGS_OPTIMIZE} ${CCFLAGS_SIMD}
export CFLAGS = ${CCFLAGS}
.SILENT:
LIBS = -lffi -lgmp -lpthread
CSRC_SUBDIR_PATHS = *.c */*.c */*/*.c */*/*/*.c */*/*/*/*.c */*/*/*/*/*.c */*/*/*/*/*/*.c */*/*/*/*/*/*/*.c */*/*/*/*/*/*/*/*.c
csrc_abstract_paths = $(wildcard $(1) $(CSRC_SUBDIR_PATHS))
app = application/RCL.o
demo = demo/IR/More/FFI/SDL1/SDL.o
VM_CSRC = $(call csrc_abstract_paths, VM\)
VM_OBJS = $(filter-out $(demo), $(VM_CSRC:.c=.o))
LIB_CSRC = $(call csrc_abstract_paths, Library\)
LIB_OBJS = $(filter-out $(app), $(LIB_CSRC:.c=.o))
#src/Core/Syntax/Parser.c src/Tools\Syntax\Parser.h: src/Core/Syntax/RCL.y
# ${BISON} ${BISON_OPTS} src/Core/Syntax/RCL.y
#src/Core/Syntax/Lexer.c: src/Core/Syntax/RCL.l src/Tools\Syntax\Lexer.h
# ${FLEX} ${FLEX_OPTS} src/Core/Syntax/RCL.l
ifeq ($(OS), Windows_NT)
uname_ext := ${ANAME}.dll
clean_cmd = @del /s /q *.o > null
else
uname_ext := ${ANAME}.so
clean_cmd = @rm -f *.o
endif
PHONY: --todo
--todo:
@echo 1) If you want to build the virtual machine only (as executable one) ... run `make VM`
@echo 2) If you want to build the library (as DLL) ........................... run `make DLL`
@echo 3) If you want to build the library (as .a) ............................ run `make LIB`
@echo 4) If you want to clean directories from object files .................. run `make clean`
@echo 5) If you want more options ............................................ run `make help`
@echo (The option (3) is probably the one you're interested in)
end-msg = @echo Compilation completed
VM: ${VM_OBJS}
${CC} $^ -o ${ANAME} ${LIBS}
$(end-msg)
DLL: ${LIB_OBJS}
${CC} -shared -o $(uname_ext) $^ ${LIBS}
$(end-msg)
LIB: ${LIB_OBJS}
ar rcs librcl.a $^
$(end-msg)
help:
@echo 1) Build VM (as executable) ............. run `make VM` --------- produce 'RCL' (as program)
@echo 2) Build library (as DLL) ............... run `make LIB` --------- produce 'librcl.a' (for static links)
@echo 2) Build library (as DLL) ............... run `make DLL` --------- produce 'RCL.dll' (for dynamic links)
@echo 4) Clean directories .................... run `make clean`
@echo 5) Display help menu .................... run `make help`
@echo 6) Display required tools ............... run `make required`
clean:
$(clean_cmd)
@echo Cleaned directories
required:
@echo Required compilation tools:
@echo - GCC (version 5.1.0 was used)
@echo - Makefile (version 4.2.1 was used)
@echo (- Bison (version 2.4.1 was used)) // pre-generated
@echo (- Flex (version 2.5.4 was used)) // pre-generated
@echo All supposed to be accessible from the shell.
@echo ---------------------------------------------
@echo Required libraries:
@echo - libffi (https://sourceware.org/libffi/)
@echo - GMP (https://gmplib.org/)
@echo Headers and static libraries simply need to be in the GCC compiler folders.
@echo ---------------------------------------------