root/lm-sensors/tags/V2-1-1/Makefile

Revision 144, 7.9 kB (checked in by frodo, 10 years ago)

ISA utility to dump address/register type adderss spaces.

Usage: isadump <ADDR-REG> <DATA-REG>
For the default LM78, this would be `isadump 0x295 0x296' (addresses may be
specified as decimal, octal or hexadecimal).

  • 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  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 # You need a full complement of GNU utilities to run this Makefile succesfully;
22 # most notably, you need bash, GNU make, flex and bison.
23
24 # Uncomment the third line on SMP systems if the magic invocation fails. It
25 # is a bit complicated because SMP configuration changed around kernel 2.1.130
26 SMP := $(shell if grep -q '^SMP[[:space:]]*=' /usr/src/linux/Makefile || \
27                   grep -q '^CONFIG_SMP=y' /usr/src/linux/.config ;  \
28                then echo 1; else echo 0; fi)
29 #SMP := 0
30 #SMP := 1
31
32 # Uncomment the second or third line if the magic invocation fails.
33 # We need to know whether CONFIG_MODVERSIONS is defined.
34 MODVER := $(shell if cat /usr/include/linux/config.h /usr/include/linux/autoconf.h 2>/dev/null | grep -q '^[[:space:]]*\#define[[:space:]]*CONFIG_MODVERSIONS[[:space:]]*1'; then echo 1; else echo 0; fi)
35 #MODVER := 0
36 #MODVER := 1
37
38 # Uncomment the second line if you do not want to compile the included
39 # i2c modules. WARNING! If the i2c module version does not match the
40 # smbus/sensor module versions, you will get into severe problems.
41 # If you want to use a self-compiled version of the i2c modules, make
42 # sure <linux/i2c.h> contains the *correct* i2c header file!
43 I2C := 1
44 #I2C := 0
45
46 # Uncomment the second line if you are a developer. This will enable many
47 # additional warnings at compile-time
48 WARN := 0
49 #WARN := 1
50
51 # Uncomment the second line if you want to get (loads of) debug information.
52 # Not recommended, unless you are actually debugging the code
53 DEBUG := 0
54 #DEBUG := 1
55
56 # This is the prefix that will be used for almost all directories below.
57 PREFIX := /usr/local
58
59 # This is the directory into which the modules will be installed.
60 MODDIR := /lib/modules/extra/misc
61
62 # This is the directory where sensors.conf will be installed, if no other
63 # configuration file is found
64 ETCDIR := /etc
65
66 # You should not need to change this. It is the directory into which the
67 # library files (both static and shared) will be installed.
68 LIBDIR := $(PREFIX)/lib
69
70 # You should not need to change this. It is the directory into which the
71 # executable program files will be installed.
72 # Note that not all programs in this package are really installed;
73 # some are just examples. You can always install them by hand, of
74 # course.
75 BINDIR := $(PREFIX)/bin
76
77 # You should not need to change this. It is the basic directory into which
78 # include files will be installed. The actual directory will be
79 # $(INCLUDEDIR)/linux for system include files, and $(INCLUDEDIR)/sensors
80 # for library include files. If PREFIX equals the default /usr/local/bin,
81 # you will be able to use '#include <linux/sensors.h>' regardless of the
82 # current kernel selected.
83 INCLUDEDIR := $(PREFIX)/include
84 SYSINCLUDEDIR := $(INCLUDEDIR)/linux
85 LIBINCLUDEDIR := $(INCLUDEDIR)/sensors
86
87 # If your /bin/sh is not bash, change the below definition so that make can
88 # find bash.
89 # SHELL=/usr/bin/bash
90
91 # Below this, nothing should need to be changed.
92
93 # Note that this is a monolithic Makefile; it calls no sub-Makefiles,
94 # but instead, it compiles everything right from here. Yes, there are
95 # some distinct advantages to this; see the following paper for more info:
96 #   http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html
97 # Note that is still uses Makefile fragments in sub-directories; these
98 # are called 'Module.mk'.
99
100 # Within each Module.mk, rules and dependencies can be added to targets
101 # all, install and clean. Use double colons instead of single ones
102 # to do this.
103
104 # The subdirectories we need to build things in
105 SRCDIRS := src lib prog/sensors prog/dump etc
106 ifeq ($(I2C),1)
107 SRCDIRS += i2c i2c/detect i2c/drivers i2c/eeprom
108 endif
109
110 # Some often-used commands with default options
111 MKDIR := mkdir -p
112 RM := rm -f
113 CC := gcc
114 BISON := bison
115 FLEX := flex
116 AR := ar
117 INSTALL := install
118 LN := ln -sfn
119
120 # Determine the default compiler flags
121 # MODCFLAGS is to create in-kernel object files (modules); PROGFLAGS is to
122 # create non-kernel object files (which are linked into executables).
123 # ARCFLAGS are used to create archive object files (static libraries), and
124 # LIBCFLAGS are for shared library objects.
125 CFLAGS := -I. -Ii2c -O2 -DLM_SENSORS
126
127 ifeq ($(DEBUG),1)
128 CFLAGS += -DDEBUG
129 endif
130
131 ifeq ($(WARN),1)
132 CFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \
133           -Wcast-align -Wwrite-strings -Wnested-externs -Winline
134 endif
135
136 MODCFLAGS := $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer
137 PROGCFLAGS := $(CFLAGS)
138 ARCFLAGS := $(CFLAGS)
139 LIBCFLAGS := $(CFLAGS) -fpic
140
141 ifeq ($(SMP),1)
142 MODCFLAGS += -D__SMP__
143 endif
144
145 ifeq ($(MODVER),1)
146 MODCFLAGS += -DMODVERSIONS -include /usr/include/linux/modversions.h
147 endif
148
149 ifeq ($(I2C),1)
150 MODCFLAGS += -DI2C
151 endif
152
153 .PHONY: all clean install version package dep
154
155 # Make all the default rule
156 all::
157
158 # Include all makefiles for sub-modules
159 INCLUDEFILES :=
160 include $(patsubst %,%/Module.mk,$(SRCDIRS))
161 ifneq ($(MAKECMDGOALS),clean)
162 include $(INCLUDEFILES)
163 endif
164
165 # Making the dependency files - done automatically!
166 dep :
167
168 all ::
169
170 install :: all
171
172 clean::
173         $(RM) lm_sensors-*
174
175 # This is tricky, but it works like a charm. It needs lots of utilities
176 # though: cut, find, gzip, ln, tail and tar.
177 package: version clean
178         lmversion=`tail -1 version.h|cut -f 2 -d \"`; \
179         lmpackage=lm_sensors-$$lmversion; \
180         ln -s . $$lmpackage;  \
181         find $$lmpackage/ -type f | grep -v ^$$lmpackage/$$lmpackage$$ | \
182                                     grep -v ^$$lmpackage/$$lmpackage.tar$$ | \
183                                     grep -v ^$$lmpackage/$$ | \
184                                     grep -v CVS | \
185                                     grep -v ^$$lmpackage/.# | \
186                                     tar rvf $$lmpackage.tar -T -; \
187         gzip -9 $$lmpackage.tar ;\
188         $(RM) $$lmpackage.tar $$lmpackage
189
190 version:
191         $(RM) version.h
192         echo '#define LM_DATE "'`date +'%Y%m%d'`\" > version.h
193         echo -n 'Version: '; \
194         echo '#define LM_VERSION "'`read VER; echo $$VER`\" >> version.h
195
196
197 # Here, we define all implicit rules we want to use.
198
199 .SUFFIXES:
200
201 # We need to create dependency files. Tricky. We sed rule puts dir/file.d and
202 # dir/file.c # in front of the dependency file rule.
203
204 # .o files are used for modules
205 %.o: %.c
206         $(CC) $(MODCFLAGS) -c $< -o $@
207
208 %.d: %.c
209         $(CC) -M -MG $(MODCFLAGS) $< | \
210         sed -e 's@^\(.*\)\.o:@$*.d $*.o: Makefile '`dirname $*.d`/Module.mk' @' > $@
211
212
213
214 # .ro files are used for programs (as opposed to modules)
215 %.ro: %.c
216         $(CC) $(PROGCFLAGS) -c $< -o $@
217
218 %.rd: %.c
219         $(CC) -M -MG $(PROGCFLAGS) $< | \
220         sed -e 's@^\(.*\)\.o:@$*.rd $*.ro: Makefile '`dirname $*.rd`/Module.mk' @' > $@
221
222
223 %: %.ro
224         $(CC) $(EXLDFLAGS) -o $@ $^
225
226
227 # .ao files are used for static archives
228 %.ao: %.c
229         $(CC) $(ARCFLAGS) -c $< -o $@
230
231 %.ad: %.c
232         $(CC) -M -MG $(ARCFLAGS) $< | \
233         sed -e 's@^\(.*\)\.o:@$*.ad $*.ao: Makefile '`dirname $*.ad`/Module.mk' @' > $@
234
235
236 # .lo files are used for shared libraries
237 %.lo: %.c
238         $(CC) $(LIBCFLAGS) -c $< -o $@
239
240 %.ld: %.c
241         $(CC) -M -MG $(LIBCFLAGS) $< | \
242         sed -e 's@^\(.*\)\.o:@$*.ld $*.lo: Makefile '`dirname $*.ld`/Module.mk' @' > $@
243
244
245 # Flex and Bison
246 %c: %y
247         $(BISON) -p sensors_yy -d $< -o $@
248
249 %.c: %.l
250         $(FLEX) -Psensors_yy -t $< > $@
Note: See TracBrowser for help on using the browser.