Gordons Projects

--> Projects Top-Level GIT

Updating for various stuff and bugs. CM3+ and PiA3+
[wiringPi] / devLib / Makefile
1 #
2 # Makefile:
3 #       wiringPi device - A "wiring" library for the Raspberry Pi
4 #
5 #       Copyright (c) 2012-2016 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 VERSION=$(shell cat ../VERSION)
25 DESTDIR?=/usr
26 PREFIX?=/local
27
28 LDCONFIG?=ldconfig
29
30 ifneq ($V,1)
31 Q ?= @
32 endif
33
34 STATIC=libwiringPiDev.a
35 DYNAMIC=libwiringPiDev.so.$(VERSION)
36
37 #DEBUG  = -g -O0
38 DEBUG   = -O2
39 INCLUDE = -I.
40 DEFS    = -D_GNU_SOURCE
41 CFLAGS  = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
42
43 LIBS    =
44
45 ###############################################################################
46
47 SRC     =       ds1302.c maxdetect.c  piNes.c           \
48                 gertboard.c piFace.c                    \
49                 lcd128x64.c lcd.c                       \
50                 scrollPhat.c                            \
51                 piGlow.c
52
53 OBJ     =       $(SRC:.c=.o)
54
55 HEADERS =       ds1302.h gertboard.h  lcd128x64.h  lcd.h  maxdetect.h piFace.h  piGlow.h  piNes.h\
56                 scrollPhat.h
57
58 all:            $(DYNAMIC)
59
60 static:         $(STATIC)
61
62 $(STATIC):      $(OBJ)
63         $Q echo "[Link (Static)]"
64         $Q ar rcs $(STATIC) $(OBJ)
65         $Q ranlib $(STATIC)
66 #       @size   $(STATIC)
67
68 $(DYNAMIC):     $(OBJ)
69         $Q echo "[Link (Dynamic)]"
70         $Q $(CC) -shared -Wl,-soname,libwiringPiDev.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ)
71
72 .c.o:
73         $Q echo [Compile] $<
74         $Q $(CC) -c $(CFLAGS) $< -o $@
75
76 .PHONY: clean
77 clean:
78         $Q echo "[Clean]"
79         $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.*
80
81 .PHONY: tags
82 tags:   $(SRC)
83         $Q echo [ctags]
84         $Q ctags $(SRC)
85
86
87 .PHONY: install
88 install:        $(DYNAMIC)
89         $Q echo "[Install Headers]"
90         $Q install -m 0755 -d                                           $(DESTDIR)$(PREFIX)/include
91         $Q install -m 0644 $(HEADERS)                                   $(DESTDIR)$(PREFIX)/include
92         $Q echo "[Install Dynamic Lib]"
93         $Q install -m 0755 -d                                           $(DESTDIR)$(PREFIX)/lib
94         $Q install -m 0755 libwiringPiDev.so.$(VERSION)                 $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
95         $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)  $(DESTDIR)/lib/libwiringPiDev.so
96         $Q $(LDCONFIG)
97
98 .PHONY: install-static
99 install-static: $(STATIC)
100         $Q echo "[Install Headers]"
101         $Q install -m 0755 -d                                           $(DESTDIR)$(PREFIX)/include
102         $Q install -m 0644 $(HEADERS)                                   $(DESTDIR)$(PREFIX)/include
103         $Q echo "[Install Static Lib]"
104         $Q install -m 0755 -d                                           $(DESTDIR)$(PREFIX)/lib
105         $Q install -m 0755 libwiringPiDev.a                             $(DESTDIR)$(PREFIX)/lib
106
107 .PHONY: install-deb
108 install-deb:    $(DYNAMIC)
109         $Q echo "[Install Headers: deb]"
110         $Q install -m 0755 -d                                                   ~/wiringPi/debian-template/wiringPi/usr/include
111         $Q install -m 0644 $(HEADERS)                                           ~/wiringPi/debian-template/wiringPi/usr/include
112         $Q echo "[Install Dynamic Lib: deb]"
113         install -m 0755 -d                                                      ~/wiringPi/debian-template/wiringPi/usr/lib
114         install -m 0755 libwiringPiDev.so.$(VERSION)                            ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPiDev.so.$(VERSION)
115         ln -sf ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPiDev.so.$(VERSION) ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPiDev.so
116
117 .PHONY: uninstall
118 uninstall:
119         $Q echo "[UnInstall]"
120         $Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
121         $Q cd $(DESTDIR)$(PREFIX)/lib/     && rm -f libwiringPiDev.*
122         $Q $(LDCONFIG)
123
124
125 .PHONY: depend
126 depend:
127         makedepend -Y $(SRC)
128
129 # DO NOT DELETE
130
131 ds1302.o: ds1302.h
132 maxdetect.o: maxdetect.h
133 piNes.o: piNes.h
134 gertboard.o: gertboard.h
135 piFace.o: piFace.h
136 lcd128x64.o: font.h lcd128x64.h
137 lcd.o: lcd.h
138 scrollPhat.o: scrollPhatFont.h scrollPhat.h
139 piGlow.o: piGlow.h