blob: 18e6c2b3ea07cfa3f3384267580b68e3e236e96c [file] [log] [blame]
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001# ebtables Makefile
2
3KERNEL_DIR?=/usr/src/linux
4PROGNAME:=ebtables
Bart De Schuymera21bc7d2002-10-17 22:00:02 +00005PROGVERSION:="2.0.1"
6PROGDATE:="October 2002"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00007
8MANDIR?=/usr/local/man
9CFLAGS:=-Wall -Wunused
Bart De Schuymer06a1b462002-09-07 11:51:13 +000010CC:=gcc
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000011include extensions/Makefile
12
13# Some kernel testers prefer to use a symlink for /usr/include/linux
14ifeq ($(SYMLINK), y)
15KERNEL_INCLUDES=symlink
16else
17KERNEL_INCLUDES=headers
18endif
19
20all: ebtables
21
22.PHONY: headers
23headers:
24 mkdir -p /usr/include/linux/netfilter_bridge
25 cp -f $(KERNEL_DIR)/include/linux/netfilter_bridge/* \
26 /usr/include/linux/netfilter_bridge/
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000027 cp -f $(KERNEL_DIR)/include/linux/netfilter_bridge.h \
28 /usr/include/linux/netfilter_bridge.h
Bart De Schuymerfc3dd672002-07-07 14:27:11 +000029 cp -f $(KERNEL_DIR)/include/linux/if_ether.h \
30 /usr/include/linux/if_ether.h
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000031
32.PHONY: symlink
33symlink:
Bart De Schuymer596c3c02002-06-04 06:30:35 +000034 rm -f /usr/include/linux
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000035 ln -fs $(KERNEL_DIR)/include/linux /usr/include/linux
36
37communication.o: communication.c include/ebtables_u.h
Bart De Schuymerd4586482002-08-11 16:15:55 +000038 $(CC) $(CFLAGS) -DPROGVERSION=\"$(PROGVERSION)\" -c -o $@ $<
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000039
40ebtables.o: ebtables.c include/ebtables_u.h
41 $(CC) $(CFLAGS) -DPROGVERSION=\"$(PROGVERSION)\" \
Bart De Schuymerd4586482002-08-11 16:15:55 +000042 -DPROGNAME=\"$(PROGNAME)\" -DPROGDATE=\"$(PROGDATE)\" -c -o $@ $<
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000043
44ebtables: ebtables.o communication.o $(EXT_OBJS)
45 $(CC) $(CFLAGS) -o $@ $^
46
47$(MANDIR)/man8/ebtables.8: ebtables.8
48 mkdir -p $(@D)
49 install -m 0644 -o root -g root $< $@
50
51/etc/ethertypes: ethertypes
52 mkdir -p $(@D)
53 install -m 0644 -o root -g root $< $@
Bart De Schuymer32890542002-07-10 20:09:56 +000054.PHONY: exec
55exec: ebtables
56 install -m 0755 -o root -g root $< /sbin/ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000057
58install: $(MANDIR)/man8/ebtables.8 $(KERNEL_INCLUDES) \
Bart De Schuymer32890542002-07-10 20:09:56 +000059 ebtables /etc/ethertypes exec
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000060
61clean:
Bart De Schuymer7ddc0e62002-06-01 21:34:16 +000062 rm -f ebtables
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000063 rm -f *.o *.c~
64 rm -f extensions/*.o extensions/*.c~