diff --git a/Makefile b/Makefile index acb5dad2..bd7e1ef7 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ -# Uncomment the second line on SMP systems if the magic invocation fails. +# Uncomment the third line on SMP systems if the magic invocation fails. +SMP := $(shell if grep -q '^SMP[[:space:]]*=' /usr/src/linux/Makefile; then echo 1; else echo 0; fi) #SMP := 0 #SMP := 1 -SMP := $(shell if grep -q '^SMP[[:space:]]*=' /usr/src/linux/Makefile; then echo 1; else echo 0; fi) + +# Uncomment the second or third line if the magic invocation fails. +# We need to know whether CONFIG_MODVERSIONS is defined. +MODVER := $(shell if cat /usr/include/linux/config.h /usr/include/linux/autoconf.h 2>/dev/null | grep -q '^[[:space:]]*\#define[[:space:]]*CONFIG_MODVERSIONS[[:space:]]*1'; then echo 1; else echo 0; fi) +#MODVER := 0 +#MODVER := 1 # Uncomment the second line if you do not want to compile the included # i2c modules. WARNING! If the i2c module version does not match the @@ -60,6 +66,10 @@ CFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ -Wcast-align -Wwrite-strings -Wnested-externs -Winline endif +ifeq ($(MODVER),1) +CFLAGS += -DMODVERSIONS -include /usr/include/linux/modversions.h +endif + .PHONY: all clean install version package # Make all the default rule diff --git a/i2c/Module.mk b/i2c/Module.mk index 080aed1c..3d82d26d 100644 --- a/i2c/Module.mk +++ b/i2c/Module.mk @@ -14,7 +14,7 @@ all :: $(TARGETS) install :: $(TARGETS) $(MKDIR) $(MODDIR) - install -o root -g root -m 644 $(MODDIR) $(TARGETS) + install -o root -g root -m 644 $(TARGETS) $(MODDIR) clean :: $(RM) $(TARGETS) $(TARGETS:.o=.d)