LIBUPNP_PREFIX=$(LOCALBASE)

INCLUDES= -I$(LIBUPNP_PREFIX)/include -I../include
LIBS= $(PTHREAD_LIBS) -lupnp -lixml -lthreadutil -L$(LIBUPNP_PREFIX)/lib -L../libs
FILES= main.o gatedevice.o pmlist.o util.o config.o

CFLAGS += -Wall -g -O2

all: upnpd

upnpd: $(FILES)
	$(CC) $(CFLAGS) $(FILES) $(LIBS) -o $@
	@echo "make $@ finished on `date`"

%.o:	%.c
	$(CC) $(CFLAGS) $(INCLUDES) -c $<

clean:
	rm -f *.o upnpd

install: upnpd
	install -d $(PREFIX)/etc/linuxigd
	$(BSD_INSTALL_DATA) etc/gatedesc.xml $(PREFIX)/etc/linuxigd
	$(BSD_INSTALL_DATA) etc/gateconnSCPD.xml $(PREFIX)/etc/linuxigd
	$(BSD_INSTALL_DATA) etc/gateicfgSCPD.xml $(PREFIX)/etc/linuxigd
	$(BSD_INSTALL_DATA) etc/dummy.xml $(PREFIX)/etc/linuxigd
	$(BSD_INSTALL_PROGRAM) upnpd $(PREFIX)/sbin
	$(BSD_INSTALL_DATA) upnpd.8 $(PREFIX)/man/man8
	$(BSD_INSTALL_DATA) etc/upnpd.conf $(PREFIX)/etc/upnpd.conf.sample
	if [ ! -f $(PREFIX)/etc/upnpd.conf ]; then $(BSD_INSTALL_DATA) $(PREFIX)/etc/upnpd.conf.sample $(PREFIX)/etc/upnpd.conf; fi


syntax highlighted by Code2HTML, v. 0.9.1