| 1 | # Module.mk - Makefile for a Linux module for reading sensor data. |
|---|
| 2 | # Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl> |
|---|
| 3 | # |
|---|
| 4 | # This program is free software; you can redistribute it and/or modify |
|---|
| 5 | # it under the terms of the GNU General Public License as published by |
|---|
| 6 | # the Free Software Foundation; either version 2 of the License, or |
|---|
| 7 | # (at your option) any later version. |
|---|
| 8 | # |
|---|
| 9 | # This program is distributed in the hope that it will be useful, |
|---|
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | # GNU General Public License for more details. |
|---|
| 13 | # |
|---|
| 14 | # You should have received a copy of the GNU General Public License |
|---|
| 15 | # along with this program; if not, write to the Free Software |
|---|
| 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 17 | |
|---|
| 18 | # Note that MODULE_DIR (the directory in which this file resides) is a |
|---|
| 19 | # 'simply expanded variable'. That means that its value is substituted |
|---|
| 20 | # verbatim in the rules, until it is redefined. |
|---|
| 21 | MODULE_DIR := kernel |
|---|
| 22 | |
|---|
| 23 | # Regrettably, even 'simply expanded variables' will not put their currently |
|---|
| 24 | # defined value verbatim into the command-list of rules... |
|---|
| 25 | # We will only include those modules which are not already built into this |
|---|
| 26 | # kernel. |
|---|
| 27 | KERNELTARGETS := |
|---|
| 28 | KERNELINCLUDES := |
|---|
| 29 | ifneq ($(shell if grep -q '^CONFIG_I2C=y' $(LINUX)/.config; then echo 1; fi),1) |
|---|
| 30 | KERNELTARGETS += $(MODULE_DIR)/i2c-core.o |
|---|
| 31 | KERNELINCLUDES += $(MODULE_DIR)/i2c.h |
|---|
| 32 | endif |
|---|
| 33 | ifneq ($(shell if grep -q '^CONFIG_I2C_CHARDEV=y' $(LINUX)/.config; then echo 1; fi),1) |
|---|
| 34 | KERNELTARGETS += $(MODULE_DIR)/i2c-dev.o |
|---|
| 35 | KERNELINCLUDES += $(MODULE_DIR)/i2c-dev.h |
|---|
| 36 | endif |
|---|
| 37 | ifneq ($(shell if grep -q '^CONFIG_I2C_ALGOBIT=y' $(LINUX)/.config; then echo 1; fi),1) |
|---|
| 38 | KERNELTARGETS += $(MODULE_DIR)/i2c-algo-bit.o |
|---|
| 39 | KERNELINCLUDES += $(MODULE_DIR)/i2c-algo-bit.h |
|---|
| 40 | endif |
|---|
| 41 | ifneq ($(shell if grep -q '^CONFIG_I2C_PHILIPSPAR=y' $(LINUX)/.config; then echo 1; fi),1) |
|---|
| 42 | KERNELTARGETS += $(MODULE_DIR)/i2c-philips-par.o |
|---|
| 43 | endif |
|---|
| 44 | ifneq ($(shell if grep -q '^CONFIG_I2C_ELV=y' $(LINUX)/.config; then echo 1; fi),1) |
|---|
| 45 | KERNELTARGETS += $(MODULE_DIR)/i2c-elv.o |
|---|
| 46 | endif |
|---|
| 47 | ifneq ($(shell if grep -q '^CONFIG_I2C_VELLEMAN=y' $(LINUX)/.config; then echo 1; fi),1) |
|---|
| 48 | KERNELTARGETS += $(MODULE_DIR)/i2c-velleman.o |
|---|
| 49 | endif |
|---|
| 50 | ifneq ($(shell if grep -q '^CONFIG_I2C_ALGOPCF=y' $(LINUX)/.config; then echo 1; fi),1) |
|---|
| 51 | KERNELTARGETS += $(MODULE_DIR)/i2c-algo-pcf.o |
|---|
| 52 | KERNELINCLUDES += $(MODULE_DIR)/i2c-algo-pcf.h |
|---|
| 53 | endif |
|---|
| 54 | ifneq ($(shell if grep -q '^CONFIG_I2C_ELEKTOR=y' $(LINUX)/.config; then echo 1; fi),1) |
|---|
| 55 | KERNELTARGETS += $(MODULE_DIR)/i2c-elektor.o |
|---|
| 56 | KERNELINCLUDES += $(MODULE_DIR)/i2c-elektor.h $(MODULE_DIR)/i2c-pcf8584.h |
|---|
| 57 | endif |
|---|
| 58 | |
|---|
| 59 | # Include all dependency files |
|---|
| 60 | INCLUDEFILES += $(KERNELTARGETS:.o=.d) |
|---|
| 61 | |
|---|
| 62 | all-kernel: $(KERNELTARGETS) |
|---|
| 63 | all :: all-kernel |
|---|
| 64 | |
|---|
| 65 | install-kernel: all-kernel |
|---|
| 66 | $(MKDIR) $(MODDIR) $(LINUX_INCLUDE_DIR) |
|---|
| 67 | $(INSTALL) -o root -g root -m 644 $(KERNELTARGETS) $(MODDIR) |
|---|
| 68 | $(INSTALL) -o root -g root -m 644 $(KERNELINCLUDES) $(LINUX_INCLUDE_DIR) |
|---|
| 69 | install :: install-kernel |
|---|
| 70 | |
|---|
| 71 | clean-kernel: |
|---|
| 72 | $(RM) $(MODULE_DIR)/*.o $(MODULE_DIR)/*.d $(MODULE_DIR)/.*.o.flags |
|---|
| 73 | $(RM) $(MODULE_DIR)/*~ |
|---|
| 74 | clean :: clean-kernel |
|---|
| 75 | |
|---|