Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 1 | # ebtables Makefile |
| 2 | |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 3 | PROGNAME:=ebtables |
Bart De Schuymer | 64182a3 | 2004-01-21 20:39:54 +0000 | [diff] [blame] | 4 | PROGVERSION:=2.0.7 |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 5 | PROGDATE:=June\ 2005 |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 6 | |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 7 | # default paths |
Bart De Schuymer | 38561e9 | 2004-02-23 09:20:42 +0000 | [diff] [blame] | 8 | LIBDIR:=/usr/lib |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 9 | MANDIR:=/usr/local/man |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 10 | BINDIR:=/usr/local/sbin |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 11 | ETCDIR:=/etc |
Bart De Schuymer | 38561e9 | 2004-02-23 09:20:42 +0000 | [diff] [blame] | 12 | DESTDIR:= |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 13 | |
| 14 | # include DESTDIR param |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 15 | override LIBDIR:=$(DESTDIR)$(LIBDIR)/$(PROGNAME) |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 16 | override MANDIR:=$(DESTDIR)$(MANDIR) |
| 17 | override BINDIR:=$(DESTDIR)$(BINDIR) |
| 18 | override ETCDIR:=$(DESTDIR)$(ETCDIR) |
| 19 | |
| 20 | |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 21 | CFLAGS:=-Wall -Wunused |
Bart De Schuymer | 06a1b46 | 2002-09-07 11:51:13 +0000 | [diff] [blame] | 22 | CC:=gcc |
Bart De Schuymer | 64182a3 | 2004-01-21 20:39:54 +0000 | [diff] [blame] | 23 | LD:=ld |
Bart De Schuymer | 3c1e00c | 2002-12-07 11:18:57 +0000 | [diff] [blame] | 24 | |
Bart De Schuymer | 60c2009 | 2003-07-23 21:34:21 +0000 | [diff] [blame] | 25 | ifeq ($(shell uname -m),sparc64) |
| 26 | CFLAGS+=-DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32 |
| 27 | endif |
| 28 | |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 29 | include extensions/Makefile |
| 30 | |
Bart De Schuymer | 64182a3 | 2004-01-21 20:39:54 +0000 | [diff] [blame] | 31 | OBJECTS2:=getethertype.o communication.o libebtc.o \ |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 32 | useful_functions.o ebtables.o |
Bart De Schuymer | 64182a3 | 2004-01-21 20:39:54 +0000 | [diff] [blame] | 33 | |
| 34 | OBJECTS:=$(OBJECTS2) ebtables.o $(EXT_OBJS) $(EXT_LIBS) |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 35 | |
Bart De Schuymer | 06a9682 | 2003-02-19 20:09:51 +0000 | [diff] [blame] | 36 | KERNEL_INCLUDES?=include/ |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 37 | |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 38 | ETHERTYPESPATH?=$(ETCDIR) |
Bart De Schuymer | a296038 | 2003-04-01 17:29:13 +0000 | [diff] [blame] | 39 | ETHERTYPESFILE:=$(ETHERTYPESPATH)/ethertypes |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 40 | |
Bart De Schuymer | a43530a | 2005-01-22 23:08:54 +0000 | [diff] [blame] | 41 | PIPE_DIR?=/tmp/$(PROGNAME)-v$(PROGVERSION) |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 42 | PIPE=$(PIPE_DIR)/ebtablesd_pipe |
| 43 | EBTD_CMDLINE_MAXLN?=2048 |
| 44 | EBTD_ARGC_MAX?=50 |
| 45 | |
| 46 | BINFILE_EBT:=$(BINDIR)/$(PROGNAME) |
| 47 | BINFILE_EBTD:=$(BINDIR)/$(PROGNAME)d |
| 48 | BINFILE_EBTU:=$(BINDIR)/$(PROGNAME)u |
Bart De Schuymer | f43456b | 2003-02-15 11:12:01 +0000 | [diff] [blame] | 49 | |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 50 | PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \ |
| 51 | -DPROGNAME=\"$(PROGNAME)\" \ |
| 52 | -DPROGDATE=\"$(PROGDATE)\" \ |
fnm3 | 9bb3d0a | 2002-11-21 10:42:56 +0000 | [diff] [blame] | 53 | -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\" |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 54 | |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 55 | PROGSPECSD:=-DPROGVERSION=\"$(PROGVERSION)\" \ |
| 56 | -DPROGNAME=\"$(PROGNAME)\" \ |
| 57 | -DPROGDATE=\"$(PROGDATE)\" \ |
| 58 | -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\" \ |
| 59 | -DEBTD_CMDLINE_MAXLN=$(EBTD_CMDLINE_MAXLN) \ |
| 60 | -DEBTD_ARGC_MAX=$(EBTD_ARGC_MAX) \ |
| 61 | -DEBTD_PIPE=\"$(PIPE)\" \ |
| 62 | -DEBTD_PIPE_DIR=\"$(PIPE_DIR)\" |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 63 | |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 64 | # Uncomment for debugging (slower) |
| 65 | #PROGSPECS+=-DEBT_DEBUG |
| 66 | #PROGSPECSD+=-DEBT_DEBUG |
| 67 | |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 68 | all: ebtables daemon |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 69 | |
| 70 | communication.o: communication.c include/ebtables_u.h |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 71 | $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) |
| 72 | |
Bart De Schuymer | 8339ff1 | 2004-01-14 20:05:27 +0000 | [diff] [blame] | 73 | libebtc.o: libebtc.c include/ebtables_u.h |
| 74 | $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) |
| 75 | |
| 76 | useful_functions.o: useful_functions.c include/ebtables_u.h |
| 77 | $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) |
| 78 | |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 79 | getethertype.o: getethertype.c include/ethernetdb.h |
fnm3 | 9bb3d0a | 2002-11-21 10:42:56 +0000 | [diff] [blame] | 80 | $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -Iinclude/ |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 81 | |
| 82 | ebtables.o: ebtables.c include/ebtables_u.h |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 83 | $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 84 | |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 85 | ebtables-standalone.o: ebtables-standalone.c include/ebtables_u.h |
| 86 | $(CC) $(CFLAGS) $(PROGSPECS) -c $< -o $@ -I$(KERNEL_INCLUDES) |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 87 | |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 88 | .PHONY: libebtc |
| 89 | libebtc: $(OBJECTS2) |
Bart De Schuymer | e1c1588 | 2004-05-24 19:57:58 +0000 | [diff] [blame] | 90 | $(LD) -shared -soname libebtc.so -o libebtc.so -lc $(OBJECTS2) |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 91 | |
| 92 | ebtables: $(OBJECTS) ebtables-standalone.o libebtc |
| 93 | $(CC) $(CFLAGS) -o $@ ebtables-standalone.o -I$(KERNEL_INCLUDES) -L. -Lextensions -lebtc $(EXT_LIBSI) \ |
| 94 | -Wl,-rpath,$(LIBDIR) |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 95 | |
| 96 | ebtablesu: ebtablesu.c |
| 97 | $(CC) $(CFLAGS) $(PROGSPECSD) $< -o $@ |
| 98 | |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 99 | ebtablesd.o: ebtablesd.c include/ebtables_u.h |
| 100 | $(CC) $(CFLAGS) $(PROGSPECSD) -c $< -o $@ -I$(KERNEL_INCLUDES) |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 101 | |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 102 | ebtablesd: $(OBJECTS) ebtablesd.o libebtc |
| 103 | $(CC) $(CFLAGS) -o $@ ebtablesd.o -I$(KERNEL_INCLUDES) -L. -Lextensions -lebtc $(EXT_LIBSI) \ |
| 104 | -Wl,-rpath,$(LIBDIR) |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 105 | |
| 106 | .PHONY: daemon |
| 107 | daemon: ebtablesd ebtablesu |
| 108 | |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 109 | $(MANDIR)/man8/ebtables.8: ebtables.8 |
| 110 | mkdir -p $(@D) |
| 111 | install -m 0644 -o root -g root $< $@ |
| 112 | |
Bart De Schuymer | 2eb1f92 | 2002-11-22 18:55:55 +0000 | [diff] [blame] | 113 | $(ETHERTYPESFILE): ethertypes |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 114 | mkdir -p $(@D) |
| 115 | install -m 0644 -o root -g root $< $@ |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 116 | |
Bart De Schuymer | 3289054 | 2002-07-10 20:09:56 +0000 | [diff] [blame] | 117 | .PHONY: exec |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 118 | exec: ebtables daemon |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 119 | mkdir -p $(BINDIR) |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 120 | install -m 0755 -o root -g root $(PROGNAME) $(BINFILE_EBT) |
| 121 | install -m 0755 -o root -g root $(PROGNAME)d $(BINFILE_EBTD) |
| 122 | install -m 0755 -o root -g root $(PROGNAME)u $(BINFILE_EBTU) |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 123 | |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 124 | .PHONY: install |
Bart De Schuymer | f43456b | 2003-02-15 11:12:01 +0000 | [diff] [blame] | 125 | install: $(MANDIR)/man8/ebtables.8 $(ETHERTYPESFILE) exec |
Bart De Schuymer | 0f5e3fe | 2004-02-10 18:08:00 +0000 | [diff] [blame] | 126 | mkdir -p $(LIBDIR) |
Bart De Schuymer | 64182a3 | 2004-01-21 20:39:54 +0000 | [diff] [blame] | 127 | install -m 0755 extensions/*.so $(LIBDIR) |
| 128 | install -m 0755 *.so $(LIBDIR) |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 129 | |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 130 | .PHONY: clean |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 131 | clean: |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 132 | rm -f ebtables ebtablesd ebtablesu |
Bart De Schuymer | 64182a3 | 2004-01-21 20:39:54 +0000 | [diff] [blame] | 133 | rm -f *.o *.c~ *.so |
| 134 | rm -f extensions/*.o extensions/*.c~ extensions/*.so |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 135 | |
| 136 | DIR:=$(PROGNAME)-v$(PROGVERSION) |
| 137 | # This is used to make a new userspace release |
| 138 | .PHONY: release |
| 139 | release: |
| 140 | mkdir -p include/linux/netfilter_bridge |
| 141 | install -m 0644 -o root -g root \ |
| 142 | $(KERNEL_INCLUDES)/linux/netfilter_bridge.h include/linux/ |
| 143 | # To keep possible compile error complaints about undefined ETH_P_8021Q |
| 144 | # off my back |
| 145 | install -m 0644 -o root -g root \ |
| 146 | $(KERNEL_INCLUDES)/linux/if_ether.h include/linux/ |
| 147 | install -m 0644 -o root -g root \ |
| 148 | $(KERNEL_INCLUDES)/linux/netfilter_bridge/*.h \ |
| 149 | include/linux/netfilter_bridge/ |
Bart De Schuymer | 60c2009 | 2003-07-23 21:34:21 +0000 | [diff] [blame] | 150 | install -m 0644 -o root -g root \ |
| 151 | include/ebtables.h include/linux/netfilter_bridge/ |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 152 | make clean |
Bart De Schuymer | e29506d | 2003-07-26 11:53:32 +0000 | [diff] [blame] | 153 | touch * |
| 154 | touch extensions/* |
| 155 | touch include/* |
| 156 | touch include/linux/* |
| 157 | touch include/linux/netfilter_bridge/* |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 158 | cd ..;tar -c $(DIR) | gzip >$(DIR).tar.gz |
Bart De Schuymer | 8bde101 | 2004-11-20 13:00:52 +0000 | [diff] [blame] | 159 | |
| 160 | .PHONY: test_ulog |
| 161 | test_ulog: examples/ulog/test_ulog.c getethertype.o |
| 162 | $(CC) $(CFLAGS) $< -o test_ulog -I$(KERNEL_INCLUDES) -lc \ |
| 163 | getethertype.o |
| 164 | mv test_ulog examples/ulog/ |
| 165 | |
| 166 | .PHONY: examples |
| 167 | examples: test_ulog |