1+ E9TOOL ?= ../../e9tool
2+ E9COMPILE ?= ../../e9compile.sh
3+
14FCF_NONE := $(shell \
25 if gcc -fcf-protection=none --version 2>&1 | grep -q 'unrecognized'; \
36 then true; \
@@ -12,58 +15,57 @@ check: regtest $(EXE)
1215 ./$^
1316
1417% .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 ) \
1720 -E data..data_END -E data2...text -E .text..begin -o $@
1821
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 \
2124 -Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
2225 -Wl,-z -Wl,max-page-size=4096 -DPIE=0
2326
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 \
2629 -Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
2730 -Wl,-z -Wl,max-page-size=4096 -DPIE=1 \
2831 -Wl,--export-dynamic
2932
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 \
3235 -Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
3336 -Wl,-z -Wl,max-page-size=4096 -DPIE=0
3437
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 $@
3740
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 $@
4043
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 $@ $< \
4346 -Wl,--export-dynamic -U_FORTIFY_SOURCE
4447 strip test_c
4548
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 $@
4851
49- inst :
50- ../../e9compile.sh inst.c -I ../../examples/
52+ inst : inst.c ../../examples/stdlib.c $( E9COMPILE )
53+ $( E9COMPILE ) $< -I../../examples
5154
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
5457
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
5760
58- init :
59- ../../e9compile.sh init.c -I ../../examples/
61+ init : init.c ../../examples/stdlib.c $( E9COMPILE )
62+ $( E9COMPILE ) $< -I../../examples
6063
61- fini :
62- ../../e9compile.sh fini.c -I ../../examples/
64+ fini : fini.c ../../examples/stdlib.c $( E9COMPILE )
65+ $( E9COMPILE ) $< -I../../examples
6366
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 $@
6769
6870clean-check :
6971 rm -f $(BASE ) $(TRAMPOLINE ) $(EXE )
0 commit comments