From adcae4d5f0dc5cbf3a3f120a15d54bd222c94718 Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Wed, 20 Nov 2002 19:41:02 +0000 Subject: new compile method --- userspace/ebtables2/Makefile | 71 +++++++++++++++++++++------------ userspace/ebtables2/extensions/Makefile | 5 ++- 2 files changed, 48 insertions(+), 28 deletions(-) (limited to 'userspace') diff --git a/userspace/ebtables2/Makefile b/userspace/ebtables2/Makefile index 18e6c2b..59ebce2 100644 --- a/userspace/ebtables2/Makefile +++ b/userspace/ebtables2/Makefile @@ -1,6 +1,5 @@ # ebtables Makefile -KERNEL_DIR?=/usr/src/linux PROGNAME:=ebtables PROGVERSION:="2.0.1" PROGDATE:="October 2002" @@ -10,39 +9,40 @@ CFLAGS:=-Wall -Wunused CC:=gcc include extensions/Makefile -# Some kernel testers prefer to use a symlink for /usr/include/linux -ifeq ($(SYMLINK), y) -KERNEL_INCLUDES=symlink +OBJECTS:=getethertype.o ebtables.o communication.o $(EXT_OBJS) + +# Use the option NONSTANDARD=y when you don't want to use the kernel includes +# that are included in this package. You should set KERNEL_INCLUDES to +# the right directory (eg /usr/src/linux/include). +# You should only need this when compiling the CVS or when adding new code. +ifeq ($(NONSTANDARD), y) +KERNEL_INCLUDES?=/usr/include/ else -KERNEL_INCLUDES=headers +KERNEL_INCLUDES:=include/ endif -all: ebtables +ETHERTYPESFILE1:="/etc/ethertypes" +ETHERTYPESFILE2:="/usr/local/etc/ethertypes" + +PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \ + -DPROGNAME=\"$(PROGNAME)\" \ + -DPROGDATE=\"$(PROGDATE)\" \ + -D_PATH_ETHERTYPES1=\"$(ETHERTYPESFILE1)\" -.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/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 +all: ebtables communication.o: communication.c include/ebtables_u.h - $(CC) $(CFLAGS) -DPROGVERSION=\"$(PROGVERSION)\" -c -o $@ $< + $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) + +getethertype.o: getethertype.c include/ethernetdb.h + $(CC) $(CFLAGS) -c -o $@ $< -Iinclude/ ebtables.o: ebtables.c include/ebtables_u.h - $(CC) $(CFLAGS) -DPROGVERSION=\"$(PROGVERSION)\" \ - -DPROGNAME=\"$(PROGNAME)\" -DPROGDATE=\"$(PROGDATE)\" -c -o $@ $< + $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES) -ebtables: ebtables.o communication.o $(EXT_OBJS) - $(CC) $(CFLAGS) -o $@ $^ +ebtables: $(OBJECTS) + $(CC) $(CFLAGS) -o $@ $^ -I$(KERNEL_INCLUDES) $(MANDIR)/man8/ebtables.8: ebtables.8 mkdir -p $(@D) @@ -51,14 +51,33 @@ $(MANDIR)/man8/ebtables.8: ebtables.8 /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 +.PHONY: install +install: $(MANDIR)/man8/ebtables.8 ebtables /etc/ethertypes exec +.PHONY: clean clean: rm -f ebtables rm -f *.o *.c~ rm -f extensions/*.o extensions/*.c~ + +DIR:=$(PROGNAME)-v$(PROGVERSION) +# This is used to make a new userspace release +.PHONY: release +release: + mkdir -p include/linux/netfilter_bridge + install -m 0644 -o root -g root \ + $(KERNEL_INCLUDES)/linux/netfilter_bridge.h include/linux/ +# To keep possible compile error complaints about undefined ETH_P_8021Q +# off my back + install -m 0644 -o root -g root \ + $(KERNEL_INCLUDES)/linux/if_ether.h include/linux/ + install -m 0644 -o root -g root \ + $(KERNEL_INCLUDES)/linux/netfilter_bridge/*.h \ + include/linux/netfilter_bridge/ + make clean + cd ..;tar -c $(DIR) | gzip >$(DIR).tar.gz diff --git a/userspace/ebtables2/extensions/Makefile b/userspace/ebtables2/extensions/Makefile index 097e9a3..7ff9cd4 100644 --- a/userspace/ebtables2/extensions/Makefile +++ b/userspace/ebtables2/extensions/Makefile @@ -6,7 +6,8 @@ EXT_OBJS+=$(foreach T,$(EXT_FUNC), extensions/ebt_$(T).o) EXT_OBJS+=$(foreach T,$(EXT_TABLES), extensions/ebtable_$(T).o) extensions/ebt_%.o: extensions/ebt_%.c include/ebtables_u.h - $(CC) $(CFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) -c -o $@ $< -I$(KERNEL_INCLUDES) + extensions/ebtable_%.o: extensions/ebtable_%.c - $(CC) $(CFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) -c -o $@ $< -I$(KERNEL_INCLUDES) -- cgit v1.2.3