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

Revision 4397, 9.6 KB (checked in by khali, 7 years ago)

Delete all kernel chip drivers, documentation and references. We are
moving to a user-space-only package, all the drivers are maintained in
the Linux kernel tree itself.

I tried to update the documentation a bit, but there's still a lot to
go. In fact, a complete rewrite seems to be needed.

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