blob: 3c3229f1d45be6499f74038929ecd0a1907eb439 [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
Bart De Schuymer8042e1c2003-12-30 17:42:30 +00007MANDIR?=$(DESTDIR)/usr/local/man
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00008CFLAGS:=-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 Schuymer8339ff12004-01-14 20:05:27 +000017OBJECTS:=getethertype.o ebtables.o communication.o libebtc.o \
18useful_functions.o $(EXT_OBJS)
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000019
Bart De Schuymer06a96822003-02-19 20:09:51 +000020KERNEL_INCLUDES?=include/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000021
Bart De Schuymer8042e1c2003-12-30 17:42:30 +000022ETHERTYPESPATH?=$(DESTDIR)/etc
Bart De Schuymera2960382003-04-01 17:29:13 +000023ETHERTYPESFILE:=$(ETHERTYPESPATH)/ethertypes
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000024
Bart De Schuymer8042e1c2003-12-30 17:42:30 +000025BINPATH?=$(DESTDIR)/sbin/
Bart De Schuymerf43456b2003-02-15 11:12:01 +000026BINFILE:=$(BINPATH)ebtables
27
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000028PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \
29 -DPROGNAME=\"$(PROGNAME)\" \
30 -DPROGDATE=\"$(PROGDATE)\" \
fnm39bb3d0a2002-11-21 10:42:56 +000031 -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000032
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000033
34all: ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000035
36communication.o: communication.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000037 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
38
Bart De Schuymer8339ff12004-01-14 20:05:27 +000039libebtc.o: libebtc.c include/ebtables_u.h
40 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
41
42useful_functions.o: useful_functions.c include/ebtables_u.h
43 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
44
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000045getethertype.o: getethertype.c include/ethernetdb.h
fnm39bb3d0a2002-11-21 10:42:56 +000046 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -Iinclude/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000047
48ebtables.o: ebtables.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000049 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000050
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000051ebtables: $(OBJECTS)
52 $(CC) $(CFLAGS) -o $@ $^ -I$(KERNEL_INCLUDES)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000053
54$(MANDIR)/man8/ebtables.8: ebtables.8
55 mkdir -p $(@D)
56 install -m 0644 -o root -g root $< $@
57
Bart De Schuymer2eb1f922002-11-22 18:55:55 +000058$(ETHERTYPESFILE): ethertypes
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000059 mkdir -p $(@D)
60 install -m 0644 -o root -g root $< $@
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000061
Bart De Schuymer32890542002-07-10 20:09:56 +000062.PHONY: exec
63exec: ebtables
Bart De Schuymerf43456b2003-02-15 11:12:01 +000064 install -m 0755 -o root -g root $< $(BINFILE)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000065
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000066.PHONY: install
Bart De Schuymerf43456b2003-02-15 11:12:01 +000067install: $(MANDIR)/man8/ebtables.8 $(ETHERTYPESFILE) exec
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000068
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000069.PHONY: clean
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000070clean:
Bart De Schuymer7ddc0e62002-06-01 21:34:16 +000071 rm -f ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000072 rm -f *.o *.c~
73 rm -f extensions/*.o extensions/*.c~
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000074
75DIR:=$(PROGNAME)-v$(PROGVERSION)
76# This is used to make a new userspace release
77.PHONY: release
78release:
79 mkdir -p include/linux/netfilter_bridge
80 install -m 0644 -o root -g root \
81 $(KERNEL_INCLUDES)/linux/netfilter_bridge.h include/linux/
82# To keep possible compile error complaints about undefined ETH_P_8021Q
83# off my back
84 install -m 0644 -o root -g root \
85 $(KERNEL_INCLUDES)/linux/if_ether.h include/linux/
86 install -m 0644 -o root -g root \
87 $(KERNEL_INCLUDES)/linux/netfilter_bridge/*.h \
88 include/linux/netfilter_bridge/
Bart De Schuymer60c20092003-07-23 21:34:21 +000089 install -m 0644 -o root -g root \
90 include/ebtables.h include/linux/netfilter_bridge/
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000091 make clean
Bart De Schuymere29506d2003-07-26 11:53:32 +000092 touch *
93 touch extensions/*
94 touch include/*
95 touch include/linux/*
96 touch include/linux/netfilter_bridge/*
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000097 cd ..;tar -c $(DIR) | gzip >$(DIR).tar.gz