--- a/makefile +++ b/makefile @@ -18,9 +18,12 @@ # Configuration: CC = gcc - -all: CFLAGS = -DLINBPQ -MMD -g -fcommon -all: LDFLAGS = -l:libpaho-mqtt3a.a -l:libjansson.a +CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) +CFLAGS+=$(shell dpkg-buildflags --get CPPFLAGS) +LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) + +all: CFLAGS += -DLINBPQ -MMD -g -fcommon +all: LIBS = -lpaho-mqtt3a -ljansson -lminiupnpc -lrt -lm -lz -lpthread -lconfig -lpcap all: linbpq @@ -32,12 +35,15 @@ linbpq: $(OBJS) - gcc $(OBJS) -Xlinker -Map=output.map -l:libminiupnpc.a -lrt -lm -lz $(LDFLAGS) -lpthread -lconfig -lpcap -o linbpq - sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq + gcc $(OBJS) $(LDFLAGS) $(LIBS) -o linbpq + # sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq -include *.d -clean : - rm *.d - rm linbpq $(OBJS) - +install: + install -b -m 755 -D -d debian/linbpq/usr/sbin + install -b -m 755 -s -p linbpq debian/linbpq/usr/sbin + +clean: + $(RM) *.d + $(RM) linbpq $(OBJS)