This commit was manufactured by cvs2svn to create branch
[iptables.git] / ipset / Makefile
1 IPSET_VERSION:=2.2.8
2
3 IPSET_LIB_DIR:=$(LIBDIR)/ipset
4
5 IPSET_CFLAGS:=# -g -DIPSET_DEBUG #-pg # -DIPTC_DEBUG
6 SETTYPES:=ipmap portmap macipmap iphash nethash iptree ipporthash
7
8 ifneq ($(wildcard $(KERNEL_DIR)/include/linux/netfilter_ipv4/ip_set.h),)
9
10 EXTRAS+=ipset/ipset
11 EXTRAS+=$(foreach T, $(SETTYPES),ipset/libipset_$(T).so)
12 EXTRA_INSTALLS+=$(DESTDIR)$(BINDIR)/ipset $(DESTDIR)$(MANDIR)/man8/ipset.8
13 EXTRA_INSTALLS+=$(foreach T, $(SETTYPES), $(DESTDIR)$(LIBDIR)/ipset/libipset_$(T).so)
14
15 #Dependencies
16 ipset/libipset.d: $(foreach T, $(SETTYPES),ipset/ipset_$(T).c)
17         @-$(CC) -M -MG $(CFLAGS) $(IPSET_CFLAGS) $^ | sed -e 's@^.*\.o:@$*.d $*.a($*.o):@' > $@
18
19 #The ipset(8) self
20 ipset/ipset.o: ipset/ipset.c
21         $(CC) $(CFLAGS) $(IPSET_CFLAGS) -DIPSET_VERSION=\"$(IPSET_VERSION)\" -DIPSET_LIB_DIR=\"$(IPSET_LIB_DIR)\" -c -o $@ $<
22
23 ipset/ipset: ipset/ipset.o
24         $(CC) $(CFLAGS) $(IPSET_CFLAGS) -ldl -rdynamic -o $@ $^
25
26 #Pooltypes
27 ipset/ipset_%.o: ipset/ipset_%.c
28         $(CC) $(SH_CFLAGS) $(IPSET_CFLAGS) -o $@ -c $<
29
30 ipset/libipset_%.so: ipset/ipset_%.o
31         $(LD) -shared -o $@ $<
32
33 $(DESTDIR)$(LIBDIR)/ipset/libipset_%.so: ipset/libipset_%.so
34         @[ -d $(DESTDIR)$(LIBDIR)/ipset ] || mkdir -p $(DESTDIR)$(LIBDIR)/ipset
35         cp $< $@
36
37 $(DESTDIR)$(BINDIR)/ipset: ipset/ipset
38         @[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
39         cp $< $@
40
41 $(DESTDIR)$(MANDIR)/man8/ipset.8: ipset/ipset.8
42         @[ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
43         cp $< $@
44
45 endif