Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 1 | # ebtables Makefile |
| 2 | |
| 3 | KERNEL_DIR?=/usr/src/linux |
| 4 | PROGNAME:=ebtables |
Bart De Schuymer | 3289054 | 2002-07-10 20:09:56 +0000 | [diff] [blame] | 5 | PROGVERSION:="2.0pre10 (July 2002)" |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 6 | |
| 7 | MANDIR?=/usr/local/man |
| 8 | CFLAGS:=-Wall -Wunused |
| 9 | include extensions/Makefile |
| 10 | |
| 11 | # Some kernel testers prefer to use a symlink for /usr/include/linux |
| 12 | ifeq ($(SYMLINK), y) |
| 13 | KERNEL_INCLUDES=symlink |
| 14 | else |
| 15 | KERNEL_INCLUDES=headers |
| 16 | endif |
| 17 | |
| 18 | all: ebtables |
| 19 | |
| 20 | .PHONY: headers |
| 21 | headers: |
| 22 | mkdir -p /usr/include/linux/netfilter_bridge |
| 23 | cp -f $(KERNEL_DIR)/include/linux/netfilter_bridge/* \ |
| 24 | /usr/include/linux/netfilter_bridge/ |
| 25 | cp -f $(KERNEL_DIR)/include/linux/br_db.h \ |
| 26 | /usr/include/linux/br_db.h |
| 27 | cp -f $(KERNEL_DIR)/include/linux/netfilter_bridge.h \ |
| 28 | /usr/include/linux/netfilter_bridge.h |
Bart De Schuymer | fc3dd67 | 2002-07-07 14:27:11 +0000 | [diff] [blame] | 29 | cp -f $(KERNEL_DIR)/include/linux/if_ether.h \ |
| 30 | /usr/include/linux/if_ether.h |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 31 | |
| 32 | .PHONY: symlink |
| 33 | symlink: |
Bart De Schuymer | 596c3c0 | 2002-06-04 06:30:35 +0000 | [diff] [blame] | 34 | rm -f /usr/include/linux |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 35 | ln -fs $(KERNEL_DIR)/include/linux /usr/include/linux |
| 36 | |
| 37 | communication.o: communication.c include/ebtables_u.h |
| 38 | $(CC) $(CFLAGS) -c -o $@ $< |
| 39 | |
| 40 | ebtables.o: ebtables.c include/ebtables_u.h |
| 41 | $(CC) $(CFLAGS) -DPROGVERSION=\"$(PROGVERSION)\" \ |
| 42 | -DPROGNAME=\"$(PROGNAME)\" -c -o $@ $< |
| 43 | |
| 44 | ebtables: 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 Schuymer | 3289054 | 2002-07-10 20:09:56 +0000 | [diff] [blame] | 54 | .PHONY: exec |
| 55 | exec: ebtables |
| 56 | install -m 0755 -o root -g root $< /sbin/ebtables |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 57 | |
| 58 | install: $(MANDIR)/man8/ebtables.8 $(KERNEL_INCLUDES) \ |
Bart De Schuymer | 3289054 | 2002-07-10 20:09:56 +0000 | [diff] [blame] | 59 | ebtables /etc/ethertypes exec |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 60 | |
| 61 | clean: |
Bart De Schuymer | 7ddc0e6 | 2002-06-01 21:34:16 +0000 | [diff] [blame] | 62 | rm -f ebtables |
Bart De Schuymer | 1abc55d | 2002-06-01 19:23:47 +0000 | [diff] [blame] | 63 | rm -f *.o *.c~ |
| 64 | rm -f extensions/*.o extensions/*.c~ |