blob: e25af6b14909a000f42ef1a9aefbb7f7420f0ac6 [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 Schuymer3749f302004-02-11 21:23:38 +00007# default paths
8LIBDIR:=/usr/lib/
9MANDIR:=/usr/local/man
10BINDIR:=/sbin
11ETCDIR:=/etc
12
13# include DESTDIR param
14override LIBDIR:=$(DESTDIR)$(LIBDIR)
15override MANDIR:=$(DESTDIR)$(MANDIR)
16override BINDIR:=$(DESTDIR)$(BINDIR)
17override ETCDIR:=$(DESTDIR)$(ETCDIR)
18
19
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000020CFLAGS:=-Wall -Wunused
Bart De Schuymer06a1b462002-09-07 11:51:13 +000021CC:=gcc
Bart De Schuymer64182a32004-01-21 20:39:54 +000022LD:=ld
Bart De Schuymer3c1e00c2002-12-07 11:18:57 +000023
Bart De Schuymer60c20092003-07-23 21:34:21 +000024ifeq ($(shell uname -m),sparc64)
25CFLAGS+=-DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32
26endif
27
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000028include extensions/Makefile
29
Bart De Schuymer64182a32004-01-21 20:39:54 +000030OBJECTS2:=getethertype.o communication.o libebtc.o \
31useful_functions.o
32
33OBJECTS:=$(OBJECTS2) ebtables.o $(EXT_OBJS) $(EXT_LIBS)
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000034
Bart De Schuymer06a96822003-02-19 20:09:51 +000035KERNEL_INCLUDES?=include/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000036
Bart De Schuymer3749f302004-02-11 21:23:38 +000037ETHERTYPESPATH?=$(ETCDIR)
Bart De Schuymera2960382003-04-01 17:29:13 +000038ETHERTYPESFILE:=$(ETHERTYPESPATH)/ethertypes
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000039
Bart De Schuymer3749f302004-02-11 21:23:38 +000040BINFILE:=$(BINDIR)/ebtables
Bart De Schuymerf43456b2003-02-15 11:12:01 +000041
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000042PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \
43 -DPROGNAME=\"$(PROGNAME)\" \
44 -DPROGDATE=\"$(PROGDATE)\" \
fnm39bb3d0a2002-11-21 10:42:56 +000045 -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000046
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000047
48all: ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000049
50communication.o: communication.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000051 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
52
Bart De Schuymer8339ff12004-01-14 20:05:27 +000053libebtc.o: libebtc.c include/ebtables_u.h
54 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
55
56useful_functions.o: useful_functions.c include/ebtables_u.h
57 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
58
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000059getethertype.o: getethertype.c include/ethernetdb.h
fnm39bb3d0a2002-11-21 10:42:56 +000060 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -Iinclude/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000061
62ebtables.o: ebtables.c include/ebtables_u.h
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000063 $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000064
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000065ebtables: $(OBJECTS)
Bart De Schuymer64182a32004-01-21 20:39:54 +000066 ld -shared -soname libebtc.so -o libebtc.so -lc $(OBJECTS2)
67 $(CC) $(CFLAGS) -o $@ ebtables.o -I$(KERNEL_INCLUDES) -L/root/ \
68 -L. -Lextensions/ -lebtc $(EXT_LIBSI)
69
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000070
71$(MANDIR)/man8/ebtables.8: ebtables.8
72 mkdir -p $(@D)
73 install -m 0644 -o root -g root $< $@
74
Bart De Schuymer2eb1f922002-11-22 18:55:55 +000075$(ETHERTYPESFILE): ethertypes
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000076 mkdir -p $(@D)
77 install -m 0644 -o root -g root $< $@
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000078
Bart De Schuymer32890542002-07-10 20:09:56 +000079.PHONY: exec
80exec: ebtables
Bart De Schuymer3749f302004-02-11 21:23:38 +000081 mkdir -p $(BINDIR)
Bart De Schuymerf43456b2003-02-15 11:12:01 +000082 install -m 0755 -o root -g root $< $(BINFILE)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000083
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000084.PHONY: install
Bart De Schuymerf43456b2003-02-15 11:12:01 +000085install: $(MANDIR)/man8/ebtables.8 $(ETHERTYPESFILE) exec
Bart De Schuymer0f5e3fe2004-02-10 18:08:00 +000086 mkdir -p $(LIBDIR)
Bart De Schuymer64182a32004-01-21 20:39:54 +000087 install -m 0755 extensions/*.so $(LIBDIR)
88 install -m 0755 *.so $(LIBDIR)
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000089
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000090.PHONY: clean
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000091clean:
Bart De Schuymer7ddc0e62002-06-01 21:34:16 +000092 rm -f ebtables
Bart De Schuymer64182a32004-01-21 20:39:54 +000093 rm -f *.o *.c~ *.so
94 rm -f extensions/*.o extensions/*.c~ extensions/*.so
Bart De Schuymer0f8c4992002-11-20 19:41:02 +000095
96DIR:=$(PROGNAME)-v$(PROGVERSION)
97# This is used to make a new userspace release
98.PHONY: release
99release:
100 mkdir -p include/linux/netfilter_bridge
101 install -m 0644 -o root -g root \
102 $(KERNEL_INCLUDES)/linux/netfilter_bridge.h include/linux/
103# To keep possible compile error complaints about undefined ETH_P_8021Q
104# off my back
105 install -m 0644 -o root -g root \
106 $(KERNEL_INCLUDES)/linux/if_ether.h include/linux/
107 install -m 0644 -o root -g root \
108 $(KERNEL_INCLUDES)/linux/netfilter_bridge/*.h \
109 include/linux/netfilter_bridge/
Bart De Schuymer60c20092003-07-23 21:34:21 +0000110 install -m 0644 -o root -g root \
111 include/ebtables.h include/linux/netfilter_bridge/
Bart De Schuymer0f8c4992002-11-20 19:41:02 +0000112 make clean
Bart De Schuymere29506d2003-07-26 11:53:32 +0000113 touch *
114 touch extensions/*
115 touch include/*
116 touch include/linux/*
117 touch include/linux/netfilter_bridge/*
Bart De Schuymer0f8c4992002-11-20 19:41:02 +0000118 cd ..;tar -c $(DIR) | gzip >$(DIR).tar.gz