Rework to build by autoconf/automake and new Debian scripts

Building in local machine:
    $ sh autogen.sh
    $ ./configure
    $ make
    $ sudo make install

Building Debian package:
    $ debuild -uc -us -b

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I76faa07c1586658d053a3e260ea231a19392f792
This commit is contained in:
Dongjin Kim
2022-01-18 10:10:24 +00:00
parent f78d982959
commit f316f52636
45 changed files with 492 additions and 1387 deletions

11
.gitignore vendored
View File

@@ -13,3 +13,14 @@ gpio/gpio
libs/
obj/
*.lo
*.la
*.in
*.pdf
.deps/
.libs/
.debhelper/
m4/
autom4te.cache/

29
Makefile.am Normal file
View File

@@ -0,0 +1,29 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
pkgconfigdir = @pkgconfigdir@
pkgconfig_DATA = libwiringpi2.pc
SUBDIRS = wiringPi wiringPiD devLib gpio
wiringpi_includedir = ${includedir}/wiringpi2
wiringpi_include_HEADERS = \
devLib/ds1302.h \
devLib/font.h \
devLib/gertboard.h \
devLib/lcd.h \
devLib/lcd128x64.h \
devLib/maxdetect.h \
devLib/piFace.h \
devLib/piGlow.h \
devLib/piNes.h \
devLib/scrollPhat.h \
devLib/scrollPhatFont.h \
wiringPi/drcSerial.h \
wiringPi/max31855.h \
wiringPi/mcp23017.h \
wiringPi/pcf8591.h \
wiringPi/sn3218.h \
wiringPi/softPwm.h \
wiringPi/softTone.h \
wiringPi/wiringPi.h \
wiringPi/wiringSerial.h

3
autogen.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
autoreconf -v --install || exit 1

208
build
View File

@@ -1,208 +0,0 @@
#!/bin/sh -e
# build
# Simple wiringPi build and install script
#
# Copyright (c) 2012-2015 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# A "wiring" 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/>.
#################################################################################
#
# wiringPi is designed to run on a Raspberry Pi only.
# However if you're clever enough to actually look at this script to
# see why it's not building for you, then good luck.
#
# To everyone else: Stop using cheap alternatives. Support the
# Raspberry Pi Foundation as they're the only ones putting money
# back into education!
#################################################################################
sudo=${WIRINGPI_SUDO-sudo}
make="make -j $(( $(nproc) + 1 ))"
hardware=$(fgrep -a Hardware /proc/cpuinfo | head -1 | awk '{ printf("%s %s %s\n", $3, $4, $5) }' | xargs)
[ "$hardware",, != *"odroid"* ] \
&& [ -f "/sys/firmware/devicetree/base/model" ] \
&& hardware=$(cat /sys/firmware/devicetree/base/model)
check_make_ok() {
if [ $? != 0 ]; then
echo ""
echo "Make Failed..."
echo "Please check the messages and fix any problems. If you're still stuck,"
echo "then please email all the output and as many details as you can to"
echo " projects@drogon.net"
echo ""
exit 1
fi
}
configure_gpiomem() {
[ $(env | grep DEB_BUILD | wc -l) -ne 0 ] && return
GPIOMEM="/dev/gpiomem"
if [ -z $1 ] && [ "$(stat -c "%a %G" "$GPIOMEM")" != "660"*"odroid" ]; then
echo "Configure /dev/gpiomem"
case "$(echo $hardware | tr [:upper:] [:lower:])" in
*xu4)
$sudo cp -f udev/rules.d/99-odroid-wiringpi-exynos.rules /etc/udev/rules.d/
;;
*c|*c1|*c2)
$sudo cp -f udev/rules.d/99-odroid-wiringpi-meson.rules /etc/udev/rules.d/
;;
*n2|*c4)
$sudo cp -f udev/rules.d/99-odroid-wiringpi-aml.rules /etc/udev/rules.d/
;;
*)
echo "This system seems not ODROID"
;;
esac
echo "Reload udev..."
[ -x "$(command -v udevadm)" ] \
&& $sudo udevadm trigger \
|| echo "udevadm not found. Please reboot to take effect"
elif [ "$1" = "uninstall" ]; then
echo "Deconfigure /dev/gpiomem"
$sudo rm -f /etc/udev/rules.d/99-odroid-wiringpi-*
else
echo "Not found $GPIOMEM"
echo "You will not be able to use WiringPi without root permission"
fi
}
install() {
echo "====================="
echo "wiringPi Build script"
echo "====================="
echo
echo "WiringPi Library"
cd wiringPi
if [ x$1 = "xstatic" ]; then
$make static
check_make_ok
$sudo $make install-static
else
$make
check_make_ok
$sudo $make install
fi
check_make_ok
echo
echo "WiringPi Devices Library"
cd ../devLib
$sudo $make uninstall
if [ x$1 = "xstatic" ]; then
$make static
check_make_ok
$sudo $make install-static
else
$make
check_make_ok
$sudo $make install
fi
check_make_ok
echo
echo "WiringPi Devices Library"
cd ../devLib
if [ x$1 = "xstatic" ]; then
$make static
check_make_ok
$sudo $make install-static
else
$make
check_make_ok
$sudo $make install
fi
check_make_ok
echo
echo "GPIO Utility"
cd ../gpio
$make
check_make_ok
$sudo $make install
check_make_ok
echo
cd ..
configure_gpiomem
echo
echo All Done.
echo ""
echo "NOTE: To compile programs with wiringPi, you need to add:"
echo " -lwiringPi -wiringPiDev"
echo " to your compile line(s) To use the Gertboard, MaxDetect, etc."
echo " code (the devLib), you need to also add:"
echo " -lwiringPiDev"
echo " to your compile line(s)."
echo ""
}
uninstall() {
cd wiringPi
echo -n "wiringPi: " ; $sudo $make uninstall
cd ../devLib
echo -n "DevLib: " ; $sudo $make uninstall
cd ../gpio
echo -n "gpio: " ; $sudo $make uninstall
cd ..
configure_gpiomem uninstall
echo
}
clean() {
cd wiringPi
echo -n "wiringPi: " ; $make clean
cd ../devLib
echo -n "DevLib: " ; $make clean
cd ../gpio
echo -n "gpio: " ; $make clean
cd ../examples
echo -n "Examples: " ; $make clean
cd Gertboard
echo -n "Gertboard: " ; $make clean
cd ../PiFace
echo -n "PiFace: " ; $make clean
cd ../q2w
echo -n "Quick2Wire: " ; $make clean
cd ../PiGlow
echo -n "PiGlow: " ; $make clean
cd ../scrollPhat
echo -n "scrollPhat: " ; $make clean
cd ../..
}
if [ x$1 = "xclean" ]; then
clean
exit
fi
if [ x$1 = "xuninstall" ]; then
uninstall
exit
fi
if [ x$1 != "x" ]; then
echo "Usage: $0 [clean | uninstall]"
exit 1
fi
uninstall; clean; install

61
configure.ac Normal file
View File

@@ -0,0 +1,61 @@
AC_PREREQ([2.69])
AC_INIT([odroid-wiringpi], [3.0], [tobetter@gmail.com])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
CURRENT=2
REVISION=0
AGE=0
AC_SUBST([LIBWIRINGPI_VERSION], [$CURRENT:$REVISION:$AGE])
AC_SUBST([EXTRA_CFLAGS], "-Wformat=2 -Wall -Wextra -Winline -Wno-format-truncation -pipe -fPIC")
pkgconfigdir=${libdir}/pkgconfig
AC_SUBST(pkgconfigdir)
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
# Checks for libraries.
PKG_CHECK_MODULES([LIBCRYPT], [libcrypt])
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h malloc.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h syslog.h termios.h unistd.h])
AM_INIT_AUTOMAKE([foreign])
#AM_MAINTAINER_MODE
AC_CONFIG_MACRO_DIRS([m4])
AC_PROG_LIBTOOL
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT8_T
AC_TYPE_PID_T
AC_TYPE_UID_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_CHECK_FUNCS([clock_gettime floor ftruncate gettimeofday memset pow rint socket strcasecmp strchr strerror strstr strtol strtoul uname])
AC_CONFIG_FILES([
Makefile
devLib/Makefile
gpio/Makefile
libwiringpi2.pc
pins/Makefile
wiringPi/Makefile
wiringPiD/Makefile])
AC_OUTPUT

6
debian/changelog vendored
View File

@@ -1,3 +1,9 @@
odroid-wiringpi (3.12) stable; urgency=medium
* Rework Debian package scripts
-- Dongjin Kim <tobetter@gmail.com> Wed, 19 Jan 2022 08:57:34 +0000
odroid-wiringpi (9:3.9) stable; urgency=medium
* WiringPi: Android: Add odroidhc4.c to compile on the android platform

2
debian/compat vendored
View File

@@ -1 +1 @@
10
13

40
debian/control vendored
View File

@@ -4,25 +4,41 @@ Priority: optional
Maintainer: Deokgyu Yang <secugyu@gmail.com>, Steve Jeong <jkhpro@gmail.com>
Standards-Version: 3.8.0
Homepage: https://wiki.odroid.com
Build-Depends: debhelper (>= 10)
Build-Depends: debhelper (>= 10),
libc6-dev,
libcrypt-dev,
libgpiod-dev,
texlive-latex-base,
texlive-fonts-recommended
Package: odroid-wiringpi
Architecture: any
Depends: ${misc:Depends}, libwiringpi2 (= ${binary:Version})
Description: gpio utility for ODROID
The wiringPi gpio command line utility, for GPIO access on a
ODROID from the command line.
Package: libwiringpi2
Section: libs
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libgpiod-dev
Description: GPIO libraries for ODROID (runtime).
Runtime for the popular wiringPi library.
Package: odroid-wiringpi
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libwiringpi2 (= ${binary:Version})
Description: gpio utility for ODROID
The wiringPi gpio command line utility, for GPIO access on a
ODROID from the command line.
Runtime for the popular wiringPi library.
Package: libwiringpi-dev
Architecture: any
Depends: libc6-dev, ${misc:Depends}, libwiringpi2 (= ${binary:Version}), odroid-wiringpi (= ${binary:Version}),
Depends: ${misc:Depends},
libc6-dev,
libgpiod-dev,
libwiringpi2 (= ${binary:Version}),
odroid-wiringpi (= ${binary:Version})
Description: GPIO development library for ODROID
Development libraries to allow GPIO access on a ODROID from C
and C++ programs.
Development libraries to allow GPIO access on a ODROID from C
and C++ programs.
Package: wiringpi-examples
Architecture: any
Depends: libwiringpi-dev
Description: GPIO development library examples for ODROID
Development libraries to allow GPIO access on a ODROID from C
and C++ programs.

View File

@@ -1,3 +1,11 @@
debian/tmp/usr/include
debian/tmp/usr/lib/*.so
examples usr/share/doc/libwiringpi-dev
debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/libwiringPi.a usr/lib/${DEB_HOST_MULTIARCH}
debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/libwiringPi.la usr/lib/${DEB_HOST_MULTIARCH}
debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/libwiringPiDev.a usr/lib/${DEB_HOST_MULTIARCH}
debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/libwiringPiDev.la usr/lib/${DEB_HOST_MULTIARCH}
debian/tmp/usr/include/wiringpi2/*.h usr/include/wiringpi2/
debian/tmp/usr/lib/aarch64-linux-gnu/pkgconfig/libwiringpi2.pc usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/
README.TXT usr/share/doc/wiringpi
People usr/share/doc/wiringpi

View File

@@ -1 +1,4 @@
debian/tmp/usr/lib/lib*.so.*
debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/libwiringPi.so* usr/lib/${DEB_HOST_MULTIARCH}
debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/libwiringPiDev.so* usr/lib/${DEB_HOST_MULTIARCH}
debian/tmp/usr/sbin/gpio
debian/tmp/usr/sbin/wiringPiD

View File

@@ -1,5 +1 @@
debian/tmp/usr/bin
debian/tmp/usr/man usr/share
README.TXT usr/share/doc/wiringpi
People usr/share/doc/wiringpi
udev/rules.d tmp/odroid-wiringpi
udev/rules.d/* usr/lib/udev/rules.d/

38
debian/rules vendored Normal file → Executable file
View File

@@ -1,40 +1,6 @@
#!/usr/bin/make -f
.PHONY: build
VERSION:=$(shell cat VERSION)
export VERSION
soname:=$(shell echo $${VERSION%%.*})
WIRINGPI_SONAME_SUFFIX:=.$(soname)
export soname
export WIRINGPI_SONAME_SUFFIX
build:
dh $@
override_dh_auto_configure:
override_dh_prep:
dh_prep -Xdebian/tmp
dirs:
dh_installdirs -A
mkdir debian/tmp
set -e; for p in `dh_listpackages`; do \
(cd debian/$$p; find -type d) | \
(cd debian/tmp; xargs mkdir -p) \
done
override_dh_clean:
dh_clean
WIRINGPI_SUDO= bash -xe ./build clean
override_dh_auto_build: dirs
V=1 LDCONFIG=: WIRINGPI_SUDO= WIRINGPI_SUID=0 \
DESTDIR=`pwd`/debian/tmp/usr \
PREFIX= WIRINGPI_SUDO= \
bash -xe ./build
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
%:
dh $@
dh $@ --with autoreconf

1
debian/wiringpi-examples.install vendored Normal file
View File

@@ -0,0 +1 @@
examples/* usr/lib/${DEB_HOST_MULTIARCH}/wiringpi/examples/

View File

@@ -1,131 +0,0 @@
#
# Makefile:
# wiringPi device - A "wiring" library for the Raspberry Pi
#
# Copyright (c) 2012-2016 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# https://projects.drogon.net/raspberry-pi/wiringpi/
#
# 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/>.
#################################################################################
VERSION=$(shell cat ../VERSION)
DESTDIR?=/usr
PREFIX?=/local
MAJOR=$(shell cat ../VERSION | cut -d'.' -f1)
LDCONFIG?=ldconfig
ifneq ($V,1)
Q ?= @
endif
STATIC=libwiringPiDev.a
DYNAMIC=libwiringPiDev.so.$(VERSION)
#DEBUG = -g -O0
DEBUG = -O2
CC = gcc
INCLUDE = -I. -I../wiringPi
DEFS = -D_GNU_SOURCE
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
LIBS =
###############################################################################
SRC = ds1302.c maxdetect.c piNes.c \
gertboard.c piFace.c \
lcd128x64.c lcd.c \
scrollPhat.c \
piGlow.c
OBJ = $(SRC:.c=.o)
HEADERS = ds1302.h gertboard.h lcd128x64.h lcd.h maxdetect.h piFace.h piGlow.h piNes.h\
scrollPhat.h
all: $(DYNAMIC)
static: $(STATIC)
$(STATIC): $(OBJ)
$Q echo "[Link (Static)]"
$Q ar rcs $(STATIC) $(OBJ)
$Q ranlib $(STATIC)
# @size $(STATIC)
$(DYNAMIC): $(OBJ)
$Q echo "[Link (Dynamic)]"
$Q $(CC) -shared -Wl,-soname,libwiringPiDev.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ)
.c.o:
$Q echo [Compile] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
.PHONY: clean
clean:
$Q echo "[Clean]"
$Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.*
.PHONY: tags
tags: $(SRC)
$Q echo [ctags]
$Q ctags $(SRC)
.PHONY: install
install: $(DYNAMIC)
$Q echo "[Install Headers]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
$Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
$Q echo "[Install Dynamic Lib]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
$Q install -m 0755 libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
$Q ln -sf libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so.$(MAJOR)
$Q ln -sf libwiringPiDev.so.$(MAJOR) $(DESTDIR)/lib/libwiringPiDev.so
$Q $(LDCONFIG)
.PHONY: install-static
install-static: $(STATIC)
$Q echo "[Install Headers]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
$Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
$Q echo "[Install Static Lib]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
$Q install -m 0755 libwiringPiDev.a $(DESTDIR)$(PREFIX)/lib
.PHONY: uninstall
uninstall:
$Q echo "[UnInstall]"
$Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
$Q cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPiDev.*
$Q $(LDCONFIG)
.PHONY: depend
depend:
makedepend -Y $(SRC)
# DO NOT DELETE
ds1302.o: ds1302.h
maxdetect.o: maxdetect.h
piNes.o: piNes.h
gertboard.o: gertboard.h
piFace.o: piFace.h
lcd128x64.o: font.h lcd128x64.h
lcd.o: lcd.h

20
devLib/Makefile.am Normal file
View File

@@ -0,0 +1,20 @@
lib_LTLIBRARIES = libwiringPiDev.la
libwiringPiDev_la_SOURCES = \
ds1302.c \
gertboard.c \
lcd.c \
lcd128x64.c \
maxdetect.c \
piFace.c \
piGlow.c \
piNes.c \
scrollPhat.c
libwiringPiDev_la_CFLAGS = \
-I ../wiringPi \
@EXTRA_CFLAGS@
libwiringPiDev_la_LDFLAGS = \
-version-info @LIBWIRINGPI_VERSION@ \
-lpthread $(LIBCRYPT_LIBS)

View File

@@ -1,78 +0,0 @@
#
# Makefile:
# Gertboard - Examples using wiringPi
#
# Copyright (c) 2013 Gordon Henderson
#################################################################################
ifneq ($V,1)
Q ?= @
endif
#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm
# Should not alter anything below this line
###############################################################################
SRC = gertboard.c \
buttons.c 7segments.c \
voltmeter.c temperature.c vumeter.c \
record.c
OBJ = $(SRC:.c=.o)
BINS = $(SRC:.c=)
all: $(BINS)
gertboard: gertboard.o
$Q echo [link]
$Q $(CC) -o $@ gertboard.o $(LDFLAGS) $(LDLIBS)
buttons: buttons.o
$Q echo [link]
$Q $(CC) -o $@ buttons.o $(LDFLAGS) $(LDLIBS)
7segments: 7segments.o
$Q echo [link]
$Q $(CC) -o $@ 7segments.o $(LDFLAGS) $(LDLIBS)
voltmeter: voltmeter.o
$Q echo [link]
$Q $(CC) -o $@ voltmeter.o $(LDFLAGS) $(LDLIBS)
temperature: temperature.o
$Q echo [link]
$Q $(CC) -o $@ temperature.o $(LDFLAGS) $(LDLIBS)
vumeter: vumeter.o
$Q echo [link]
$Q $(CC) -o $@ vumeter.o $(LDFLAGS) $(LDLIBS)
record: record.o
$Q echo [link]
$Q $(CC) -o $@ record.o $(LDFLAGS) $(LDLIBS)
.c.o:
$Q echo [CC] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
clean:
$Q echo [Clean]
$Q rm -f $(OBJ) *~ core tags $(BINS)
tags: $(SRC)
$Q echo [ctags]
$Q ctags $(SRC)
depend:
makedepend -Y $(SRC)
# DO NOT DELETE

View File

@@ -0,0 +1,26 @@
COMMON_CFLAGS=$(EXTRA_CFLAGS) $(LIBWIRINGPI_CFLAGS)
LIBS=$(LIBWIRINGPI_LIBS)
bin_PROGRAMS = gertboard buttons 7segments voltmeter temperature vumeter record
gertboard_SOURCES = gertboard.c
gertboard_CFLAGS = $(COMMON_CFLAGS)
gertboard_LDADD = -lm
buttons_SOURCES = buttons.c
buttons_CFLAGS = $(COMMON_CFLAGS)
7segments_SOURCES = 7segments.c
7segments_CFLAGS = $(COMMON_CFLAGS)
voltmeter_SOURCES = voltmeter.c
voltmeter_CFLAGS = $(COMMON_CFLAGS)
temperature_SOURCES = temperature.c
temperature_CFLAGS = $(COMMON_CFLAGS)
vumeter_SOURCES = vumeter.c
vumeter_CFLAGS = $(COMMON_CFLAGS)
record_SOURCES = record.c
record_CFLAGS = $(COMMON_CFLAGS)

View File

@@ -1,171 +0,0 @@
#
# Makefile:
# wiringPi - A "wiring" library for the Raspberry Pi
# 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/>.
#################################################################################
ifneq ($V,1)
Q ?= @
endif
#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm -lcrypt -lrt
# Should not alter anything below this line
###############################################################################
SRC = blink.c blink8.c blink12.c \
blink12drcs.c \
pwm.c \
speed.c wfi.c isr.c isr-osc.c \
lcd.c lcd-adafruit.c clock.c \
nes.c \
softPwm.c softTone.c \
delayTest.c serialRead.c serialTest.c okLed.c ds1302.c \
lowPower.c \
max31855.c \
rht03.c
OBJ = $(SRC:.c=.o)
BINS = $(SRC:.c=)
all:
$Q cat README.TXT
$Q echo " $(BINS)" | fmt
$Q echo ""
really-all: $(BINS)
blink: blink.o
$Q echo [link]
$Q $(CC) -o $@ blink.o $(LDFLAGS) $(LDLIBS)
blink8: blink8.o
$Q echo [link]
$Q $(CC) -o $@ blink8.o $(LDFLAGS) $(LDLIBS)
blink12drcs: blink12drcs.o
$Q echo [link]
$Q $(CC) -o $@ blink12drcs.o $(LDFLAGS) $(LDLIBS)
blink12: blink12.o
$Q echo [link]
$Q $(CC) -o $@ blink12.o $(LDFLAGS) $(LDLIBS)
speed: speed.o
$Q echo [link]
$Q $(CC) -o $@ speed.o $(LDFLAGS) $(LDLIBS)
lcd: lcd.o
$Q echo [link]
$Q $(CC) -o $@ lcd.o $(LDFLAGS) $(LDLIBS)
lcd-adafruit: lcd-adafruit.o
$Q echo [link]
$Q $(CC) -o $@ lcd-adafruit.o $(LDFLAGS) $(LDLIBS)
clock: clock.o
$Q echo [link]
$Q $(CC) -o $@ clock.o $(LDFLAGS) $(LDLIBS)
wfi: wfi.o
$Q echo [link]
$Q $(CC) -o $@ wfi.o $(LDFLAGS) $(LDLIBS)
isr: isr.o
$Q echo [link]
$Q $(CC) -o $@ isr.o $(LDFLAGS) $(LDLIBS)
isr-osc: isr-osc.o
$Q echo [link]
$Q $(CC) -o $@ isr-osc.o $(LDFLAGS) $(LDLIBS)
nes: nes.o
$Q echo [link]
$Q $(CC) -o $@ nes.o $(LDFLAGS) $(LDLIBS)
rht03: rht03.o
$Q echo [link]
$Q $(CC) -o $@ rht03.o $(LDFLAGS) $(LDLIBS)
pwm: pwm.o
$Q echo [link]
$Q $(CC) -o $@ pwm.o $(LDFLAGS) $(LDLIBS)
softPwm: softPwm.o
$Q echo [link]
$Q $(CC) -o $@ softPwm.o $(LDFLAGS) $(LDLIBS)
softTone: softTone.o
$Q echo [link]
$Q $(CC) -o $@ softTone.o $(LDFLAGS) $(LDLIBS)
delayTest: delayTest.o
$Q echo [link]
$Q $(CC) -o $@ delayTest.o $(LDFLAGS) $(LDLIBS)
serialRead: serialRead.o
$Q echo [link]
$Q $(CC) -o $@ serialRead.o $(LDFLAGS) $(LDLIBS)
serialTest: serialTest.o
$Q echo [link]
$Q $(CC) -o $@ serialTest.o $(LDFLAGS) $(LDLIBS)
okLed: okLed.o
$Q echo [link]
$Q $(CC) -o $@ okLed.o $(LDFLAGS) $(LDLIBS)
tone: tone.o
$Q echo [link]
$Q $(CC) -o $@ tone.o $(LDFLAGS) $(LDLIBS)
ds1302: ds1302.o
$Q echo [link]
$Q $(CC) -o $@ ds1302.o $(LDFLAGS) $(LDLIBS)
max31855: max31855.o
$Q echo [link]
$Q $(CC) -o $@ max31855.o $(LDFLAGS) $(LDLIBS)
.c.o:
$Q echo [CC] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
clean:
$Q echo "[Clean]"
$Q rm -f $(OBJ) *~ core tags $(BINS)
tags: $(SRC)
$Q echo [ctags]
$Q ctags $(SRC)
depend:
makedepend -Y $(SRC)
# DO NOT DELETE

75
examples/Makefile.am Normal file
View File

@@ -0,0 +1,75 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
COMMON_CFLAGS = $(EXTRA_CFLAGS) $(LIBWIRINGPI_CFLAGS)
LIBS = $(LIBWIRINGPI_LIBS)
bin_PROGRAMS = blink blink12 blink12drcs blink8 clock delayTest ds1302 isr isr-osc lcd lcd-adafruit max31855 nes okLed pwm rht03 serialRead serialTest softPwm softTone speed wfi
blink_SOURCES = blink.c
blink_CFLAGS = $(COMMON_CFLAGS)
blink12_SOURCES = blink12.c
blink12_CFLAGS = $(COMMON_CFLAGS)
blink12drcs_SOURCES = blink12drcs.c
blink12drcs_CFLAGS = $(COMMON_CFLAGS)
blink8_SOURCES = blink8.c
blink8_CFLAGS = $(COMMON_CFLAGS)
clock_SOURCES = clock.c
clock_CFLAGS = $(COMMON_CFLAGS)
clock_LDADD = -lm
delayTest_SOURCES = delayTest.c
delayTest_CFLAGS = $(COMMON_CFLAGS)
ds1302_SOURCES = ds1302.c
ds1302_CFLAGS = $(COMMON_CFLAGS)
isr_SOURCES = isr.c
isr_CFLAGS = $(COMMON_CFLAGS)
isr_osc_SOURCES = isr-osc.c
isr_osc_CFLAGS = $(COMMON_CFLAGS)
lcd_SOURCES = lcd.c
lcd_CFLAGS = $(COMMON_CFLAGS)
lcd_adafruit_SOURCES = lcd-adafruit.c
lcd_adafruit_CFLAGS = $(COMMON_CFLAGS)
max31855_SOURCES = max31855.c
max31855_CFLAGS = $(COMMON_CFLAGS)
nes_SOURCES = nes.c
nes_CFLAGS = $(COMMON_CFLAGS)
okLed_SOURCES = okLed.c
okLed_CFLAGS = $(COMMON_CFLAGS)
pwm_SOURCES = pwm.c
pwm_CFLAGS = $(COMMON_CFLAGS)
rht03_SOURCES = rht03.c
rht03_CFLAGS = $(COMMON_CFLAGS)
serialRead_SOURCES = serialRead.c
serialRead_CFLAGS = $(COMMON_CFLAGS)
serialTest_SOURCES = serialTest.c
serialTest_CFLAGS = $(COMMON_CFLAGS)
softPwm_SOURCES = softPwm.c
softPwm_CFLAGS = $(COMMON_CFLAGS)
softTone_SOURCES = softTone.c
softTone_CFLAGS = $(COMMON_CFLAGS)
speed_SOURCES = speed.c
speed_CFLAGS = $(COMMON_CFLAGS)
wfi_SOURCES = wfi.c
wfi_CFLAGS = $(COMMON_CFLAGS)
SUBDIRS = Gertboard PiFace PiGlow q2w scrollPhat

View File

@@ -1,88 +0,0 @@
#
# Makefile:
# wiringPi - A "wiring" library for the Raspberry Pi
# https://projects.drogon.net/wiring-pi
#
# Copyright (c) 2012 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# A "wiring" 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/>.
#################################################################################
ifneq ($V,1)
Q ?= @
endif
#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm
# Should not alter anything below this line
###############################################################################
SRC = blink.c buttons.c reaction.c ladder.c metro.c motor.c
OBJ = $(SRC:.c=.o)
BINS = $(SRC:.c=)
all: $(BINS)
blink: blink.o
$Q echo [link]
$Q $(CC) -o $@ blink.o $(LDFLAGS) $(LDLIBS)
buttons: buttons.o
$Q echo [link]
$Q $(CC) -o $@ buttons.o $(LDFLAGS) $(LDLIBS)
reaction: reaction.o
$Q echo [link]
$Q $(CC) -o $@ reaction.o $(LDFLAGS) $(LDLIBS)
ladder: ladder.o
$Q echo [link]
$Q $(CC) -o $@ ladder.o $(LDFLAGS) $(LDLIBS)
metro: metro.o
$Q echo [link]
$Q $(CC) -o $@ metro.o $(LDFLAGS) $(LDLIBS)
motor: motor.o
$Q echo [link]
$Q $(CC) -o $@ motor.o $(LDFLAGS) $(LDLIBS)
.c.o:
$Q echo [CC] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
clean:
$Q echo "[Clean]"
$Q rm -f $(OBJ) *~ core tags $(BINS)
tags: $(SRC)
$Q echo [ctags]
$Q ctags $(SRC)
depend:
makedepend -Y $(SRC)
# DO NOT DELETE

View File

@@ -0,0 +1,22 @@
COMMON_CFLAGS = $(EXTRA_CFLAGS) $(LIBWIRINGPI_CFLAGS) -I.
LIBS = $(LIBWIRINGPI_LIBS)
bin_PROGRAMS = blink buttons ladder metro motor reaction
blink_SOURCES = blink.c
blink_CFLAGS = $(COMMON_CFLAGS)
buttons_SOURCES = buttons.c
buttons_CFLAGS = $(COMMON_CFLAGS)
ladder_SOURCES = ladder.c
ladder_CFLAGS = $(COMMON_CFLAGS)
metro_SOURCES = metro.c
metro_CFLAGS = $(COMMON_CFLAGS)
motor_SOURCES = motor.c
motor_CFLAGS = $(COMMON_CFLAGS)
reaction_SOURCES = reaction.c
reaction_CFLAGS = $(COMMON_CFLAGS)

View File

@@ -1,82 +0,0 @@
#
# Makefile:
# wiringPi - A "wiring" library for the Raspberry Pi
# https://projects.drogon.net/wiring-pi
#
# Copyright (c) 2012-2015 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# A "wiring" 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/>.
#################################################################################
ifneq ($V,1)
Q ?= @
endif
#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm
# Should not alter anything below this line
###############################################################################
SRC = piGlow0.c piGlow1.c piglow.c
OBJ = $(SRC:.c=.o)
BINS = $(SRC:.c=)
all: $(BINS)
piGlow0: piGlow0.o
$Q echo [link]
$Q $(CC) -o $@ piGlow0.o $(LDFLAGS) $(LDLIBS)
piGlow1: piGlow1.o
$Q echo [link]
$Q $(CC) -o $@ piGlow1.o $(LDFLAGS) $(LDLIBS)
piglow: piglow.o
$Q echo [link]
$Q $(CC) -o $@ piglow.o $(LDFLAGS) $(LDLIBS)
.c.o:
$Q echo [CC] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
clean:
$Q echo "[Clean]"
$Q rm -f $(OBJ) *~ core tags $(BINS)
tags: $(SRC)
$Q echo [ctags]
$Q ctags $(SRC)
install: piglow
$Q echo Installing piglow into /usr/local/bin
$Q cp -a piglow /usr/local/bin/piglow
$Q chmod 755 /usr/local/bin/piglow
$Q echo Done. Remember to load the I2C drivers!
depend:
makedepend -Y $(SRC)
# DO NOT DELETE

View File

@@ -0,0 +1,10 @@
COMMON_CFLAGS=$(EXTRA_CFLAGS) $(LIBWIRINGPI_CFLAGS) -I.
LIBS=$(LIBWIRINGPI_LIBS)
bin_PROGRAMS = piGlow0 piGlow1
piGlow0_SOURCES = piGlow0.c
piGlow0_CFLAGS = $(COMMON_CFLAGS)
piGlow1_SOURCES = piGlow1.c
piGlow1_CFLAGS = $(COMMON_CFLAGS)

BIN
examples/PiGlow/piGlow0 Executable file

Binary file not shown.

3
examples/autogen.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
autoreconf -v --install || exit 1

39
examples/configure.ac Normal file
View File

@@ -0,0 +1,39 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([wiringpi-examples], [1.0], [tobetter@gmail.com])
AC_CONFIG_SRCDIR([serialRead.c])
AC_CONFIG_HEADERS([config.h])
AC_SUBST([EXTRA_CFLAGS], ["-Wformat=2 -Wall -Wextra -Winline -Wno-format-truncation -pipe -fPIC"])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
PKG_CHECK_MODULES([LIBCRYPT], [libcrypt])
PKG_CHECK_MODULES([LIBWIRINGPI], [libwiringpi2])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_MACRO_DIRS([m4])
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h sys/ioctl.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([floor gettimeofday rint strcasecmp strerror])
AC_CONFIG_FILES([
Makefile
Gertboard/Makefile
PiFace/Makefile
PiGlow/Makefile
q2w/Makefile
scrollPhat/Makefile
])
AC_OUTPUT

View File

@@ -1,84 +0,0 @@
#
# Makefile:
# wiringPi - A "wiring" library for the Raspberry Pi
# https://projects.drogon.net/wiring-pi
#
# Copyright (c) 2012-2013 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# A "wiring" 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/>.
#################################################################################
ifneq ($V,1)
Q ?= @
endif
#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm
###############################################################################
SRC = blink.c button.c blink-io.c volts.c bright.c
OBJ = $(SRC:.c=.o)
BINS = $(SRC:.c=)
all: $(BINS)
blink: blink.o
$Q echo [link]
$Q $(CC) -o $@ blink.o $(LDFLAGS) $(LDLIBS)
blink-io: blink-io.o
$Q echo [link]
$Q $(CC) -o $@ blink-io.o $(LDFLAGS) $(LDLIBS)
button: button.o
$Q echo [link]
$Q $(CC) -o $@ button.o $(LDFLAGS) $(LDLIBS)
volts: volts.o
$Q echo [link]
$Q $(CC) -o $@ volts.o $(LDFLAGS) $(LDLIBS)
bright: bright.o
$Q echo [link]
$Q $(CC) -o $@ bright.o $(LDFLAGS) $(LDLIBS)
.c.o:
$Q echo [CC] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
clean:
$Q echo "[Clean]"
$Q rm -f $(OBJ) *~ core tags $(BINS)
tags: $(SRC)
$Q echo [ctags]
$Q ctags $(SRC)
depend:
makedepend -Y $(SRC)
# DO NOT DELETE

20
examples/q2w/Makefile.am Normal file
View File

@@ -0,0 +1,20 @@
COMMON_CFLAGS=$(EXTRA_CFLAGS) $(LIBWIRINGPI_CFLAGS)
LIBS=$(LIBWIRINGPI_LIBS)
bin_PROGRAMS = blink button blink-io volts bright
blink_SOURCES = blink.c
blink_CFLAGS = $(COMMON_CFLAGS)
blink_LDADD = -lm
button_SOURCES = button.c
button_CFLAGS = $(COMMON_CFLAGS)
blink_io_SOURCES = blink-io.c
blink_io_CFLAGS = $(COMMON_CFLAGS)
volts_SOURCES = volts.c
volts_CFLAGS = $(COMMON_CFLAGS)
bright_SOURCES = bright.c
bright_CFLAGS = $(COMMON_CFLAGS)

View File

@@ -1,79 +0,0 @@
#
# Makefile:
# wiringPi - A "wiring" library for the Raspberry Pi
# https://projects.drogon.net/wiring-pi
#
# Copyright (c) 2012-2015 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# A "wiring" 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/>.
#################################################################################
ifneq ($V,1)
Q ?= @
endif
#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm
# Should not alter anything below this line
###############################################################################
SRC = scphat.c test.c
OBJ = $(SRC:.c=.o)
BINS = $(SRC:.c=)
all: $(BINS)
test: test.o
$Q echo [link]
$Q $(CC) -o $@ test.o $(LDFLAGS) $(LDLIBS)
scphat: scphat.o
$Q echo [link]
$Q $(CC) -o $@ scphat.o $(LDFLAGS) $(LDLIBS)
.c.o:
$Q echo [CC] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
clean:
$Q echo "[Clean]"
$Q rm -f $(OBJ) *~ core tags $(BINS)
tags: $(SRC)
$Q echo [ctags]
$Q ctags $(SRC)
install: scphat
$Q echo Installing scphat into /usr/local/bin
$Q cp -a scphat /usr/local/bin/scphat
$Q chmod 755 /usr/local/bin/scphat
$Q echo Done. Remember to load the I2C drivers if needed.
depend:
makedepend -Y $(SRC)
# DO NOT DELETE

View File

@@ -0,0 +1,10 @@
COMMON_CFLAGS=$(EXTRA_CFLAGS) $(LIBWIRINGPI_CFLAGS)
LIBS=$(LIBWIRINGPI_LIBS)
bin_PROGRAMS = scphat test
scphat_SOURCES = scphat.c
scphat_CFLAGS = $(COMMON_CFLAGS)
test_SOURCES = test.c
test_CFLAGS = $(COMMON_CFLAGS)

View File

@@ -1,95 +0,0 @@
#
# Makefile:
# The gpio command:
# A swiss-army knige of GPIO shenanigans.
# https://projects.drogon.net/wiring-pi
#
# Copyright (c) 2012-2016 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# A "wiring" 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 -Wextra $(INCLUDE) -Winline -pipe
LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
LIBS = -lwiringPi -lpthread -lrt -lm -lcrypt -lgpiod
# May not need to alter anything below this line
###############################################################################
SRC = gpio.c readall.c
OBJ = $(SRC:.c=.o)
all: gpio
version.h: ../VERSION
$Q echo Need to run newVersion above.
gpio: $(OBJ)
$Q echo [Link]
$Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
.c.o:
$Q echo [Compile] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
.PHONY: clean
clean:
$Q echo "[Clean]"
$Q rm -f $(OBJ) gpio *~ core tags *.bak
.PHONY: tags
tags: $(SRC)
$Q echo [ctags]
$Q ctags $(SRC)
.PHONY: install
install: gpio
$Q echo "[Install]"
$Q cp gpio $(DESTDIR)$(PREFIX)/bin
ifneq ($(WIRINGPI_SUID),0)
$Q chown root.root $(DESTDIR)$(PREFIX)/bin/gpio
$Q chmod 4755 $(DESTDIR)$(PREFIX)/bin/gpio
endif
$Q mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
$Q cp gpio.1 $(DESTDIR)$(PREFIX)/share/man/man1
.PHONY: uninstall
uninstall:
$Q echo "[UnInstall]"
$Q rm -f $(DESTDIR)$(PREFIX)/bin/gpio
$Q rm -f $(DESTDIR)$(PREFIX)/share/man/man1/gpio.1
.PHONY: depend
depend:
makedepend -Y $(SRC)
# DO NOT DELETE
gpio.o: ../version.h

14
gpio/Makefile.am Normal file
View File

@@ -0,0 +1,14 @@
sbin_PROGRAMS = gpio
gpio_SOURCES = \
gpio.c \
readall.c
gpio_CFLAGS = \
-I ../wiringPi \
@EXTRA_CFLAGS@ \
$(LIBCRYPT_CFLAGS)
gpio_LDFLAGS = \
-L../wiringPi/.libs -lwiringPi \
$(LIBCRYPT_LIBS)

10
libwiringpi2.pc.in Normal file
View File

@@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libwiringpi2
Description: GPIO libraries for ODROID (runtime).
Version: 2.0.0
Libs: -L${libdir} -lwiringPiDev -lwiringPi
Cflags: -I${includedir}/wiringpi2

View File

@@ -1,25 +0,0 @@
ifneq ($V,1)
Q ?= @
endif
SRC = odroid_xu3.tex \
odroid_c1.tex \
odroid_c2.tex \
odroid_n1.tex \
odroid_n2.tex \
odroid_c4.tex \
odroid_m1.tex
DVI = $(SRC:.tex=.dvi)
all: $(DVI)
$Q echo Generating DVI
.tex.dvi:
$Q latex $< $@
$Q dvipdf $@
.PHONY: clean
clean:
$Q rm -f *.dvi *.aux *.log *.ps *.toc *.bak *~

16
pins/Makefile.am Normal file
View File

@@ -0,0 +1,16 @@
dist_pdf_DATA = \
odroid_c1.pdf \
odroid_c2.pdf \
odroid_c4.pdf \
odroid_m1.pdf \
odroid_n1.pdf \
odroid_n2.pdf \
odroid_xu3.pdf
.tex.pdf:
pdflatex $< $@
clean-latex:
rm -f *.pdf *.aux *.log
clean-local: clean-latex

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,188 +0,0 @@
#
# Makefile:
# wiringPi - Wiring Compatable library for the Raspberry Pi
#
# Copyright (c) 2012-2015 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# https://projects.drogon.net/raspberry-pi/wiringpi/
#
# 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/>.
#################################################################################
VERSION=$(shell cat ../VERSION)
DESTDIR?=/usr
PREFIX?=/local
MAJOR=$(shell cat ../VERSION | cut -d'.' -f1)
LDCONFIG?=ldconfig
ifneq ($V,1)
Q ?= @
endif
STATIC=libwiringPi.a
DYNAMIC=libwiringPi.so.$(VERSION)
#DEBUG = -g -O0
DEBUG = -O2
CC = gcc
INCLUDE = -I.
DEFS = -D_GNU_SOURCE
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline -Wno-format-truncation $(INCLUDE) -pipe -fPIC
LIBS = -lm -lpthread -lrt -lcrypt -lgpiod
###############################################################################
SRC = wiringPi.c \
wiringSerial.c wiringShift.c \
wiringPiSPI.c wiringPiI2C.c \
piHiPri.c piThread.c \
softPwm.c softTone.c softServo.c \
mcp23008.c mcp23016.c mcp23017.c \
mcp23s08.c mcp23s17.c \
sr595.c \
pcf8574.c pcf8591.c \
mcp3002.c mcp3004.c mcp4802.c mcp3422.c \
max31855.c max5322.c ads1115.c \
sn3218.c \
bmp180.c htu21d.c ds18b20.c rht03.c \
drcSerial.c drcNet.c \
pseudoPins.c \
wpiExtensions.c \
odroidc1.c \
odroidc2.c \
odroidxu3.c \
odroidn1.c \
odroidn2.c \
odroidc4.c \
odroidhc4.c \
odroidm1.c
HEADERS = $(shell ls *.h)
OBJ = $(SRC:.c=.o)
all: $(DYNAMIC)
static: $(STATIC)
$(STATIC): $(OBJ)
$Q echo "[Link (Static)]"
$Q ar rcs $(STATIC) $(OBJ)
$Q ranlib $(STATIC)
# @size $(STATIC)
$(DYNAMIC): $(OBJ)
$Q echo "[Link (Dynamic)]"
$Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(OBJ) $(LIBS)
.c.o:
$Q echo [Compile] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
.PHONY: clean
clean:
$Q echo "[Clean]"
$Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
.PHONY: tags
tags: $(SRC)
$Q echo [ctags]
$Q ctags $(SRC)
.PHONY: install
install: $(DYNAMIC)
$Q echo "[Install Headers]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
$Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
$Q echo "[Install Dynamic Lib]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
$Q install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
$Q ln -sf libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so.$(MAJOR)
$Q ln -sf libwiringPi.so.$(MAJOR) $(DESTDIR)/lib/libwiringPi.so
$Q $(LDCONFIG)
.PHONY: install-static
install-static: $(STATIC)
$Q echo "[Install Headers]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
$Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
$Q echo "[Install Static Lib]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
$Q install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
.PHONY: uninstall
uninstall:
$Q echo "[UnInstall]"
$Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS) wiringOdroid*.h
$Q cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPi.*
$Q $(LDCONFIG)
.PHONY: depend
depend:
makedepend -Y $(SRC) $(SRC_I2C)
# DO NOT DELETE
wiringPi.o: softPwm.h softTone.h wiringPi.h ../version.h
wiringSerial.o: wiringSerial.h
wiringShift.o: wiringPi.h wiringShift.h
wiringPiSPI.o: wiringPi.h wiringPiSPI.h
wiringPiI2C.o: wiringPi.h wiringPiI2C.h
piHiPri.o: wiringPi.h
piThread.o: wiringPi.h
softPwm.o: wiringPi.h softPwm.h
softTone.o: wiringPi.h softTone.h
softServo.o: wiringPi.h softServo.h
mcp23008.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23008.h
mcp23016.o: wiringPi.h wiringPiI2C.h mcp23016.h mcp23016reg.h
mcp23017.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23017.h
mcp23s08.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s08.h
mcp23s17.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s17.h
sr595.o: wiringPi.h sr595.h
pcf8574.o: wiringPi.h wiringPiI2C.h pcf8574.h
pcf8591.o: wiringPi.h wiringPiI2C.h pcf8591.h
mcp3002.o: wiringPi.h wiringPiSPI.h mcp3002.h
mcp3004.o: wiringPi.h wiringPiSPI.h mcp3004.h
mcp4802.o: wiringPi.h wiringPiSPI.h mcp4802.h
mcp3422.o: wiringPi.h wiringPiI2C.h mcp3422.h
max31855.o: wiringPi.h wiringPiSPI.h max31855.h
max5322.o: wiringPi.h wiringPiSPI.h max5322.h
ads1115.o: wiringPi.h wiringPiI2C.h ads1115.h
sn3218.o: wiringPi.h wiringPiI2C.h sn3218.h
bmp180.o: wiringPi.h wiringPiI2C.h bmp180.h
htu21d.o: wiringPi.h wiringPiI2C.h htu21d.h
ds18b20.o: wiringPi.h ds18b20.h
drcSerial.o: wiringPi.h wiringSerial.h drcSerial.h
pseudoPins.o: wiringPi.h pseudoPins.h
wpiExtensions.o: wiringPi.h mcp23008.h mcp23016.h mcp23017.h mcp23s08.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 ads1115.h sn3218.h
wpiExtensions.o: drcSerial.h pseudoPins.h bmp180.h htu21d.h ds18b20.h
wpiExtensions.o: wpiExtensions.h
# ODROID Boards
odroidc1.o : wiringPi.h odroidc1.h
odroidc2.o : wiringPi.h odroidc2.h
odroidxu3.o : wiringPi.h odroidxu3.h
odroidn1.o : wiringPi.h odroidn1.h
odroidn2.o : wiringPi.h odroidn2.h
odroidc4.o : wiringPi.h odroidc4.h
odroidhc4.o : wiringPi.h odroidc4.h
odroidm1.o : wiringPi.h odroidm1.h

53
wiringPi/Makefile.am Normal file
View File

@@ -0,0 +1,53 @@
lib_LTLIBRARIES = libwiringPi.la
libwiringPi_la_SOURCES = \
ads1115.c \
bmp180.c \
drcNet.c \
drcSerial.c \
ds18b20.c \
htu21d.c \
max31855.c \
max5322.c \
mcp23008.c \
mcp23016.c \
mcp23017.c \
mcp23s08.c \
mcp23s17.c \
mcp3002.c \
mcp3004.c \
mcp3422.c \
mcp4802.c \
odroidc1.c \
odroidc2.c \
odroidc4.c \
odroidhc4.c \
odroidm1.c \
odroidn1.c \
odroidn2.c \
odroidxu3.c \
pcf8574.c \
pcf8591.c \
piHiPri.c \
piThread.c \
pseudoPins.c \
rht03.c \
sn3218.c \
softPwm.c \
softServo.c \
softTone.c \
sr595.c \
wiringPi.c \
wiringPiI2C.c \
wiringPiSPI.c \
wiringSerial.c \
wiringShift.c \
wpiExtensions.c
libwiringPi_la_CFLAGS = \
@EXTRA_CFLAGS@ \
$(LIBCRYPT_CFLAGS)
libwiringPi_la_LDFLAGS = \
-version-info @LIBWIRINGPI_VERSION@ \
-lpthread -lm -lrt $(LIBCRYPT_LIBS)

View File

@@ -1,100 +0,0 @@
#
# Makefile:
# The wiringPiD utility:
# https://projects.drogon.net/wiring-pi
#
# Copyright (c) 2012-2017 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# A "wiring" 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 -Wextra $(INCLUDE) -Winline -pipe
LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
LIBS = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
# May not need to alter anything below this line
###############################################################################
SRC = wiringpid.c network.c runRemote.c daemonise.c
OBJ = $(SRC:.c=.o)
all: wiringpid
wiringpid: $(OBJ)
$Q echo [Link]
$Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
.c.o:
$Q echo [Compile] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
.PHONY: clean
clean:
$Q echo "[Clean]"
$Q rm -f $(OBJ) wiringpid *~ core tags *.bak
.PHONY: tags
tags: $(SRC)
$Q echo [ctags]
$Q ctags $(SRC)
.PHONY: install
install: wiringpid
$Q echo "[Install]"
$Q mkdir -p $(DESTDIR)$(PREFIX)/sbin
$Q cp wiringpid $(DESTDIR)$(PREFIX)/sbin
$Q chown root.root $(DESTDIR)$(PREFIX)/sbin/wiringpid
# $Q mkdir -p $(DESTDIR)$(PREFIX)/man/man8
# $Q cp gpio.1 $(DESTDIR)$(PREFIX)/man/man8
.PHONY: install-deb
install-deb: gpio
$Q echo "[Install: deb]"
$Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/bin
$Q install -m 0755 gpio ~/wiringPi/debian-template/wiringPi/usr/bin
$Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/man/man1
$Q install -m 0644 gpio.1 ~/wiringPi/debian-template/wiringPi/man/man1
.PHONY: uninstall
uninstall:
$Q echo "[UnInstall]"
$Q rm -f $(DESTDIR)$(PREFIX)/sbin/wiringpid
$Q rm -f $(DESTDIR)$(PREFIX)/man/man8/wiringpid.8
.PHONY: depend
depend:
makedepend -Y $(SRC)
# DO NOT DELETE
wiringpid.o: drcNetCmd.h network.h runRemote.h daemonise.h
network.o: network.h
runRemote.o: drcNetCmd.h network.h runRemote.h
daemonise.o: daemonise.h

16
wiringPiD/Makefile.am Normal file
View File

@@ -0,0 +1,16 @@
sbin_PROGRAMS = wiringPiD
wiringPiD_SOURCES = \
daemonise.c \
network.c \
runRemote.c \
wiringpid.c
wiringPiD_CFLAGS = \
-I ../wiringPi \
@EXTRA_CFLAGS@ \
$(LIBCRYPT_CFLAGS)
wiringPiD_LDFLAGS = \
-L../wiringPi/.libs -lwiringPi \
$(LIBCRYPT_LIBS)