Update Makefile and fix compilation errors

This commit is contained in:
Daniel Adolfsson 2011-10-10 13:05:24 +02:00
parent 5208248f25
commit 4bebf388a5
4 changed files with 25 additions and 39 deletions

View File

@ -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}

View File

@ -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}

View File

@ -13,9 +13,10 @@
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cstddef>
#include <unistd.h>