CC = gcc KSRC = /usr/src/linux KCFG = $(KSRC)/.config KVER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) CFLAGS = -Wall -Wstrict-prototypes -Winline -O2 -fomit-frame-pointer \ #-DGR_VERTICAL=131 -DGR_LUCORNER=170 -DGR_LBCORNER=144 ifneq ($(wildcard $(KCFG)), $(KCFG)) all install modules_install ip_masq_icq.o: NO_CONFIG = y CONFIG_IP_MASQUERADE_MOD := $(shell grep -q '\' /proc/ksyms && echo y) else include $(KCFG) endif CFLAGS += $(shell $(CC) -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1 && echo "-fno-strict-aliasing") foo := $(shell egrep '^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION|ARCH) ' $(KSRC)/Makefile >Makefile.arch) include Makefile.arch foo := $(shell egrep -v '^ |^[^ :]*:' $(KSRC)/arch/$(ARCH)/Makefile >Makefile.arch) include Makefile.arch all: ip_masq_icq.o install modules_install: ip_masq_icq.o mkdir -p $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/ipv4 cp -f $< $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/ipv4 depmod -a $(KVER) ip_masq_icq.o: ip_masq_icq.c ifneq ($(KVER), $(shell uname -r)) @echo -e '\033[1;33mwarning\033[37m:\033[0m compiling for kernel version \033[1;36m$(KVER)\033[0m, while running \033[1;36m'`uname -r`'\033[0m\n' >&2 endif ifdef NO_CONFIG @echo -e '\033[1;33mwarning\033[37m:\033[0m no \033[1;32m$(KCFG)\033[0m file, using \033[36m/proc\033[0m to guess kernel parameters.' >&2 ifneq ($(shell uname -m | sed s/i.86/ix86/), ix86) @echo -e '\t on non-x86, compilation may fail without \033[1;32m.config\033[0m file.\n' >&2 else @echo >&2 endif endif ifneq ($(CONFIG_IP_MASQUERADE_MOD), y) @echo -n 'Turn on ' >&2 ifneq ($(CONFIG_EXPERIMENTAL), y) @echo -ne '"Prompt for development and/or incomplete code/drivers" (the 1st menu)\nand ' >&2 endif @echo -e '"IP: masquerading special modules support" ("Networking options" menu)\nin the kernel config. \033[1;37;41m!!!! RTFM !!!!\033[0m' >&2 @exit 1 endif $(CC) $(CFLAGS) -I$(KSRC)/include -c $< -o $@ clean: rm -fv Makefile.arch ip_masq_icq.o