1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
PREFIX ?= /usr
#LIBIPTC_PREFIX=/usr
# libupnp version for use with pkgconfig
LIBUPNP=libupnp
CC ?= gcc
CFLAGS ?= -Wall -g -O2
INCLUDES += $(shell pkg-config --cflags $(LIBUPNP))
LIBS += $(shell pkg-config --libs $(LIBUPNP))
FILES= main.o gatedevice.o pmlist.o util.o config.o
ifdef HAVE_LIBIPTC
ifdef LIBIPTC_PREFIX
INCLUDES += $(shell pkg-config --cflags libiptc)
LIBS += $(shell pkg-config --libs libiptc)
endif
# iptables 1.4.3 moves some functions from ip_ namespace to nf_
ifdef HAVE_IPTABLES_143
INCLUDES += -DIPTABLES_143
endif
# xtables now makes available some formerly private iptables bits
ifdef HAVE_XTABLES
INCLUDES += -DHAVE_XTABLES
INCLUDES += $(shell pkg-config --cflags xtables)
LIBS += $(shell pkg-config --libs xtables)
endif
LIBS += -liptc
INCLUDES += -DHAVE_LIBIPTC
FILES += iptc.o
endif
all: upnpd
upnpd: $(FILES)
$(CC) $(LDFLAGS) $(FILES) $(LIBS) -o $@
@echo "make $@ finished on `date`"
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) -D_GNU_SOURCE -c $<
clean:
rm -f *.o upnpd
install: upnpd
install -d $(DESTDIR)/etc/linuxigd
install -m0644 -p etc/gatedesc.xml $(DESTDIR)/etc/linuxigd
install -m0644 -p etc/gateconnSCPD.xml $(DESTDIR)/etc/linuxigd
install -m0644 -p etc/gateicfgSCPD.xml $(DESTDIR)/etc/linuxigd
install -m0644 -p etc/dummy.xml $(DESTDIR)/etc/linuxigd
install -D upnpd $(DESTDIR)$(PREFIX)/sbin/upnpd
install -D -m0644 -p upnpd.8 $(DESTDIR)$(PREFIX)/share/man/man8/upnpd.8
if [ ! -f $(DESTDIR)/etc/upnpd.conf ]; then install -p -m0644 etc/upnpd.conf $(DESTDIR)/etc; fi
|