File: makefiles

package info (click to toggle)
lm-sensors 1%3A2.10.1-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,104 kB
  • ctags: 10,474
  • sloc: ansic: 61,469; perl: 7,544; sh: 1,491; makefile: 400; lex: 300; yacc: 291
file content (71 lines) | stat: -rw-r--r-- 3,048 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
The Makefiles in this package are rather advanced. They are partially based
on the article "Recursive Make considered Harmful", written by Peter Miller.
See doc/useful_addresses.html for a link to this article.

There is one big Makefile in the root of this package. It includes many
other files; one for each directory in which source code is found. These
included files are called 'Module.mk'. There is a separate set of Makefiles
in the i2c/ directories; these are Simon Vogl's original Makefiles, and
not referred by the main package Makefile.

There are several interesting targets defined through this Makefile:
  * all
    Create everything in all directories.
  * all-i2c, all-src, ...
    Create everything in the designated directory.
  * install
    Install everything from all directories.
  * install-i2c, install-src, ...
    Install everything in the designated directory.
  * clean
    Remove anything which can be regenerated from all directories. A call
    of 'make clean' (without any other targets) will ignore any .d files;
    this is useful when they are out of date (and prevent the calling of
    any other target).
  * clean-i2c, clean-src, ...
    Remove anything which can be regenerated from the designated directory.
  * version
    Regenerate version.h, using the current date for the date-stamp, and
    a user-supplied version number.
  * package
    Create a .tar.gz file containing everything except the SVN directories.
  * src/lm78.o, i2c/i2c-core.o, ...
    You can of course also specify one or more targets to make.

The best way to understand the Module.mk subfiles is to examine one of them,
for example src/Module.mk. They are not too difficult to understand.

There are several variables which can be set in the main Makefile. You can
also specify them on the command-line; this overrules any definitions 
within the Makefile. For example: 'make all WARN=1' will enable all warnings.
Examine main Makefile to see which ones are available. The most important
ones for developers:
  * WARN
    Set to 1 to enable many compiler warnings.
  * DEBUG
    Set to 1 to enable any debugging code. Note that debugging code should
    only output more information, and never make the code mis-behave.

Several files are generated by Makefiles:
  * .d
    Dependency files for modules. Automatically generated.
  * .rd
    Dependency files for executables. Automatically generated.
  * .ao
    Dependency files for static libraries. Automatically generated.
  * .lo
    Dependency files for shared libraries. Automatically generated.
  * .o
    Generated modules
  * .ro
    Object files for executables. They will be linked together to create
    the executable. This extension is used to distinguish them from 
    modules (which end on .o). Also, using a different extensions makes
    the Makefile fragments much simpler.
  * .ao
    Object files for static libraries
  * .lo
    Object files for shared libraries

There are lots of comments within the main Makefile. Please read them if
you want to know more.