11.PHONY : check clean-check
22
3+ E9TOOL ?= ../../e9tool
4+ E9COMPILE ?= ../../e9compile.sh
5+
36FCF_NONE := $(shell \
47 if gcc -fcf-protection=none --version 2>&1 | grep -q 'unrecognized'; \
58 then true; \
@@ -14,58 +17,57 @@ check: regtest $(EXE)
1417 ./$^
1518
1619% .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 ) \
1922 -E data..data_END -E data2...text -E .text..begin -o $@
2023
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 \
2326 -Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
2427 -Wl,-z -Wl,max-page-size=4096 -DPIE=0
2528
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 \
2831 -Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
2932 -Wl,-z -Wl,max-page-size=4096 -DPIE=1 \
3033 -Wl,--export-dynamic
3134
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 \
3437 -Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
3538 -Wl,-z -Wl,max-page-size=4096 -DPIE=0
3639
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 $@
3942
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 $@
4245
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 $@ $< \
4548 -Wl,--export-dynamic -U_FORTIFY_SOURCE
4649 strip test_c
4750
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 $@
5053
51- inst :
52- ../../e9compile.sh inst.c -I ../../examples/
54+ inst : inst.c ../../examples/stdlib.c $( E9COMPILE )
55+ $( E9COMPILE ) $< -I../../examples
5356
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
5659
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
5962
60- init :
61- ../../e9compile.sh init.c -I ../../examples/
63+ init : init.c ../../examples/stdlib.c $( E9COMPILE )
64+ $( E9COMPILE ) $< -I../../examples
6265
63- fini :
64- ../../e9compile.sh fini.c -I ../../examples/
66+ fini : fini.c ../../examples/stdlib.c $( E9COMPILE )
67+ $( E9COMPILE ) $< -I../../examples
6568
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 $@
6971
7072clean-check :
7173 rm -f $(BASE ) $(TRAMPOLINE ) $(EXE )
0 commit comments