blob: a0300fc3e1f64712d9acede846aa71dc84dda1d5 [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 Schuymer60c20092003-07-23 21:34:21 +00004PROGVERSION:=2.0.5
5PROGDATE:=July\ 2003
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 Schuymer60c20092003-07-23 21:34:21 +000011ifeq ($(shell uname -m),sparc64)
12CFLAGS+=-DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32
13endif
14
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000015include extensions/Makefile
16
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000017OBJECTS:=getethertype.o ebtables.o communication.o $(EXT_OBJS)
18
Bart De Schuymer06a96822003-02-19 20:09:51 +000019KERNEL_INCLUDES?=include/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000020
Bart De Schuymer5fd425b2003-06-01 16:41:01 +000021ETHERTYPESPATH?=/etc
Bart De Schuymera2960382003-04-01 17:29:13 +000022ETHERTYPESFILE:=$(ETHERTYPESPATH)/ethertypes
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000023
Bart De Schuymera2960382003-04-01 17:29:13 +000024BINPATH?=/sbin/
Bart De Schuymerf43456b2003-02-15 11:12:01 +000025BINFILE:=$(BINPATH)ebtables
26
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000027PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \
28 -DPROGNAME=\"$(PROGNAME)\" \
29 -DPROGDATE=\"$(PROGDATE)\" \
fnm39bb3d0a2002-11-21 10:42:56 +000030 -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000031
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000032
33all: ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000034
35communication.o: communication.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000036 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
37
38getethertype.o: getethertype.c include/ethernetdb.h
fnm39bb3d0a2002-11-21 10:42:56 +000039 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -Iinclude/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000040
41ebtables.o: ebtables.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000042 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000043
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000044ebtables: $(OBJECTS)
45 $(CC) $(CFLAGS) -o $@ $^ -I$(KERNEL_INCLUDES)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000046
47$(MANDIR)/man8/ebtables.8: ebtables.8
48 mkdir -p $(@D)
49 install -m 0644 -o root -g root $< $@
50
Bart De Schuymer2eb1f922002-11-22 18:55:55 +000051$(ETHERTYPESFILE): ethertypes
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000052 mkdir -p $(@D)
53 install -m 0644 -o root -g root $< $@
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000054
Bart De Schuymer32890542002-07-10 20:09:56 +000055.PHONY: exec
56exec: ebtables
Bart De Schuymerf43456b2003-02-15 11:12:01 +000057 install -m 0755 -o root -g root $< $(BINFILE)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000058
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000059.PHONY: install
Bart De Schuymerf43456b2003-02-15 11:12:01 +000060install: $(MANDIR)/man8/ebtables.8 $(ETHERTYPESFILE) exec
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000061
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000062.PHONY: clean
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000063clean:
Bart De Schuymer7ddc0e62002-06-01 21:34:16 +000064 rm -f ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000065 rm -f *.o *.c~
66 rm -f extensions/*.o extensions/*.c~
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000067
68DIR:=$(PROGNAME)-v$(PROGVERSION)
69# This is used to make a new userspace release
70.PHONY: release
71release:
72 mkdir -p include/linux/netfilter_bridge
73 install -m 0644 -o root -g root \
74 $(KERNEL_INCLUDES)/linux/netfilter_bridge.h include/linux/
75# To keep possible compile error complaints about undefined ETH_P_8021Q
76# off my back
77 install -m 0644 -o root -g root \
78 $(KERNEL_INCLUDES)/linux/if_ether.h include/linux/
79 install -m 0644 -o root -g root \
80 $(KERNEL_INCLUDES)/linux/netfilter_bridge/*.h \
81 include/linux/netfilter_bridge/
Bart De Schuymer60c20092003-07-23 21:34:21 +000082 install -m 0644 -o root -g root \
83 include/ebtables.h include/linux/netfilter_bridge/
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000084 make clean
Bart De Schuymere29506d2003-07-26 11:53:32 +000085 touch *
86 touch extensions/*
87 touch include/*
88 touch include/linux/*
89 touch include/linux/netfilter_bridge/*
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000090 cd ..;tar -c $(DIR) | gzip >$(DIR).tar.gz