Gordons Projects

--> Projects Top-Level GIT

Lots of changes here. Added new I2C test code, a new serialTest program,
[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                              \
49                 wiringPiSPI.c wiringPiI2C.c                             \
50                 softPwm.c softServo.c softTone.c
51
52 OBJ     =       $(SRC:.c=.o)
53
54 all:            $(DYNAMIC)
55
56 static:         $(STATIC)
57
58 $(STATIC):      $(OBJ)
59         @echo "[Link (Static)]"
60         @ar rcs $(STATIC) $(OBJ)
61         @ranlib $(STATIC)
62 #       @size   $(STATIC)
63
64 $(DYNAMIC):     $(OBJ)
65         @echo "[Link (Dynamic)]"
66         @$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ)
67
68 .c.o:
69         @echo [Compile] $<
70         @$(CC) -c $(CFLAGS) $< -o $@
71
72 .PHONEY:        clean
73 clean:
74         rm -f $(OBJ) *~ core tags Makefile.bak libwiringPi.*
75
76 .PHONEY:        tags
77 tags:   $(SRC)
78         @echo [ctags]
79         @ctags $(SRC)
80
81 .PHONEY:        install
82 install:        $(DYNAMIC)
83         @echo "[Install]"
84         @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/lib
85         @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/include
86         @install -m 0644 wiringPi.h             $(DESTDIR)$(PREFIX)/include
87         @install -m 0644 wiringSerial.h         $(DESTDIR)$(PREFIX)/include
88         @install -m 0644 wiringShift.h          $(DESTDIR)$(PREFIX)/include
89         @install -m 0644 gertboard.h            $(DESTDIR)$(PREFIX)/include
90         @install -m 0644 piNes.h                $(DESTDIR)$(PREFIX)/include
91         @install -m 0644 softPwm.h              $(DESTDIR)$(PREFIX)/include
92         @install -m 0644 softServo.h            $(DESTDIR)$(PREFIX)/include
93         @install -m 0644 softTone.h             $(DESTDIR)$(PREFIX)/include
94         @install -m 0644 lcd.h                  $(DESTDIR)$(PREFIX)/include
95         @install -m 0644 wiringPiSPI.h          $(DESTDIR)$(PREFIX)/include
96         @install -m 0644 wiringPiI2C.h          $(DESTDIR)$(PREFIX)/include
97         @install -m 0755 libwiringPi.so.$(VERSION)                $(DESTDIR)$(PREFIX)/lib
98         @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
99         @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so.1
100         @ldconfig
101
102 .PHONEY:        install-static
103 install-static: $(STATIC)
104         @echo "[Install Static]"
105         @install -m 0755 libwiringPi.a          $(DESTDIR)$(PREFIX)/lib
106
107 .PHONEY:        uninstall
108 uninstall:
109         @echo "[UnInstall]"
110         @rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
111         @rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
112         @rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
113         @rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h
114         @rm -f $(DESTDIR)$(PREFIX)/include/piNes.h
115         @rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
116         @rm -f $(DESTDIR)$(PREFIX)/include/softServo.h
117         @rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
118         @rm -f $(DESTDIR)$(PREFIX)/include/lcd.h
119         @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
120         @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h
121         @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
122         @ldconfig
123
124
125 .PHONEY:        depend
126 depend:
127         makedepend -Y $(SRC)
128
129 # DO NOT DELETE
130
131 wiringPi.o: wiringPi.h
132 wiringPiFace.o: wiringPi.h
133 wiringSerial.o: wiringSerial.h
134 wiringShift.o: wiringPi.h wiringShift.h
135 gertboard.o: wiringPiSPI.h gertboard.h
136 piNes.o: wiringPi.h piNes.h
137 lcd.o: wiringPi.h lcd.h
138 piHiPri.o: wiringPi.h
139 piThread.o: wiringPi.h
140 softPwm.o: wiringPi.h softPwm.h
141 wiringPiSPI.o: wiringPiSPI.h