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