Statistics
| Branch: | Revision:

ddr4s / fw / wiringPi / gpio / Makefile @ 32:cadb9025f1e0

History | View | Annotate | Download (2.75 KB)

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-2016 Gordon Henderson
8
#################################################################################
9
# This file is part of wiringPi:
10
#	A "wiring" 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
ifneq ($V,1)
30
Q ?= @
31
endif
32

    
33
#DEBUG	= -g -O0
34
DEBUG	= -O2
35
INCLUDE	= -I$(DESTDIR)$(PREFIX)/include
36
CFLAGS	= $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
37

    
38
LDFLAGS	= -L$(DESTDIR)$(PREFIX)/lib
39
LIBS    = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
40

    
41
# May not need to  alter anything below this line
42
###############################################################################
43

    
44
SRC	=	gpio.c readall.c
45

    
46
OBJ	=	$(SRC:.c=.o)
47

    
48
all:		gpio
49

    
50
version.h:	../VERSION
51
	$Q echo Need to run newVersion above.
52

    
53
gpio:	$(OBJ)
54
	$Q echo [Link]
55
	$Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
56

    
57
.c.o:
58
	$Q echo [Compile] $<
59
	$Q $(CC) -c $(CFLAGS) $< -o $@
60

    
61
.PHONY:	clean
62
clean:
63
	$Q echo "[Clean]"
64
	$Q rm -f $(OBJ) gpio *~ core tags *.bak
65

    
66
.PHONY:	tags
67
tags:	$(SRC)
68
	$Q echo [ctags]
69
	$Q ctags $(SRC)
70

    
71
.PHONY:	install
72
install: gpio
73
	$Q echo "[Install]"
74
	$Q cp gpio		$(DESTDIR)$(PREFIX)/bin
75
ifneq ($(WIRINGPI_SUID),0)
76
	$Q chown root.root	$(DESTDIR)$(PREFIX)/bin/gpio
77
	$Q chmod 4755		$(DESTDIR)$(PREFIX)/bin/gpio
78
endif
79
	$Q mkdir -p		$(DESTDIR)$(PREFIX)/share/man/man1
80
	$Q cp gpio.1		$(DESTDIR)$(PREFIX)/share/man/man1
81

    
82
.PHONY:	install-deb
83
install-deb:	gpio
84
	$Q echo "[Install: deb]"
85
	$Q install -m 0755 -d							~/wiringPi/debian-template/wiringPi/usr/bin
86
	$Q install -m 0755 gpio							~/wiringPi/debian-template/wiringPi/usr/bin
87
	$Q install -m 0755 -d							~/wiringPi/debian-template/wiringPi/usr/share/man/man1
88
	$Q install -m 0644 gpio.1						~/wiringPi/debian-template/wiringPi/usr/share/man/man1
89

    
90
.PHONY:	uninstall
91
uninstall:
92
	$Q echo "[UnInstall]"
93
	$Q rm -f $(DESTDIR)$(PREFIX)/bin/gpio
94
	$Q rm -f $(DESTDIR)$(PREFIX)/share/man/man1/gpio.1
95

    
96
.PHONY:	depend
97
depend:
98
	makedepend -Y $(SRC)
99

    
100
# DO NOT DELETE
101

    
102
gpio.o: ../version.h