3 # wiringPi - Wiring Compatable library for the Raspberry Pi
5 # Copyright (c) 2012 Gordon Henderson
6 #################################################################################
7 # This file is part of wiringPi:
8 # https://projects.drogon.net/raspberry-pi/wiringpi/
10 # wiringPi is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU Lesser General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # wiringPi is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU Lesser General Public License for more details.
20 # You should have received a copy of the GNU Lesser General Public License
21 # along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
22 #################################################################################
27 VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN)
32 DYNAMIC=libwiringPi.so.$(VERSION)
38 CFLAGS = $(DEBUG) -Wformat=2 -Wall $(INCLUDE) -Winline -pipe -fPIC
42 # Should not alter anything below this line
43 ###############################################################################
46 wiringSerial.c wiringShift.c \
47 piHiPri.c piThread.c \
48 wiringPiSPI.c wiringPiI2C.c \
49 softPwm.c softTone.c \
50 mcp23008.c mcp23016.c mcp23017.c \
51 mcp23s08.c mcp23s17.c \
54 mcp3002.c mcp3004.c mcp4802.c mcp3422.c \
64 @echo "[Link (Static)]"
65 @ar rcs $(STATIC) $(OBJ)
70 @echo "[Link (Dynamic)]"
71 @$(CC) -shared -Wl,-soname,libwiringPi.so -o libwiringPi.so.$(VERSION) -lpthread $(OBJ)
75 @$(CC) -c $(CFLAGS) $< -o $@
80 @rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
88 .PHONEY: install-headers
90 @echo "[Install Headers]"
91 @install -m 0755 -d $(DESTDIR)$(PREFIX)/include
92 @install -m 0644 wiringPi.h $(DESTDIR)$(PREFIX)/include
93 @install -m 0644 wiringSerial.h $(DESTDIR)$(PREFIX)/include
94 @install -m 0644 wiringShift.h $(DESTDIR)$(PREFIX)/include
95 @install -m 0644 softPwm.h $(DESTDIR)$(PREFIX)/include
96 @install -m 0644 softTone.h $(DESTDIR)$(PREFIX)/include
97 @install -m 0644 wiringPiSPI.h $(DESTDIR)$(PREFIX)/include
98 @install -m 0644 wiringPiI2C.h $(DESTDIR)$(PREFIX)/include
99 @install -m 0644 mcp23008.h $(DESTDIR)$(PREFIX)/include
100 @install -m 0644 mcp23016.h $(DESTDIR)$(PREFIX)/include
101 @install -m 0644 mcp23017.h $(DESTDIR)$(PREFIX)/include
102 @install -m 0644 mcp23s08.h $(DESTDIR)$(PREFIX)/include
103 @install -m 0644 mcp23s17.h $(DESTDIR)$(PREFIX)/include
104 @install -m 0644 mcp3002.h $(DESTDIR)$(PREFIX)/include
105 @install -m 0644 mcp3004.h $(DESTDIR)$(PREFIX)/include
106 @install -m 0644 mcp4802.h $(DESTDIR)$(PREFIX)/include
107 @install -m 0644 mcp3422.h $(DESTDIR)$(PREFIX)/include
108 @install -m 0644 sr595.h $(DESTDIR)$(PREFIX)/include
109 @install -m 0644 pcf8574.h $(DESTDIR)$(PREFIX)/include
110 @install -m 0644 pcf8591.h $(DESTDIR)$(PREFIX)/include
113 install: $(DYNAMIC) install-headers
114 @echo "[Install Dynamic Lib]"
115 @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
116 @install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
117 @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
120 .PHONEY: install-static
121 install-static: $(STATIC) install-headers
122 @echo "[Install Static Lib]"
123 @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
124 @install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
129 @rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
130 @rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
131 @rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
132 @rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
133 @rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
134 @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
135 @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h
136 @rm -f $(DESTDIR)$(PREFIX)/include/mcp23008.h
137 @rm -f $(DESTDIR)$(PREFIX)/include/mcp23016.h
138 @rm -f $(DESTDIR)$(PREFIX)/include/mcp23017.h
139 @rm -f $(DESTDIR)$(PREFIX)/include/mcp23s08.h
140 @rm -f $(DESTDIR)$(PREFIX)/include/mcp23s17.h
141 @rm -f $(DESTDIR)$(PREFIX)/include/mcp3002.h
142 @rm -f $(DESTDIR)$(PREFIX)/include/mcp3004.h
143 @rm -f $(DESTDIR)$(PREFIX)/include/mcp4802.h
144 @rm -f $(DESTDIR)$(PREFIX)/include/mcp3422.h
145 @rm -f $(DESTDIR)$(PREFIX)/include/sr595.h
146 @rm -f $(DESTDIR)$(PREFIX)/include/pcf8574.h
147 @rm -f $(DESTDIR)$(PREFIX)/include/pcf8591.h
148 @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
154 makedepend -Y $(SRC) $(SRC_I2C)
158 wiringPi.o: wiringPi.h
159 wiringSerial.o: wiringSerial.h
160 wiringShift.o: wiringPi.h wiringShift.h
161 piHiPri.o: wiringPi.h
162 piThread.o: wiringPi.h
163 wiringPiSPI.o: wiringPi.h wiringPiSPI.h
164 wiringPiI2C.o: wiringPi.h wiringPiI2C.h
165 softPwm.o: wiringPi.h softPwm.h
166 softTone.o: wiringPi.h softTone.h
167 mcp23008.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23008.h
168 mcp23016.o: wiringPi.h wiringPiI2C.h mcp23016.h mcp23016reg.h
169 mcp23017.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23017.h
170 mcp23s08.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s08.h
171 mcp23s17.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s17.h
172 sr595.o: wiringPi.h sr595.h
173 pcf8574.o: wiringPi.h wiringPiI2C.h pcf8574.h
174 pcf8591.o: wiringPi.h wiringPiI2C.h pcf8591.h
175 mcp3002.o: wiringPi.h wiringPiSPI.h mcp3002.h
176 mcp4802.o: wiringPi.h wiringPiSPI.h mcp4802.h
177 mcp3422.o: wiringPi.h wiringPiI2C.h mcp3422.h
178 drc.o: wiringPi.h wiringSerial.h drc.h