mirror of
https://github.com/clockworkpi/WiringPi.git
synced 2026-03-27 14:22:54 +01:00
OK, so an easier way to manage versions.
Debian package creation - crude, probably violated the Debian policys but it seems to work just fine... some other changes.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# ;
|
||||
#
|
||||
# Makefile:
|
||||
# wiringPi - Wiring Compatable library for the Raspberry Pi
|
||||
#
|
||||
# Copyright (c) 2012 Gordon Henderson
|
||||
# Copyright (c) 2012-2015 Gordon Henderson
|
||||
#################################################################################
|
||||
# This file is part of wiringPi:
|
||||
# https://projects.drogon.net/raspberry-pi/wiringpi/
|
||||
@@ -21,10 +21,7 @@
|
||||
# along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
|
||||
#################################################################################
|
||||
|
||||
DYN_VERS_MAJ=2
|
||||
DYN_VERS_MIN=0
|
||||
|
||||
VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN)
|
||||
VERSION=$(shell cat ../VERSION)
|
||||
DESTDIR=/usr
|
||||
PREFIX=/local
|
||||
|
||||
@@ -40,7 +37,6 @@ CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
|
||||
|
||||
LIBS =
|
||||
|
||||
# Should not alter anything below this line
|
||||
###############################################################################
|
||||
|
||||
SRC = wiringPi.c \
|
||||
@@ -58,6 +54,21 @@ SRC = wiringPi.c \
|
||||
drcSerial.c \
|
||||
wpiExtensions.c
|
||||
|
||||
HEADERS = wiringPi.h \
|
||||
wiringSerial.h wiringShift.h \
|
||||
wiringPiSPI.h wiringPiI2C.h \
|
||||
softPwm.h softTone.h \
|
||||
mcp23008.h mcp23016.h mcp23017.h \
|
||||
mcp23s08.h mcp23s17.h \
|
||||
sr595.h \
|
||||
pcf8574.h pcf8591.h \
|
||||
mcp3002.h mcp3004.h mcp4802.h mcp3422.h \
|
||||
max31855.h max5322.h \
|
||||
sn3218.h \
|
||||
drcSerial.h \
|
||||
wpiExtensions.h
|
||||
|
||||
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
all: $(DYNAMIC)
|
||||
@@ -78,6 +89,7 @@ $(DYNAMIC): $(OBJ)
|
||||
@echo [Compile] $<
|
||||
@$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo "[Clean]"
|
||||
@@ -89,37 +101,11 @@ tags: $(SRC)
|
||||
@ctags $(SRC)
|
||||
|
||||
|
||||
.PHONY: install-headers
|
||||
install-headers:
|
||||
@echo "[Install Headers]"
|
||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 wiringPi.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 wiringSerial.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 wiringShift.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 softPwm.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 softTone.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 wiringPiSPI.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 wiringPiI2C.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 drcSerial.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 mcp23008.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 mcp23016.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 mcp23017.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 mcp23s08.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 mcp23s17.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 max31855.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 max5322.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 mcp3002.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 mcp3004.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 mcp4802.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 mcp3422.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 sr595.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 pcf8574.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 pcf8591.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 sn3218.h $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 wpiExtensions.h $(DESTDIR)$(PREFIX)/include
|
||||
|
||||
.PHONY: install
|
||||
install: $(DYNAMIC) install-headers
|
||||
install: $(DYNAMIC)
|
||||
@echo "[Install Headers]"
|
||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
|
||||
@echo "[Install Dynamic Lib]"
|
||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
||||
@install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
|
||||
@@ -127,39 +113,29 @@ install: $(DYNAMIC) install-headers
|
||||
@ldconfig
|
||||
|
||||
.PHONY: install-static
|
||||
install-static: $(STATIC) install-headers
|
||||
install-static: $(STATIC)
|
||||
@echo "[Install Headers]"
|
||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
|
||||
@install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
|
||||
@echo "[Install Static Lib]"
|
||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
||||
@install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
|
||||
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
||||
@install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
|
||||
|
||||
.PHONY: install-deb
|
||||
install-deb: $(DYNAMIC)
|
||||
@echo "[Install Headers: deb]"
|
||||
@install -m 0755 -d ~/wiringPi/debian/wiringPi/usr/include
|
||||
@install -m 0644 $(HEADERS) ~/wiringPi/debian/wiringPi/usr/include
|
||||
@echo "[Install Dynamic Lib: deb]"
|
||||
install -m 0755 -d ~/wiringPi/debian/wiringPi/usr/lib
|
||||
install -m 0755 libwiringPi.so.$(VERSION) ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so.$(VERSION)
|
||||
ln -sf ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so.$(VERSION) ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
@echo "[UnInstall]"
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/drcSerial.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/mcp23008.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/mcp23016.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/mcp23017.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/mcp23s08.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/mcp23s17.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/max31855.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/max5322.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/mcp3002.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/mcp3004.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/mcp4802.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/mcp3422.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/sr595.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/pcf8574.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/pcf8591.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/include/sn3218.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/includewpiExtensions.h
|
||||
@rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
|
||||
@cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
|
||||
@cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPi.*
|
||||
@ldconfig
|
||||
|
||||
|
||||
@@ -195,6 +171,6 @@ max5322.o: wiringPi.h wiringPiSPI.h max5322.h
|
||||
sn3218.o: wiringPi.h wiringPiI2C.h sn3218.h
|
||||
drcSerial.o: wiringPi.h wiringSerial.h drcSerial.h
|
||||
wpiExtensions.o: wiringPi.h mcp23008.h mcp23016.h mcp23017.h mcp23s08.h
|
||||
wpiExtensions.o: mcp23s17.h sr595.h pcf8591.h pcf8574.h max31855.h max5322.h
|
||||
wpiExtensions.o: mcp3002.h mcp3004.h mcp4802.h mcp3422.h sn3218.h drcSerial.h
|
||||
wpiExtensions.o: wpiExtensions.h
|
||||
wpiExtensions.o: mcp23s17.h sr595.h pcf8574.h pcf8591.h mcp3002.h mcp3004.h
|
||||
wpiExtensions.o: mcp4802.h mcp3422.h max31855.h max5322.h sn3218.h
|
||||
wpiExtensions.o: drcSerial.h wpiExtensions.h
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* wiringPi:
|
||||
* Arduino compatable (ish) Wiring library for the Raspberry Pi
|
||||
* Copyright (c) 2012 Gordon Henderson
|
||||
* Arduino look-a-like Wiring library for the Raspberry Pi
|
||||
* Copyright (c) 2012-2015 Gordon Henderson
|
||||
* Additional code for pwmSetClock by Chris Hall <chris@kchall.plus.com>
|
||||
*
|
||||
* Thanks to code samples from Gert Jan van Loo and the
|
||||
@@ -131,7 +131,7 @@ struct wiringPiNodeStruct *wiringPiNodes = NULL ;
|
||||
// Taken from Gert/Doms code. Some of this is not in the manual
|
||||
// that I can find )-:
|
||||
|
||||
static volatile unsigned int BCM2708_PERI_BASE = 0x20000000 ;
|
||||
static volatile unsigned int BCM2708_PERI_BASE = 0x20000000 ; // Variable for Pi2
|
||||
#define GPIO_PADS (BCM2708_PERI_BASE + 0x00100000)
|
||||
#define CLOCK_BASE (BCM2708_PERI_BASE + 0x00101000)
|
||||
#define GPIO_BASE (BCM2708_PERI_BASE + 0x00200000)
|
||||
@@ -607,7 +607,7 @@ int wiringPiFailure (int fatal, const char *message, ...)
|
||||
*
|
||||
* Revision 1 really means the early Model B's.
|
||||
* Revision 2 is everything else - it covers the B, B+ and CM.
|
||||
* ... and the quad core Pi 2 - which is a B+ ++ ...
|
||||
* ... and the Pi 2 - which is a B+ ++ ...
|
||||
*
|
||||
* Seems there are some boards with 0000 in them (mistake in manufacture)
|
||||
* So the distinction between boards that I can see is:
|
||||
|
||||
@@ -44,14 +44,14 @@
|
||||
#include "mcp23s08.h"
|
||||
#include "mcp23s17.h"
|
||||
#include "sr595.h"
|
||||
#include "pcf8591.h"
|
||||
#include "pcf8574.h"
|
||||
#include "max31855.h"
|
||||
#include "max5322.h"
|
||||
#include "pcf8591.h"
|
||||
#include "mcp3002.h"
|
||||
#include "mcp3004.h"
|
||||
#include "mcp4802.h"
|
||||
#include "mcp3422.h"
|
||||
#include "max31855.h"
|
||||
#include "max5322.h"
|
||||
#include "sn3218.h"
|
||||
#include "drcSerial.h"
|
||||
|
||||
@@ -664,6 +664,8 @@ static struct extensionFunctionStruct extensionFunctions [] =
|
||||
/*
|
||||
* loadWPiExtension:
|
||||
* Load in a wiringPi extension
|
||||
* The extensionData always starts with the name, a colon then the pinBase
|
||||
* number. Other parameters after that are decoded by the module in question.
|
||||
*********************************************************************************
|
||||
*/
|
||||
|
||||
@@ -676,7 +678,7 @@ int loadWPiExtension (char *progName, char *extensionData, int printErrors)
|
||||
|
||||
verbose = printErrors ;
|
||||
|
||||
// Get the extension extension name by finding the first colon
|
||||
// Get the extension name by finding the first colon
|
||||
|
||||
p = extension ;
|
||||
while (*p != ':')
|
||||
@@ -688,9 +690,10 @@ int loadWPiExtension (char *progName, char *extensionData, int printErrors)
|
||||
}
|
||||
++p ;
|
||||
}
|
||||
|
||||
*p++ = 0 ;
|
||||
|
||||
// Simple ATOI code
|
||||
|
||||
if (!isdigit (*p))
|
||||
{
|
||||
verbError ("%s: pinBase number expected after extension name", progName) ;
|
||||
@@ -699,7 +702,7 @@ int loadWPiExtension (char *progName, char *extensionData, int printErrors)
|
||||
|
||||
while (isdigit (*p))
|
||||
{
|
||||
if (pinBase > 1000000000)
|
||||
if (pinBase > 1000000000) // Lets be realistic here...
|
||||
{
|
||||
verbError ("%s: pinBase too large", progName) ;
|
||||
return FALSE ;
|
||||
|
||||
Reference in New Issue
Block a user