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-04-08 19:20:07 +02:00
|
|
|
CFLAGS += -O3 -Wall
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2015-05-27 21:00:26 +02:00
|
|
|
LIB1 = libpigpio.so
|
|
|
|
LIB1_ST = libpigpio.a
|
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
|
|
|
|
LIB2_ST = libpigpiod_if.a
|
2014-01-12 22:31:59 +01:00
|
|
|
OBJ2 = pigpiod_if.o command.o
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2015-05-27 21:00:26 +02:00
|
|
|
LIB = $(LIB1) $(LIB1_ST) $(LIB2) $(LIB2_ST)
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2014-03-13 16:50:23 +01:00
|
|
|
ALL = $(LIB) x_pigpio x_pigpiod_if pig2vcd pigpiod pigs
|
2013-12-12 11:27:22 +01:00
|
|
|
|
2014-03-13 16:50:23 +01:00
|
|
|
LL1 = -L. -lpigpio -lpthread -lrt
|
|
|
|
|
|
|
|
LL2 = -L. -lpigpiod_if -lpthread -lrt
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
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)
|
|
|
|
sudo install -m 0755 -d /opt/pigpio/cgi
|
|
|
|
sudo install -m 0755 -d /usr/local/include
|
|
|
|
sudo install -m 0644 pigpio.h /usr/local/include
|
|
|
|
sudo install -m 0644 pigpiod_if.h /usr/local/include
|
|
|
|
sudo install -m 0755 -d /usr/local/lib
|
|
|
|
sudo install -m 0644 libpigpio.a /usr/local/lib
|
|
|
|
sudo install -m 0755 libpigpio.so /usr/local/lib
|
|
|
|
sudo install -m 0644 libpigpiod_if.a /usr/local/lib
|
|
|
|
sudo install -m 0755 libpigpiod_if.so /usr/local/lib
|
|
|
|
sudo install -m 0755 -d /usr/local/bin
|
|
|
|
sudo install -m 0755 -s pig2vcd /usr/local/bin
|
|
|
|
sudo install -m 0755 -s pigpiod /usr/local/bin
|
|
|
|
sudo install -m 0755 -s pigs /usr/local/bin
|
2015-04-23 09:58:59 +02:00
|
|
|
sudo python2 setup.py install
|
|
|
|
sudo python3 setup.py install
|
2015-05-27 21:00:26 +02:00
|
|
|
sudo install -m 0755 -d /usr/local/man/man1
|
|
|
|
sudo install -m 0644 *.1 /usr/local/man/man1
|
|
|
|
sudo install -m 0755 -d /usr/local/man/man3
|
|
|
|
sudo install -m 0644 *.3 /usr/local/man/man3
|
|
|
|
sudo ldconfig
|
2013-12-12 11:27:22 +01:00
|
|
|
|
|
|
|
uninstall:
|
2013-12-12 11:32:49 +01:00
|
|
|
sudo rm -f /usr/local/include/pigpio.h
|
2014-01-12 22:31:59 +01:00
|
|
|
sudo rm -f /usr/local/include/pigpiod_if.h
|
2013-12-12 11:32:49 +01:00
|
|
|
sudo rm -f /usr/local/lib/libpigpio.a
|
2014-01-12 22:31:59 +01:00
|
|
|
sudo rm -f /usr/local/lib/libpigpiod_if.a
|
2015-05-27 21:00:26 +02:00
|
|
|
sudo rm -f /usr/local/lib/libpigpio.so
|
|
|
|
sudo rm -f /usr/local/lib/libpigpiod_if.so
|
2013-12-12 11:27:22 +01:00
|
|
|
sudo rm -f /usr/local/bin/pig2vcd
|
|
|
|
sudo rm -f /usr/local/bin/pigpiod
|
|
|
|
sudo rm -f /usr/local/bin/pigs
|
2015-04-23 09:58:59 +02:00
|
|
|
echo removing python2 files
|
|
|
|
sudo python2 setup.py install --record /tmp/pigpio >/dev/null
|
|
|
|
sudo xargs rm -f < /tmp/pigpio >/dev/null
|
|
|
|
echo removing python3 files
|
|
|
|
sudo python3 setup.py install --record /tmp/pigpio >/dev/null
|
|
|
|
sudo xargs rm -f < /tmp/pigpio >/dev/null
|
2014-08-01 10:30:25 +02:00
|
|
|
sudo rm -f /usr/local/man/man1/pig*.1
|
|
|
|
sudo rm -f /usr/local/man/man3/pig*.3
|
2015-05-27 21:00:26 +02:00
|
|
|
sudo 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)
|
|
|
|
|
|
|
|
$(LIB1_ST): $(OBJ1)
|
|
|
|
$(AR) rcs $(LIB1_ST) $(OBJ1)
|
|
|
|
$(RANLIB) $(LIB1_ST)
|
|
|
|
$(STRIPLIB) $(LIB1_ST)
|
|
|
|
$(SIZE) $(LIB1_ST)
|
2013-12-12 11:27:22 +01:00
|
|
|
|
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)
|
|
|
|
|
|
|
|
$(LIB2_ST): $(OBJ2)
|
|
|
|
$(AR) rcs $(LIB2_ST) $(OBJ2)
|
|
|
|
$(RANLIB) $(LIB2_ST)
|
|
|
|
$(STRIPLIB) $(LIB2_ST)
|
|
|
|
$(SIZE) $(LIB2_ST)
|
2013-12-12 11:27:22 +01:00
|
|
|
|
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
|