root/i2c/trunk/Makefile @ 3315

Revision 3315, 5.2 KB (checked in by frodo, 14 years ago)

Lots of small thingies

This commit adds all relevant i2c source code patches we applied to the
lm_sensors project. They are all very small things. A list is found below.
This commit synchronises the lm_sensors i2c tree and Simon's tree.
Note that the current source tree will still not work with lm_sensors
The current tree compiles with kernels 2.0.0, 2.2.9, probably everything
in-between, and very likely with 2.3.x kernels (the only known incompatibility
is taken care of).

All known PPC patches are also applied; we should ask Geert Uytterhoeven
<geert@…> to check whether the current tree compiles on PPCs
(yes, Simon, they got it running on Macs too!)

Please examine the current tree; one of the things which needs to be done
is to rename some internal variables to correspond with the new source
file names. But I first want an OK on the new names.

* i2c-philips-par.c: Added #include <linux/stddef> (to make it compile on PPC)
* algo-bit.c: Set i2c_debug to zero by default
* i2c-core.c: Introduces init_MUTEX to make it compile with new 2.3 kernels
* i2c-elv.c: Removed RCS $log (it gets much too long)
* i2c-velleman.c: Removed RCS $log (it gets much too long)
* i2c.h: Included <asm/page.h> for 2.0 kernels
* i2c.h: Added I2C_DRIVERID_BT848
* i2c.h: Renamed #define HW_B_MB to HW_B_VIA
* i2c.h: Added HW_B_HYDRA
* i2c-algo-bit.h: Changed line 2 from AGLO_BIT_H to ALGO_BIT_H
* i2c-algo-bit.h: Corrected comment typo
* i2c-philips-par.c, i2c-elektor.c, i2c-velleman.c, i2c-elv.c:

You can now rmmod adapters even when they have registered clients.
Without this, you would have to detach the clients first. Only way of doing
this is to rmmod the client drivers, but the same drivers might be used to
access clients behind other hosts.

* All .c files: only included <linux/init.h> for kernels >= 2.1.35
* i2c-dev.c: Changed KERNEL_VERSION to a plain 0x number for old kernels
* i2c-algo-bit.c: Commented out alg_rcsid to stop compiler complaints
* i2c-elektor.c: renamed `irq' parameter to stop compiler complaints
* i2c-elektor.c: commented out pcf_isa_sleep (unused function) to stop

compiler complaints

* Makefile: Added WARN directive

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1#  Makefile - 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# Everything you may want to change is in the top of this file. Usually, you
19# can just use the defaults, fortunately.
20
21# There are two build systems supported. The lm_sensors-like one builds
22# everything without needing write-access to the kernel tree. The original
23# i2c one adds versioning for module symbols; it needs to write in your
24# kernel tree for this (and seems to give minor troubles in some cases).
25# Make your choice.
26BUILD_SYSTEM=lm_sensors
27#BUILD_SYSTEM=i2c
28
29# The location of your kernel headers (which should be the linux and asm
30# subdirectories). For most people, the below works perfectly. If you use
31# Debian, you may want to change this to something like /usr/src/linux/include.
32LINUX_HEADERS=/usr/include
33
34# The location of linux itself. This is only used to determine whether you
35# use a SMP kernel in the magic invocation just below.
36LINUX=/usr/src/linux
37# Uncomment the third line on SMP systems if the magic invocation fails. It
38# is a bit complicated because SMP configuration changed around kernel 2.1.130
39SMP := $(shell if grep -q '^SMP[[:space:]]*=' $(LINUX)/Makefile || \
40                  grep -q '^[[:space:]]*\#define[[:space:]]*CONFIG_SMP[[:space:]]*1' $(LINUX_HEADERS)/linux/autoconf.h ; \
41               then echo 1; else echo 0; fi)
42#SMP := 0
43#SMP := 1
44
45# Uncomment the second or third line if the magic invocation fails.
46# We need to know whether CONFIG_MODVERSIONS is defined.
47MODVER := $(shell if cat $(LINUX_HEADERS)/linux/config.h $(LINUX_HEADERS)/linux/autoconf.h 2>/dev/null | grep -q '^[[:space:]]*\#define[[:space:]]*CONFIG_MODVERSIONS[[:space:]]*1'; then echo 1; else echo 0; fi)
48#MODVER := 0
49#MODVER := 1
50
51# This is the directory into which the modules will be installed.
52MODDIR := /lib/modules/current/extra/misc
53
54# Uncomment the second line if you are a developer. This will enable many
55# additional warnings at compile-time
56#WARN := 0
57WARN := 1
58
59##################################################
60# Below this, nothing should need to be changed. #
61##################################################
62
63ifeq ($(BUILD_SYSTEM),i2c)
64
65all:
66        $(MAKE) -C kernel KERNEL_LOCATION=$(LINUX) MODULE_DIR=$(MODDIR) here
67
68install:
69        $(MAKE) -C kernel KERNEL_LOCATION=$(LINUX) MODULE_DIR=$(MODDIR) install
70
71clean:
72        $(MAKE) -C kernel KERNEL_LOCATION=$(LINUX) MODULE_DIR=$(MODDIR) clean
73
74
75else
76
77# Note that this is a monolithic Makefile; it calls no sub-Makefiles,
78# but instead, it compiles everything right from here. Yes, there are
79# some distinct advantages to this; see the following paper for more info:
80#   http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html
81# Note that is still uses Makefile fragments in sub-directories; these
82# are called 'Module.mk'.
83
84# Within each Module.mk, rules and dependencies can be added to targets
85# all, install and clean. Use double colons instead of single ones
86# to do this.
87
88# The subdirectories we need to build things in
89SRCDIRS := kernel
90
91# Some often-used commands with default options
92MKDIR := mkdir -p
93RM := rm -f
94CC := gcc
95BISON := bison
96FLEX := flex
97AR := ar
98INSTALL := install
99LN := ln -sfn
100GREP := grep
101
102# Determine the default compiler flags
103# MODCFLAGS is to create in-kernel object files (modules)
104
105CFLAGS := -I$(LINUX_HEADERS) -O2 -DLM_SENSORS
106
107ifeq ($(WARN),1)
108CFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \
109          -Wcast-align -Wwrite-strings -Wnested-externs -Winline
110endif
111
112
113# The -DEXPORT_SYMTAB is to keep the symbol export mechanism quiet.
114MODCFLAGS := $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer \
115             -DEXPORT_SYMTAB
116
117ifeq ($(SMP),1)
118MODCFLAGS += -D__SMP__
119endif
120
121ifeq ($(MODVER),1)
122MODCFLAGS += -DMODVERSIONS -include /usr/include/linux/modversions.h
123endif
124
125.PHONY: all clean install version package dep
126# Make all the default rule
127all::
128
129# Include all makefiles for sub-modules
130INCLUDEFILES :=
131include $(patsubst %,%/Module.mk,$(SRCDIRS))
132ifneq ($(MAKECMDGOALS),clean)
133include $(INCLUDEFILES)
134endif
135
136# Making the dependency files - done automatically!
137dep :
138
139all ::
140
141install :: all
142
143clean::
144        $(RM) lm_sensors-*
145
146# Here, we define all implicit rules we want to use.
147
148.SUFFIXES:
149
150# We need to create dependency files. Tricky. We sed rule puts dir/file.d and
151# dir/file.c # in front of the dependency file rule.
152
153# .o files are used for modules
154%.o: %.c
155        $(CC) $(MODCFLAGS) -c $< -o $@
156
157%.d: %.c
158        $(CC) -M -MG $(MODCFLAGS) $< | \
159        sed -e 's@^\(.*\)\.o:@$*.d $*.o: Makefile '`dirname $*.d`/Module.mk' @' > $@
160
161endif
Note: See TracBrowser for help on using the browser.