Gordons Projects

--> Projects Top-Level GIT

More changes to help reflect usage on Rev 2 / 512MB Raspberry Pi's.
[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 STATIC=libwiringPi.a
28 DYNAMIC=libwiringPi.so.$(DYN_VERS_MAJ).$(DYN_VERS_MIN)
29
30 #DEBUG  = -g -O0
31 DEBUG   = -O2
32 CC      = gcc
33 INCLUDE = -I.
34 CFLAGS  = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe -fPIC
35
36 LIBS    =
37
38 # Should not alter anything below this line
39 ###############################################################################
40
41 SRC     =       wiringPi.c wiringPiFace.c wiringSerial.c wiringShift.c  \
42                 gertboard.c                                             \
43                 piNes.c                                                 \
44                 lcd.c piHiPri.c piThread.c softPwm.c wiringPiSPI.c
45
46 OBJ     =       $(SRC:.c=.o)
47
48 #all:           $(STATIC) $(DYNAMIC)
49 all:            $(DYNAMIC)
50
51 $(STATIC):      $(OBJ)
52         @echo [Link (Static)]
53         @ar rcs $(STATIC) $(OBJ)
54         @ranlib $(STATIC)
55         @size   $(STATIC)
56
57 $(DYNAMIC):     $(OBJ)
58         @echo [Link]
59         @$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ)
60
61 .c.o:
62         @echo [Compile] $<
63         @$(CC) -c $(CFLAGS) $< -o $@
64
65 .PHONEY:        clean
66 clean:
67         rm -f $(OBJ) *~ core tags Makefile.bak libwiringPi.*
68
69 .PHONEY:        tags
70 tags:   $(SRC)
71         @echo [ctags]
72         @ctags $(SRC)
73
74 .PHONEY:        install
75 install:        $(TARGET)
76         @echo "[Install]"
77         @install -m 0755 -d /usr/local/lib
78         @install -m 0755 -d /usr/local/include
79         @install -m 0644 wiringPi.h     /usr/local/include
80         @install -m 0644 wiringSerial.h /usr/local/include
81         @install -m 0644 wiringShift.h  /usr/local/include
82         @install -m 0644 gertboard.h    /usr/local/include
83         @install -m 0644 piNes.h                /usr/local/include
84         @install -m 0644 softPwm.h      /usr/local/include
85         @install -m 0644 lcd.h          /usr/local/include
86         @install -m 0644 wiringPiSPI.h  /usr/local/include
87 #       @install -m 0644 libwiringPi.a  /usr/local/lib
88         @install        -m 0755 libwiringPi.so.1.0 /usr/local/lib
89         @ln -sf /usr/local/lib/libwiringPi.so.1.0 /usr/local/lib/libwiringPi.so
90         @ln -sf /usr/local/lib/libwiringPi.so.1.0 /usr/local/lib/libwiringPi.so.1
91         @ldconfig
92
93 .PHONEY:        uninstall
94 uninstall:
95         @echo "[UnInstall]"
96         @rm -f /usr/local/include/wiringPi.h
97         @rm -f /usr/local/include/wiringSerial.h
98         @rm -f /usr/local/include/wiringShift.h
99         @rm -f /usr/local/include/gertboard.h
100         @rm -f /usr/local/include/piNes.h
101         @rm -f /usr/local/include/softPwm.h
102         @rm -f /usr/local/include/lcd.h
103         @rm -f /usr/local/include/wiringPiSPI.h
104         @rm -f /usr/local/lib/libwiringPi.*
105         @ldconfig
106
107
108 .PHONEY:        depend
109 depend:
110         makedepend -Y $(SRC)
111
112 # DO NOT DELETE
113
114 wiringPi.o: wiringPi.h
115 wiringPiFace.o: wiringPi.h
116 wiringSerial.o: wiringSerial.h
117 wiringShift.o: wiringPi.h wiringShift.h
118 gertboard.o: wiringPiSPI.h gertboard.h
119 piNes.o: wiringPi.h piNes.h
120 lcd.o: wiringPi.h lcd.h
121 piHiPri.o: wiringPi.h
122 piThread.o: wiringPi.h
123 softPwm.o: wiringPi.h softPwm.h
124 wiringPiSPI.o: wiringPiSPI.h