Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 1 | # Standard part of Makefile for topdir. |
| 2 | TOPLEVEL_INCLUDED=YES |
| 3 | |
| 4 | ifndef KERNEL_DIR |
| 5 | KERNEL_DIR=/usr/src/linux |
| 6 | endif |
Rusty Russell | 175f641 | 2000-03-24 09:32:20 +0000 | [diff] [blame^] | 7 | NETFILTER_VERSION:=1.0.0beta |
| 8 | OLD_NETFILTER_VERSION:=1.0.0alpha |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 9 | |
| 10 | LIBDIR:=/usr/local/lib |
| 11 | BINDIR:=/usr/local/bin |
| 12 | MANDIR:=/usr/local/man |
| 13 | |
Rusty Russell | 175f641 | 2000-03-24 09:32:20 +0000 | [diff] [blame^] | 14 | COPT_FLAGS:=-O2 |
| 15 | CFLAGS:=$(COPT_FLAGS) -Wall -Wunused -Iinclude/ -I$(KERNEL_DIR)/include -DNETFILTER_VERSION=\"$(NETFILTER_VERSION)\" #-g -pg |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 16 | |
| 17 | DEPFILES := $(SHARED_LIBS:%.so=%.d) |
| 18 | SH_CFLAGS:=$(CFLAGS) -fPIC |
| 19 | DEPFILES := $(SHARED_LIBS:%.so=%.d) |
| 20 | |
| 21 | EXTRAS+=iptables iptables.o #iptables-save iptables-restore |
| 22 | EXTRA_INSTALLS+=$(DESTDIR)$(BINDIR)/iptables $(DESTDIR)$(MANDIR)/man8/iptables.8 #$(DESTDIR)$(BINDIR)/iptables-save $(DESTDIR)$(BINDIR)/iptables-restore |
| 23 | |
| 24 | ifndef IPT_LIBDIR |
| 25 | IPT_LIBDIR:=$(LIBDIR)/iptables |
| 26 | endif |
| 27 | |
| 28 | default: all |
| 29 | |
| 30 | iptables.o: iptables.c |
| 31 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -c -o $@ $< |
| 32 | |
| 33 | iptables: iptables-standalone.c iptables.o libiptc/libiptc.a |
| 34 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -rdynamic -o $@ $^ -ldl |
| 35 | |
| 36 | $(DESTDIR)$(BINDIR)/iptables: iptables |
| 37 | @[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) |
| 38 | cp $< $@ |
| 39 | |
| 40 | iptables-save: iptables-save.c iptables.o libiptc/libiptc.a |
| 41 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -rdynamic -o $@ $^ -ldl |
| 42 | |
| 43 | $(DESTDIR)$(BINDIR)/iptables-save: iptables-save |
| 44 | @[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) |
| 45 | cp $< $@ |
| 46 | |
| 47 | iptables-restore: iptables-restore.c iptables.o libiptc/libiptc.a |
| 48 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -rdynamic -o $@ $^ -ldl |
| 49 | |
| 50 | $(DESTDIR)$(BINDIR)/iptables-restore: iptables-restore |
| 51 | @[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) |
| 52 | cp $< $@ |
| 53 | |
| 54 | $(DESTDIR)$(MANDIR)/man8/iptables.8: iptables.8 |
| 55 | @[ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8 |
| 56 | cp $< $@ |
| 57 | |
| 58 | EXTRA_DEPENDS+=iptables-standalone.d iptables.d |
| 59 | |
| 60 | iptables-standalone.d iptables.d: %.d: %.c |
| 61 | @-$(CC) -M -MG $(CFLAGS) $< | sed -e 's@^.*\.o:@$*.d $*.o:@' > $@ |
| 62 | |
Rusty Russell | 175f641 | 2000-03-24 09:32:20 +0000 | [diff] [blame^] | 63 | |
| 64 | # Rusty's distro magic. |
| 65 | distrib: check nowhitespace distclean delrelease /home/public/netfilter/iptables-$(NETFILTER_VERSION).tar.bz2 diff md5sums |
| 66 | |
| 67 | # Makefile must not define: |
| 68 | # -g -pg |
| 69 | check: |
| 70 | @if echo $(CFLAGS) | egrep 'DEBUG|-g|-pg' >/dev/null; then echo Remove debugging flags; exit 1; else exit 0; fi |
| 71 | |
| 72 | nowhitespace: |
| 73 | @if grep -n ' $$' `find . -name 'Makefile' -o -name '*.[ch]'`; then exit 1; else exit 0; fi |
| 74 | |
| 75 | delrelease: |
| 76 | rm -f /home/public/netfilter/iptables-$(NETFILTER_VERSION).tar.bz2 |
| 77 | |
| 78 | /home/public/netfilter/iptables-$(NETFILTER_VERSION).tar.bz2: |
| 79 | cd .. && ln -sf userspace iptables-$(NETFILTER_VERSION) && tar cvf - --exclude CVS --exclude iptables-$(NETFILTER_VERSION)/. | bzip2 -9 > $@ && rm iptables-$(NETFILTER_VERSION) |
| 80 | |
| 81 | diff: /home/public/netfilter/iptables-$(NETFILTER_VERSION).tar.bz2 |
| 82 | @mkdir /tmp/diffdir |
| 83 | @cd /tmp/diffdir && tar xfI /home/public/netfilter/iptables-$(NETFILTER_VERSION).tar.bz2 |
| 84 | @set -e; cd /tmp/diffdir; tar xfI /home/public/netfilter/iptables-$(OLD_NETFILTER_VERSION).tar.bz2; echo Creating patch-iptables-$(OLD_NETFILTER_VERSION)-$(NETFILTER_VERSION).bz2; diff -urN iptables-$(OLD_NETFILTER_VERSION) iptables-$(NETFILTER_VERSION) | bzip2 -9 > /home/public/netfilter/patch-iptables-$(OLD_NETFILTER_VERSION)-$(NETFILTER_VERSION).bz2 |
| 85 | @rm -rf /tmp/diffdir |
| 86 | |
| 87 | md5sums: |
| 88 | cd /home/public/netfilter/ && md5sum patch-iptables-*-$(NETFILTER_VERSION).bz2 iptables-$(NETFILTER_VERSION).tar.bz2 |
| 89 | |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 90 | # $(wildcard) fails wierdly with make v.3.78.1. |
| 91 | include $(shell echo */Makefile) |
| 92 | include Rules.make |