2015-02-02 22:11:28 +01:00
|
|
|
#
|
2015-05-27 21:00:26 +02:00
|
|
|
CC = gcc
|
|
|
|
AR = ar
|
|
|
|
RANLIB = ranlib
|
|
|
|
SIZE = size
|
|
|
|
SHLIB = gcc -shared
|
|
|
|
STRIPLIB = strip --strip-unneeded
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2015-11-10 15:57:12 +01:00
|
|
|
CFLAGS += -O3 -Wall -pthread
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2015-05-27 21:00:26 +02:00
|
|
|
LIB1 = libpigpio.so
|
2014-01-12 22:31:59 +01:00
|
|
|
OBJ1 = pigpio.o command.o
|
2013-12-12 11:32:49 +01:00
|
|
|
|
2015-05-27 21:00:26 +02:00
|
|
|
LIB2 = libpigpiod_if.so
|
2014-01-12 22:31:59 +01:00
|
|
|
OBJ2 = pigpiod_if.o command.o
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2015-11-10 15:57:12 +01:00
|
|
|
LIB3 = libpigpiod_if2.so
|
|
|
|
OBJ3 = pigpiod_if2.o command.o
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2015-11-10 15:57:12 +01:00
|
|
|
LIB = $(LIB1) $(LIB2) $(LIB3)
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2015-11-10 15:57:12 +01:00
|
|
|
ALL = $(LIB) x_pigpio x_pigpiod_if x_pigpiod_if2 pig2vcd pigpiod pigs
|
2014-03-13 16:50:23 +01:00
|
|
|
|
2015-11-10 15:57:12 +01:00
|
|
|
LL1 = -L. -lpigpio -pthread -lrt
|
|
|
|
|
|
|
|
LL2 = -L. -lpigpiod_if -pthread -lrt
|
|
|
|
|
|
|
|
LL3 = -L. -lpigpiod_if2 -pthread -lrt
|
2014-01-12 22:31:59 +01:00
|
|
|
|
2015-12-22 17:44:27 +01:00
|
|
|
prefix = /usr/local
|
|
|
|
exec_prefix = $(prefix)
|
|
|
|
bindir = $(exec_prefix)/bin
|
|
|
|
includedir = $(prefix)/include
|
|
|
|
libdir = $(prefix)/lib
|
|
|
|
mandir = $(prefix)/man
|
|
|
|
|
2014-01-12 22:31:59 +01:00
|
|
|
all: $(ALL)
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2015-05-27 21:00:26 +02:00
|
|
|
pigpio.o: pigpio.c pigpio.h command.h custom.cext
|
|
|
|
$(CC) $(CFLAGS) -fpic -c -o pigpio.o pigpio.c
|
|
|
|
|
|
|
|
pigpiod_if.o: pigpiod_if.c pigpio.h command.h pigpiod_if.h
|
|
|
|
$(CC) $(CFLAGS) -fpic -c -o pigpiod_if.o pigpiod_if.c
|
|
|
|
|
2015-11-10 15:57:12 +01:00
|
|
|
pigpiod_if2.o: pigpiod_if2.c pigpio.h command.h pigpiod_if2.h
|
|
|
|
$(CC) $(CFLAGS) -fpic -c -o pigpiod_if2.o pigpiod_if2.c
|
|
|
|
|
2015-05-27 21:00:26 +02:00
|
|
|
command.o: command.c pigpio.h command.h
|
|
|
|
$(CC) $(CFLAGS) -fpic -c -o command.o command.c
|
|
|
|
|
2014-03-13 16:50:23 +01:00
|
|
|
x_pigpio: x_pigpio.o $(LIB1)
|
2015-05-27 21:00:26 +02:00
|
|
|
$(CC) -o x_pigpio x_pigpio.o $(LL1)
|
2014-03-13 16:50:23 +01:00
|
|
|
|
|
|
|
x_pigpiod_if: x_pigpiod_if.o $(LIB2)
|
2015-05-27 21:00:26 +02:00
|
|
|
$(CC) -o x_pigpiod_if x_pigpiod_if.o $(LL2)
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2015-11-10 15:57:12 +01:00
|
|
|
x_pigpiod_if2: x_pigpiod_if2.o $(LIB3)
|
|
|
|
$(CC) -o x_pigpiod_if2 x_pigpiod_if2.o $(LL3)
|
|
|
|
|
2014-01-12 22:31:59 +01:00
|
|
|
pigpiod: pigpiod.o $(LIB1)
|
2015-05-27 21:00:26 +02:00
|
|
|
$(CC) -o pigpiod pigpiod.o $(LL1)
|
2014-01-12 22:31:59 +01:00
|
|
|
|
|
|
|
pigs: pigs.o command.o
|
2015-05-27 21:00:26 +02:00
|
|
|
$(CC) -o pigs pigs.o command.o
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2014-01-12 22:31:59 +01:00
|
|
|
pig2vcd: pig2vcd.o
|
2015-05-27 21:00:26 +02:00
|
|
|
$(CC) -o pig2vcd pig2vcd.o
|
2014-01-12 22:31:59 +01:00
|
|
|
|
2013-12-12 11:27:22 +01:00
|
|
|
clean:
|
2013-12-12 11:32:49 +01:00
|
|
|
rm -f *.o *.i *.s *~ $(ALL)
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2015-05-27 21:00:26 +02:00
|
|
|
install: $(ALL)
|
2015-12-22 17:44:27 +01:00
|
|
|
install -m 0755 -d $(DESTDIR)/opt/pigpio/cgi
|
|
|
|
install -m 0755 -d $(DESTDIR)$(includedir)
|
|
|
|
install -m 0644 pigpio.h $(DESTDIR)$(includedir)
|
|
|
|
install -m 0644 pigpiod_if.h $(DESTDIR)$(includedir)
|
|
|
|
install -m 0644 pigpiod_if2.h $(DESTDIR)$(includedir)
|
|
|
|
install -m 0755 -d $(DESTDIR)$(libdir)
|
|
|
|
install -m 0755 libpigpio.so $(DESTDIR)$(libdir)
|
|
|
|
install -m 0755 libpigpiod_if.so $(DESTDIR)$(libdir)
|
|
|
|
install -m 0755 libpigpiod_if2.so $(DESTDIR)$(libdir)
|
|
|
|
install -m 0755 -d $(DESTDIR)$(bindir)
|
|
|
|
install -m 0755 -s pig2vcd $(DESTDIR)$(bindir)
|
|
|
|
install -m 0755 -s pigpiod $(DESTDIR)$(bindir)
|
|
|
|
install -m 0755 -s pigs $(DESTDIR)$(bindir)
|
2015-10-02 09:23:02 +02:00
|
|
|
if which python2; then python2 setup.py install; fi
|
|
|
|
if which python3; then python3 setup.py install; fi
|
2015-12-22 17:44:27 +01:00
|
|
|
install -m 0755 -d $(DESTDIR)$(mandir)/man1
|
|
|
|
install -m 0644 *.1 $(DESTDIR)$(mandir)/man1
|
|
|
|
install -m 0755 -d $(DESTDIR)$(mandir)/man3
|
|
|
|
install -m 0644 *.3 $(DESTDIR)$(mandir)/man3
|
2015-08-30 10:40:42 +02:00
|
|
|
ldconfig
|
2013-12-12 11:27:22 +01:00
|
|
|
|
|
|
|
uninstall:
|
2015-12-22 17:44:27 +01:00
|
|
|
rm -f $(DESTDIR)$(includedir)/pigpio.h
|
|
|
|
rm -f $(DESTDIR)$(includedir)/pigpiod_if.h
|
|
|
|
rm -f $(DESTDIR)$(includedir)/pigpiod_if2.h
|
|
|
|
rm -f $(DESTDIR)$(libdir)/libpigpio.so
|
|
|
|
rm -f $(DESTDIR)$(libdir)/libpigpiod_if.so
|
|
|
|
rm -f $(DESTDIR)$(libdir)/libpigpiod_if2.so
|
|
|
|
rm -f $(DESTDIR)$(bindir)/pig2vcd
|
|
|
|
rm -f $(DESTDIR)$(bindir)/pigpiod
|
|
|
|
rm -f $(DESTDIR)$(bindir)/pigs
|
2015-10-02 09:23:02 +02:00
|
|
|
if which python2; then python2 setup.py install --record /tmp/pigpio >/dev/null; xargs rm -f < /tmp/pigpio >/dev/null; fi
|
|
|
|
if which python3; then python3 setup.py install --record /tmp/pigpio >/dev/null; xargs rm -f < /tmp/pigpio >/dev/null; fi
|
2015-12-22 17:44:27 +01:00
|
|
|
rm -f $(DESTDIR)$(mandir)/man1/pig*.1
|
|
|
|
rm -f $(DESTDIR)$(mandir)/man3/pig*.3
|
2015-08-30 10:40:42 +02:00
|
|
|
ldconfig
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2014-01-12 22:31:59 +01:00
|
|
|
$(LIB1): $(OBJ1)
|
2015-05-27 21:00:26 +02:00
|
|
|
$(SHLIB) -o $(LIB1) $(OBJ1)
|
|
|
|
$(STRIPLIB) $(LIB1)
|
|
|
|
$(SIZE) $(LIB1)
|
|
|
|
|
2014-01-12 22:31:59 +01:00
|
|
|
$(LIB2): $(OBJ2)
|
2015-05-27 21:00:26 +02:00
|
|
|
$(SHLIB) -o $(LIB2) $(OBJ2)
|
|
|
|
$(STRIPLIB) $(LIB2)
|
|
|
|
$(SIZE) $(LIB2)
|
|
|
|
|
2015-11-10 15:57:12 +01:00
|
|
|
$(LIB3): $(OBJ3)
|
|
|
|
$(SHLIB) -o $(LIB3) $(OBJ3)
|
|
|
|
$(STRIPLIB) $(LIB3)
|
|
|
|
$(SIZE) $(LIB3)
|
|
|
|
|
2014-01-12 22:31:59 +01:00
|
|
|
# generated using gcc -MM *.c
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2013-12-12 11:32:49 +01:00
|
|
|
pig2vcd.o: pig2vcd.c pigpio.h
|
2014-01-21 20:04:59 +01:00
|
|
|
pigpiod.o: pigpiod.c pigpio.h
|
2013-12-12 11:32:49 +01:00
|
|
|
pigs.o: pigs.c pigpio.h command.h
|
2015-02-02 22:11:28 +01:00
|
|
|
x_pigpio.o: x_pigpio.c pigpio.h
|
|
|
|
x_pigpiod_if.o: x_pigpiod_if.c pigpiod_if.h pigpio.h
|
2015-11-10 15:57:12 +01:00
|
|
|
x_pigpiod_if2.o: x_pigpiod_if2.c pigpiod_if2.h pigpio.h
|