blob: f46c3f7564aaa4292f90d20ec91db1fb8b0b3c41 [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 Schuymer2eb1f922002-11-22 18:55:55 +00004PROGVERSION:=2.0.1
5PROGDATE:=October\ 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 Schuymer1abc55d2002-06-01 19:23:47 +000010include extensions/Makefile
11
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000012OBJECTS:=getethertype.o ebtables.o communication.o $(EXT_OBJS)
13
14# Use the option NONSTANDARD=y when you don't want to use the kernel includes
15# that are included in this package. You should set KERNEL_INCLUDES to
16# the right directory (eg /usr/src/linux/include).
17# You should only need this when compiling the CVS or when adding new code.
18ifeq ($(NONSTANDARD), y)
19KERNEL_INCLUDES?=/usr/include/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000020else
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000021KERNEL_INCLUDES:=include/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000022endif
23
Bart De Schuymer2eb1f922002-11-22 18:55:55 +000024ifneq ($(ETHERTYPESPATH),)
25ETHERTYPESFILE:=$(ETHERTYPESPATH)ethertypes
26else
27ETHERTYPESFILE:=/usr/local/etc/ethertypes
28endif
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000029
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000030PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \
31 -DPROGNAME=\"$(PROGNAME)\" \
32 -DPROGDATE=\"$(PROGDATE)\" \
fnm39bb3d0a2002-11-21 10:42:56 +000033 -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000034
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000035
36all: ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000037
38communication.o: communication.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000039 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
40
41getethertype.o: getethertype.c include/ethernetdb.h
fnm39bb3d0a2002-11-21 10:42:56 +000042 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -Iinclude/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000043
44ebtables.o: ebtables.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000045 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000046
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000047ebtables: $(OBJECTS)
48 $(CC) $(CFLAGS) -o $@ $^ -I$(KERNEL_INCLUDES)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000049
50$(MANDIR)/man8/ebtables.8: ebtables.8
51 mkdir -p $(@D)
52 install -m 0644 -o root -g root $< $@
53
Bart De Schuymer2eb1f922002-11-22 18:55:55 +000054$(ETHERTYPESFILE): ethertypes
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000055 mkdir -p $(@D)
56 install -m 0644 -o root -g root $< $@
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000057
Bart De Schuymer32890542002-07-10 20:09:56 +000058.PHONY: exec
59exec: ebtables
60 install -m 0755 -o root -g root $< /sbin/ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000061
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000062.PHONY: install
Bart De Schuymer2eb1f922002-11-22 18:55:55 +000063install: $(MANDIR)/man8/ebtables.8 ebtables $(ETHERTYPESFILE) exec
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000064
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000065.PHONY: clean
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000066clean:
Bart De Schuymer7ddc0e62002-06-01 21:34:16 +000067 rm -f ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000068 rm -f *.o *.c~
69 rm -f extensions/*.o extensions/*.c~
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000070
71DIR:=$(PROGNAME)-v$(PROGVERSION)
72# This is used to make a new userspace release
73.PHONY: release
74release:
75 mkdir -p include/linux/netfilter_bridge
76 install -m 0644 -o root -g root \
77 $(KERNEL_INCLUDES)/linux/netfilter_bridge.h include/linux/
78# To keep possible compile error complaints about undefined ETH_P_8021Q
79# off my back
80 install -m 0644 -o root -g root \
81 $(KERNEL_INCLUDES)/linux/if_ether.h include/linux/
82 install -m 0644 -o root -g root \
83 $(KERNEL_INCLUDES)/linux/netfilter_bridge/*.h \
84 include/linux/netfilter_bridge/
85 make clean
86 cd ..;tar -c $(DIR) | gzip >$(DIR).tar.gz