Gordons Projects

--> Projects Top-Level GIT

Big update here.
[wiringPi] / wiringPi / Makefile
1 #
2 # Makefile:
3 #       wiringPi - Wiring Compatable library for the Raspberry Pi
4 #
5 #       Copyright (c) 2012 Gordon Henderson
6 #################################################################################
7 # This file is part of wiringPi:
8 #       https://projects.drogon.net/raspberry-pi/wiringpi/
9 #
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.
14 #
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.
19 #
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 #################################################################################
23
24 DYN_VERS_MAJ=1
25 DYN_VERS_MIN=0
26
27 VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN)
28 DESTDIR=/usr
29 PREFIX=/local
30
31 STATIC=libwiringPi.a
32 DYNAMIC=libwiringPi.so.$(VERSION)
33
34 #DEBUG  = -g -O0
35 DEBUG   = -O2
36 CC      = gcc
37 INCLUDE = -I.
38 CFLAGS  = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe -fPIC
39
40 LIBS    =
41
42 # Should not alter anything below this line
43 ###############################################################################
44
45 SRC     =       wiringPi.c wiringPiFace.c wiringSerial.c wiringShift.c  \
46                 gertboard.c                                             \
47                 piNes.c                                                 \
48                 lcd.c piHiPri.c piThread.c wiringPiSPI.c                \
49                 softPwm.c softServo.c softTone.c
50
51 OBJ     =       $(SRC:.c=.o)
52
53 all:            $(STATIC) $(DYNAMIC)
54 #all:           $(DYNAMIC)
55
56 $(STATIC):      $(OBJ)
57         @echo "[Link (Static)]"
58         @ar rcs $(STATIC) $(OBJ)
59         @ranlib $(STATIC)
60 #       @size   $(STATIC)
61
62 $(DYNAMIC):     $(OBJ)
63         @echo "[Link (Dynamic)]"
64         @$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ)
65
66 .c.o:
67         @echo [Compile] $<
68         @$(CC) -c $(CFLAGS) $< -o $@
69
70 .PHONEY:        clean
71 clean:
72         rm -f $(OBJ) *~ core tags Makefile.bak libwiringPi.*
73
74 .PHONEY:        tags
75 tags:   $(SRC)
76         @echo [ctags]
77         @ctags $(SRC)
78
79 .PHONEY:        install
80 install:        $(TARGET)
81         @echo "[Install]"
82         @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/lib
83         @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/include
84         @install -m 0644 wiringPi.h             $(DESTDIR)$(PREFIX)/include
85         @install -m 0644 wiringSerial.h         $(DESTDIR)$(PREFIX)/include
86         @install -m 0644 wiringShift.h          $(DESTDIR)$(PREFIX)/include
87         @install -m 0644 gertboard.h            $(DESTDIR)$(PREFIX)/include
88         @install -m 0644 piNes.h                $(DESTDIR)$(PREFIX)/include
89         @install -m 0644 softPwm.h              $(DESTDIR)$(PREFIX)/include
90         @install -m 0644 softServo.h            $(DESTDIR)$(PREFIX)/include
91         @install -m 0644 softTone.h             $(DESTDIR)$(PREFIX)/include
92         @install -m 0644 lcd.h                  $(DESTDIR)$(PREFIX)/include
93         @install -m 0644 wiringPiSPI.h          $(DESTDIR)$(PREFIX)/include
94         @install -m 0755 libwiringPi.a          $(DESTDIR)$(PREFIX)/lib
95         @install -m 0755 libwiringPi.so.$(VERSION)                $(DESTDIR)$(PREFIX)/lib
96         @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
97         @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so.1
98         @ldconfig
99
100 .PHONEY:        uninstall
101 uninstall:
102         @echo "[UnInstall]"
103         @rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
104         @rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
105         @rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
106         @rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h
107         @rm -f $(DESTDIR)$(PREFIX)/include/piNes.h
108         @rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
109         @rm -f $(DESTDIR)$(PREFIX)/include/softServo.h
110         @rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
111         @rm -f $(DESTDIR)$(PREFIX)/include/lcd.h
112         @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
113         @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
114         @ldconfig
115
116
117 .PHONEY:        depend
118 depend:
119         makedepend -Y $(SRC)
120
121 # DO NOT DELETE
122
123 wiringPi.o: wiringPi.h
124 wiringPiFace.o: wiringPi.h
125 wiringSerial.o: wiringSerial.h
126 wiringShift.o: wiringPi.h wiringShift.h
127 gertboard.o: wiringPiSPI.h gertboard.h
128 piNes.o: wiringPi.h piNes.h
129 lcd.o: wiringPi.h lcd.h
130 piHiPri.o: wiringPi.h
131 piThread.o: wiringPi.h
132 softPwm.o: wiringPi.h softPwm.h
133 wiringPiSPI.o: wiringPiSPI.h