blob: 75ea55264c946c2e3145ded4dbce6ef8367957e6 [file] [log] [blame]
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001# ebtables Makefile
2
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00003PROGNAME:=ebtables
Bart De Schuymer3c1e00c2002-12-07 11:18:57 +00004PROGVERSION:=2.0.2
5PROGDATE:=December\ 2002
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00006
7MANDIR?=/usr/local/man
8CFLAGS:=-Wall -Wunused
Bart De Schuymer06a1b462002-09-07 11:51:13 +00009CC:=gcc
Bart De Schuymer3c1e00c2002-12-07 11:18:57 +000010
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000011include extensions/Makefile
12
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000013OBJECTS:=getethertype.o ebtables.o communication.o $(EXT_OBJS)
14
15# Use the option NONSTANDARD=y when you don't want to use the kernel includes
16# that are included in this package. You should set KERNEL_INCLUDES to
17# the right directory (eg /usr/src/linux/include).
18# You should only need this when compiling the CVS or when adding new code.
19ifeq ($(NONSTANDARD), y)
20KERNEL_INCLUDES?=/usr/include/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000021else
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000022KERNEL_INCLUDES:=include/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000023endif
24
Bart De Schuymer3c1e00c2002-12-07 11:18:57 +000025ifeq ($(ETHERTYPESPATH),)
26ETHERTYPESPATH:=/etc/
Bart De Schuymer2eb1f922002-11-22 18:55:55 +000027endif
Bart De Schuymer3c1e00c2002-12-07 11:18:57 +000028ETHERTYPESFILE:=$(ETHERTYPESPATH)ethertypes
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000029
Bart De Schuymerf43456b2003-02-15 11:12:01 +000030ifeq ($(BINPATH),)
31BINPATH:=/sbin/
32endif
33BINFILE:=$(BINPATH)ebtables
34
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000035PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \
36 -DPROGNAME=\"$(PROGNAME)\" \
37 -DPROGDATE=\"$(PROGDATE)\" \
fnm39bb3d0a2002-11-21 10:42:56 +000038 -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000039
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000040
41all: ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000042
43communication.o: communication.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000044 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
45
46getethertype.o: getethertype.c include/ethernetdb.h
fnm39bb3d0a2002-11-21 10:42:56 +000047 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -Iinclude/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000048
49ebtables.o: ebtables.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000050 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000051
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000052ebtables: $(OBJECTS)
53 $(CC) $(CFLAGS) -o $@ $^ -I$(KERNEL_INCLUDES)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000054
55$(MANDIR)/man8/ebtables.8: ebtables.8
56 mkdir -p $(@D)
57 install -m 0644 -o root -g root $< $@
58
Bart De Schuymer2eb1f922002-11-22 18:55:55 +000059$(ETHERTYPESFILE): ethertypes
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000060 mkdir -p $(@D)
61 install -m 0644 -o root -g root $< $@
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000062
Bart De Schuymer32890542002-07-10 20:09:56 +000063.PHONY: exec
64exec: ebtables
Bart De Schuymerf43456b2003-02-15 11:12:01 +000065 install -m 0755 -o root -g root $< $(BINFILE)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000066
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000067.PHONY: install
Bart De Schuymerf43456b2003-02-15 11:12:01 +000068install: $(MANDIR)/man8/ebtables.8 $(ETHERTYPESFILE) exec
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000069
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000070.PHONY: clean
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000071clean:
Bart De Schuymer7ddc0e62002-06-01 21:34:16 +000072 rm -f ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000073 rm -f *.o *.c~
74 rm -f extensions/*.o extensions/*.c~
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000075
76DIR:=$(PROGNAME)-v$(PROGVERSION)
77# This is used to make a new userspace release
78.PHONY: release
79release:
80 mkdir -p include/linux/netfilter_bridge
81 install -m 0644 -o root -g root \
82 $(KERNEL_INCLUDES)/linux/netfilter_bridge.h include/linux/
83# To keep possible compile error complaints about undefined ETH_P_8021Q
84# off my back
85 install -m 0644 -o root -g root \
86 $(KERNEL_INCLUDES)/linux/if_ether.h include/linux/
87 install -m 0644 -o root -g root \
88 $(KERNEL_INCLUDES)/linux/netfilter_bridge/*.h \
89 include/linux/netfilter_bridge/
90 make clean
91 cd ..;tar -c $(DIR) | gzip >$(DIR).tar.gz