summaryrefslogtreecommitdiffstats
path: root/src/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/Makefile b/src/Makefile
index db683a2..5863414 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,30 +1,25 @@
-TARGETS=squark-auth-snmp squark-auth-ip squark-filter squarkdb.so
+progs-y += squark-filter squark-auth-snmp squark-auth-ip
+shlibs-y += squarkdb.so
+scripts-y += sqdb-build.lua
-NETSNMP_CFLAGS:=$(shell net-snmp-config --cflags)
-NETSNMP_LIBS:=$(shell net-snmp-config --libs)
-LUA_CFLAGS:=$(shell pkg-config --cflags lua5.1)
-LUA_LIBS:=$(shell pkg-config --libs lua5.1)
-CMPH_CFLAGS:=$(shell pkg-config --cflags cmph)
-CMPH_LIBS:=$(shell pkg-config --libs cmph)
+common-objs += filterdb.o authdb.o blob.o addr.o
-CC=gcc
-CFLAGS=-g -I. $(NETSNMP_CFLAGS) $(LUA_CFLAGS) $(CMPH_CFLAGS) -std=gnu99 -D_GNU_SOURCE -Wall
-LIBS+=-lrt
+squark-filter-objs += squark-filter.o $(common-objs)
+squark-auth-snmp-objs += squark-auth-snmp.o $(common-objs)
+squark-auth-ip-objs += squark-auth-ip.o $(common-objs)
+squarkdb.so-objs += lua-squarkdb.o filterdb.o blob.o
-all: $(TARGETS)
+CFLAGS += -DSQUARK_VERSION=\"$(FULL_VERSION)\"
+LIBS += -lrt
-squark-auth-snmp: squark-auth-snmp.o filterdb.o authdb.o blob.o addr.o
- $(CC) -o $@ $^ $(NETSNMP_LIBS) $(LIBS)
+CFLAGS_lua-squarkdb.o += $(shell pkg-config --cflags lua5.1)
+LIBS_squark-filter += $(shell pkg-config --libs cmph)
+LIBS_squark-auth-snmp += $(shell net-snmp-config --libs)
+LIBS_squarkdb.so += $(shell pkg-config --libs lua5.1)
-squark-auth-ip: squark-auth-ip.o filterdb.o authdb.o blob.o addr.o
- $(CC) -o $@ $^ $(LIBS)
-
-squark-filter: squark-filter.o filterdb.o authdb.o blob.o addr.o
- $(CC) -o $@ $^ $(CMPH_LIBS) $(LIBS)
-
-squarkdb.so: lua-squarkdb.o filterdb.o blob.o
- $(CC) -shared -o $@ $^ $(LUA_LIBS) $(CMPH_LIBS) $(LIBS)
-
-clean:
- rm $(OBJS1) $(TARGETS)
+install:
+ $(INSTALLDIR) $(DESTDIR)$(BINDIR)
+ $(INSTALL) $(addprefix $(obj)/,$(progs-y) $(scripts-y)) $(DESTDIR)$(BINDIR)
+ $(INSTALLDIR) $(DESTDIR)$(LUALIBDIR)
+ $(INSTALL) $(addprefix $(obj)/,$(shlibs-y)) $(DESTDIR)$(LUALIBDIR) \ No newline at end of file