Skip to content

Commit 71ab15c

Browse files
authored
Merge pull request #84 from McSinyx/prefix
Allow passing installation prefix to make
2 parents bde6004 + a49726d commit 71ab15c

File tree

1 file changed

+53
-52
lines changed

1 file changed

+53
-52
lines changed

Makefile

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
# BUILD COMMON
33
#########################################################################
44

5+
PREFIX ?= /usr
56
CXXFLAGS ?= -march=native
67
CXXFLAGS += -std=c++11 -Wall -Wno-reorder -fPIC -pie \
7-
-DVERSION=$(shell cat VERSION) -Wl,-rpath=/usr/share/e9tool/lib/
8+
-DVERSION=$(shell cat VERSION) -Wl,-rpath=$(PREFIX)/share/e9tool/lib/
89

910
E9PATCH_OBJS=\
1011
src/e9patch/e9CFR.o \
@@ -90,62 +91,62 @@ contrib/libdw/libdw.a:
9091
(cd contrib/libdw/; make)
9192

9293
install: all
93-
install -d "$(DESTDIR)/usr/bin"
94-
install -m 755 e9patch "$(DESTDIR)/usr/bin/e9patch"
95-
install -m 755 e9tool "$(DESTDIR)/usr/bin/e9tool"
96-
install -m 755 e9compile.sh "$(DESTDIR)/usr/bin/e9compile"
94+
install -d "$(DESTDIR)$(PREFIX)/bin"
95+
install -m 755 e9patch "$(DESTDIR)$(PREFIX)/bin/e9patch"
96+
install -m 755 e9tool "$(DESTDIR)$(PREFIX)/bin/e9tool"
97+
install -m 755 e9compile.sh "$(DESTDIR)$(PREFIX)/bin/e9compile"
9798
sed \
98-
-e 's#-I examples#-I /usr/share/e9compile/include#g' e9compile.sh > \
99-
"$(DESTDIR)/usr/bin/e9compile"
100-
chmod 555 "$(DESTDIR)/usr/bin/e9compile"
101-
install -d "$(DESTDIR)/usr/share/doc/e9patch/"
99+
-e 's#-I examples#-I $(PREFIX)/share/e9compile/include#g' e9compile.sh > \
100+
"$(DESTDIR)$(PREFIX)/bin/e9compile"
101+
chmod 555 "$(DESTDIR)$(PREFIX)/bin/e9compile"
102+
install -d "$(DESTDIR)$(PREFIX)/share/doc/e9patch/"
102103
sed \
103-
-e 's#https://github.com/GJDuck/e9patch/blob/master/doc/e9tool-user-guide.md#file:///usr/share/doc/e9tool/e9tool-user-guide.html#g' \
104-
-e 's#https://github.com/GJDuck/e9patch/tree/master/examples#file:///usr/share/e9tool/examples#g' \
105-
doc/e9patch-programming-guide.md | markdown > \
106-
"$(DESTDIR)/usr/share/doc/e9patch/e9patch-programming-guide.html"
107-
install -m 444 LICENSE "$(DESTDIR)/usr/share/doc/e9patch/LICENSE"
108-
install -d "$(DESTDIR)/usr/share/doc/e9tool/"
104+
-e 's#https://github.com/GJDuck/e9patch/blob/master/doc/e9tool-user-guide.md#file://$(PREFIX)/share/doc/e9tool/e9tool-user-guide.html#g' \
105+
-e 's#https://github.com/GJDuck/e9patch/tree/master/examples#file://$(PREFIX)/share/e9tool/examples#g' \
106+
doc/e9patch-programming-guide.md | markdown > \
107+
"$(DESTDIR)$(PREFIX)/share/doc/e9patch/e9patch-programming-guide.html"
108+
install -m 444 LICENSE "$(DESTDIR)$(PREFIX)/share/doc/e9patch/LICENSE"
109+
install -d "$(DESTDIR)$(PREFIX)/share/doc/e9tool/"
109110
sed \
110-
-e 's#https://github.com/GJDuck/e9patch/blob/master/doc/e9patch-programming-guide.md#file:///usr/share/doc/e9patch/e9patch-programming-guide.html#g' \
111-
doc/e9tool-user-guide.md | markdown > \
112-
"$(DESTDIR)/usr/share/doc/e9tool/e9tool-user-guide.html"
113-
install -m 444 LICENSE "$(DESTDIR)/usr/share/doc/e9tool/LICENSE"
114-
install -Dm 444 src/e9tool/e9tool.h "$(DESTDIR)/usr/include/e9tool/e9tool.h"
115-
install -Dm 444 src/e9tool/e9plugin.h "$(DESTDIR)/usr/include/e9tool/e9plugin.h"
116-
install -d "$(DESTDIR)/usr/share/e9tool/examples/"
117-
install -m 444 examples/bounds.c "$(DESTDIR)/usr/share/e9tool/examples/bounds.c"
111+
-e 's#https://github.com/GJDuck/e9patch/blob/master/doc/e9patch-programming-guide.md#file://$(PREFIX)/share/doc/e9patch/e9patch-programming-guide.html#g' \
112+
doc/e9tool-user-guide.md | markdown > \
113+
"$(DESTDIR)$(PREFIX)/share/doc/e9tool/e9tool-user-guide.html"
114+
install -m 444 LICENSE "$(DESTDIR)$(PREFIX)/share/doc/e9tool/LICENSE"
115+
install -Dm 444 src/e9tool/e9tool.h "$(DESTDIR)$(PREFIX)/include/e9tool/e9tool.h"
116+
install -Dm 444 src/e9tool/e9plugin.h "$(DESTDIR)$(PREFIX)/include/e9tool/e9plugin.h"
117+
install -d "$(DESTDIR)$(PREFIX)/share/e9tool/examples/"
118+
install -m 444 examples/bounds.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/bounds.c"
118119
sed \
119-
-e 's#\./e9compile.sh examples/bounds.c#e9compile /usr/share/e9tool/examples/bounds.c#' \
120+
-e 's#\./e9compile.sh examples/bounds.c#e9compile $(PREFIX)/share/e9tool/examples/bounds.c#' \
120121
-e 's#\./e9tool#e9tool#' \
121-
examples/bounds.sh > \
122-
"$(DESTDIR)/usr/share/e9tool/examples/bounds.sh"
123-
chmod 555 "$(DESTDIR)/usr/share/e9tool/examples/bounds.sh"
124-
install -m 444 examples/cfi.c "$(DESTDIR)/usr/share/e9tool/examples/cfi.c"
125-
install -m 444 examples/count.c "$(DESTDIR)/usr/share/e9tool/examples/count.c"
126-
install -m 444 examples/cov.c "$(DESTDIR)/usr/share/e9tool/examples/cov.c"
127-
install -m 444 examples/delay.c "$(DESTDIR)/usr/share/e9tool/examples/delay.c"
128-
install -m 444 examples/hello.c "$(DESTDIR)/usr/share/e9tool/examples/hello.c"
129-
install -m 444 examples/limit.c "$(DESTDIR)/usr/share/e9tool/examples/limit.c"
130-
install -m 444 examples/nop.c "$(DESTDIR)/usr/share/e9tool/examples/nop.c"
131-
install -m 444 examples/print.c "$(DESTDIR)/usr/share/e9tool/examples/print.c"
132-
install -m 444 examples/printf.c "$(DESTDIR)/usr/share/e9tool/examples/printf.c"
133-
install -m 444 examples/skip.c "$(DESTDIR)/usr/share/e9tool/examples/skip.c"
134-
install -m 444 examples/state.c "$(DESTDIR)/usr/share/e9tool/examples/state.c"
135-
install -m 444 examples/trap.c "$(DESTDIR)/usr/share/e9tool/examples/trap.c"
136-
install -m 444 examples/win64_demo.c "$(DESTDIR)/usr/share/e9tool/examples/win64_demo.c"
137-
install -d "$(DESTDIR)/usr/share/e9tool/examples/plugins/"
138-
install -m 444 examples/plugins/example.cpp "$(DESTDIR)/usr/share/e9tool/examples/plugins/example.cpp"
139-
install -d "$(DESTDIR)/usr/share/e9compile/include/"
140-
install -m 444 examples/stdlib.c "$(DESTDIR)/usr/share/e9compile/include/stdlib.c"
141-
install -m 444 src/e9patch/e9loader.h "$(DESTDIR)/usr/share/e9compile/include/e9loader.h"
142-
install -d "$(DESTDIR)/usr/share/man/man1/"
143-
gzip --stdout doc/e9patch.1 > "$(DESTDIR)/usr/share/man/man1/e9patch.1.gz"
144-
chmod 444 "$(DESTDIR)/usr/share/man/man1/e9patch.1.gz"
145-
gzip --stdout doc/e9tool.1 > "$(DESTDIR)/usr/share/man/man1/e9tool.1.gz"
146-
chmod 444 "$(DESTDIR)/usr/share/man/man1/e9tool.1.gz"
147-
gzip --stdout doc/e9compile.1 > "$(DESTDIR)/usr/share/man/man1/e9compile.1.gz"
148-
chmod 444 "$(DESTDIR)/usr/share/man/man1/e9compile.1.gz"
122+
examples/bounds.sh > \
123+
"$(DESTDIR)$(PREFIX)/share/e9tool/examples/bounds.sh"
124+
chmod 555 "$(DESTDIR)$(PREFIX)/share/e9tool/examples/bounds.sh"
125+
install -m 444 examples/cfi.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/cfi.c"
126+
install -m 444 examples/count.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/count.c"
127+
install -m 444 examples/cov.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/cov.c"
128+
install -m 444 examples/delay.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/delay.c"
129+
install -m 444 examples/hello.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/hello.c"
130+
install -m 444 examples/limit.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/limit.c"
131+
install -m 444 examples/nop.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/nop.c"
132+
install -m 444 examples/print.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/print.c"
133+
install -m 444 examples/printf.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/printf.c"
134+
install -m 444 examples/skip.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/skip.c"
135+
install -m 444 examples/state.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/state.c"
136+
install -m 444 examples/trap.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/trap.c"
137+
install -m 444 examples/win64_demo.c "$(DESTDIR)$(PREFIX)/share/e9tool/examples/win64_demo.c"
138+
install -d "$(DESTDIR)$(PREFIX)/share/e9tool/examples/plugins/"
139+
install -m 444 examples/plugins/example.cpp "$(DESTDIR)$(PREFIX)/share/e9tool/examples/plugins/example.cpp"
140+
install -d "$(DESTDIR)$(PREFIX)/share/e9compile/include/"
141+
install -m 444 examples/stdlib.c "$(DESTDIR)$(PREFIX)/share/e9compile/include/stdlib.c"
142+
install -m 444 src/e9patch/e9loader.h "$(DESTDIR)$(PREFIX)/share/e9compile/include/e9loader.h"
143+
install -d "$(DESTDIR)$(PREFIX)/share/man/man1/"
144+
gzip --stdout doc/e9patch.1 > "$(DESTDIR)$(PREFIX)/share/man/man1/e9patch.1.gz"
145+
chmod 444 "$(DESTDIR)$(PREFIX)/share/man/man1/e9patch.1.gz"
146+
gzip --stdout doc/e9tool.1 > "$(DESTDIR)$(PREFIX)/share/man/man1/e9tool.1.gz"
147+
chmod 444 "$(DESTDIR)$(PREFIX)/share/man/man1/e9tool.1.gz"
148+
gzip --stdout doc/e9compile.1 > "$(DESTDIR)$(PREFIX)/share/man/man1/e9compile.1.gz"
149+
chmod 444 "$(DESTDIR)$(PREFIX)/share/man/man1/e9compile.1.gz"
149150

150151
#########################################################################
151152
# SPECIAL BUILD

0 commit comments

Comments
 (0)