diff --git a/Makefile b/Makefile index 41c67318..bf9ea90e 100644 --- a/Makefile +++ b/Makefile @@ -129,7 +129,7 @@ MANGRP := root # to do this. # The subdirectories we need to build things in -SRCDIRS := +SRCDIRS := mkpatch ifeq ($(COMPILE_KERNEL),1) SRCDIRS += kernel kernel/busses kernel/chips kernel/include endif diff --git a/kernel/Module.mk b/kernel/Module.mk index dd3d66dd..918bc771 100644 --- a/kernel/Module.mk +++ b/kernel/Module.mk @@ -19,6 +19,7 @@ # 'simply expanded variable'. That means that its value is substituted # verbatim in the rules, until it is redefined. MODULE_DIR := kernel +KERNELDIR := $(MODULE_DIR) # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... @@ -39,5 +40,5 @@ install-kernel: all-kernel install :: install-kernel clean-kernel: - $(RM) $(KERNELTARGETS) $(KERNELTARGETS:.o=.d) + $(RM) $(KERNELDIR)/*.o $(KERNELDIR)/*.d clean :: clean-kernel diff --git a/kernel/busses/Module.mk b/kernel/busses/Module.mk index 39f4b680..c98e2cac 100644 --- a/kernel/busses/Module.mk +++ b/kernel/busses/Module.mk @@ -19,6 +19,7 @@ # 'simply expanded variable'. That means that its value is substituted # verbatim in the rules, until it is redefined. MODULE_DIR := kernel/busses +KERNELBUSSESDIR := $(MODULE_DIR) # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... @@ -53,5 +54,5 @@ install-kernel-busses: all-kernel-busses install :: install-kernel-busses clean-kernel-busses: - $(RM) $(KERNELBUSSESTARGETS) $(KERNELBUSSESTARGETS:.o=.d) + $(RM) $(KERNELBUSSESDIR)/*.o $(KERNELBUSSESDIR)/*.d clean :: clean-kernel-busses diff --git a/kernel/chips/Module.mk b/kernel/chips/Module.mk index 6552753b..cf35f97d 100644 --- a/kernel/chips/Module.mk +++ b/kernel/chips/Module.mk @@ -19,6 +19,7 @@ # 'simply expanded variable'. That means that its value is substituted # verbatim in the rules, until it is redefined. MODULE_DIR := kernel/chips +KERNELCHIPSDIR := $(MODULE_DIR) # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... @@ -68,5 +69,5 @@ install-kernel-chips: all-kernel-chips install :: install-kernel-chips clean-kernel-chips: - $(RM) $(KERNELCHIPSTARGETS) $(KERNELCHIPSTARGETS:.o=.d) + $(RM) $(KERNELCHIPSDIR)/*.o $(KERNELCHIPSDIR)/*.d clean :: clean-kernel-chips diff --git a/kernel/include/Module.mk b/kernel/include/Module.mk index 887cee5c..d6831d94 100644 --- a/kernel/include/Module.mk +++ b/kernel/include/Module.mk @@ -19,6 +19,7 @@ # 'simply expanded variable'. That means that its value is substituted # verbatim in the rules, until it is redefined. MODULE_DIR := kernel/include +KERNELINCLUDEDIR := $(MODULE_DIR) KERNELINCLUDEFILES := ifneq ($(shell if grep -q '^CONFIG_SENSORS=y' $(LINUX)/.config; then echo 1; fi),1) @@ -35,6 +36,6 @@ install-all-kernel-include: install :: install-all-kernel-include clean-all-kernel-include: - $(RM) $(KERNELINCLUDEFILES:.h=.h.install) + $(RM) $(KERNELINCLUDEDIR)/*.h.install clean :: clean-all-kernel-include diff --git a/lib/Module.mk b/lib/Module.mk index 12905128..7de0cdb6 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -19,6 +19,7 @@ # 'simply expanded variable'. That means that its value is substituted # verbatim in the rules, until it is redefined. MODULE_DIR := lib +LIBDIR := $(MODULE_DIR) # The manual dirs and files LIBMAN3DIR := $(MANDIR)/man3 @@ -48,7 +49,8 @@ LIBCSOURCES := $(MODULE_DIR)/data.c $(MODULE_DIR)/general.c \ LIBOTHEROBJECTS := $(MODULE_DIR)/conf-parse.o $(MODULE_DIR)/conf-lex.o LIBSHOBJECTS := $(LIBCSOURCES:.c=.lo) $(LIBOTHEROBJECTS:.o=.lo) LIBSTOBJECTS := $(LIBCSOURCES:.c=.ao) $(LIBOTHEROBJECTS:.o=.ao) -LIBEXTRACLEAN := $(MODULE_DIR)/conf-parse.h $(MODULE_DIR)/libsensors.so* +LIBEXTRACLEAN := $(MODULE_DIR)/conf-parse.h $(MODULE_DIR)/conf-parse.c \ + $(MODULE_DIR)/conf-lex.c LIBHEADERFILES := $(MODULE_DIR)/error.h $(MODULE_DIR)/sensors.h \ $(MODULE_DIR)/chips.h @@ -95,7 +97,7 @@ install-lib: all-lib install :: install-lib clean-lib: - $(RM) $(LIBTARGETS) $(LIBSHOBJECTS) $(LIBSTOBJECTS) - $(RM) $(LIBSHOBJECTS:.lo=.ld) $(LIBSTOBJECTS:.ao=.ad) - $(RM) $(LIBOTHEROBJECTS:.o=.c) $(LIBEXTRACLEAN) + $(RM) $(LIBDIR)/*.ld $(LIBDIR)/*.ad + $(RM) $(LIBDIR)/*.lo $(LIBDIR)/*.ao + $(RM) $(LIBTARGETS) $(LIBEXTRACLEAN) clean :: clean-lib diff --git a/mkpatch/Module.mk b/mkpatch/Module.mk new file mode 100644 index 00000000..3b3cc8e8 --- /dev/null +++ b/mkpatch/Module.mk @@ -0,0 +1,26 @@ +# Module.mk - Makefile for a Linux module for reading sensor data. +# Copyright (c) 1998, 1999 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 := mkpatch +MKPATCHDIR := $(MODULE_DIR) + +clean-mkpatch: + $(RM) $(MKPATCHDIR)/.temp +clean :: clean-mkpatch diff --git a/prog/detect/Module.mk b/prog/detect/Module.mk index 29c6dbd3..10957434 100644 --- a/prog/detect/Module.mk +++ b/prog/detect/Module.mk @@ -19,6 +19,7 @@ # 'simply expanded variable'. That means that its value is substituted # verbatim in the rules, until it is redefined. MODULE_DIR := prog/detect +PROGDETECTDIR := $(MODULE_DIR) # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... @@ -39,6 +40,5 @@ install-prog-detect: all-prog-detect install :: install-prog-detect clean-prog-detect: - $(RM) $(PROGDETECTSOURCES:.c=.rd) $(PROGDETECTSOURCES:.c=.ro) \ - $(PROGDETECTTARGETS) + $(RM) $(PROGDETECTDIR)/*.rd $(PROGDETECTDIR)/*.ro $(PROGDETECTTARGETS) clean :: clean-prog-detect diff --git a/prog/dump/Module.mk b/prog/dump/Module.mk index 12630082..c306ed75 100644 --- a/prog/dump/Module.mk +++ b/prog/dump/Module.mk @@ -19,6 +19,7 @@ # 'simply expanded variable'. That means that its value is substituted # verbatim in the rules, until it is redefined. MODULE_DIR := prog/dump +PROGDUMPDIR := $(MODULE_DIR) # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... @@ -33,6 +34,5 @@ all-prog-dump: $(PROGDUMPTARGETS) all :: all-prog-dump clean-prog-dump: - $(RM) $(PROGDUMPSOURCES:.c=.rd) $(PROGDUMPSOURCES:.c=.ro) \ - $(PROGDUMPTARGETS) + $(RM) $(PROGDUMPDIR)/*.rd $(PROGDUMPDIR)/*.ro $(PROGDUMPTARGETS) clean :: clean-prog-dump diff --git a/prog/sensors/Module.mk b/prog/sensors/Module.mk index 180bef1c..2ae8545f 100644 --- a/prog/sensors/Module.mk +++ b/prog/sensors/Module.mk @@ -19,6 +19,7 @@ # 'simply expanded variable'. That means that its value is substituted # verbatim in the rules, until it is redefined. MODULE_DIR := prog/sensors +PROGSENSORSDIR := $(MODULE_DIR) PROGSENSORSMAN1DIR := $(MANDIR)/man1 PROGSENSORSMAN1FILES := $(MODULE_DIR)/sensors.1 @@ -45,6 +46,6 @@ install-prog-sensors: all-prog-sensors install :: install-prog-sensors clean-prog-sensors: - $(RM) $(PROGSENSORSSOURCES:.c=.rd) $(PROGSENSORSSOURCES:.c=.ro) \ - $(PROGSENSORSTARGETS) + $(RM) $(PROGSENSORSDIR)/*.rd $(PROGSENSORSDIR)/*.ro + $(RM) $(PROGSENSORSTARGETS) clean :: clean-prog-sensors