Gordons Projects

--> Projects Top-Level GIT

It helps if you add the files into GIT...
[wiringPi] / devLib / Makefile
1 # Makefile:
2 #       wiringPi device - Wiring Compatable library for the Raspberry Pi
3 #
4 #       Copyright (c) 2012-2013 Gordon Henderson
5 #################################################################################
6 # This file is part of wiringPi:
7 #       https://projects.drogon.net/raspberry-pi/wiringpi/
8 #
9 #    wiringPi is free software: you can redistribute it and/or modify
10 #    it under the terms of the GNU Lesser General Public License as published by
11 #    the Free Software Foundation, either version 3 of the License, or
12 #    (at your option) any later version.
13 #
14 #    wiringPi is distributed in the hope that it will be useful,
15 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
16 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 #    GNU Lesser General Public License for more details.
18 #
19 #    You should have received a copy of the GNU Lesser General Public License
20 #    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
21 #################################################################################
22
23 DYN_VERS_MAJ=2
24 DYN_VERS_MIN=0
25
26 VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN)
27 DESTDIR=/usr
28 PREFIX=/local
29
30 STATIC=libwiringPiDev.a
31 DYNAMIC=libwiringPiDev.so.$(VERSION)
32
33 #DEBUG  = -g -O0
34 DEBUG   = -O2
35 CC      = gcc
36 INCLUDE = -I.
37 CFLAGS  = $(DEBUG) -Wformat=2 -Wall $(INCLUDE) -Winline -pipe -fPIC
38
39 LIBS    =
40
41 ###############################################################################
42
43 SRC     =       ds1302.c maxdetect.c  piNes.c           \
44                 gertboard.c piFace.c                    \
45                 lcd128x64.c lcd.c                       \
46                 piGlow.c
47
48 OBJ     =       $(SRC:.c=.o)
49
50 all:            $(DYNAMIC)
51
52 static:         $(STATIC)
53
54 $(STATIC):      $(OBJ)
55         @echo "[Link (Static)]"
56         @ar rcs $(STATIC) $(OBJ)
57         @ranlib $(STATIC)
58 #       @size   $(STATIC)
59
60 $(DYNAMIC):     $(OBJ)
61         @echo "[Link (Dynamic)]"
62         @$(CC) -shared -Wl,-soname,libwiringPiDev.so -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ)
63
64 .c.o:
65         @echo [Compile] $<
66         @$(CC) -c $(CFLAGS) $< -o $@
67
68 .PHONEY:        clean
69 clean:
70         @echo "[Clean]"
71         @rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.*
72
73 .PHONEY:        tags
74 tags:   $(SRC)
75         @echo [ctags]
76         @ctags $(SRC)
77
78
79 .PHONEY:        install-headers
80 install-headers:
81         @echo "[Install Headers]"
82         @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/include
83         @install -m 0644 ds1302.h               $(DESTDIR)$(PREFIX)/include
84         @install -m 0644 maxdetect.h            $(DESTDIR)$(PREFIX)/include
85         @install -m 0644 piNes.h                $(DESTDIR)$(PREFIX)/include
86         @install -m 0644 gertboard.h            $(DESTDIR)$(PREFIX)/include
87         @install -m 0644 piFace.h               $(DESTDIR)$(PREFIX)/include
88         @install -m 0644 lcd128x64.h            $(DESTDIR)$(PREFIX)/include
89         @install -m 0644 lcd.h                  $(DESTDIR)$(PREFIX)/include
90         @install -m 0644 piGlow.h               $(DESTDIR)$(PREFIX)/include
91
92 .PHONEY:        install
93 install:        $(DYNAMIC) install-headers
94         @echo "[Install Dynamic Lib]"
95         @install -m 0755 -d                                             $(DESTDIR)$(PREFIX)/lib
96         @install -m 0755 libwiringPiDev.so.$(VERSION)                   $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
97         @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)    $(DESTDIR)/lib/libwiringPiDev.so
98         @ldconfig
99
100 .PHONEY:        install-static
101 install-static: $(STATIC) install-headers
102         @echo "[Install Static Lib]"
103         @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/lib
104         @install -m 0755 libwiringPiDev.a       $(DESTDIR)$(PREFIX)/lib
105
106 .PHONEY:        uninstall
107 uninstall:
108         @echo "[UnInstall]"
109         @rm -f $(DESTDIR)$(PREFIX)/include/ds1302.h
110         @rm -f $(DESTDIR)$(PREFIX)/include/maxdetect.h
111         @rm -f $(DESTDIR)$(PREFIX)/include/piNes.h
112         @rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h
113         @rm -f $(DESTDIR)$(PREFIX)/include/piFace.h
114         @rm -f $(DESTDIR)$(PREFIX)/include/lcd128x64.h
115         @rm -f $(DESTDIR)$(PREFIX)/include/lcd.h
116         @rm -f $(DESTDIR)$(PREFIX)/include/piGlow.h
117         @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.*
118         @ldconfig
119
120
121 .PHONEY:        depend
122 depend:
123         makedepend -Y $(SRC)
124
125 # DO NOT DELETE
126
127 ds1302.o: ds1302.h
128 maxdetect.o: maxdetect.h
129 piNes.o: piNes.h
130 gertboard.o: gertboard.h
131 piFace.o: piFace.h
132 lcd128x64.o: font.h lcd128x64.h
133 lcd.o: lcd.h
134 piGlow.o: piGlow.h