aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-devtools/wiringPi/files/Makefiles-install.patch
blob: cd13064241e76e811755395324c7c44c6312f174 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
diff --git a/examples/Makefile b/examples/Makefile
index defd510..b84f3de 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -26,10 +26,10 @@
 #DEBUG	= -g -O0
 DEBUG	= -O3
 CC	= gcc
-INCLUDE	= -I/usr/local/include
+INCLUDE	= -I../wiringPi
 CFLAGS	= $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
 
-LDFLAGS	= -L/usr/local/lib
+LDFLAGS	= -L../wiringPi
 LDLIBS    = -lwiringPi -lpthread -lm
 
 # Should not alter anything below this line
diff --git a/gpio/Makefile b/gpio/Makefile
index a043962..b1539d9 100644
--- a/gpio/Makefile
+++ b/gpio/Makefile
@@ -23,13 +23,16 @@
 #################################################################################
 
 
+DESTDIR?=/usr
+PREFIX?=/local
+
 #DEBUG	= -g -O0
-DEBUG	= -O2
-CC	= gcc
-INCLUDE	= -I/usr/local/include
-CFLAGS	= $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
+DEBUG	?= -O2
+CC	?= gcc
+INCLUDE	?= -I../wiringPi
+CFLAGS	?= $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
 
-LDFLAGS	= -L/usr/local/lib
+LDFLAGS	?= -L../wiringPi
 LIBS    = -lwiringPi -lpthread -lm
 
 # May not need to  alter anything below this line
@@ -61,17 +64,16 @@ tags:	$(SRC)
 .PHONEY:	install
 install:
 	@echo "[Install]"
-	@cp gpio /usr/local/bin
-	@chown root.root /usr/local/bin/gpio
-	@chmod 4755 /usr/local/bin/gpio
-	@mkdir -p /usr/local/man/man1
-	@cp gpio.1 /usr/local/man/man1
+	@install -d $(DESTDIR)$(PREFIX)/bin
+	@install -m 4755 -o root -g root gpio $(DESTDIR)$(PREFIX)/bin
+	@install -d $(DESTDIR)$(PREFIX)/share/man/man1
+	@install -m 644 -o root -g root gpio.1 $(DESTDIR)$(PREFIX)/share/man/man1
 
 .PHONEY:	uninstall
 uninstall:
 	@echo "[UnInstall]"
-	@rm -f /usr/local/bin/gpio
-	@rm -f /usr/local/man/man1/gpio.1
+	@rm -f $(DESTDIR)$(PREFIX)/bin/gpio
+	@rm -f $(DESTDIR)$(PREFIX)/share/man/man1/gpio.1
 
 .PHONEY:	depend
 depend:
diff --git a/wiringPi/Makefile b/wiringPi/Makefile
index c6a4555..2c7ae82 100644
--- a/wiringPi/Makefile
+++ b/wiringPi/Makefile
@@ -25,17 +25,20 @@ DYN_VERS_MAJ=1
 DYN_VERS_MIN=0
 
 VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN)
-DESTDIR=/usr
-PREFIX=/local
+DESTDIR?=/usr
+PREFIX?=/local
+INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include
+LIB_DIR?=$(DESTDIR)$(PREFIX)/lib
 
-STATIC=libwiringPi.a
-DYNAMIC=libwiringPi.so.$(VERSION)
+BASE_NAME=libwiringPi
+STATIC=$(BASE_NAME).a
+DYNAMIC=$(BASE_NAME).so.$(VERSION)
 
 #DEBUG	= -g -O0
-DEBUG	= -O2
-CC	= gcc
-INCLUDE	= -I.
-CFLAGS	= $(DEBUG) -Wall $(INCLUDE) -Winline -pipe -fPIC
+DEBUG	?= -O2
+CC	?= gcc
+INCLUDE	?= -I.
+CFLAGS	?= $(DEBUG) -Wall $(INCLUDE) -Winline -pipe -fPIC
 
 LIBS    =
 
@@ -67,19 +70,19 @@ $(STATIC):	$(OBJ)
 
 $(DYNAMIC):	$(OBJ)
 	@echo "[Link (Dynamic)]"
-	@$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ)
+	@$(CC) -shared -Wl,-soname,$(BASE_NAME).so.$(DYN_VERS_MAJ) -o $(BASE_NAME).so -lpthread $(OBJ)
 
 i2c:	$(OBJ) $(OBJ_I2C)
 	@echo "[Link (Dynamic + I2C)]"
-	@$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ) $(OBJ_I2C)
+	@$(CC) -shared -Wl,-soname,$(BASE_NAME).so.$(DYN_VERS_MAJ) -o $(BASE_NAME).so -lpthread $(OBJ) $(OBJ_I2C)
 
 .c.o:
 	@echo [Compile] $<
-	@$(CC) -c $(CFLAGS) $< -o $@
+	@$(CC) -c $(CFLAGS) -fPIC $< -o $@
 
 .PHONEY:	clean
 clean:
-	rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
+	rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak $(BASE_NAME).so* $(BASE_NAME).a
 
 .PHONEY:	tags
 tags:	$(SRC)
@@ -89,45 +92,46 @@ tags:	$(SRC)
 .PHONEY:	install
 install:	$(DYNAMIC)
 	@echo "[Install]"
-	@install -m 0755 -d			$(DESTDIR)$(PREFIX)/lib
-	@install -m 0755 -d			$(DESTDIR)$(PREFIX)/include
-	@install -m 0644 wiringPi.h		$(DESTDIR)$(PREFIX)/include
-	@install -m 0644 wiringSerial.h		$(DESTDIR)$(PREFIX)/include
-	@install -m 0644 wiringShift.h		$(DESTDIR)$(PREFIX)/include
-	@install -m 0644 gertboard.h		$(DESTDIR)$(PREFIX)/include
-	@install -m 0644 piNes.h		$(DESTDIR)$(PREFIX)/include
-	@install -m 0644 softPwm.h		$(DESTDIR)$(PREFIX)/include
-	@install -m 0644 softServo.h		$(DESTDIR)$(PREFIX)/include
-	@install -m 0644 softTone.h		$(DESTDIR)$(PREFIX)/include
-	@install -m 0644 lcd.h			$(DESTDIR)$(PREFIX)/include
-	@install -m 0644 wiringPiSPI.h		$(DESTDIR)$(PREFIX)/include
-	@install -m 0644 wiringPiI2C.h		$(DESTDIR)$(PREFIX)/include
-	@install -m 0755 libwiringPi.so.$(VERSION)		  $(DESTDIR)$(PREFIX)/lib
-	@ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
-	@ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so.1
-	@ldconfig
+	@install -m 0755 -d			$(LIB_DIR)
+	@install -m 0755 -d			$(INCLUDE_DIR)
+	@install -m 0644 wiringPi.h		$(INCLUDE_DIR)
+	@install -m 0644 wiringSerial.h		$(INCLUDE_DIR)
+	@install -m 0644 wiringShift.h		$(INCLUDE_DIR)
+	@install -m 0644 gertboard.h		$(INCLUDE_DIR)
+	@install -m 0644 piNes.h		$(INCLUDE_DIR)
+	@install -m 0644 softPwm.h		$(INCLUDE_DIR)
+	@install -m 0644 softServo.h		$(INCLUDE_DIR)
+	@install -m 0644 softTone.h		$(INCLUDE_DIR)
+	@install -m 0644 lcd.h			$(INCLUDE_DIR)
+	@install -m 0644 wiringPiSPI.h		$(INCLUDE_DIR)
+	@install -m 0644 wiringPiI2C.h		$(INCLUDE_DIR)
+	@install -m 0755 $(BASE_NAME).so	$(LIB_DIR)/$(DYNAMIC)
+	@ln -sf $(DYNAMIC)			$(LIB_DIR)/$(BASE_NAME).so
+	@ln -sf $(DYNAMIC)			$(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ)
 
 .PHONEY:	install-static
 install-static:	$(STATIC)
 	@echo "[Install Static]"
-	@install -m 0755 libwiringPi.a		$(DESTDIR)$(PREFIX)/lib
+	@install -m 0644 $(STATIC)		$(LIB_DIR)
 
 .PHONEY:	uninstall
 uninstall:
 	@echo "[UnInstall]"
-	@rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
-	@rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
-	@rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
-	@rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h
-	@rm -f $(DESTDIR)$(PREFIX)/include/piNes.h
-	@rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
-	@rm -f $(DESTDIR)$(PREFIX)/include/softServo.h
-	@rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
-	@rm -f $(DESTDIR)$(PREFIX)/include/lcd.h
-	@rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
-	@rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h
-	@rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
-	@ldconfig
+	@rm -f $(INCLUDE_DIR)/wiringPi.h
+	@rm -f $(INCLUDE_DIR)/wiringSerial.h
+	@rm -f $(INCLUDE_DIR)/wiringShift.h
+	@rm -f $(INCLUDE_DIR)/gertboard.h
+	@rm -f $(INCLUDE_DIR)/piNes.h
+	@rm -f $(INCLUDE_DIR)/softPwm.h
+	@rm -f $(INCLUDE_DIR)/softServo.h
+	@rm -f $(INCLUDE_DIR)/softTone.h
+	@rm -f $(INCLUDE_DIR)/lcd.h
+	@rm -f $(INCLUDE_DIR)/wiringPiSPI.h
+	@rm -f $(INCLUDE_DIR)/wiringPiI2C.h
+	@rm -f $(LIB_DIR)/$(STATIC)
+	@rm -f $(LIB_DIR)/$(DYNAMIC)
+	@rm -f $(LIB_DIR)/$(BASE_NAME).so
+	@rm -f $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ)
 
 
 .PHONEY:	depend