root/lm-sensors/tags/V2-2-0/Makefile

Revision 222, 8.4 kB (checked in by mds, 10 years ago)

removed indent on comment on line 10 which caused my

make (gnu make V3.71) to fail.

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