@@ -45,6 +45,20 @@ E9TOOL_CXXFLAGS ::= -Isrc/e9tool -Wno-unused-function
4545E9TOOL_LDFLAGS ::= -Wl,--dynamic-list=src/e9tool/e9tool.syms
4646E9TOOL_LDLIBS ::= -ldl -lz
4747
48+ BIN ::= e9tool e9patch e9compile
49+ INCLUDE ::= src/e9tool/e9tool.h src/e9tool/e9plugin.h
50+ MAN1 ::= $(wildcard doc/* .1)
51+ DOC ::= $(wildcard doc/e9* .md)
52+ EXAMPLE ::= $(wildcard examples/* .sh examples/* .c examples/* .cpp \
53+ examples/plugins/* .cpp)
54+ INSTALL = $(DESTDIR )$(PREFIX ) /share/doc/e9patch/LICENSE \
55+ $(BIN:%=$(DESTDIR )$(PREFIX ) /bin/% ) \
56+ $(DESTDIR )$(PREFIX ) /share/e9compile/include/e9loader.h \
57+ $(INCLUDE:src/%.h=$(DESTDIR )$(PREFIX ) /include/%.h ) \
58+ $(MAN1:%.1=$(DESTDIR )$(PREFIX ) /share/man/man1/%.1 ) \
59+ $(DOC:doc/%.md=$(DESTDIR )$(PREFIX ) /share/doc/e9patch/%.html ) \
60+ $(EXAMPLE:%=$(DESTDIR )$(PREFIX ) /share/e9tool/% )
61+
4862# ########################################################################
4963# CONVENTIONAL BUILD
5064# ########################################################################
@@ -83,63 +97,46 @@ src/e9patch/e9loader_pe.c: src/e9patch/e9loader_pe.cpp
8397src/e9patch/e9elf.o : src/e9patch/e9loader_elf.c
8498src/e9patch/e9pe.o : src/e9patch/e9loader_pe.c
8599
86- install : all
87- install -d " $( DESTDIR) $( PREFIX) /bin"
88- install -m 755 e9patch " $( DESTDIR) $( PREFIX) /bin/e9patch"
89- install -m 755 e9tool " $( DESTDIR) $( PREFIX) /bin/e9tool"
90- install -m 755 e9compile.sh " $( DESTDIR) $( PREFIX) /bin/e9compile"
91- sed \
92- -e ' s#-I examples#-I $(PREFIX)/share/e9compile/include#g' e9compile.sh > \
93- " $( DESTDIR) $( PREFIX) /bin/e9compile"
94- chmod 555 " $( DESTDIR) $( PREFIX) /bin/e9compile"
95- install -d " $( DESTDIR) $( PREFIX) /share/doc/e9patch/"
96- sed \
97- -e ' s#https://github.com/GJDuck/e9patch/blob/master/doc/e9tool-user-guide.md#file://$(PREFIX)/share/doc/e9tool/e9tool-user-guide.html#g' \
98- -e ' s#https://github.com/GJDuck/e9patch/tree/master/examples#file://$(PREFIX)/share/e9tool/examples#g' \
99- doc/e9patch-programming-guide.md | markdown > \
100- " $( DESTDIR) $( PREFIX) /share/doc/e9patch/e9patch-programming-guide.html"
101- install -m 444 LICENSE " $( DESTDIR) $( PREFIX) /share/doc/e9patch/LICENSE"
102- install -d " $( DESTDIR) $( PREFIX) /share/doc/e9tool/"
100+ install : $(INSTALL )
101+
102+ $(DESTDIR )$(PREFIX ) /share/doc/e9patch/LICENSE : LICENSE
103+ install -Dm 644 $< " $@ "
104+
105+ e9compile : e9compile.sh
106+ sed ' s#-I examples#-I $(PREFIX)/share/e9compile/include#g' $< > $@
107+
108+ $(DESTDIR )$(PREFIX ) /bin/% : %
109+ install -Dm 755 $< " $@ "
110+
111+ $(DESTDIR )$(PREFIX ) /share/e9compile/include/e9loader.h : src/e9patch/e9loader.h
112+ install -Dm 644 $< " $@ "
113+
114+ $(DESTDIR )$(PREFIX ) /include/% .h : src/% .h
115+ install -Dm 644 $< " $@ "
116+
117+ $(DESTDIR )$(PREFIX ) /share/man/man1/% .1 : % .1
118+ install -Dm 644 $< " $@ "
119+
120+ $(DESTDIR )$(PREFIX ) /share/doc/e9patch/% .html : doc/% .md
121+ install -d $(DESTDIR )$(PREFIX ) /share/doc/e9patch
103122 sed \
104- -e ' s#https://github.com/GJDuck/e9patch/blob/master/doc/e9patch-programming-guide.md#file://$(PREFIX)/share/doc/e9patch/e9patch-programming-guide.html#g' \
105- doc/e9tool-user-guide.md | markdown > \
106- " $( DESTDIR) $( PREFIX) /share/doc/e9tool/e9tool-user-guide.html"
107- install -m 444 LICENSE " $( DESTDIR) $( PREFIX) /share/doc/e9tool/LICENSE"
108- install -Dm 444 src/e9tool/e9tool.h " $( DESTDIR) $( PREFIX) /include/e9tool/e9tool.h"
109- install -Dm 444 src/e9tool/e9plugin.h " $( DESTDIR) $( PREFIX) /include/e9tool/e9plugin.h"
110- install -d " $( DESTDIR) $( PREFIX) /share/e9tool/examples/"
111- install -m 444 examples/bounds.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/bounds.c"
123+ -e ' s#https://github.com/GJDuck/e9patch/blob/master/doc/e9patch-programming-guide.md#file://$(PREFIX)/share/doc/e9patch/e9patch-programming-guide.html#g' \
124+ -e ' s#https://github.com/GJDuck/e9patch/blob/master/doc/e9tool-user-guide.md#file://$(PREFIX)/share/doc/e9tool/e9tool-user-guide.html#g' \
125+ -e ' s#https://github.com/GJDuck/e9patch/tree/master/examples#file://$(PREFIX)/share/e9tool/examples#g' \
126+ $< | markdown > $@
127+
128+ $(DESTDIR )$(PREFIX ) /share/e9tool/examples/% .c : examples/% .c
129+ install -Dm 644 $< " $@ "
130+
131+ $(DESTDIR )$(PREFIX ) /share/e9tool/examples/% .cpp : examples/% .cpp
132+ install -Dm 644 $< " $@ "
133+
134+ $(DESTDIR )$(PREFIX ) /share/e9tool/examples/bounds.sh : examples/bounds.sh
135+ install -Dm 755 $< " $@ "
112136 sed \
113- -e ' s#\./e9compile.sh examples/bounds.c#e9compile $(PREFIX)/share/e9tool/examples/bounds.c#' \
114- -e ' s#\./e9tool#e9tool#' \
115- examples/bounds.sh > \
116- " $( DESTDIR) $( PREFIX) /share/e9tool/examples/bounds.sh"
117- chmod 555 " $( DESTDIR) $( PREFIX) /share/e9tool/examples/bounds.sh"
118- install -m 444 examples/cfi.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/cfi.c"
119- install -m 444 examples/count.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/count.c"
120- install -m 444 examples/cov.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/cov.c"
121- install -m 444 examples/delay.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/delay.c"
122- install -m 444 examples/hello.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/hello.c"
123- install -m 444 examples/limit.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/limit.c"
124- install -m 444 examples/nop.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/nop.c"
125- install -m 444 examples/print.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/print.c"
126- install -m 444 examples/printf.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/printf.c"
127- install -m 444 examples/skip.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/skip.c"
128- install -m 444 examples/state.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/state.c"
129- install -m 444 examples/trap.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/trap.c"
130- install -m 444 examples/win64_demo.c " $( DESTDIR) $( PREFIX) /share/e9tool/examples/win64_demo.c"
131- install -d " $( DESTDIR) $( PREFIX) /share/e9tool/examples/plugins/"
132- install -m 444 examples/plugins/example.cpp " $( DESTDIR) $( PREFIX) /share/e9tool/examples/plugins/example.cpp"
133- install -d " $( DESTDIR) $( PREFIX) /share/e9compile/include/"
134- install -m 444 examples/stdlib.c " $( DESTDIR) $( PREFIX) /share/e9compile/include/stdlib.c"
135- install -m 444 src/e9patch/e9loader.h " $( DESTDIR) $( PREFIX) /share/e9compile/include/e9loader.h"
136- install -d " $( DESTDIR) $( PREFIX) /share/man/man1/"
137- gzip --stdout doc/e9patch.1 > " $( DESTDIR) $( PREFIX) /share/man/man1/e9patch.1.gz"
138- chmod 444 " $( DESTDIR) $( PREFIX) /share/man/man1/e9patch.1.gz"
139- gzip --stdout doc/e9tool.1 > " $( DESTDIR) $( PREFIX) /share/man/man1/e9tool.1.gz"
140- chmod 444 " $( DESTDIR) $( PREFIX) /share/man/man1/e9tool.1.gz"
141- gzip --stdout doc/e9compile.1 > " $( DESTDIR) $( PREFIX) /share/man/man1/e9compile.1.gz"
142- chmod 444 " $( DESTDIR) $( PREFIX) /share/man/man1/e9compile.1.gz"
137+ -e ' s#\./e9compile.sh examples/bounds.c#e9compile $(PREFIX)/share/e9tool/examples/bounds.c#' \
138+ -e ' s#\./e9tool#e9tool#' \
139+ -i " $@ "
143140
144141# ########################################################################
145142# SPECIAL BUILD
0 commit comments