diff --git a/Makefile b/Makefile index b5c7cdb..f4a3d72 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,17 @@ ifdef DEBUG -MFLAGS = DEBUG=${DEBUG} +CXXFLAGS ?= -g -DDEBUG else -MFLAGS = +CXXFLAGS ?= -O3 endif -MANDIR = ${DESTDIR}/usr/share/man -SBINDIR = ${DESTDIR}/usr/sbin +PREFIX ?= /usr/local +CXX ?= g++ +LDFLAGS ?= -lconfuse +OBJ ?= src/log.o src/ndppd.o src/iface.o src/proxy.o src/address.o \ + src/rule.o src/session.o src/conf.o +GZIP ?= /bin/gzip +MANDIR ?= ${DESTDIR}${PREFIX}/share/man +SBINDIR ?= ${DESTDIR}${PREFIX}/sbin all: ndppd ndppd.1.gz ndppd.conf.5.gz @@ -16,15 +22,17 @@ install: all cp ndppd.1.gz ${MANDIR}/man1 cp ndppd.conf.5.gz ${MANDIR}/man5 -ndppd: - cd src && make ${MFLAGS} all && cp ndppd .. - -clean: - rm -f ndppd ndppd.conf.5.gz ndppd.1.gz - cd src && make clean - ndppd.1.gz: - gzip < ndppd.1 > ndppd.1.gz + ${GZIP} < ndppd.1 > ndppd.1.gz ndppd.conf.5.gz: - gzip < ndppd.conf.5 > ndppd.conf.5.gz + ${GZIP} < ndppd.conf.5 > ndppd.conf.5.gz + +ndppd: ${OBJ} + ${CXX} -o ndppd ${LDFLAGS} ${OBJ} + +.cc.o: + ${CXX} -c $(CXXFLAGS) -o $@ $< + +clean: + rm -f ndppd ndppd.conf.5.gz ndppd.1.gz ${OBJ} diff --git a/ndppd.conf.example b/ndppd.conf-dist similarity index 100% rename from ndppd.conf.example rename to ndppd.conf-dist diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index c32d05e..0000000 --- a/src/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -ifdef DEBUG -CFLAGS = -g -DDEBUG -else -CFLAGS = -O3 -endif - -CC = g++ -LDFLAGS = -lconfuse -OBJ = log.o ndppd.o iface.o proxy.o address.o rule.o session.o conf.o - - -all: ndppd - -ndppd: ${OBJ} - ${CC} -o ndppd ${LDFLAGS} ${OBJ} - -.cc.o: - ${CC} -c $(CFLAGS) $< - -clean: - rm -f ndppd ${OBJ} - - diff --git a/src/iface.cc b/src/iface.cc index d879551..2f70e1e 100644 --- a/src/iface.cc +++ b/src/iface.cc @@ -13,9 +13,10 @@ // // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include -#include -#include +#include +#include +#include +#include #include