Makefile skeleton, made i2c compile with 2.0 kernels

Please examine the Makefile before extending it, as its approach is
completely new. It should be very modular now, though. Makefile fragments
are called Module.mk.

The Module.mk in i2c does not handle dependencies yet.

There are some patches to bit-mb.c to make it compile with 2.0 kernels.
They have been sent to Simon Vogl (author of the i2c module).


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Frodo Looijaard committed 1998-11-03 01:19:04 +00:00
1 parent 11e88380d5
commit a001ba2b96
5 files changed
+156

No files matched your search

+95
View File
@@ -0,0 +1,95 @@
# Uncomment the second line on SMP systems if the magic invocation fails.
#SMP := 0
#SMP := 1
SMP := $(shell if grep -q '^SMP[[:space:]]*=' /usr/src/linux/Makefile; then echo 1; else echo 0; fi)
# Uncomment the second line if you do not want to compile the included
# i2c modules. WARNING! If the i2c module version does not match the
# smbus/sensor module versions, you will get into severe problems.
I2C := 1
#I2C := 0
# Uncomment the second line if you are a developer. This will enable many
# additional warnings at compile-time
WARN := 0
#WARN := 1
# This is the directory into which the modules will be installed, if you
# call 'make install'
MODDIR := /lib/modules/extra/misc
# This is the directory into which the include files will be installed,
# if you call 'make install'. If you install it in the directory below,
# #include <linux/smbus.h>, for example, should work, regardless of the
# current linux kernel.
INCLUDEDIR := /usr/local/include/linux
# Below this, nothing should need to be changed.
# Note that this is a monolithic Makefile; it calls no sub-Makefiles,
# but instead, it compiles everything right from here. Yes, there are
# some distinct advantages to this; see the following paper for more info:
# http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html
# Note that is still uses Makefile fragments in sub-directories; these
# are called 'Module.mk'.
# Within each Module.mk, rules and dependencies can be added to targets
# all, install and clean. Use double colons instead of single ones
# to do this.
# The subdirectories we need to build things in
MODULES :=
ifeq ($(I2C),1)
MODULES += i2c
endif
# Some often-used commands with default options
MKDIR := mkdir -p
RM := rm -f
# Determine the default compiler flags
CFLAGS := -D__KERNEL__ -DMODULE -I. -O2 -fomit-frame-pointer
ifeq ($(SMP),1)
CFLAGS += -D__SMP__
endif
ifeq ($(WARN),1)
CFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \
-Wcast-align -Wwrite-strings -Wnested-externs -Winline
endif
.PHONY: all clean install version package
# Include all makefiles for sub-modules
include $(patsubst %,%/Module.mk,$(MODULES))
all::
install::
clean::
$(RM) lm_sensors-*
# This is tricky, but it works like a charm. It needs lots of utilities
# though: cut, find, gzip, ln, tail and tar.
package: version clean
lmversion=`tail -1 version.h|cut -f 2 -d \"`; \
lmpackage=lm_sensors-$$lmversion; \
ln -s . $$lmpackage; \
find $$lmpackage/ -type f | grep -v ^$$lmpackage/$$lmpackage$$ | \
grep -v ^$$lmpackage/$$lmpackage.tar$$ | \
grep -v ^$$lmpackage/$$ | \
grep -v CVS | \
grep -v ^$$lmpackage/.# | \
tar rvf $$lmpackage.tar -T -; \
gzip -9 $$lmpackage.tar ;\
$(RM) $$lmpackage.tar $$lmpackage
version:
$(RM) version.h
echo '#define LM_DATE "'`date +'%Y%m%d'`\" > version.h
echo -n 'Version: '; \
echo '#define LM_VERSION "'`read VER; echo $$VER`\" >> version.h
+6
View File
@@ -55,6 +55,12 @@ hardware monitor</A>
wmlm78 is a graphical extension of lm_sensors, which can be docked in Window
Manager.
</UL>
<LI>Other things
<UL>
<LI><A HREF="http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html">Recursive
Make considered Harmful</A>
<BR>A paper on which the version 2 Makefile is based
</UL>
</UL>
</BODY>
</HTML>
+17
View File
@@ -0,0 +1,17 @@
# 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 := i2c
TARGETS := $(MODULE_DIR)/i2c-core.o $(MODULE_DIR)/algo-bit.o \
$(MODULE_DIR)/i2c-dev.o $(MODULE_DIR)/bit-lp.o \
$(MODULE_DIR)/bit-velle.o $(MODULE_DIR)/bit-mb.o
all :: $(TARGETS)
install :: $(TARGETS)
$(MKDIR) $(MODDIR)
install -o root -g root -m 644 $(MODDIR) $(TARGETS)
clean ::
$(RM) $(TARGETS)
+36
View File
@@ -24,6 +24,14 @@
#include <linux/module.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/types.h>
#include <linux/version.h>
/* When exactly was the new pci interface introduced? */
#if LINUX_VERSION_CODE < 0x020100
#include <linux/bios32.h>
#endif
#include "i2c.h"
#include "algo-bit.h"
@@ -119,6 +127,9 @@ static void bit_mb_exit(void)
release_region(I2C_DIR, IOSPACE);
}
/* When exactly was the new pci interface introduced? */
#if LINUX_VERSION_CODE >= 0x020100
static u32 find_i2c(void)
{
struct pci_dev *s_bridge;
@@ -138,6 +149,31 @@ static u32 find_i2c(void)
return (val & (0xff<<8));
}
#else
static u32 find_i2c(void)
{
unsigned char VIA_bus, VIA_devfn;
u32 val;
if (! pcibios_present())
return(0);
if(pcibios_find_device(
PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, 0, &VIA_bus,
&VIA_devfn));
return 0;
if ( PCIBIOS_SUCCESSFUL !=
pcibios_read_config_dword(VIA_bus, VIA_devfn,
PM_IO_BASE_REGISTER, &val))
return 0;
return (val & (0xff<<8));
}
#endif
#ifdef MODULE
MODULE_AUTHOR("Kyosti Malkki <kmalkki@cc.hut.fi>");
MODULE_DESCRIPTION("SMBus for VT82C586");
+2
View File
@@ -0,0 +1,2 @@
#define LM_DATE "19981103"
#define LM_VERSION "2.0.0pre0"