📄 module.mk
字号:
# Module.mk - Makefile for a Linux module for reading sensor data.# Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>## 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 := kernelKERNELDIR := $(MODULE_DIR)# Regrettably, even 'simply expanded variables' will not put their currently# defined value verbatim into the command-list of rules...# We will only include those modules which are not already built into this# kernel.KERNELTARGETS :=KERNELINCLUDES :=ifneq ($(shell if grep -q '^CONFIG_I2C=y' $(LINUX)/.config; then echo 1; fi),1)KERNELTARGETS += $(MODULE_DIR)/i2c-core.oKERNELINCLUDES += $(MODULE_DIR)/i2c.h $(MODULE_DIR)/i2c-id.hendififneq ($(shell if grep -q '^CONFIG_I2C_CHARDEV=y' $(LINUX)/.config; then echo 1; fi),1)KERNELTARGETS += $(MODULE_DIR)/i2c-dev.oendififneq ($(shell if grep -q '^CONFIG_I2C_ALGOBIT=y' $(LINUX)/.config; then echo 1; fi),1)KERNELTARGETS += $(MODULE_DIR)/i2c-algo-bit.oKERNELINCLUDES += $(MODULE_DIR)/i2c-algo-bit.hendif# i2c-algo-biths is no more compiled by default, as it has no users and# has caused more trouble than was worth.#ifneq ($(shell if grep -q '^CONFIG_I2C_ALGOBITHS=y' $(LINUX)/.config; then echo 1; fi),1)#KERNELTARGETS += $(MODULE_DIR)/i2c-algo-biths.o#KERNELINCLUDES += $(MODULE_DIR)/i2c-algo-biths.h#endififneq ($(shell if grep -q '^CONFIG_I2C_PHILIPSPAR=y' $(LINUX)/.config; then echo 1; fi),1)ifeq ($(shell if grep -q '^CONFIG_PARPORT=[my]' $(LINUX)/.config; then echo 1; fi),1)KERNELTARGETS += $(MODULE_DIR)/i2c-philips-par.oendifendififneq ($(shell if grep -q '^CONFIG_I2C_ELV=y' $(LINUX)/.config; then echo 1; fi),1)KERNELTARGETS += $(MODULE_DIR)/i2c-elv.oendififneq ($(shell if grep -q '^CONFIG_I2C_VELLEMAN=y' $(LINUX)/.config; then echo 1; fi),1)KERNELTARGETS += $(MODULE_DIR)/i2c-velleman.oendififneq ($(shell if grep -q '^CONFIG_I2C_ALGOPCF=y' $(LINUX)/.config; then echo 1; fi),1)KERNELTARGETS += $(MODULE_DIR)/i2c-algo-pcf.oKERNELINCLUDES += $(MODULE_DIR)/i2c-algo-pcf.hendif# will not build outside kernel tree ifneq ($(shell if grep -q '^CONFIG_I2C_ELEKTOR=y' $(LINUX)/.config; then echo 1; fi),1)#KERNELTARGETS += $(MODULE_DIR)/i2c-elektor.o#KERNELINCLUDES += $(MODULE_DIR)/i2c-pcf8584.hendififneq ($(shell if grep -q '^CONFIG_I2C_PROC=y' $(LINUX)/.config; then echo 1; fi),1)KERNELTARGETS += $(MODULE_DIR)/i2c-proc.oKERNELINCLUDES += $(MODULE_DIR)/i2c-proc.hendififneq ($(shell if grep -q '^CONFIG_I2C_PPORT=y' $(LINUX)/.config; then echo 1; fi),1)KERNELTARGETS += $(MODULE_DIR)/i2c-pport.oendif#ifeq ($(shell if grep -q '^CONFIG_I2C_IOP3XX=y' $(LINUX)/.config; then echo 1; fi),1)#KERNELTARGETS += $(MODULE_DIR)/i2c-iop3xx.o#endif## No CONFIG option for this yet (not in mkpatch)## will not build outside kernel tree #KERNELTARGETS += $(MODULE_DIR)/i2c-pcf-epp.o## following require kernel 2.4.3 or higher... and PPC##ifneq ($(shell if grep -q '^CONFIG_I2C_ALGO8XX=y' $(LINUX)/.config; then echo 1; fi),1)#KERNELTARGETS += $(MODULE_DIR)/i2c-algo-8xx.o#KERNELINCLUDES += $(MODULE_DIR)/i2c-algo-8xx.h#endif#ifneq ($(shell if grep -q '^CONFIG_I2C_RPXLITE=y' $(LINUX)/.config; then echo 1; fi),1)#KERNELTARGETS += $(MODULE_DIR)/i2c-rpx.o#endif# Include all dependency filesINCLUDEFILES += $(KERNELTARGETS:.o=.d)all-kernel: $(KERNELTARGETS)all :: all-kernel## If $MODPREF/kernel exists, we presume the new (2.4.0) /lib/modules/x.y.z directory# layout, so we install in kernel/drivers/i2c/ and remove old versions in misc/# Otherwise we install in misc/ as before.#install-kernel: all-kernel if [ -n "$(KERNELTARGETS)" ] ; then \ $(MKDIR) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c ; \ $(INSTALL) -m 644 $(KERNELTARGETS) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c ; \ for i in $(KERNELTARGETS) ; do \ $(RM) $(DESTDIR)$(MODPREF)/misc/`basename $$i` $(DESTDIR)$(MODPREF)/misc/`basename $$i`.gz $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/`basename $$i`.gz ; \ done ; \ for i in i2c-elektor.o i2c-pcf-epp.o ; do \ $(RM) $(DESTDIR)$(MODPREF)/misc/`basename $$i` $(DESTDIR)$(MODPREF)/misc/`basename $$i`.gz $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/`basename $$i` $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/`basename $$i`.gz ; \ done ; \ $(RMDIR) $(DESTDIR)$(MODPREF)/misc 2> /dev/null || true ; \ fi if [ -n "$(KERNELINCLUDES)" ] ; then \ $(MKDIR) $(DESTDIR)$(LINUX_INCLUDE_DIR) ; \ $(INSTALL) -m 644 $(KERNELINCLUDES) $(DESTDIR)$(LINUX_INCLUDE_DIR) ; \ fiinstall :: install-kernelclean-kernel: $(RM) $(KERNELDIR)/*.o $(KERNELDIR)/*.d $(KERNELDIR)/.*.o.flags $(RM) $(KERNELDIR)/*~clean :: clean-kernel
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -