blob: cc91da5660a8dc133ae61cf08ac47bd4adc32418 [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 Schuymer64182a32004-01-21 20:39:54 +00004PROGVERSION:=2.0.7
5PROGDATE:=January\ 2004
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00006
Bart De Schuymer0f5e3fe2004-02-10 18:08:00 +00007LIBDIR?=$(DESTDIR)/usr/lib/
Bart De Schuymer8042e1c2003-12-30 17:42:30 +00008MANDIR?=$(DESTDIR)/usr/local/man
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00009CFLAGS:=-Wall -Wunused
Bart De Schuymer06a1b462002-09-07 11:51:13 +000010CC:=gcc
Bart De Schuymer64182a32004-01-21 20:39:54 +000011LD:=ld
Bart De Schuymer3c1e00c2002-12-07 11:18:57 +000012
Bart De Schuymer60c20092003-07-23 21:34:21 +000013ifeq ($(shell uname -m),sparc64)
14CFLAGS+=-DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32
15endif
16
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000017include extensions/Makefile
18
Bart De Schuymer64182a32004-01-21 20:39:54 +000019OBJECTS2:=getethertype.o communication.o libebtc.o \
20useful_functions.o
21
22OBJECTS:=$(OBJECTS2) ebtables.o $(EXT_OBJS) $(EXT_LIBS)
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000023
Bart De Schuymer06a96822003-02-19 20:09:51 +000024KERNEL_INCLUDES?=include/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000025
Bart De Schuymer8042e1c2003-12-30 17:42:30 +000026ETHERTYPESPATH?=$(DESTDIR)/etc
Bart De Schuymera2960382003-04-01 17:29:13 +000027ETHERTYPESFILE:=$(ETHERTYPESPATH)/ethertypes
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000028
Bart De Schuymer8042e1c2003-12-30 17:42:30 +000029BINPATH?=$(DESTDIR)/sbin/
Bart De Schuymerf43456b2003-02-15 11:12:01 +000030BINFILE:=$(BINPATH)ebtables
31
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000032PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \
33 -DPROGNAME=\"$(PROGNAME)\" \
34 -DPROGDATE=\"$(PROGDATE)\" \
fnm39bb3d0a2002-11-21 10:42:56 +000035 -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000036
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000037
38all: ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000039
40communication.o: communication.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000041 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
42
Bart De Schuymer8339ff12004-01-14 20:05:27 +000043libebtc.o: libebtc.c include/ebtables_u.h
44 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
45
46useful_functions.o: useful_functions.c include/ebtables_u.h
47 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
48
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000049getethertype.o: getethertype.c include/ethernetdb.h
fnm39bb3d0a2002-11-21 10:42:56 +000050 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -Iinclude/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000051
52ebtables.o: ebtables.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000053 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000054
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000055ebtables: $(OBJECTS)
Bart De Schuymer64182a32004-01-21 20:39:54 +000056 ld -shared -soname libebtc.so -o libebtc.so -lc $(OBJECTS2)
57 $(CC) $(CFLAGS) -o $@ ebtables.o -I$(KERNEL_INCLUDES) -L/root/ \
58 -L. -Lextensions/ -lebtc $(EXT_LIBSI)
59
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000060
61$(MANDIR)/man8/ebtables.8: ebtables.8
62 mkdir -p $(@D)
63 install -m 0644 -o root -g root $< $@
64
Bart De Schuymer2eb1f922002-11-22 18:55:55 +000065$(ETHERTYPESFILE): ethertypes
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000066 mkdir -p $(@D)
67 install -m 0644 -o root -g root $< $@
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000068
Bart De Schuymer32890542002-07-10 20:09:56 +000069.PHONY: exec
70exec: ebtables
Bart De Schuymer0f5e3fe2004-02-10 18:08:00 +000071 mkdir -p $(BINPATH)
Bart De Schuymerf43456b2003-02-15 11:12:01 +000072 install -m 0755 -o root -g root $< $(BINFILE)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000073
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000074.PHONY: install
Bart De Schuymerf43456b2003-02-15 11:12:01 +000075install: $(MANDIR)/man8/ebtables.8 $(ETHERTYPESFILE) exec
Bart De Schuymer0f5e3fe2004-02-10 18:08:00 +000076 mkdir -p $(LIBDIR)
Bart De Schuymer64182a32004-01-21 20:39:54 +000077 install -m 0755 extensions/*.so $(LIBDIR)
78 install -m 0755 *.so $(LIBDIR)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000079
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000080.PHONY: clean
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000081clean:
Bart De Schuymer7ddc0e62002-06-01 21:34:16 +000082 rm -f ebtables
Bart De Schuymer64182a32004-01-21 20:39:54 +000083 rm -f *.o *.c~ *.so
84 rm -f extensions/*.o extensions/*.c~ extensions/*.so
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000085
86DIR:=$(PROGNAME)-v$(PROGVERSION)
87# This is used to make a new userspace release
88.PHONY: release
89release:
90 mkdir -p include/linux/netfilter_bridge
91 install -m 0644 -o root -g root \
92 $(KERNEL_INCLUDES)/linux/netfilter_bridge.h include/linux/
93# To keep possible compile error complaints about undefined ETH_P_8021Q
94# off my back
95 install -m 0644 -o root -g root \
96 $(KERNEL_INCLUDES)/linux/if_ether.h include/linux/
97 install -m 0644 -o root -g root \
98 $(KERNEL_INCLUDES)/linux/netfilter_bridge/*.h \
99 include/linux/netfilter_bridge/
Bart De Schuymer60c20092003-07-23 21:34:21 +0000100 install -m 0644 -o root -g root \
101 include/ebtables.h include/linux/netfilter_bridge/
Bart De Schuymer0f8c4992002-11-20 19:41:02 +0000102 make clean
Bart De Schuymere29506d2003-07-26 11:53:32 +0000103 touch *
104 touch extensions/*
105 touch include/*
106 touch include/linux/*
107 touch include/linux/netfilter_bridge/*
Bart De Schuymer0f8c4992002-11-20 19:41:02 +0000108 cd ..;tar -c $(DIR) | gzip >$(DIR).tar.gz