@@ -47,6 +47,20 @@ E9TOOL_LDFLAGS=\
4747 -Wl,--dynamic-list=src/e9tool/e9tool.syms \
4848 -ldl -lz
4949
50+ BIN ::= e9tool e9patch e9compile
51+ INCLUDE ::= src/e9tool/e9tool.h src/e9tool/e9plugin.h
52+ MAN1 ::= $(wildcard doc/* .1)
53+ DOC ::= $(wildcard doc/e9* .md)
54+ EXAMPLE ::= $(wildcard examples/* .sh examples/* .c examples/* .cpp \
55+ examples/plugins/* .cpp)
56+ INSTALL = $(DESTDIR )$(PREFIX ) /share/doc/e9patch/LICENSE \
57+ $(BIN:%=$(DESTDIR )$(PREFIX ) /bin/% ) \
58+ $(DESTDIR )$(PREFIX ) /share/e9compile/include/e9loader.h \
59+ $(INCLUDE:src/%.h=$(DESTDIR )$(PREFIX ) /include/%.h ) \
60+ $(MAN1:%.1=$(DESTDIR )$(PREFIX ) /share/man/man1/%.1 ) \
61+ $(DOC:doc/%.md=$(DESTDIR )$(PREFIX ) /share/doc/e9patch/%.html ) \
62+ $(EXAMPLE:%=$(DESTDIR )$(PREFIX ) /share/e9tool/% )
63+
5064# ########################################################################
5165# CONVENTIONAL BUILD
5266# ########################################################################
@@ -89,63 +103,46 @@ contrib/zydis/libZydis.a:
89103contrib/libdw/libdw.a :
90104 (cd contrib/libdw/; make)
91105
92- install : all
93- install -d " $( DESTDIR) $( PREFIX) /bin"
94- install -m 755 e9patch " $( DESTDIR) $( PREFIX) /bin/e9patch"
95- install -m 755 e9tool " $( DESTDIR) $( PREFIX) /bin/e9tool"
96- install -m 755 e9compile.sh " $( DESTDIR) $( PREFIX) /bin/e9compile"
97- sed \
98- -e ' s#-I examples#-I $(PREFIX)/share/e9compile/include#g' e9compile.sh > \
99- " $( DESTDIR) $( PREFIX) /bin/e9compile"
100- chmod 555 " $( DESTDIR) $( PREFIX) /bin/e9compile"
101- install -d " $( DESTDIR) $( PREFIX) /share/doc/e9patch/"
102- sed \
103- -e ' s#https://github.com/GJDuck/e9patch/blob/master/doc/e9tool-user-guide.md#file://$(PREFIX)/share/doc/e9tool/e9tool-user-guide.html#g' \
104- -e ' s#https://github.com/GJDuck/e9patch/tree/master/examples#file://$(PREFIX)/share/e9tool/examples#g' \
105- doc/e9patch-programming-guide.md | markdown > \
106- " $( DESTDIR) $( PREFIX) /share/doc/e9patch/e9patch-programming-guide.html"
107- install -m 444 LICENSE " $( DESTDIR) $( PREFIX) /share/doc/e9patch/LICENSE"
108- install -d " $( DESTDIR) $( PREFIX) /share/doc/e9tool/"
106+ install : $(INSTALL )
107+
108+ $(DESTDIR )$(PREFIX ) /share/doc/e9patch/LICENSE : LICENSE
109+ install -Dm 644 $< " $@ "
110+
111+ e9compile : e9compile.sh
112+ sed ' s#-I examples#-I $(PREFIX)/share/e9compile/include#g' $< > $@
113+
114+ $(DESTDIR )$(PREFIX ) /bin/% : %
115+ install -Dm 755 $< " $@ "
116+
117+ $(DESTDIR )$(PREFIX ) /share/e9compile/include/e9loader.h : src/e9patch/e9loader.h
118+ install -Dm 644 $< " $@ "
119+
120+ $(DESTDIR )$(PREFIX ) /include/% .h : src/% .h
121+ install -Dm 644 $< " $@ "
122+
123+ $(DESTDIR )$(PREFIX ) /share/man/man1/% .1 : % .1
124+ install -Dm 644 $< " $@ "
125+
126+ $(DESTDIR )$(PREFIX ) /share/doc/e9patch/% .html : doc/% .md
127+ install -d $(DESTDIR )$(PREFIX ) /share/doc/e9patch
109128 sed \
110- -e ' s#https://github.com/GJDuck/e9patch/blob/master/doc/e9patch-programming-guide.md#file://$(PREFIX)/share/doc/e9patch/e9patch-programming-guide.html#g' \
111- doc/e9tool-user-guide.md | markdown > \
112- " $( DESTDIR) $( PREFIX) /share/doc/e9tool/e9tool-user-guide.html"
113- install -m 444 LICENSE " $( DESTDIR) $( PREFIX) /share/doc/e9tool/LICENSE"
114- install -Dm 444 src/e9tool/e9tool.h " $( DESTDIR) $( PREFIX) /include/e9tool/e9tool.h"
115- install -Dm 444 src/e9tool/e9plugin.h " $( DESTDIR) $( PREFIX) /include/e9tool/e9plugin.h"
116- install -d " $( DESTDIR) $( PREFIX) /share/e9tool/examples/"
117- install -m 444 examples/bounds.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/bounds.c"
129+ -e ' s#https://github.com/GJDuck/e9patch/blob/master/doc/e9patch-programming-guide.md#file://$(PREFIX)/share/doc/e9patch/e9patch-programming-guide.html#g' \
130+ -e ' s#https://github.com/GJDuck/e9patch/blob/master/doc/e9tool-user-guide.md#file://$(PREFIX)/share/doc/e9tool/e9tool-user-guide.html#g' \
131+ -e ' s#https://github.com/GJDuck/e9patch/tree/master/examples#file://$(PREFIX)/share/e9tool/examples#g' \
132+ $< | markdown > $@
133+
134+ $(DESTDIR )$(PREFIX ) /share/e9tool/examples/% .c : examples/% .c
135+ install -Dm 644 $< " $@ "
136+
137+ $(DESTDIR )$(PREFIX ) /share/e9tool/examples/% .cpp : examples/% .cpp
138+ install -Dm 644 $< " $@ "
139+
140+ $(DESTDIR )$(PREFIX ) /share/e9tool/examples/bounds.sh : examples/bounds.sh
141+ install -Dm 755 $< " $@ "
118142 sed \
119- -e ' s#\./e9compile.sh examples/bounds.c#e9compile $(PREFIX)/share/e9tool/examples/bounds.c#' \
120- -e ' s#\./e9tool#e9tool#' \
121- examples/bounds.sh > \
122- " $( DESTDIR) $( PREFIX) /share/e9tool/examples/bounds.sh"
123- chmod 555 " $( DESTDIR) $( PREFIX) /share/e9tool/examples/bounds.sh"
124- install -m 444 examples/cfi.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/cfi.c"
125- install -m 444 examples/count.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/count.c"
126- install -m 444 examples/cov.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/cov.c"
127- install -m 444 examples/delay.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/delay.c"
128- install -m 444 examples/hello.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/hello.c"
129- install -m 444 examples/limit.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/limit.c"
130- install -m 444 examples/nop.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/nop.c"
131- install -m 444 examples/print.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/print.c"
132- install -m 444 examples/printf.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/printf.c"
133- install -m 444 examples/skip.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/skip.c"
134- install -m 444 examples/state.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/state.c"
135- install -m 444 examples/trap.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/trap.c"
136- install -m 444 examples/win64_demo.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/win64_demo.c"
137- install -d " $( DESTDIR) $( PREFIX) /share/e9tool/examples/plugins/"
138- install -m 444 examples/plugins/example.cpp " $( DESTDIR) $( PREFIX) /share/e9tool/examples/plugins/example.cpp"
139- install -d " $( DESTDIR) $( PREFIX) /share/e9compile/include/"
140- install -m 444 examples/stdlib.c " $( DESTDIR) $( PREFIX) /share/e9compile/include/stdlib.c"
141- install -m 444 src/e9patch/e9loader.h " $( DESTDIR) $( PREFIX) /share/e9compile/include/e9loader.h"
142- install -d " $( DESTDIR) $( PREFIX) /share/man/man1/"
143- gzip --stdout doc/e9patch.1 > " $( DESTDIR) $( PREFIX) /share/man/man1/e9patch.1.gz"
144- chmod 444 " $( DESTDIR) $( PREFIX) /share/man/man1/e9patch.1.gz"
145- gzip --stdout doc/e9tool.1 > " $( DESTDIR) $( PREFIX) /share/man/man1/e9tool.1.gz"
146- chmod 444 " $( DESTDIR) $( PREFIX) /share/man/man1/e9tool.1.gz"
147- gzip --stdout doc/e9compile.1 > " $( DESTDIR) $( PREFIX) /share/man/man1/e9compile.1.gz"
148- chmod 444 " $( DESTDIR) $( PREFIX) /share/man/man1/e9compile.1.gz"
143+ -e ' s#\./e9compile.sh examples/bounds.c#e9compile $(PREFIX)/share/e9tool/examples/bounds.c#' \
144+ -e ' s#\./e9tool#e9tool#' \
145+ -i " $@ "
149146
150147# ########################################################################
151148# SPECIAL BUILD
0 commit comments