1
+ E9TOOL ?= ../../e9tool
2
+ E9COMPILE ?= ../../e9compile.sh
3
+
1
4
FCF_NONE := $(shell \
2
5
if gcc -fcf-protection=none --version 2>&1 | grep -q 'unrecognized'; \
3
6
then true; \
@@ -12,58 +15,57 @@ check: regtest $(EXE)
12
15
./$^
13
16
14
17
% .exe : in=$(shell head -1 $< )
15
- % .exe : % .in $(BASE ) $(TRAMPOLINE )
16
- ../../e9tool $(E9TOOL_OPTIONS ) -M ' addr >= &"entry"' $(in ) \
18
+ % .exe : % .in $(BASE ) $(TRAMPOLINE ) $( E9TOOL )
19
+ $( E9TOOL ) $(E9TOOL_OPTIONS ) -M ' addr >= &"entry"' $(in ) \
17
20
-E data..data_END -E data2...text -E .text..begin -o $@
18
21
19
- test :
20
- gcc -x assembler-with-cpp -o test test.s -no-pie -nostdlib \
22
+ test : test.s
23
+ $( CC ) -x assembler-with-cpp -o $@ $< -no-pie -nostdlib \
21
24
-Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
22
25
-Wl,-z -Wl,max-page-size=4096 -DPIE=0
23
26
24
- test.pie :
25
- gcc -x assembler-with-cpp -o test.pie test.s -pie -nostdlib \
27
+ test.pie : test.s
28
+ $( CC ) -x assembler-with-cpp -o $@ $< -pie -nostdlib \
26
29
-Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
27
30
-Wl,-z -Wl,max-page-size=4096 -DPIE=1 \
28
31
-Wl,--export-dynamic
29
32
30
- bugs :
31
- gcc -x assembler-with-cpp -o bugs bugs.s -no-pie -nostdlib \
33
+ bugs : bugs.s
34
+ $( CC ) -x assembler-with-cpp -o $@ $< -no-pie -nostdlib \
32
35
-Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
33
36
-Wl,-z -Wl,max-page-size=4096 -DPIE=0
34
37
35
- test.libc :
36
- gcc -x assembler-with-cpp -o test.libc test_libc.s -pie - Wl,--export-dynamic
38
+ test.libc : test_libc.s
39
+ $( CC ) -x assembler-with-cpp -pie $< - Wl,--export-dynamic -o $@
37
40
38
- libtest.so :
39
- gcc -x assembler-with-cpp -shared -o libtest.so libtest.s
41
+ libtest.so : libtest.s
42
+ $( CC ) -x assembler-with-cpp $< -shared -o $@
40
43
41
- test_c :
42
- gcc -O2 -fPIC $(FCF_NONE ) -pie -o test_c test_c.c \
44
+ test_c : test_c.c
45
+ $( CC ) -O2 -fPIC $(FCF_NONE ) -pie -o $@ $< \
43
46
-Wl,--export-dynamic -U_FORTIFY_SOURCE
44
47
strip test_c
45
48
46
- test_c.debug :
47
- gcc -O0 -g -fPIC -pie -o test_c.debug test_c.c
49
+ test_c.debug : test_c.c
50
+ $( CC ) -O0 -g -fPIC -pie $< -o $@
48
51
49
- inst :
50
- ../../e9compile.sh inst.c -I ../../examples/
52
+ inst : inst.c ../../examples/stdlib.c $( E9COMPILE )
53
+ $( E9COMPILE ) $< -I../../examples
51
54
52
- patch :
53
- ../../e9compile.sh patch.cpp -std=c++11 -I ../../examples/
55
+ patch : patch.cpp ../../examples/stdlib.c $( E9COMPILE )
56
+ $( E9COMPILE ) $< -std=c++11 -I../../examples
54
57
55
- dl :
56
- NO_SIMD_CHECK=1 ../../e9compile.sh dl.c -I ../../examples/
58
+ dl : dl.c ../../examples/stdlib.c $( E9COMPILE )
59
+ NO_SIMD_CHECK=1 $( E9COMPILE ) $< -I../../examples
57
60
58
- init :
59
- ../../e9compile.sh init.c -I ../../examples/
61
+ init : init.c ../../examples/stdlib.c $( E9COMPILE )
62
+ $( E9COMPILE ) $< -I../../examples
60
63
61
- fini :
62
- ../../e9compile.sh fini.c -I ../../examples/
64
+ fini : fini.c ../../examples/stdlib.c $( E9COMPILE )
65
+ $( E9COMPILE ) $< -I../../examples
63
66
64
- example.so :
65
- g++ -std=c++11 -fPIC -shared -o example.so -O2 \
66
- ../../examples/plugins/example.cpp -I ../../src/e9tool/
67
+ example.so : ../../examples/plugins/example.cpp ../../src/e9tool/e9plugin.h
68
+ $(CXX ) -std=c++11 -O2 -fPIC -I../../src/e9tool $< -shared -o $@
67
69
68
70
clean-check :
69
71
rm -f $(BASE ) $(TRAMPOLINE ) $(EXE )
0 commit comments