summaryrefslogtreecommitdiff
path: root/development/tcc/makefile_destdir.patch
blob: 8d62c94214dab142558d90ab641c751b08400946 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
Index: tcc-0.9.25/Makefile
===================================================================
--- tcc-0.9.25.orig/Makefile
+++ tcc-0.9.25/Makefile
@@ -13,6 +13,10 @@ ifneq ($(GCC_MAJOR),2)
 CFLAGS+=-fno-strict-aliasing
 endif
 
+ifndef ($(DESTDIR))
+DESTDIR = /
+endif
+
 ifeq ($(ARCH),i386)
 CFLAGS+=-mpreferred-stack-boundary=2
 ifeq ($(GCC_MAJOR),2)
@@ -197,48 +201,48 @@ INSTALL=install
 
 ifndef CONFIG_WIN32
 install: $(PROGS) $(LIBTCC1) $(BCHECK_O) libtcc.a tcc.1 tcc-doc.html
-	mkdir -p "$(bindir)"
-	$(INSTALL) -s -m755 $(PROGS) "$(bindir)"
-	mkdir -p "$(mandir)/man1"
-	$(INSTALL) tcc.1 "$(mandir)/man1"
-	mkdir -p "$(tccdir)"
-	mkdir -p "$(tccdir)/include"
+	mkdir -p "$(DESTDIR)/$(bindir)"
+	$(INSTALL) -s -m755 $(PROGS) "$(DESTDIR)/$(bindir)"
+	mkdir -p "$(DESTDIR)/$(mandir)/man1"
+	$(INSTALL) tcc.1 "$(DESTDIR)/$(mandir)/man1"
+	mkdir -p "$(DESTDIR)/$(tccdir)"
+	mkdir -p "$(DESTDIR)/$(tccdir)/include"
 ifneq ($(LIBTCC1),)
-	$(INSTALL) -m644 $(LIBTCC1) "$(tccdir)"
+	$(INSTALL) -m644 $(LIBTCC1) "$(DESTDIR)/$(tccdir)"
 endif
 ifneq ($(BCHECK_O),)
-	$(INSTALL) -m644 $(BCHECK_O) "$(tccdir)"
+	$(INSTALL) -m644 $(BCHECK_O) "$(DESTDIR)/$(tccdir)"
 endif
-	$(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"
-	mkdir -p "$(docdir)"
-	$(INSTALL) -m644 tcc-doc.html "$(docdir)"
-	mkdir -p "$(libdir)"
-	$(INSTALL) -m644 libtcc.a "$(libdir)"
-	mkdir -p "$(includedir)"
-	$(INSTALL) -m644 libtcc.h "$(includedir)"
+	$(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(DESTDIR)/$(tccdir)/include"
+	mkdir -p "$(DESTDIR)/$(docdir)"
+	$(INSTALL) -m644 tcc-doc.html "$(DESTDIR)/$(docdir)"
+	mkdir -p "$(DESTDIR)/$(libdir)"
+	$(INSTALL) -m644 libtcc.a "$(DESTDIR)/$(libdir)"
+	mkdir -p "$(DESTDIR)/$(includedir)"
+	$(INSTALL) -m644 libtcc.h "$(DESTDIR)/$(includedir)"
 
 uninstall:
-	rm -fv $(foreach P,$(PROGS),"$(bindir)/$P")
-	rm -fv $(foreach P,$(LIBTCC1) $(BCHECK_O),"$(tccdir)/$P")
-	rm -fv $(foreach P,$(TCC_INCLUDES),"$(tccdir)/include/$P")
-	rm -fv "$(docdir)/tcc-doc.html" "$(mandir)/man1/tcc.1"
-	rm -fv "$(libdir)/libtcc.a" "$(includedir)/libtcc.h"
+	rm -fv $(foreach P,$(PROGS),"$(DESTDIR)/$(bindir)/$P")
+	rm -fv $(foreach P,$(LIBTCC1) $(BCHECK_O),"$(DESTDIR)/$(tccdir)/$P")
+	rm -fv $(foreach P,$(TCC_INCLUDES),"$(DESTDIR)/$(tccdir)/include/$P")
+	rm -fv "$(DESTDIR)/$(docdir)/tcc-doc.html" "$(DESTDIR)/$(mandir)/man1/tcc.1"
+	rm -fv "$(DESTDIR)/$(libdir)/libtcc.a" "$(includedir)/libtcc.h"
 
 else
 install: $(PROGS) $(LIBTCC1) libtcc.a tcc-doc.html
-	mkdir -p "$(tccdir)"
-	mkdir -p "$(tccdir)/lib"
-	mkdir -p "$(tccdir)/include"
-	mkdir -p "$(tccdir)/examples"
-	mkdir -p "$(tccdir)/doc"
-	mkdir -p "$(tccdir)/libtcc"
-	$(INSTALL) -s -m755 $(PROGS) "$(tccdir)"
-	$(INSTALL) -m644 $(LIBTCC1) win32/lib/*.def "$(tccdir)/lib"
-	cp -r win32/include/. "$(tccdir)/include"
-	cp -r win32/examples/. "$(tccdir)/examples"
-#	$(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"
-	$(INSTALL) -m644 tcc-doc.html win32/tcc-win32.txt "$(tccdir)/doc"
-	$(INSTALL) -m644 libtcc.a libtcc.h "$(tccdir)/libtcc"
+	mkdir -p "$(DESTDIR)/$(tccdir)"
+	mkdir -p "$(DESTDIR)/$(tccdir)/lib"
+	mkdir -p "$(DESTDIR)/$(tccdir)/include"
+	mkdir -p "$(DESTDIR)/$(tccdir)/examples"
+	mkdir -p "$(DESTDIR)/$(tccdir)/doc"
+	mkdir -p "$(DESTDIR)/$(tccdir)/libtcc"
+	$(INSTALL) -s -m755 $(PROGS) "$(DESTDIR)/$(tccdir)"
+	$(INSTALL) -m644 $(LIBTCC1) win32/lib/*.def "$(DESTDIR)/$(tccdir)/lib"
+	cp -r win32/include/. "$(DESTDIR)/$(tccdir)/include"
+	cp -r win32/examples/. "$(DESTDIR)/$(tccdir)/examples"
+#	$(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(DESTDIR)/$(tccdir)/include"
+	$(INSTALL) -m644 tcc-doc.html win32/tcc-win32.txt "$(DESTDIR)/$(tccdir)/doc"
+	$(INSTALL) -m644 libtcc.a libtcc.h "$(DESTDIR)/$(tccdir)/libtcc"
 endif
 
 # documentation and man page