root/i2c/trunk/kernel/Module.mk @ 3955

Revision 3955, 5.2 KB (checked in by khali, 10 years ago)

Revert the header install removal, which was a damn bad idea.
The header files are required to compile lm_sensors (among others)!

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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.
21MODULE_DIR := kernel
22KERNELDIR := $(MODULE_DIR)
23
24# Regrettably, even 'simply expanded variables' will not put their currently
25# defined value verbatim into the command-list of rules...
26# We will only include those modules which are not already built into this
27# kernel.
28KERNELTARGETS :=
29KERNELINCLUDES :=
30ifneq ($(shell if grep -q '^CONFIG_I2C=y' $(LINUX)/.config; then echo 1; fi),1)
31KERNELTARGETS += $(MODULE_DIR)/i2c-core.o
32KERNELINCLUDES += $(MODULE_DIR)/i2c.h $(MODULE_DIR)/i2c-id.h
33endif
34ifneq ($(shell if grep -q '^CONFIG_I2C_CHARDEV=y' $(LINUX)/.config; then echo 1; fi),1)
35KERNELTARGETS += $(MODULE_DIR)/i2c-dev.o
36endif
37ifneq ($(shell if grep -q '^CONFIG_I2C_ALGOBIT=y' $(LINUX)/.config; then echo 1; fi),1)
38KERNELTARGETS += $(MODULE_DIR)/i2c-algo-bit.o
39KERNELINCLUDES += $(MODULE_DIR)/i2c-algo-bit.h
40endif
41ifneq ($(shell if grep -q '^CONFIG_I2C_ALGOBITHS=y' $(LINUX)/.config; then echo 1; fi),1)
42KERNELTARGETS += $(MODULE_DIR)/i2c-algo-biths.o
43KERNELINCLUDES += $(MODULE_DIR)/i2c-algo-biths.h
44endif
45ifneq ($(shell if grep -q '^CONFIG_I2C_PHILIPSPAR=y' $(LINUX)/.config; then echo 1; fi),1)
46ifeq ($(shell if grep -q '^CONFIG_PARPORT=[my]' $(LINUX)/.config; then echo 1; fi),1)
47KERNELTARGETS += $(MODULE_DIR)/i2c-philips-par.o
48endif
49endif
50ifneq ($(shell if grep -q '^CONFIG_I2C_ELV=y' $(LINUX)/.config; then echo 1; fi),1)
51KERNELTARGETS += $(MODULE_DIR)/i2c-elv.o
52endif
53ifneq ($(shell if grep -q '^CONFIG_I2C_VELLEMAN=y' $(LINUX)/.config; then echo 1; fi),1)
54KERNELTARGETS += $(MODULE_DIR)/i2c-velleman.o
55endif
56ifneq ($(shell if grep -q '^CONFIG_I2C_ALGOPCF=y' $(LINUX)/.config; then echo 1; fi),1)
57KERNELTARGETS += $(MODULE_DIR)/i2c-algo-pcf.o
58KERNELINCLUDES += $(MODULE_DIR)/i2c-algo-pcf.h
59endif
60# will not build outside kernel tree
61ifneq ($(shell if grep -q '^CONFIG_I2C_ELEKTOR=y' $(LINUX)/.config; then echo 1; fi),1)
62#KERNELTARGETS += $(MODULE_DIR)/i2c-elektor.o
63#KERNELINCLUDES += $(MODULE_DIR)/i2c-pcf8584.h
64endif
65ifneq ($(shell if grep -q '^CONFIG_I2C_PROC=y' $(LINUX)/.config; then echo 1; fi),1)
66KERNELTARGETS += $(MODULE_DIR)/i2c-proc.o
67KERNELINCLUDES += $(MODULE_DIR)/i2c-proc.h
68endif
69ifneq ($(shell if grep -q '^CONFIG_I2C_PPORT=y' $(LINUX)/.config; then echo 1; fi),1)
70KERNELTARGETS += $(MODULE_DIR)/i2c-pport.o
71endif
72#ifeq ($(shell if grep -q '^CONFIG_I2C_IOP3XX=y' $(LINUX)/.config; then echo 1; fi),1)
73#KERNELTARGETS += $(MODULE_DIR)/i2c-iop3xx.o
74#endif
75#
76# No CONFIG option for this yet (not in mkpatch)
77#
78# will not build outside kernel tree
79#KERNELTARGETS += $(MODULE_DIR)/i2c-pcf-epp.o
80#
81# following require kernel 2.4.3 or higher... and PPC
82#
83#ifneq ($(shell if grep -q '^CONFIG_I2C_ALGO8XX=y' $(LINUX)/.config; then echo 1; fi),1)
84#KERNELTARGETS += $(MODULE_DIR)/i2c-algo-8xx.o
85#KERNELINCLUDES += $(MODULE_DIR)/i2c-algo-8xx.h
86#endif
87#ifneq ($(shell if grep -q '^CONFIG_I2C_RPXLITE=y' $(LINUX)/.config; then echo 1; fi),1)
88#KERNELTARGETS += $(MODULE_DIR)/i2c-rpx.o
89#endif
90
91# Include all dependency files
92INCLUDEFILES += $(KERNELTARGETS:.o=.d)
93
94all-kernel: $(KERNELTARGETS)
95all :: all-kernel
96
97#
98# If $MODPREF/kernel exists, we presume the new (2.4.0) /lib/modules/x.y.z directory
99# layout, so we install in kernel/drivers/i2c/ and remove old versions in misc/
100# Otherwise we install in misc/ as before.
101#
102install-kernel: all-kernel
103        if [ -n "$(KERNELTARGETS)" ] ; then \
104          $(MKDIR) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c ; \
105          $(INSTALL) -m 644 $(KERNELTARGETS) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c ; \
106          for i in $(KERNELTARGETS) ; do \
107            $(RM) $(DESTDIR)$(MODPREF)/misc/`basename $$i` $(DESTDIR)$(MODPREF)/misc/`basename $$i`.gz $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/`basename $$i`.gz ; \
108          done ; \
109          for i in i2c-elektor.o i2c-pcf-epp.o ; do \
110            $(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 ; \
111          done ; \
112          $(RMDIR) $(DESTDIR)$(MODPREF)/misc 2> /dev/null || true ; \
113        fi
114        if [ -n "$(KERNELINCLUDES)" ] ; then \
115          $(MKDIR) $(DESTDIR)$(LINUX_INCLUDE_DIR) ; \
116          $(INSTALL) -m 644 $(KERNELINCLUDES) $(DESTDIR)$(LINUX_INCLUDE_DIR) ; \
117        fi
118install :: install-kernel
119
120clean-kernel:
121        $(RM) $(KERNELDIR)/*.o $(KERNELDIR)/*.d $(KERNELDIR)/.*.o.flags
122        $(RM) $(KERNELDIR)/*~
123clean :: clean-kernel
124
Note: See TracBrowser for help on using the browser.