pigpio/Makefile

105 lines
2.9 KiB
Makefile
Raw Normal View History

2015-02-02 22:11:28 +01:00
#
CC = gcc
AR = ar
RANLIB = ranlib
SIZE = size
SHLIB = gcc -shared
STRIPLIB = strip --strip-unneeded
2013-12-12 11:27:22 +01:00
CFLAGS += -O3 -Wall
2013-12-12 11:27:22 +01: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
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-06-18 12:46:46 +02:00
LIB = $(LIB1) $(LIB2)
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
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)
$(CC) -o x_pigpio x_pigpio.o $(LL1)
2014-03-13 16:50:23 +01:00
x_pigpiod_if: x_pigpiod_if.o $(LIB2)
$(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)
$(CC) -o pigpiod pigpiod.o $(LL1)
2014-01-12 22:31:59 +01:00
pigs: pigs.o command.o
$(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
$(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
install: $(ALL)
2015-08-30 10:40:42 +02:00
install -m 0755 -d /opt/pigpio/cgi
install -m 0755 -d /usr/local/include
install -m 0644 pigpio.h /usr/local/include
install -m 0644 pigpiod_if.h /usr/local/include
install -m 0755 -d /usr/local/lib
install -m 0755 libpigpio.so /usr/local/lib
install -m 0755 libpigpiod_if.so /usr/local/lib
install -m 0755 -d /usr/local/bin
install -m 0755 -s pig2vcd /usr/local/bin
install -m 0755 -s pigpiod /usr/local/bin
install -m 0755 -s pigs /usr/local/bin
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-08-30 10:40:42 +02:00
install -m 0755 -d /usr/local/man/man1
install -m 0644 *.1 /usr/local/man/man1
install -m 0755 -d /usr/local/man/man3
install -m 0644 *.3 /usr/local/man/man3
ldconfig
2013-12-12 11:27:22 +01:00
uninstall:
2015-08-30 10:40:42 +02:00
rm -f /usr/local/include/pigpio.h
rm -f /usr/local/include/pigpiod_if.h
rm -f /usr/local/lib/libpigpio.so
rm -f /usr/local/lib/libpigpiod_if.so
rm -f /usr/local/bin/pig2vcd
rm -f /usr/local/bin/pigpiod
rm -f /usr/local/bin/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-08-30 10:40:42 +02:00
rm -f /usr/local/man/man1/pig*.1
rm -f /usr/local/man/man3/pig*.3
ldconfig
2013-12-12 11:27:22 +01:00
2014-01-12 22:31:59 +01:00
$(LIB1): $(OBJ1)
$(SHLIB) -o $(LIB1) $(OBJ1)
$(STRIPLIB) $(LIB1)
$(SIZE) $(LIB1)
2014-01-12 22:31:59 +01:00
$(LIB2): $(OBJ2)
$(SHLIB) -o $(LIB2) $(OBJ2)
$(STRIPLIB) $(LIB2)
$(SIZE) $(LIB2)
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