diff --git a/Makefile b/Makefile index a051341b..19a32b50 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,9 @@ MODVER := $(shell if cat /usr/include/linux/config.h /usr/include/linux/autoconf # i2c modules. WARNING! If the i2c module version does not match the # smbus/sensor module versions, you will get into severe problems. # If you want to use a self-compiled version of the i2c modules, make -# sure contains the *correct* i2c header file! +# sure contains the *correct* i2c header file! The stock +# Linux 2.1.xxx and 2.2.x modules are *not* good enough; you really need +# Simon Vogl's version! I2C := 1 #I2C := 0 @@ -102,7 +104,8 @@ LIBINCLUDEDIR := $(INCLUDEDIR)/sensors # to do this. # The subdirectories we need to build things in -SRCDIRS := kernel lib prog/sensors prog/dump etc +SRCDIRS := kernel kernel/busses kernel/chips kernel/include lib prog/sensors \ + prog/dump etc ifeq ($(I2C),1) SRCDIRS += i2c i2c/detect i2c/drivers i2c/eeprom endif diff --git a/kernel/Module.mk b/kernel/Module.mk index 23d1d642..1cbf44eb 100644 --- a/kernel/Module.mk +++ b/kernel/Module.mk @@ -20,37 +20,23 @@ # verbatim in the rules, until it is redefined. MODULE_DIR := kernel -SRCDIRS := kernel/busses kernel/chips - # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... -SRCTARGETS := $(MODULE_DIR)/smbus.o \ - $(MODULE_DIR)/i2c-proc.o \ - $(MODULE_DIR)/i2c-dev.o $(MODULE_DIR)/sensors.o - -SRCHEADERFILES := $(MODULE_DIR)/include/sensors.h $(MODULE_DIR)/include/isa.h \ - $(MODULE_DIR)/include/smbus.h $(MODULE_DIR)/include/i2c-dev.h +KERNELTARGETS := $(MODULE_DIR)/smbus.o \ + $(MODULE_DIR)/i2c-proc.o \ + $(MODULE_DIR)/i2c-dev.o $(MODULE_DIR)/sensors.o # Include all dependency files -INCLUDEFILES += $(SRCTARGETS:.o=.d) +INCLUDEFILES += $(KERNELTARGETS:.o=.d) -all-src: $(SRCTARGETS) -all :: all-src +all-kernel: $(KERNELTARGETS) +all :: all-kernel -# Include all makefiles for sub-modules -INCLUDEFILES := -include $(patsubst %,%/Module.mk,$(SRCDIRS)) -ifneq ($(MAKECMDGOALS),clean) -include $(INCLUDEFILES) -endif +install-kernel: all-kernel + $(MKDIR) $(MODDIR) + $(INSTALL) -o root -g root -m 644 $(KERNELTARGETS) $(MODDIR) +install :: install-kernel - -install-src: all-src - $(MKDIR) $(MODDIR) $(SYSINCLUDEDIR) - $(INSTALL) -o root -g root -m 644 $(SRCTARGETS) $(MODDIR) - $(INSTALL) -o root -g root -m 644 $(SRCHEADERFILES) $(SYSINCLUDEDIR) -install :: install-src - -clean-src: - $(RM) $(SRCTARGETS) $(SRCTARGETS:.o=.d) -clean :: clean-src +clean-kernel: + $(RM) $(KERNELTARGETS) $(KERNELTARGETS:.o=.d) +clean :: clean-kernel diff --git a/kernel/busses/Module.mk b/kernel/busses/Module.mk index d79b024d..c761c5b7 100644 --- a/kernel/busses/Module.mk +++ b/kernel/busses/Module.mk @@ -22,23 +22,19 @@ MODULE_DIR := kernel/busses # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... -SRCTARGETS := $(MODULE_DIR)/i2c-piix4.o $(MODULE_DIR)/i2c-isa.o - -SRCHEADERFILES := $(MODULE_DIR)/../include/sensors.h $(MODULE_DIR)/../include/isa.h \ - $(MODULE_DIR)/../include/smbus.h $(MODULE_DIR)/../include/i2c-dev.h +KERNELBUSSESTARGETS := $(MODULE_DIR)/i2c-piix4.o $(MODULE_DIR)/i2c-isa.o # Include all dependency files -INCLUDEFILES += $(SRCTARGETS:.o=.d) +INCLUDEFILES += $(KERNELBUSSESTARGETS:.o=.d) -all-src: $(SRCTARGETS) -all :: all-src +all-kernel-busses: $(KERNELBUSSESTARGETS) +all :: all-kernel-busses -install-src-busses: all-src - $(MKDIR) $(MODDIR) $(SYSINCLUDEDIR) - $(INSTALL) -o root -g root -m 644 $(SRCTARGETS) $(MODDIR) - $(INSTALL) -o root -g root -m 644 $(SRCHEADERFILES) $(SYSINCLUDEDIR) -install :: install-src-busses +install-kernel-busses: all-kernel-busses + $(MKDIR) $(MODDIR) + $(INSTALL) -o root -g root -m 644 $(KERNELBUSSESTARGETS) $(MODDIR) +install :: install-kernel-busses -clean-src-busses: - $(RM) $(SRCTARGETS) $(SRCTARGETS:.o=.d) -clean :: clean-src-busses +clean-kernel-busses: + $(RM) $(KERNELBUSSESTARGETS) $(KERNELBUSSESTARGETS:.o=.d) +clean :: clean-kernel-busses diff --git a/kernel/chips/Module.mk b/kernel/chips/Module.mk index 25f33914..3cae583f 100644 --- a/kernel/chips/Module.mk +++ b/kernel/chips/Module.mk @@ -22,27 +22,23 @@ MODULE_DIR := kernel/chips # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... -SRCTARGETS := $(MODULE_DIR)/adm1021.o $(MODULE_DIR)/adm9240.o \ - $(MODULE_DIR)/eeprom.o $(MODULE_DIR)/gl518sm.o \ - $(MODULE_DIR)/lm75.o $(MODULE_DIR)/lm78.o \ - $(MODULE_DIR)/lm80.o $(MODULE_DIR)/ltc1710.o \ - $(MODULE_DIR)/w83781d.o - -SRCHEADERFILES := $(MODULE_DIR)/../include/sensors.h $(MODULE_DIR)/../include/isa.h \ - $(MODULE_DIR)/../include/smbus.h $(MODULE_DIR)/../include/i2c-dev.h +KERNELCHIPSTARGETS := $(MODULE_DIR)/adm1021.o $(MODULE_DIR)/adm9240.o \ + $(MODULE_DIR)/eeprom.o $(MODULE_DIR)/gl518sm.o \ + $(MODULE_DIR)/lm75.o $(MODULE_DIR)/lm78.o \ + $(MODULE_DIR)/lm80.o $(MODULE_DIR)/ltc1710.o \ + $(MODULE_DIR)/w83781d.o # Include all dependency files -INCLUDEFILES += $(SRCTARGETS:.o=.d) +INCLUDEFILES += $(KERNELCHIPSTARGETS:.o=.d) -all-src: $(SRCTARGETS) -all :: all-src +all-kernel-chips: $(KERNELCHIPSTARGETS) +all :: all-kernel-chips -install-src-chips: all-src - $(MKDIR) $(MODDIR) $(SYSINCLUDEDIR) - $(INSTALL) -o root -g root -m 644 $(SRCTARGETS) $(MODDIR) - $(INSTALL) -o root -g root -m 644 $(SRCHEADERFILES) $(SYSINCLUDEDIR) -install :: install-src-chips +install-kernel-chips: all-kernel-chips + $(MKDIR) $(MODDIR) + $(INSTALL) -o root -g root -m 644 $(KERNELCHIPSTARGETS) $(MODDIR) +install :: install-kernel-chips -clean-src-chips: - $(RM) $(SRCTARGETS) $(SRCTARGETS:.o=.d) -clean :: clean-src-chips +clean-kernel-chips: + $(RM) $(KERNELCHIPSTARGETS) $(KERNELCHIPSTARGETS:.o=.d) +clean :: clean-kernel-chips diff --git a/kernel/include/Module.mk b/kernel/include/Module.mk new file mode 100644 index 00000000..d9ba0e77 --- /dev/null +++ b/kernel/include/Module.mk @@ -0,0 +1,29 @@ +# Module.mk - Makefile for a Linux module for reading sensor data. +# Copyright (c) 1998 Frodo Looijaard +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Note that MODULE_DIR (the directory in which this file resides) is a +# 'simply expanded variable'. That means that its value is substituted +# verbatim in the rules, until it is redefined. +MODULE_DIR := kernel/include + +KERNELINCLUDEHEADERFILES := $(MODULE_DIR)/sensors.h $(MODULE_DIR)/isa.h \ + $(MODULE_DIR)/smbus.h $(MODULE_DIR)/i2c-dev.h + +install-all-kernel-include: + $(MKDIR) $(SYSINCLUDEDIR) + $(INSTALL) -o root -g root -m 644 $(SRCHEADERFILES) $(SYSINCLUDEDIR) +install :: install-all-kernel-include