WiringPi/gpio/Makefile
Ian Jackson cf6f38107e Build system: Add a formulaic setting of Q from V for debugging
We want to be able to disable the many @'s in the Makefiles so
that we can see what they are doing, when things go wrong.  It is
conventional to arrange for setting V=1 to have this effect.

Here we supply a formulaic stanza for either setting Q?=@ or
doing nothing.  (There is sadly no standard place which is
included in all the Makefiles so this is probably best).

In this patch we do not introduce any users of Q yet.  This is
because the next patch, which introduces all the users of Q, can
be generated entirely automatically.  (This is also convenient in
case something needs to be rebased across it.)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2015-09-10 00:15:28 +00:00

98 lines
2.4 KiB
Makefile

#
# Makefile:
# The gpio command:
# A swiss-army knige of GPIO shenanigans.
# https://projects.drogon.net/wiring-pi
#
# Copyright (c) 2012-2015 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# Wiring Compatable library for the Raspberry Pi
#
# wiringPi is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# wiringPi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
#################################################################################
DESTDIR=/usr
PREFIX=/local
ifneq ($V,1)
Q ?= @
endif
#DEBUG = -g -O0
DEBUG = -O2
CC = gcc
INCLUDE = -I$(DESTDIR)$(PREFIX)/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
LIBS = -lwiringPi -lwiringPiDev -lpthread -lm
# May not need to alter anything below this line
###############################################################################
SRC = gpio.c readall.c pins.c
OBJ = $(SRC:.c=.o)
all: gpio
version.h: ../VERSION
./newVersion
gpio: $(OBJ)
@echo [Link]
@$(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
.c.o:
@echo [Compile] $<
@$(CC) -c $(CFLAGS) $< -o $@
.PHONY: clean
clean:
@echo "[Clean]"
@rm -f $(OBJ) gpio *~ core tags *.bak
.PHONY: tags
tags: $(SRC)
@echo [ctags]
@ctags $(SRC)
.PHONY: install
install: gpio
@echo "[Install]"
@cp gpio $(DESTDIR)$(PREFIX)/bin
@chown root.root $(DESTDIR)$(PREFIX)/bin/gpio
@chmod 4755 $(DESTDIR)$(PREFIX)/bin/gpio
@mkdir -p $(DESTDIR)$(PREFIX)/man/man1
@cp gpio.1 $(DESTDIR)$(PREFIX)/man/man1
.PHONY: install-deb
install-deb: gpio
@echo "[Install: deb]"
@install -m 0755 -d ~/wiringPi/debian/wiringPi/usr/bin
@install -m 0755 gpio ~/wiringPi/debian/wiringPi/usr/bin
.PHONY: uninstall
uninstall:
@echo "[UnInstall]"
@rm -f $(DESTDIR)$(PREFIX)/bin/gpio
@rm -f $(DESTDIR)$(PREFIX)/man/man1/gpio.1
.PHONY: depend
depend:
makedepend -Y $(SRC)
# DO NOT DELETE