root/lm-sensors/branches/lm-sensors-3.0.0/Makefile

Revision 5163, 8.6 kB (checked in by khali, 8 months ago)

Patch from Aurelien Jarno:

I have just noticed that the FSF address is the old one in all files
except COPYING. Please find a patch below to fix that.

  • 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., 51 Franklin Street, Fifth Floor, Boston,
17 #  MA 02110-1301 USA.
18
19 # Everything you may want to change is in the top of this file. Usually, you
20 # can just use the defaults, fortunately.
21
22 # You need a full complement of GNU utilities to run this Makefile
23 # successfully; most notably, you need GNU make, flex (>= 2.5.1)
24 # and bison.
25
26 # Uncomment the second line if you are a developer. This will enable many
27 # additional warnings at compile-time
28 #WARN := 0
29 WARN := 1
30
31 # Uncomment the second line if you want to get (loads of) debug information
32 # at run-time.
33 # Not recommended, unless you are actually debugging the code
34 DEBUG := 0
35 #DEBUG := 1
36
37 # Note that all the installation paths below can also be set on the make
38 # command line (e.g. "make PREFIX=/usr").
39
40 # If you want to install at some other place then at from which you will run
41 # everything, set DESTDIR to the extra prefix.
42 DESTDIR :=
43
44 # This is the prefix that will be used for almost all directories below.
45 PREFIX := /usr/local
46
47 # Your C compiler
48 CC := gcc
49
50 # This is the directory where sensors.conf will be installed, if no other
51 # configuration file is found
52 ETCDIR := /etc
53
54 # You should not need to change this. It is the directory into which the
55 # library files (both static and shared) will be installed.
56 LIBDIR := $(PREFIX)/lib
57
58 EXLDFLAGS := -Wl,-rpath,$(LIBDIR)
59
60 # You should not need to change this. It is the directory into which the
61 # executable program files will be installed. BINDIR for programs that are
62 # also useful for normal users, SBINDIR for programs that can only be run
63 # by the superuser.
64 # Note that not all programs in this package are really installed;
65 # some are just examples. You can always install them by hand, of
66 # course.
67 BINDIR := $(PREFIX)/bin
68 SBINDIR := $(PREFIX)/sbin
69
70 # You should not need to change this. It is the basic directory into which
71 # include files will be installed. The actual directory will be
72 # $(INCLUDEDIR)/sensors for library include files.
73 INCLUDEDIR := $(PREFIX)/include
74 LIBINCLUDEDIR := $(INCLUDEDIR)/sensors
75
76 # You should not need to change this. It is the base directory under which the
77 # manual pages will be installed.
78 MANDIR := $(PREFIX)/man
79
80 MACHINE := $(shell uname -m)
81
82 # Extra non-default programs to build; e.g., sensord
83 # PROG_EXTRA := sensord
84
85 # Set these to add preprocessor or compiler flags, or use
86 # environment variables
87 # CFLAGS :=
88 # CPPFLAGS :=
89
90 ##################################################
91 # Below this, nothing should need to be changed. #
92 ##################################################
93
94 # Note that this is a monolithic Makefile; it calls no sub-Makefiles,
95 # but instead, it compiles everything right from here. Yes, there are
96 # some distinct advantages to this; see the following paper for more info:
97 #   http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html
98 # Note that is still uses Makefile fragments in sub-directories; these
99 # are called 'Module.mk'.
100
101 # Within each Module.mk, rules and dependencies can be added to targets
102 # all, install and clean. Use double colons instead of single ones
103 # to do this.
104
105 # The subdirectories we need to build things in
106 SRCDIRS := lib prog/detect prog/pwm \
107            prog/sensors ${PROG_EXTRA:%=prog/%} etc
108 # Only build isadump and isaset on x86 machines.
109 ifneq (,$(findstring $(MACHINE), i386 i486 i586 i686 x86_64))
110 SRCDIRS += prog/dump
111 endif
112 SRCDIRS += lib/test
113
114 # Some often-used commands with default options
115 MKDIR := mkdir -p
116 RMDIR := rmdir
117 RM := rm -f
118 BISON := bison
119 FLEX := flex
120 AR := ar
121 INSTALL := install
122 LN := ln -sf
123 GREP := grep
124 AWK := awk
125 SED := sed
126
127 # Determine the default compiler flags
128 # Set CFLAGS or CPPFLAGS above to add your own flags to all.
129 # ALLCPPFLAGS/ALLCFLAGS are common flags, plus any user-specified overrides from the environment or make command line.
130 # PROGCPPFLAGS/PROGCFLAGS is to create regular object files (which are linked into executables).
131 # ARCPPFLAGS/ARCFLAGS are used to create archive object files (static libraries).
132 # LIBCPPFLAGS/LIBCFLAGS are for shared library objects.
133 ALL_CPPFLAGS := -I.
134 ALL_CFLAGS := -Wall
135
136 ifeq ($(DEBUG),1)
137 ALL_CPPFLAGS += -DDEBUG
138 ALL_CFLAGS += -O -g
139 else
140 ALL_CFLAGS += -O2
141 endif
142
143 ifeq ($(WARN),1)
144 ALL_CFLAGS += -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \
145             -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W \
146             -Wmissing-prototypes -Wundef
147 endif
148
149 ALL_CPPFLAGS += $(CPPFLAGS)
150 ALL_CFLAGS += $(CFLAGS)
151
152 PROGCPPFLAGS := -DETCDIR="\"$(ETCDIR)\"" $(ALL_CPPFLAGS)
153 PROGCFLAGS := $(ALL_CFLAGS)
154 ARCPPFLAGS := -DETCDIR="\"$(ETCDIR)\"" $(ALL_CPPFLAGS)
155 ARCFLAGS := $(ALL_CFLAGS)
156 LIBCPPFLAGS := -DETCDIR="\"$(ETCDIR)\"" $(ALL_CPPFLAGS)
157 LIBCFLAGS := -fpic -D_REENTRANT $(ALL_CFLAGS)
158
159 .PHONY: all user clean install user_install uninstall user_uninstall
160
161 # Make all the default rule
162 all::
163
164 # Include all makefiles for sub-modules
165 INCLUDEFILES :=
166 include $(patsubst %,%/Module.mk,$(SRCDIRS))
167 ifneq ($(MAKECMDGOALS),clean)
168 ifneq ($(MAKECMDGOALS),uninstall)
169 ifneq ($(MAKECMDGOALS),user_uninstall)
170 ifneq ($(MAKECMDGOALS),help)
171 include $(INCLUDEFILES)
172 endif
173 endif
174 endif
175 endif
176
177 # Man pages
178 MANPAGES := $(LIBMAN3FILES) $(LIBMAN5FILES) $(PROGDETECTMAN8FILES) $(PROGDUMPMAN8FILES) \
179             $(PROGSENSORSMAN1FILES) $(PROGPWMMAN8FILES) prog/sensord/sensord.8
180
181 user ::
182 user_install::
183         @echo "*** Important notes:"
184         @echo "***  * The libsensors configuration file ($(ETCDIR)/sensors.conf) is never"
185         @echo "***    overwritten by our installation process, so that you won't lose"
186         @echo "***    your personal settings in that file. You still can get our latest"
187         @echo "***    default config file in etc/sensors.conf.eg and manually copy it to"
188         @echo "***    $(ETCDIR)/sensors.conf if you want. You will then want to edit it"
189         @echo "***    to fit your needs again."
190         @echo "***  * The format of $(ETCDIR)/sensors.conf changed with lm-sensors 3.0.0."
191         @echo "***    If you have a custom configuration file using the old format, you"
192         @echo "***    can convert it using the sensors-conf-convert script. Otherwise just"
193         @echo "***    overwrite your old configuration file with the new default one."
194 all :: user
195 install :: all user_install
196
197 clean::
198         $(RM) lm_sensors-* lex.backup
199
200 user_uninstall::
201
202 uninstall :: user_uninstall
203
204 help:
205         @echo 'Make targets are:'
206         @echo '  all (default): build library and userspace programs'
207         @echo '  install: install library and userspace programs'
208         @echo '  uninstall: uninstall library and userspace programs'
209         @echo '  clean: cleanup'
210
211 # Generate html man pages to be copied to the lm_sensors website.
212 # This uses the man2html from here
213 # http://ftp.math.utah.edu/pub/sgml/
214 # which works directly from the nroff source
215 manhtml:
216         $(MKDIR) html
217         cp $(MANPAGES) html
218         cd html ; \
219         export LOGNAME=sensors ; \
220         export HOSTNAME=www.lm-sensors.org ; \
221         man2html *.[1-8] ; \
222         $(RM) *.[1-8]
223
224 # Here, we define all implicit rules we want to use.
225
226 .SUFFIXES:
227
228 # We need to create dependency files. Tricky. The sed rule puts dir/file.d and
229 # dir/file.c in front of the dependency file rule.
230
231
232 # .ro files are used for programs (as opposed to modules)
233 %.ro: %.c
234         $(CC) $(PROGCPPFLAGS) $(PROGCFLAGS) -c $< -o $@
235
236 %.rd: %.c
237         $(CC) -M -MG $(PROGCPPFLAGS) $(PROGCFLAGS) $< | \
238         $(SED) -e 's@^\(.*\)\.o:@$*.rd $*.ro: Makefile '`dirname $*.rd`/Module.mk' @' > $@
239
240
241 %: %.ro
242         $(CC) $(EXLDFLAGS) -o $@ $^
243
244
245 # .ao files are used for static archives
246 %.ao: %.c
247         $(CC) $(ARCPPFLAGS) $(ARCFLAGS) -c $< -o $@
248
249 %.ad: %.c
250         $(CC) -M -MG $(ARCPPFLAGS) $(ARCFLAGS) $< | \
251         $(SED) -e 's@^\(.*\)\.o:@$*.ad $*.ao: Makefile '`dirname $*.ad`/Module.mk' @' > $@
252
253
254 # .lo files are used for shared libraries
255 %.lo: %.c
256         $(CC) $(LIBCPPFLAGS) $(LIBCFLAGS) -c $< -o $@
257
258 %.ld: %.c
259         $(CC) -M -MG $(LIBCPPFLAGS) $(LIBCFLAGS) $< | \
260         $(SED) -e 's@^\(.*\)\.o:@$*.ld $*.lo: Makefile '`dirname $*.ld`/Module.mk' @' > $@
261
262
263 # Flex and Bison
264 %c: %y
265         $(BISON) -p sensors_yy -d $< -o $@
266
267 ifeq ($(DEBUG),1)
268 FLEX_FLAGS := -Psensors_yy -t -b -Cfe -8
269 else
270 FLEX_FLAGS := -Psensors_yy -t -Cfe -8
271 endif
272
273 %.c: %.l
274         $(FLEX) $(FLEX_FLAGS) $< > $@
Note: See TracBrowser for help on using the browser.