aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/smart-config.txt
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /Documentation/smart-config.txt
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'Documentation/smart-config.txt')
-rw-r--r--Documentation/smart-config.txt102
1 files changed, 102 insertions, 0 deletions
diff --git a/Documentation/smart-config.txt b/Documentation/smart-config.txt
new file mode 100644
index 000000000000..c9bed4cf8773
--- /dev/null
+++ b/Documentation/smart-config.txt
@@ -0,0 +1,102 @@
1Smart CONFIG_* Dependencies
21 August 1999
3
4Michael Chastain <mec@shout.net>
5Werner Almesberger <almesber@lrc.di.epfl.ch>
6Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>
7
8Here is the problem:
9
10 Suppose that drivers/net/foo.c has the following lines:
11
12 #include <linux/config.h>
13
14 ...
15
16 #ifdef CONFIG_FOO_AUTOFROB
17 /* Code for auto-frobbing */
18 #else
19 /* Manual frobbing only */
20 #endif
21
22 ...
23
24 #ifdef CONFIG_FOO_MODEL_TWO
25 /* Code for model two */
26 #endif
27
28 Now suppose the user (the person building kernels) reconfigures the
29 kernel to change some unrelated setting. This will regenerate the
30 file include/linux/autoconf.h, which will cause include/linux/config.h
31 to be out of date, which will cause drivers/net/foo.c to be recompiled.
32
33 Most kernel sources, perhaps 80% of them, have at least one CONFIG_*
34 dependency somewhere. So changing _any_ CONFIG_* setting requires
35 almost _all_ of the kernel to be recompiled.
36
37Here is the solution:
38
39 We've made the dependency generator, mkdep.c, smarter. Instead of
40 generating this dependency:
41
42 drivers/net/foo.c: include/linux/config.h
43
44 It now generates these dependencies:
45
46 drivers/net/foo.c: \
47 include/config/foo/autofrob.h \
48 include/config/foo/model/two.h
49
50 So drivers/net/foo.c depends only on the CONFIG_* lines that
51 it actually uses.
52
53 A new program, split-include.c, runs at the beginning of
54 compilation (make bzImage or make zImage). split-include reads
55 include/linux/autoconf.h and updates the include/config/ tree,
56 writing one file per option. It updates only the files for options
57 that have changed.
58
59 mkdep.c no longer generates warning messages for missing or unneeded
60 <linux/config.h> lines. The new top-level target 'make checkconfig'
61 checks for these problems.
62
63Flag Dependencies
64
65 Martin Von Loewis contributed another feature to this patch:
66 'flag dependencies'. The idea is that a .o file depends on
67 the compilation flags used to build it. The file foo.o has
68 its flags stored in .flags.foo.o.
69
70 Suppose the user changes the foo driver from resident to modular.
71 'make' will notice that the current foo.o was not compiled with
72 -DMODULE and will recompile foo.c.
73
74 All .o files made from C source have flag dependencies. So do .o
75 files made with ld, and .a files made with ar. However, .o files
76 made from assembly source do not have flag dependencies (nobody
77 needs this yet, but it would be good to fix).
78
79Per-source-file Flags
80
81 Flag dependencies also work with per-source-file flags.
82 You can specify compilation flags for individual source files
83 like this:
84
85 CFLAGS_foo.o = -DSPECIAL_FOO_DEFINE
86
87 This helps clean up drivers/net/Makefile, drivers/scsi/Makefile,
88 and several other Makefiles.
89
90Credit
91
92 Werner Almesberger had the original idea and wrote the first
93 version of this patch.
94
95 Michael Chastain picked it up and continued development. He is
96 now the principal author and maintainer. Please report any bugs
97 to him.
98
99 Martin von Loewis wrote flag dependencies, with some modifications
100 by Michael Chastain.
101
102 Thanks to all of the beta testers.