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 | f9ebb5e | 2010-02-03 21:13:27 +0000 | [diff] [blame] | 4 | PROGRELEASE:=2 |
Bart De Schuymer | 7ae403b | 2009-06-21 13:13:02 +0000 | [diff] [blame] | 5 | PROGVERSION_:=2.0.9 |
Bart De Schuymer | 865dd4d | 2006-12-15 11:37:07 +0000 | [diff] [blame] | 6 | PROGVERSION:=$(PROGVERSION_)-$(PROGRELEASE) |
Bart De Schuymer | 7ae403b | 2009-06-21 13:13:02 +0000 | [diff] [blame] | 7 | PROGDATE:=June\ 2009 |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 8 | |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 9 | # default paths |
Bart De Schuymer | 38561e9 | 2004-02-23 09:20:42 +0000 | [diff] [blame] | 10 | LIBDIR:=/usr/lib |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 11 | MANDIR:=/usr/local/man |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 12 | BINDIR:=/usr/local/sbin |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 13 | ETCDIR:=/etc |
Bart De Schuymer | 50441e9 | 2005-08-30 21:20:55 +0000 | [diff] [blame] | 14 | INITDIR:=/etc/rc.d/init.d |
| 15 | SYSCONFIGDIR:=/etc/sysconfig |
Bart De Schuymer | 38561e9 | 2004-02-23 09:20:42 +0000 | [diff] [blame] | 16 | DESTDIR:= |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 17 | |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 18 | CFLAGS:=-Wall -Wunused |
Bart De Schuymer | 17c60f5 | 2006-12-14 18:55:44 +0000 | [diff] [blame] | 19 | CFLAGS_SH_LIB:=-fPIC |
Bart De Schuymer | 06a1b46 | 2002-09-07 11:51:13 +0000 | [diff] [blame] | 20 | CC:=gcc |
Bart De Schuymer | 3c1e00c | 2002-12-07 11:18:57 +0000 | [diff] [blame] | 21 | |
Bart De Schuymer | 60c2009 | 2003-07-23 21:34:21 +0000 | [diff] [blame] | 22 | ifeq ($(shell uname -m),sparc64) |
| 23 | CFLAGS+=-DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32 |
| 24 | endif |
| 25 | |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 26 | include extensions/Makefile |
| 27 | |
Bart De Schuymer | 64182a3 | 2004-01-21 20:39:54 +0000 | [diff] [blame] | 28 | OBJECTS2:=getethertype.o communication.o libebtc.o \ |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 29 | useful_functions.o ebtables.o |
Bart De Schuymer | 64182a3 | 2004-01-21 20:39:54 +0000 | [diff] [blame] | 30 | |
Bart De Schuymer | 7d9e3eb | 2006-02-06 21:24:02 +0000 | [diff] [blame] | 31 | OBJECTS:=$(OBJECTS2) $(EXT_OBJS) $(EXT_LIBS) |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 32 | |
Bart De Schuymer | 06a9682 | 2003-02-19 20:09:51 +0000 | [diff] [blame] | 33 | KERNEL_INCLUDES?=include/ |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 34 | |
Bart De Schuymer | 3749f30 | 2004-02-11 21:23:38 +0000 | [diff] [blame] | 35 | ETHERTYPESPATH?=$(ETCDIR) |
Bart De Schuymer | a296038 | 2003-04-01 17:29:13 +0000 | [diff] [blame] | 36 | ETHERTYPESFILE:=$(ETHERTYPESPATH)/ethertypes |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 37 | |
Bart De Schuymer | 0ddd575 | 2007-08-12 15:11:40 +0000 | [diff] [blame] | 38 | PIPE_DIR?=/tmp/$(PROGNAME)-v$(PROGVERSION) |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 39 | PIPE=$(PIPE_DIR)/ebtablesd_pipe |
| 40 | EBTD_CMDLINE_MAXLN?=2048 |
| 41 | EBTD_ARGC_MAX?=50 |
| 42 | |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 43 | PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \ |
| 44 | -DPROGNAME=\"$(PROGNAME)\" \ |
| 45 | -DPROGDATE=\"$(PROGDATE)\" \ |
Bart De Schuymer | 9d680cc | 2005-10-01 09:16:51 +0000 | [diff] [blame] | 46 | -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\" \ |
| 47 | -DEBTD_ARGC_MAX=$(EBTD_ARGC_MAX) \ |
| 48 | -DEBTD_CMDLINE_MAXLN=$(EBTD_CMDLINE_MAXLN) |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 49 | |
Bart De Schuymer | 96ee8d1 | 2005-11-04 21:59:57 +0000 | [diff] [blame] | 50 | # You can probably ignore this, ebtables{u,d} are normally not used |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 51 | PROGSPECSD:=-DPROGVERSION=\"$(PROGVERSION)\" \ |
| 52 | -DPROGNAME=\"$(PROGNAME)\" \ |
| 53 | -DPROGDATE=\"$(PROGDATE)\" \ |
| 54 | -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\" \ |
| 55 | -DEBTD_CMDLINE_MAXLN=$(EBTD_CMDLINE_MAXLN) \ |
| 56 | -DEBTD_ARGC_MAX=$(EBTD_ARGC_MAX) \ |
| 57 | -DEBTD_PIPE=\"$(PIPE)\" \ |
| 58 | -DEBTD_PIPE_DIR=\"$(PIPE_DIR)\" |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 59 | |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 60 | # Uncomment for debugging (slower) |
| 61 | #PROGSPECS+=-DEBT_DEBUG |
| 62 | #PROGSPECSD+=-DEBT_DEBUG |
Bart De Schuymer | 96ee8d1 | 2005-11-04 21:59:57 +0000 | [diff] [blame] | 63 | #CFLAGS+=-ggdb |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 64 | |
Bart De Schuymer | 96ee8d1 | 2005-11-04 21:59:57 +0000 | [diff] [blame] | 65 | all: ebtables ebtables-restore |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 66 | |
| 67 | communication.o: communication.c include/ebtables_u.h |
Bart De Schuymer | 17c60f5 | 2006-12-14 18:55:44 +0000 | [diff] [blame] | 68 | $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 69 | |
Bart De Schuymer | 8339ff1 | 2004-01-14 20:05:27 +0000 | [diff] [blame] | 70 | libebtc.o: libebtc.c include/ebtables_u.h |
Bart De Schuymer | 17c60f5 | 2006-12-14 18:55:44 +0000 | [diff] [blame] | 71 | $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) |
Bart De Schuymer | 8339ff1 | 2004-01-14 20:05:27 +0000 | [diff] [blame] | 72 | |
| 73 | useful_functions.o: useful_functions.c include/ebtables_u.h |
Bart De Schuymer | 17c60f5 | 2006-12-14 18:55:44 +0000 | [diff] [blame] | 74 | $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) |
Bart De Schuymer | 8339ff1 | 2004-01-14 20:05:27 +0000 | [diff] [blame] | 75 | |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 76 | getethertype.o: getethertype.c include/ethernetdb.h |
Bart De Schuymer | 17c60f5 | 2006-12-14 18:55:44 +0000 | [diff] [blame] | 77 | $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -Iinclude/ |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 78 | |
| 79 | ebtables.o: ebtables.c include/ebtables_u.h |
Bart De Schuymer | eacf5c9 | 2007-07-03 17:48:53 +0000 | [diff] [blame] | 80 | $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 81 | |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 82 | ebtables-standalone.o: ebtables-standalone.c include/ebtables_u.h |
Bart De Schuymer | eacf5c9 | 2007-07-03 17:48:53 +0000 | [diff] [blame] | 83 | $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c $< -o $@ -I$(KERNEL_INCLUDES) |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 84 | |
Bart De Schuymer | cc17a41 | 2011-06-19 11:35:21 +0000 | [diff] [blame] | 85 | libebtc.so: $(OBJECTS2) |
Bart De Schuymer | 078161d | 2010-03-16 13:10:37 +0000 | [diff] [blame] | 86 | $(CC) -shared $(LDFLAGS) -Wl,-soname,libebtc.so -o libebtc.so -lc $(OBJECTS2) |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 87 | |
Bart De Schuymer | cc17a41 | 2011-06-19 11:35:21 +0000 | [diff] [blame] | 88 | ebtables: $(OBJECTS) ebtables-standalone.o libebtc.so |
Bart De Schuymer | 078161d | 2010-03-16 13:10:37 +0000 | [diff] [blame] | 89 | $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(LDFLAGS) -o $@ ebtables-standalone.o -I$(KERNEL_INCLUDES) -L. -Lextensions -lebtc $(EXT_LIBSI) \ |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 90 | -Wl,-rpath,$(LIBDIR) |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 91 | |
| 92 | ebtablesu: ebtablesu.c |
| 93 | $(CC) $(CFLAGS) $(PROGSPECSD) $< -o $@ |
| 94 | |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 95 | ebtablesd.o: ebtablesd.c include/ebtables_u.h |
| 96 | $(CC) $(CFLAGS) $(PROGSPECSD) -c $< -o $@ -I$(KERNEL_INCLUDES) |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 97 | |
Bart De Schuymer | cc17a41 | 2011-06-19 11:35:21 +0000 | [diff] [blame] | 98 | ebtablesd: $(OBJECTS) ebtablesd.o libebtc.so |
Bart De Schuymer | 838fa5b | 2005-06-18 14:43:32 +0000 | [diff] [blame] | 99 | $(CC) $(CFLAGS) -o $@ ebtablesd.o -I$(KERNEL_INCLUDES) -L. -Lextensions -lebtc $(EXT_LIBSI) \ |
| 100 | -Wl,-rpath,$(LIBDIR) |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 101 | |
Bart De Schuymer | 90db00b | 2005-09-28 19:36:34 +0000 | [diff] [blame] | 102 | ebtables-restore.o: ebtables-restore.c include/ebtables_u.h |
Bart De Schuymer | 9d680cc | 2005-10-01 09:16:51 +0000 | [diff] [blame] | 103 | $(CC) $(CFLAGS) $(PROGSPECS) -c $< -o $@ -I$(KERNEL_INCLUDES) |
Bart De Schuymer | 90db00b | 2005-09-28 19:36:34 +0000 | [diff] [blame] | 104 | |
Bart De Schuymer | cc17a41 | 2011-06-19 11:35:21 +0000 | [diff] [blame] | 105 | ebtables-restore: $(OBJECTS) ebtables-restore.o libebtc.so |
Bart De Schuymer | 078161d | 2010-03-16 13:10:37 +0000 | [diff] [blame] | 106 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ebtables-restore.o -I$(KERNEL_INCLUDES) -L. -Lextensions -lebtc $(EXT_LIBSI) \ |
Bart De Schuymer | 90db00b | 2005-09-28 19:36:34 +0000 | [diff] [blame] | 107 | -Wl,-rpath,$(LIBDIR) |
| 108 | |
Bart De Schuymer | 6622a01 | 2005-01-19 21:09:05 +0000 | [diff] [blame] | 109 | .PHONY: daemon |
| 110 | daemon: ebtablesd ebtablesu |
| 111 | |
Bart De Schuymer | 7d9e3eb | 2006-02-06 21:24:02 +0000 | [diff] [blame] | 112 | # a little scripting for a static binary, making one for ebtables-restore |
| 113 | # should be completely analogous |
| 114 | static: extensions/ebt_*.c extensions/ebtable_*.c ebtables.c communication.c ebtables-standalone.c getethertype.c libebtc.c useful_functions.c |
| 115 | cp ebtables-standalone.c ebtables-standalone.c_ ; \ |
| 116 | cp include/ebtables_u.h include/ebtables_u.h_ ; \ |
| 117 | sed "s/ main(/ pseudomain(/" ebtables-standalone.c > ebtables-standalone.c__ ; \ |
| 118 | mv ebtables-standalone.c__ ebtables-standalone.c ; \ |
| 119 | printf "\nint main(int argc, char *argv[])\n{\n " >> ebtables-standalone.c ; \ |
| 120 | for arg in $(EXT_FUNC) \ |
| 121 | ; do \ |
| 122 | sed s/_init/_$${arg}_init/ extensions/ebt_$${arg}.c > extensions/ebt_$${arg}.c_ ; \ |
| 123 | mv extensions/ebt_$${arg}.c_ extensions/ebt_$${arg}.c ; \ |
| 124 | printf "\t%s();\n" _$${arg}_init >> ebtables-standalone.c ; \ |
| 125 | printf "extern void %s();\n" _$${arg}_init >> include/ebtables_u.h ; \ |
| 126 | done ; \ |
| 127 | for arg in $(EXT_TABLES) \ |
| 128 | ; do \ |
| 129 | sed s/_init/_t_$${arg}_init/ extensions/ebtable_$${arg}.c > extensions/ebtable_$${arg}.c_ ; \ |
| 130 | mv extensions/ebtable_$${arg}.c_ extensions/ebtable_$${arg}.c ; \ |
| 131 | printf "\t%s();\n" _t_$${arg}_init >> ebtables-standalone.c ; \ |
| 132 | printf "extern void %s();\n" _t_$${arg}_init >> include/ebtables_u.h ; \ |
| 133 | done ; \ |
| 134 | printf "\n\tpseudomain(argc, argv);\n\treturn 0;\n}\n" >> ebtables-standalone.c ;\ |
Bart De Schuymer | dc5d9fc | 2006-08-09 10:28:14 +0000 | [diff] [blame] | 135 | $(CC) $(CFLAGS) $(PROGSPECS) -o $@ $^ -I$(KERNEL_INCLUDES) -Iinclude ; \ |
Bart De Schuymer | 7d9e3eb | 2006-02-06 21:24:02 +0000 | [diff] [blame] | 136 | for arg in $(EXT_FUNC) \ |
| 137 | ; do \ |
| 138 | sed "s/ .*_init/ _init/" extensions/ebt_$${arg}.c > extensions/ebt_$${arg}.c_ ; \ |
| 139 | mv extensions/ebt_$${arg}.c_ extensions/ebt_$${arg}.c ; \ |
| 140 | done ; \ |
| 141 | for arg in $(EXT_TABLES) \ |
| 142 | ; do \ |
| 143 | sed "s/ .*_init/ _init/" extensions/ebtable_$${arg}.c > extensions/ebtable_$${arg}.c_ ; \ |
| 144 | mv extensions/ebtable_$${arg}.c_ extensions/ebtable_$${arg}.c ; \ |
| 145 | done ; \ |
| 146 | mv ebtables-standalone.c_ ebtables-standalone.c ; \ |
| 147 | mv include/ebtables_u.h_ include/ebtables_u.h |
| 148 | |
Bart De Schuymer | 50441e9 | 2005-08-30 21:20:55 +0000 | [diff] [blame] | 149 | tmp1:=$(shell printf $(BINDIR) | sed 's/\//\\\//g') |
| 150 | tmp2:=$(shell printf $(SYSCONFIGDIR) | sed 's/\//\\\//g') |
Bart De Schuymer | db97ab2 | 2005-09-01 20:37:07 +0000 | [diff] [blame] | 151 | tmp3:=$(shell printf $(PIPE) | sed 's/\//\\\//g') |
Bart De Schuymer | 50441e9 | 2005-08-30 21:20:55 +0000 | [diff] [blame] | 152 | .PHONY: scripts |
Bart De Schuymer | 90db00b | 2005-09-28 19:36:34 +0000 | [diff] [blame] | 153 | scripts: ebtables-save ebtables.sysv ebtables-config |
Bart De Schuymer | 50441e9 | 2005-08-30 21:20:55 +0000 | [diff] [blame] | 154 | cat ebtables-save | sed 's/__EXEC_PATH__/$(tmp1)/g' > ebtables-save_ |
Bart De Schuymer | 2320f8b | 2010-03-16 13:00:37 +0000 | [diff] [blame] | 155 | mkdir -p $(DESTDIR)$(BINDIR) |
Bart De Schuymer | 0ddd575 | 2007-08-12 15:11:40 +0000 | [diff] [blame] | 156 | install -m 0755 -o root -g root ebtables-save_ $(DESTDIR)$(BINDIR)/ebtables-save |
Bart De Schuymer | db97ab2 | 2005-09-01 20:37:07 +0000 | [diff] [blame] | 157 | cat ebtables.sysv | sed 's/__EXEC_PATH__/$(tmp1)/g' | sed 's/__SYSCONFIG__/$(tmp2)/g' > ebtables.sysv_ |
Bart De Schuymer | 4eba2d4 | 2010-03-18 08:58:44 +0000 | [diff] [blame] | 158 | if [ "$(DESTDIR)" != "" ]; then mkdir -p $(DESTDIR)$(INITDIR); fi |
Bart De Schuymer | 2320f8b | 2010-03-16 13:00:37 +0000 | [diff] [blame] | 159 | if test -d $(DESTDIR)$(INITDIR); then install -m 0755 -o root -g root ebtables.sysv_ $(DESTDIR)$(INITDIR)/ebtables; fi |
Bart De Schuymer | 9336b5a | 2005-11-04 22:01:23 +0000 | [diff] [blame] | 160 | cat ebtables-config | sed 's/__SYSCONFIG__/$(tmp2)/g' > ebtables-config_ |
Bart De Schuymer | 4eba2d4 | 2010-03-18 08:58:44 +0000 | [diff] [blame] | 161 | if [ "$(DESTDIR)" != "" ]; then mkdir -p $(DESTDIR)$(SYSCONFIGDIR); fi |
Bart De Schuymer | 2320f8b | 2010-03-16 13:00:37 +0000 | [diff] [blame] | 162 | if test -d $(DESTDIR)$(SYSCONFIGDIR); then install -m 0600 -o root -g root ebtables-config_ $(DESTDIR)$(SYSCONFIGDIR)/ebtables-config; fi |
Bart De Schuymer | 90db00b | 2005-09-28 19:36:34 +0000 | [diff] [blame] | 163 | rm -f ebtables-save_ ebtables.sysv_ ebtables-config_ |
Bart De Schuymer | 50441e9 | 2005-08-30 21:20:55 +0000 | [diff] [blame] | 164 | |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 165 | $(MANDIR)/man8/ebtables.8: ebtables.8 |
Bart De Schuymer | 0ddd575 | 2007-08-12 15:11:40 +0000 | [diff] [blame] | 166 | mkdir -p $(DESTDIR)$(@D) |
Bart De Schuymer | 1cda4be | 2006-12-17 20:05:02 +0000 | [diff] [blame] | 167 | sed 's/$$(VERSION)/$(PROGVERSION)/' ebtables.8 | sed 's/$$(DATE)/$(PROGDATE)/' > ebtables.8_ |
Bart De Schuymer | 0ddd575 | 2007-08-12 15:11:40 +0000 | [diff] [blame] | 168 | install -m 0644 -o root -g root ebtables.8_ $(DESTDIR)$@ |
Bart De Schuymer | 865dd4d | 2006-12-15 11:37:07 +0000 | [diff] [blame] | 169 | rm -f ebtables.8_ |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 170 | |
Bart De Schuymer | 2320f8b | 2010-03-16 13:00:37 +0000 | [diff] [blame] | 171 | $(DESTDIR)$(ETHERTYPESFILE): ethertypes |
| 172 | mkdir -p $(@D) |
| 173 | install -m 0644 -o root -g root $< $@ |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 174 | |
Bart De Schuymer | 3289054 | 2002-07-10 20:09:56 +0000 | [diff] [blame] | 175 | .PHONY: exec |
Bart De Schuymer | 90db00b | 2005-09-28 19:36:34 +0000 | [diff] [blame] | 176 | exec: ebtables ebtables-restore |
Bart De Schuymer | 0ddd575 | 2007-08-12 15:11:40 +0000 | [diff] [blame] | 177 | mkdir -p $(DESTDIR)$(BINDIR) |
| 178 | install -m 0755 -o root -g root $(PROGNAME) $(DESTDIR)$(BINDIR)/$(PROGNAME) |
| 179 | install -m 0755 -o root -g root ebtables-restore $(DESTDIR)$(BINDIR)/ebtables-restore |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 180 | |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 181 | .PHONY: install |
Bart De Schuymer | 2320f8b | 2010-03-16 13:00:37 +0000 | [diff] [blame] | 182 | install: $(MANDIR)/man8/ebtables.8 $(DESTDIR)$(ETHERTYPESFILE) exec scripts |
Bart De Schuymer | 0ddd575 | 2007-08-12 15:11:40 +0000 | [diff] [blame] | 183 | mkdir -p $(DESTDIR)$(LIBDIR) |
| 184 | install -m 0755 extensions/*.so $(DESTDIR)$(LIBDIR) |
| 185 | install -m 0755 *.so $(DESTDIR)$(LIBDIR) |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 186 | |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 187 | .PHONY: clean |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 188 | clean: |
Bart De Schuymer | 7d9e3eb | 2006-02-06 21:24:02 +0000 | [diff] [blame] | 189 | rm -f ebtables ebtables-restore ebtablesd ebtablesu static |
Bart De Schuymer | 90db00b | 2005-09-28 19:36:34 +0000 | [diff] [blame] | 190 | rm -f *.o *~ *.so |
Bart De Schuymer | 96ee8d1 | 2005-11-04 21:59:57 +0000 | [diff] [blame] | 191 | rm -f extensions/*.o extensions/*.c~ extensions/*.so include/*~ |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 192 | |
| 193 | DIR:=$(PROGNAME)-v$(PROGVERSION) |
Bart De Schuymer | 22d8f5f | 2007-05-28 16:45:38 +0000 | [diff] [blame] | 194 | CVSDIRS:=CVS extensions/CVS examples/CVS examples/perf_test/CVS \ |
| 195 | examples/ulog/CVS include/CVS |
Bart De Schuymer | 865dd4d | 2006-12-15 11:37:07 +0000 | [diff] [blame] | 196 | # This is used to make a new userspace release, some files are altered so |
| 197 | # do this on a temporary version |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 198 | .PHONY: release |
| 199 | release: |
Bart De Schuymer | 22d8f5f | 2007-05-28 16:45:38 +0000 | [diff] [blame] | 200 | rm -f extensions/ebt_inat.c |
| 201 | rm -rf $(CVSDIRS) |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 202 | mkdir -p include/linux/netfilter_bridge |
| 203 | install -m 0644 -o root -g root \ |
| 204 | $(KERNEL_INCLUDES)/linux/netfilter_bridge.h include/linux/ |
| 205 | # To keep possible compile error complaints about undefined ETH_P_8021Q |
| 206 | # off my back |
| 207 | install -m 0644 -o root -g root \ |
| 208 | $(KERNEL_INCLUDES)/linux/if_ether.h include/linux/ |
| 209 | install -m 0644 -o root -g root \ |
Bart De Schuymer | 72ecebe | 2006-12-17 21:29:34 +0000 | [diff] [blame] | 210 | $(KERNEL_INCLUDES)/linux/types.h include/linux/ |
| 211 | install -m 0644 -o root -g root \ |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 212 | $(KERNEL_INCLUDES)/linux/netfilter_bridge/*.h \ |
| 213 | include/linux/netfilter_bridge/ |
Bart De Schuymer | 60c2009 | 2003-07-23 21:34:21 +0000 | [diff] [blame] | 214 | install -m 0644 -o root -g root \ |
| 215 | include/ebtables.h include/linux/netfilter_bridge/ |
Bart De Schuymer | 0f8c499 | 2002-11-20 19:41:02 +0000 | [diff] [blame] | 216 | make clean |
Bart De Schuymer | e29506d | 2003-07-26 11:53:32 +0000 | [diff] [blame] | 217 | touch * |
| 218 | touch extensions/* |
| 219 | touch include/* |
| 220 | touch include/linux/* |
| 221 | touch include/linux/netfilter_bridge/* |
Bart De Schuymer | 865dd4d | 2006-12-15 11:37:07 +0000 | [diff] [blame] | 222 | sed -i 's/$$(VERSION)/$(PROGVERSION)/' ebtables.8 |
| 223 | sed -i 's/$$(DATE)/$(PROGDATE)/' ebtables.8 |
Bart De Schuymer | 22d8f5f | 2007-05-28 16:45:38 +0000 | [diff] [blame] | 224 | sed -i 's/$$(VERSION)/$(PROGVERSION_)/' ebtables.spec |
Bart De Schuymer | 865dd4d | 2006-12-15 11:37:07 +0000 | [diff] [blame] | 225 | sed -i 's/$$(RELEASE)/$(PROGRELEASE)/' ebtables.spec |
Bart De Schuymer | 308ea9f | 2005-11-13 12:15:09 +0000 | [diff] [blame] | 226 | cd ..;tar -c $(DIR) | gzip >$(DIR).tar.gz; cd - |
| 227 | rm -rf include/linux |
| 228 | |
| 229 | # This will make the rpm and put it in /usr/src/redhat/RPMS |
| 230 | # (do this as root after make release) |
| 231 | .PHONY: rpmbuild |
| 232 | rpmbuild: |
| 233 | cp ../$(DIR).tar.gz /usr/src/redhat/SOURCES/ |
Bart De Schuymer | 58acf95 | 2005-11-13 12:23:13 +0000 | [diff] [blame] | 234 | rpmbuild --buildroot $(shell mktemp -td $(DIR)-XXXXX) -bb ebtables.spec |
Bart De Schuymer | 8bde101 | 2004-11-20 13:00:52 +0000 | [diff] [blame] | 235 | |
| 236 | .PHONY: test_ulog |
| 237 | test_ulog: examples/ulog/test_ulog.c getethertype.o |
| 238 | $(CC) $(CFLAGS) $< -o test_ulog -I$(KERNEL_INCLUDES) -lc \ |
| 239 | getethertype.o |
| 240 | mv test_ulog examples/ulog/ |
| 241 | |
| 242 | .PHONY: examples |
| 243 | examples: test_ulog |