chiark / gitweb /
wiringPi Version 2 - First commit (of v2)
[wiringPi.git] / 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
47 OBJ     =       $(SRC:.c=.o)
48
49 all:            $(DYNAMIC)
50
51 static:         $(STATIC)
52
53 $(STATIC):      $(OBJ)
54         @echo "[Link (Static)]"
55         @ar rcs $(STATIC) $(OBJ)
56         @ranlib $(STATIC)
57 #       @size   $(STATIC)
58
59 $(DYNAMIC):     $(OBJ)
60         @echo "[Link (Dynamic)]"
61         @$(CC) -shared -Wl,-soname,libwiringPiDev.so -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ)
62
63 .c.o:
64         @echo [Compile] $<
65         @$(CC) -c $(CFLAGS) $< -o $@
66
67 .PHONEY:        clean
68 clean:
69         @echo "[Clean]"
70         @rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.*
71
72 .PHONEY:        tags
73 tags:   $(SRC)
74         @echo [ctags]
75         @ctags $(SRC)
76
77
78 .PHONEY:        install-headers
79 install-headers:
80         @echo "[Install Headers]"
81         @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/include
82         @install -m 0644 ds1302.h               $(DESTDIR)$(PREFIX)/include
83         @install -m 0644 maxdetect.h            $(DESTDIR)$(PREFIX)/include
84         @install -m 0644 piNes.h                $(DESTDIR)$(PREFIX)/include
85         @install -m 0644 gertboard.h            $(DESTDIR)$(PREFIX)/include
86         @install -m 0644 piFace.h               $(DESTDIR)$(PREFIX)/include
87         @install -m 0644 lcd128x64.h            $(DESTDIR)$(PREFIX)/include
88         @install -m 0644 lcd.h                  $(DESTDIR)$(PREFIX)/include
89
90 .PHONEY:        install
91 install:        $(DYNAMIC) install-headers
92         @echo "[Install Dynamic Lib]"
93         @install -m 0755 -d                                             $(DESTDIR)$(PREFIX)/lib
94         @install -m 0755 libwiringPiDev.so.$(VERSION)                   $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
95         @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)    $(DESTDIR)/lib/libwiringPiDev.so
96         @ldconfig
97
98 .PHONEY:        install-static
99 install-static: $(STATIC) install-headers
100         @echo "[Install Static Lib]"
101         @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/lib
102         @install -m 0755 libwiringPiDev.a       $(DESTDIR)$(PREFIX)/lib
103
104 .PHONEY:        uninstall
105 uninstall:
106         @echo "[UnInstall]"
107         @rm -f $(DESTDIR)$(PREFIX)/include/ds1302.h
108         @rm -f $(DESTDIR)$(PREFIX)/include/maxdetect.h
109         @rm -f $(DESTDIR)$(PREFIX)/include/piNes.h
110         @rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h
111         @rm -f $(DESTDIR)$(PREFIX)/include/piFace.h
112         @rm -f $(DESTDIR)$(PREFIX)/include/lcd128x64.h
113         @rm -f $(DESTDIR)$(PREFIX)/include/lcd.h
114         @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.*
115         @ldconfig
116
117
118 .PHONEY:        depend
119 depend:
120         makedepend -Y $(SRC)
121
122 # DO NOT DELETE
123
124 ds1302.o: ds1302.h
125 maxdetect.o: maxdetect.h
126 piNes.o: piNes.h
127 gertboard.o: gertboard.h
128 piFace.o: piFace.h
129 lcd128x64.o: font.h lcd128x64.h
130 lcd.o: lcd.h