missed
[iptables.git] / ipset / Makefile
1 IPSET_VERSION:=2.3.0
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 iptreemap ipporthash
7
8 # for building on fedora 8
9 ifneq "$(shell ld --help | grep build-id)" ""
10 #not needed# CFLAGS += -Wl,--build-id
11 LD += --build-id
12 endif
13
14 ifneq ($(wildcard $(KERNEL_DIR)/include/linux/netfilter_ipv4/ip_set.h),)
15
16 EXTRAS+=ipset/ipset
17 EXTRAS+=$(foreach T, $(SETTYPES),ipset/libipset_$(T).so)
18 EXTRA_INSTALLS+=$(DESTDIR)$(BINDIR)/ipset $(DESTDIR)$(MANDIR)/man8/ipset.8
19 EXTRA_INSTALLS+=$(foreach T, $(SETTYPES), $(DESTDIR)$(LIBDIR)/ipset/libipset_$(T).so)
20
21 #Dependencies
22 ipset/libipset.d: $(foreach T, $(SETTYPES),ipset/ipset_$(T).c)
23         @-$(CC) -M -MG $(CFLAGS) $(IPSET_CFLAGS) $^ | sed -e 's@^.*\.o:@$*.d $*.a($*.o):@' > $@
24
25 #The ipset(8) self
26 ipset/ipset.o: ipset/ipset.c
27         $(CC) $(CFLAGS) $(IPSET_CFLAGS) -DIPSET_VERSION=\"$(IPSET_VERSION)\" -DIPSET_LIB_DIR=\"$(IPSET_LIB_DIR)\" -c -o $@ $<
28
29 ipset/ipset: ipset/ipset.o
30         $(CC) $(CFLAGS) $(IPSET_CFLAGS) -ldl -rdynamic -o $@ $^
31
32 #Pooltypes
33 ipset/ipset_%.o: ipset/ipset_%.c
34         $(CC) $(SH_CFLAGS) $(IPSET_CFLAGS) -o $@ -c $<
35
36 ipset/libipset_%.so: ipset/ipset_%.o
37         $(CC) -shared -o $@ $<
38
39 $(DESTDIR)$(LIBDIR)/ipset/libipset_%.so: ipset/libipset_%.so
40         @[ -d $(DESTDIR)$(LIBDIR)/ipset ] || mkdir -p $(DESTDIR)$(LIBDIR)/ipset
41         cp $< $@
42
43 $(DESTDIR)$(BINDIR)/ipset: ipset/ipset
44         @[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
45         cp $< $@
46
47 $(DESTDIR)$(MANDIR)/man8/ipset.8: ipset/ipset.8
48         @[ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
49         cp $< $@
50
51 endif