chiark / gitweb /
449986ebd8486c2e44c4a858003e6a108b991269
[wiringPi.git] / gpio / Makefile
1 #
2 # Makefile:
3 #       The gpio command:
4 #         A swiss-army knige of GPIO shenanigans.
5 #       https://projects.drogon.net/wiring-pi
6 #
7 #       Copyright (c) 2012-2015 Gordon Henderson
8 #################################################################################
9 # This file is part of wiringPi:
10 #       Wiring Compatable library for the Raspberry Pi
11 #
12 #    wiringPi is free software: you can redistribute it and/or modify
13 #    it under the terms of the GNU Lesser General Public License as published by
14 #    the Free Software Foundation, either version 3 of the License, or
15 #    (at your option) any later version.
16 #
17 #    wiringPi is distributed in the hope that it will be useful,
18 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
19 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 #    GNU Lesser General Public License for more details.
21 #
22 #    You should have received a copy of the GNU Lesser General Public License
23 #    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
24 #################################################################################
25
26 DESTDIR=/usr
27 PREFIX=/local
28
29 #DEBUG  = -g -O0
30 DEBUG   = -O2
31 CC      = gcc
32 INCLUDE = -I$(DESTDIR)$(PREFIX)/include
33 CFLAGS  = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
34
35 LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
36 LIBS    = -lwiringPi -lwiringPiDev -lpthread -lm
37
38 # May not need to  alter anything below this line
39 ###############################################################################
40
41 SRC     =       gpio.c readall.c pins.c
42
43 OBJ     =       $(SRC:.c=.o)
44
45 all:            gpio
46
47 version.h:      ../VERSION
48         ./newVersion
49
50 gpio:   $(OBJ)
51         @echo [Link]
52         @$(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
53         
54 .c.o:
55         @echo [Compile] $<
56         @$(CC) -c $(CFLAGS) $< -o $@
57
58 .PHONY: clean
59 clean:
60         @echo "[Clean]"
61         @rm -f $(OBJ) gpio *~ core tags *.bak
62
63 .PHONY: tags
64 tags:   $(SRC)
65         @echo [ctags]
66         @ctags $(SRC)
67
68 .PHONY: install
69 install: gpio
70         @echo "[Install]"
71         @cp gpio                $(DESTDIR)$(PREFIX)/bin
72         @chown root.root        $(DESTDIR)$(PREFIX)/bin/gpio
73         @chmod 4755             $(DESTDIR)$(PREFIX)/bin/gpio
74         @mkdir -p               $(DESTDIR)$(PREFIX)/man/man1
75         @cp gpio.1              $(DESTDIR)$(PREFIX)/man/man1
76
77 .PHONY: install-deb
78 install-deb:    gpio
79         @echo "[Install: deb]"
80         @install -m 0755 -d                                                     ~/wiringPi/debian/wiringPi/usr/bin
81         @install -m 0755 gpio                                                   ~/wiringPi/debian/wiringPi/usr/bin
82
83 .PHONY: uninstall
84 uninstall:
85         @echo "[UnInstall]"
86         @rm -f $(DESTDIR)$(PREFIX)/bin/gpio
87         @rm -f $(DESTDIR)$(PREFIX)/man/man1/gpio.1
88
89 .PHONY: depend
90 depend:
91         makedepend -Y $(SRC)
92
93 # DO NOT DELETE