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) -Wall $(INCLUDE) -Winline -pipe -fPIC
42 # Should not alter anything below this line
43 ###############################################################################
45 SRC = wiringPi.c wiringPiFace.c wiringSerial.c wiringShift.c \
48 lcd.c piHiPri.c piThread.c \
50 softPwm.c softServo.c softTone.c
52 SRC_I2C = wiringPiI2C.c
56 OBJ_I2C = $(SRC_I2C:.c=.o)
63 @echo "[Link (Static)]"
64 @ar rcs $(STATIC) $(OBJ)
69 @echo "[Link (Dynamic)]"
70 @$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ)
72 i2c: $(OBJ) $(OBJ_I2C)
73 @echo "[Link (Dynamic + I2C)]"
74 @$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ) $(OBJ_I2C)
78 @$(CC) -c $(CFLAGS) $< -o $@
82 rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
92 @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
93 @install -m 0755 -d $(DESTDIR)$(PREFIX)/include
94 @install -m 0644 wiringPi.h $(DESTDIR)$(PREFIX)/include
95 @install -m 0644 wiringSerial.h $(DESTDIR)$(PREFIX)/include
96 @install -m 0644 wiringShift.h $(DESTDIR)$(PREFIX)/include
97 @install -m 0644 gertboard.h $(DESTDIR)$(PREFIX)/include
98 @install -m 0644 piNes.h $(DESTDIR)$(PREFIX)/include
99 @install -m 0644 softPwm.h $(DESTDIR)$(PREFIX)/include
100 @install -m 0644 softServo.h $(DESTDIR)$(PREFIX)/include
101 @install -m 0644 softTone.h $(DESTDIR)$(PREFIX)/include
102 @install -m 0644 lcd.h $(DESTDIR)$(PREFIX)/include
103 @install -m 0644 wiringPiSPI.h $(DESTDIR)$(PREFIX)/include
104 @install -m 0644 wiringPiI2C.h $(DESTDIR)$(PREFIX)/include
105 @install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib
106 @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
107 @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so.1
110 .PHONEY: install-static
111 install-static: $(STATIC)
112 @echo "[Install Static]"
113 @install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
118 @rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
119 @rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
120 @rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
121 @rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h
122 @rm -f $(DESTDIR)$(PREFIX)/include/piNes.h
123 @rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
124 @rm -f $(DESTDIR)$(PREFIX)/include/softServo.h
125 @rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
126 @rm -f $(DESTDIR)$(PREFIX)/include/lcd.h
127 @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
128 @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h
129 @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
135 makedepend -Y $(SRC) $(SRC_I2C)
139 wiringPi.o: wiringPi.h
140 wiringPiFace.o: wiringPi.h
141 wiringSerial.o: wiringSerial.h
142 wiringShift.o: wiringPi.h wiringShift.h
143 gertboard.o: wiringPiSPI.h gertboard.h
144 piNes.o: wiringPi.h piNes.h
145 lcd.o: wiringPi.h lcd.h
146 piHiPri.o: wiringPi.h
147 piThread.o: wiringPi.h
148 wiringPiSPI.o: wiringPiSPI.h
149 softPwm.o: wiringPi.h softPwm.h
150 softServo.o: wiringPi.h softServo.h
151 softTone.o: wiringPi.h softTone.h
152 wiringPiI2C.o: wiringPi.h wiringPiI2C.h