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