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

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)