really save options
[pve-firewall.git] / src / Makefile
index 3a578cd..590a783 100644 (file)
@@ -1,28 +1,34 @@
 
-PREFIX=/usr
-BINDIR=${PREFIX}/bin
-SBINDIR=${PREFIX}/bin
-MANDIR=${PREFIX}/share/man
-DOCDIR=${PREFIX}/share/doc
-MAN1DIR=${MANDIR}/man1/
-PERLDIR=${PREFIX}/share/perl5
+export PREFIX=/usr
+export BINDIR=${PREFIX}/bin
+export SBINDIR=${PREFIX}/sbin
+export MANDIR=${PREFIX}/share/man
+export DOCDIR=${PREFIX}/share/doc
+export MAN1DIR=${MANDIR}/man1/
+export PERLDIR=${PREFIX}/share/perl5
 
-LIB_SOURCES=                   \
-       Firewall.pm
+all: pvefw-logger
 
-all:
+CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
+CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
+LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
+
+pvefw-logger: pvefw-logger.c
+       gcc -Wall -Werror pvefw-logger.c -o pvefw-logger -std=gnu99 \
+       $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
+       $(shell pkg-config libnetfilter_log glib-2.0 gthread-2.0 --libs --cflags)
 
 .PHONY: install
-install:
+install: pvefw pvefw-logger
+       make -C PVE install
        install -d -m 0755 ${DESTDIR}/${SBINDIR}
        install -m 0755 pvefw ${DESTDIR}/${SBINDIR}
-       install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE
-       for i in ${LIB_SOURCES}; do install -D -m 0644 PVE/$$i ${DESTDIR}${PERLDIR}/PVE/$$i; done
-
+       install -m 0755 --strip pvefw-logger ${DESTDIR}/${SBINDIR}
 
 .PHONY: clean
 clean:         
-       rm -rf *~
+       make -C PVE clean
+       rm -rf *~ pvefw-logger
 
 .PHONY: distclean
 distclean: clean