summaryrefslogtreecommitdiff
path: root/Makefile
blob: 6aa859946303e19bb880aafa5b015e134940a086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# ebtables Makefile

KERNEL_DIR?=/usr/src/linux
PROGNAME:=ebtables
PROGVERSION:="2.0pre10 (July 2002)"

MANDIR?=/usr/local/man
CFLAGS:=-Wall -Wunused
include extensions/Makefile

# Some kernel testers prefer to use a symlink for /usr/include/linux
ifeq ($(SYMLINK), y)
KERNEL_INCLUDES=symlink
else
KERNEL_INCLUDES=headers
endif

all:	ebtables

.PHONY: headers
headers:
	mkdir -p /usr/include/linux/netfilter_bridge
	cp -f $(KERNEL_DIR)/include/linux/netfilter_bridge/* \
		/usr/include/linux/netfilter_bridge/
	cp -f $(KERNEL_DIR)/include/linux/br_db.h \
		/usr/include/linux/br_db.h
	cp -f $(KERNEL_DIR)/include/linux/netfilter_bridge.h \
		/usr/include/linux/netfilter_bridge.h
	cp -f $(KERNEL_DIR)/include/linux/if_ether.h \
		/usr/include/linux/if_ether.h

.PHONY: symlink
symlink:
	rm -f /usr/include/linux
	ln -fs $(KERNEL_DIR)/include/linux /usr/include/linux

communication.o: communication.c include/ebtables_u.h
	$(CC) $(CFLAGS) -c -o $@ $<

ebtables.o: ebtables.c include/ebtables_u.h
	$(CC) $(CFLAGS) -DPROGVERSION=\"$(PROGVERSION)\" \
	-DPROGNAME=\"$(PROGNAME)\" -c -o $@ $<

ebtables: ebtables.o communication.o $(EXT_OBJS)
	$(CC) $(CFLAGS) -o $@ $^

$(MANDIR)/man8/ebtables.8: ebtables.8
	mkdir -p $(@D)
	install -m 0644 -o root -g root $< $@

/etc/ethertypes: ethertypes
	mkdir -p $(@D)
	install -m 0644 -o root -g root $< $@
.PHONY: exec
exec: ebtables
	install -m 0755 -o root -g root $< /sbin/ebtables

install: $(MANDIR)/man8/ebtables.8 $(KERNEL_INCLUDES) \
	ebtables /etc/ethertypes exec

clean:
	rm -f ebtables
	rm -f *.o *.c~
	rm -f extensions/*.o extensions/*.c~