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 | 5245182 | 2000-08-27 07:47:46 +0000 | [diff] [blame] | 7 | NETFILTER_VERSION:=1.1.2 |
| 8 | OLD_NETFILTER_VERSION:=1.1.1 |
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 |
James Morris | c82e9ac | 2000-11-24 14:34:02 +0000 | [diff] [blame] | 13 | INCDIR:=/usr/local/include |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 14 | |
Rusty Russell | 8c245b5 | 2000-07-14 08:01:22 +0000 | [diff] [blame] | 15 | COPT_FLAGS:=-O2 -DNDEBUG |
| 16 | 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] | 17 | |
Rusty Russell | 5622f21 | 2000-05-02 16:42:09 +0000 | [diff] [blame] | 18 | DEPFILES = $(SHARED_LIBS:%.so=%.d) |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 19 | SH_CFLAGS:=$(CFLAGS) -fPIC |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 20 | |
Harald Welte | ae1ff9f | 2000-12-01 14:26:20 +0000 | [diff] [blame] | 21 | EXTRAS+=iptables iptables.o iptables-save iptables-restore # ip6tables ip6tables.o |
| 22 | EXTRA_INSTALLS+=$(DESTDIR)$(BINDIR)/iptables $(DESTDIR)$(MANDIR)/man8/iptables.8 $(DESTDIR)$(BINDIR)/iptables-save $(DESTDIR)$(BINDIR)/iptables-restore # $(DESTDIR)$(BINDIR)/ip6tables |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 23 | |
Rusty Russell | 09b9a41 | 2000-04-27 10:16:47 +0000 | [diff] [blame] | 24 | # Sparc64 hack |
| 25 | ifeq ($(shell uname -m),sparc64) |
| 26 | # The kernel is 64-bit, even though userspace is 32. |
Rusty Russell | c8d7d89 | 2000-09-19 07:01:00 +0000 | [diff] [blame] | 27 | CFLAGS+=-DIPT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32 |
Rusty Russell | 09b9a41 | 2000-04-27 10:16:47 +0000 | [diff] [blame] | 28 | endif |
| 29 | |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 30 | ifndef IPT_LIBDIR |
| 31 | IPT_LIBDIR:=$(LIBDIR)/iptables |
| 32 | endif |
| 33 | |
Rusty Russell | 5245182 | 2000-08-27 07:47:46 +0000 | [diff] [blame] | 34 | default: print-extensions all |
| 35 | |
| 36 | print-extensions: |
Rusty Russell | c8d7d89 | 2000-09-19 07:01:00 +0000 | [diff] [blame] | 37 | @[ -n "$(OPTIONALS)" ] && echo Extensions found: $(OPTIONALS) |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 38 | |
| 39 | iptables.o: iptables.c |
| 40 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -c -o $@ $< |
| 41 | |
| 42 | iptables: iptables-standalone.c iptables.o libiptc/libiptc.a |
| 43 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -rdynamic -o $@ $^ -ldl |
| 44 | |
| 45 | $(DESTDIR)$(BINDIR)/iptables: iptables |
| 46 | @[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) |
| 47 | cp $< $@ |
| 48 | |
| 49 | iptables-save: iptables-save.c iptables.o libiptc/libiptc.a |
| 50 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -rdynamic -o $@ $^ -ldl |
| 51 | |
| 52 | $(DESTDIR)$(BINDIR)/iptables-save: iptables-save |
| 53 | @[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) |
| 54 | cp $< $@ |
| 55 | |
| 56 | iptables-restore: iptables-restore.c iptables.o libiptc/libiptc.a |
| 57 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -rdynamic -o $@ $^ -ldl |
| 58 | |
| 59 | $(DESTDIR)$(BINDIR)/iptables-restore: iptables-restore |
| 60 | @[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) |
| 61 | cp $< $@ |
| 62 | |
Philip Blundell | 8c70090 | 2000-05-15 02:17:52 +0000 | [diff] [blame] | 63 | ip6tables.o: ip6tables.c |
| 64 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -c -o $@ $< |
| 65 | |
| 66 | ip6tables: ip6tables-standalone.c ip6tables.o libiptc/libiptc.a |
| 67 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -rdynamic -o $@ $^ -ldl |
| 68 | |
| 69 | $(DESTDIR)$(BINDIR)/ip6tables: ip6tables |
| 70 | @[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) |
| 71 | cp $< $@ |
| 72 | |
| 73 | ip6tables-save: ip6tables-save.c ip6tables.o libiptc/libiptc.a |
| 74 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -rdynamic -o $@ $^ -ldl |
| 75 | |
| 76 | $(DESTDIR)$(BINDIR)/ip6tables-save: ip6tables-save |
| 77 | @[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) |
| 78 | cp $< $@ |
| 79 | |
| 80 | ip6tables-restore: ip6tables-restore.c ip6tables.o libiptc/libiptc.a |
| 81 | $(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -rdynamic -o $@ $^ -ldl |
| 82 | |
| 83 | $(DESTDIR)$(BINDIR)/ip6tables-restore: ip6tables-restore |
| 84 | @[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) |
| 85 | cp $< $@ |
| 86 | |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 87 | $(DESTDIR)$(MANDIR)/man8/iptables.8: iptables.8 |
| 88 | @[ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8 |
| 89 | cp $< $@ |
| 90 | |
| 91 | EXTRA_DEPENDS+=iptables-standalone.d iptables.d |
| 92 | |
| 93 | iptables-standalone.d iptables.d: %.d: %.c |
| 94 | @-$(CC) -M -MG $(CFLAGS) $< | sed -e 's@^.*\.o:@$*.d $*.o:@' > $@ |
| 95 | |
James Morris | c82e9ac | 2000-11-24 14:34:02 +0000 | [diff] [blame] | 96 | |
| 97 | # Development Targets |
| 98 | install-devel-man3: $(DEVEL_MAN3) |
| 99 | @[ -d $(DESTDIR)$(MANDIR)/man3 ] || mkdir -p $(DESTDIR)$(MANDIR)/man3 |
| 100 | @cp -v $(DEVEL_MAN3) $(DESTDIR)$(MANDIR)/man3 |
| 101 | |
| 102 | install-devel-headers: $(DEVEL_HEADERS) |
| 103 | @[ -d $(DESTDIR)$(INCDIR) ] || mkdir -p $(DESTDIR)$(INCDIR) |
| 104 | @cp -v $(DEVEL_HEADERS) $(DESTDIR)$(INCDIR) |
| 105 | |
| 106 | install-devel-libs: $(DEVEL_LIBS) |
| 107 | @[ -d $(DESTDIR)$(LIBDIR) ] || mkdir -p $(DESTDIR)$(LIBDIR) |
| 108 | @cp -v $(DEVEL_LIBS) $(DESTDIR)$(LIBDIR) |
| 109 | |
| 110 | install-devel: all install-devel-man3 install-devel-headers install-devel-libs |
| 111 | |
Rusty Russell | 905795c | 2000-04-19 11:22:03 +0000 | [diff] [blame] | 112 | distclean: clean |
Rusty Russell | a470f33 | 2000-11-07 04:08:34 +0000 | [diff] [blame] | 113 | @rm -f TAGS `find . -name '*~' -o -name '.*~'` `find . -name '*.rej'` `find . -name '*.d'` .makefirst |
Rusty Russell | 175f641 | 2000-03-24 09:32:20 +0000 | [diff] [blame] | 114 | |
Rusty Russell | 5245182 | 2000-08-27 07:47:46 +0000 | [diff] [blame] | 115 | .PHONY: patch-o-matic |
Rusty Russell | a470f33 | 2000-11-07 04:08:34 +0000 | [diff] [blame] | 116 | patch-o-matic/ patch-o-matic: |
Rusty Russell | 5245182 | 2000-08-27 07:47:46 +0000 | [diff] [blame] | 117 | @cd $@ && KERNEL_DIR=$(KERNEL_DIR) ./runme |
| 118 | |
Rusty Russell | 175f641 | 2000-03-24 09:32:20 +0000 | [diff] [blame] | 119 | # Rusty's distro magic. |
| 120 | distrib: check nowhitespace distclean delrelease /home/public/netfilter/iptables-$(NETFILTER_VERSION).tar.bz2 diff md5sums |
| 121 | |
| 122 | # Makefile must not define: |
| 123 | # -g -pg |
Rusty Russell | 849779c | 2000-04-23 15:51:51 +0000 | [diff] [blame] | 124 | # And must define -NDEBUG |
Rusty Russell | 175f641 | 2000-03-24 09:32:20 +0000 | [diff] [blame] | 125 | check: |
Rusty Russell | 849779c | 2000-04-23 15:51:51 +0000 | [diff] [blame] | 126 | @if echo $(CFLAGS) | egrep -e '-g|-pg' >/dev/null; then echo Remove debugging flags; exit 1; else exit 0; fi |
| 127 | @if echo $(CFLAGS) | egrep -e NDEBUG >/dev/null; then exit 0; else echo Define -DNDEBUG; exit 1; fi |
Rusty Russell | 175f641 | 2000-03-24 09:32:20 +0000 | [diff] [blame] | 128 | |
| 129 | nowhitespace: |
| 130 | @if grep -n ' $$' `find . -name 'Makefile' -o -name '*.[ch]'`; then exit 1; else exit 0; fi |
| 131 | |
| 132 | delrelease: |
| 133 | rm -f /home/public/netfilter/iptables-$(NETFILTER_VERSION).tar.bz2 |
| 134 | |
| 135 | /home/public/netfilter/iptables-$(NETFILTER_VERSION).tar.bz2: |
Rusty Russell | 905795c | 2000-04-19 11:22:03 +0000 | [diff] [blame] | 136 | cd .. && ln -sf userspace iptables-$(NETFILTER_VERSION) && tar cvf - --exclude CVS iptables-$(NETFILTER_VERSION)/. | bzip2 -9 > $@ && rm iptables-$(NETFILTER_VERSION) |
Rusty Russell | 175f641 | 2000-03-24 09:32:20 +0000 | [diff] [blame] | 137 | |
| 138 | diff: /home/public/netfilter/iptables-$(NETFILTER_VERSION).tar.bz2 |
| 139 | @mkdir /tmp/diffdir |
| 140 | @cd /tmp/diffdir && tar xfI /home/public/netfilter/iptables-$(NETFILTER_VERSION).tar.bz2 |
| 141 | @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 |
| 142 | @rm -rf /tmp/diffdir |
| 143 | |
| 144 | md5sums: |
| 145 | cd /home/public/netfilter/ && md5sum patch-iptables-*-$(NETFILTER_VERSION).bz2 iptables-$(NETFILTER_VERSION).tar.bz2 |
| 146 | |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 147 | # $(wildcard) fails wierdly with make v.3.78.1. |
| 148 | include $(shell echo */Makefile) |
| 149 | include Rules.make |