1 | /* $Id: kmkdocs.c 19 2002-10-17 23:02:18Z bird $
|
---|
2 | *
|
---|
3 | * kmk design and documentation.
|
---|
4 | *
|
---|
5 | * Copyright (c) 2002 knut st. osmundsen <[email protected]>
|
---|
6 | *
|
---|
7 | *
|
---|
8 | * This file is part of kBuild.
|
---|
9 | *
|
---|
10 | * kBuild is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU Lesser General Public License as published
|
---|
12 | * by the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * kBuild is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU Lesser General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU Lesser General Public License
|
---|
21 | * along with kBuild; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
23 | *
|
---|
24 | */
|
---|
25 |
|
---|
26 | /** @design kmk
|
---|
27 | *
|
---|
28 | * kmk is the make file interpreter and executer in kBuild. It is based on
|
---|
29 | * FreeBSD make but some changes have been made.
|
---|
30 | *
|
---|
31 | *
|
---|
32 | *
|
---|
33 | * @subsection Differences From BSD Make
|
---|
34 | *
|
---|
35 | * The main difference is that kmk doesn't make use of an external shell to execute
|
---|
36 | * commands. It uses it's internal micro shell. This has a number of advantages
|
---|
37 | * when it comes to portability. It also speeds up the execution a little bit.
|
---|
38 | *
|
---|
39 | * The other important difference is default makefile names and order. The names
|
---|
40 | * and order is as follows:
|
---|
41 | * <ol>
|
---|
42 | * <li>makefile.kmk
|
---|
43 | * <li>Makefile.kmk
|
---|
44 | * <li>makefile
|
---|
45 | * <li>Makefile
|
---|
46 | * </ol>
|
---|
47 | *
|
---|
48 | *
|
---|
49 | *
|
---|
50 | * @subsection The Micro Shell
|
---|
51 | *
|
---|
52 | * The micro shell provides the basic shell functionality kBuild need - no more,
|
---|
53 | * no less. It is intended to be as simple as possible.
|
---|
54 | *
|
---|
55 | * The shell commands are case sensitive - all lowercase.
|
---|
56 | *
|
---|
57 | * The shell environment variables are case sensitive or insensitive according to
|
---|
58 | * host os.
|
---|
59 | *
|
---|
60 | *
|
---|
61 | *
|
---|
62 | * @subsubsection Command Separators
|
---|
63 | *
|
---|
64 | * There is one command separator '&&'. This works like splitting the command line
|
---|
65 | * into several makefile lines. This splitting isn't done by the micro shell but
|
---|
66 | * the makefile interpreter.
|
---|
67 | *
|
---|
68 | * You might thing this is limiting, but no, you can use all the makefile command
|
---|
69 | * prefixes.
|
---|
70 | *
|
---|
71 | *
|
---|
72 | *
|
---|
73 | * @subsubsection Path Component Separator (/)
|
---|
74 | *
|
---|
75 | * The shell uses '/' as path component separator.
|
---|
76 | * For host OSes with the notion of drive letters or similar, ':' is
|
---|
77 | * used to separate the drive letter and the path.
|
---|
78 | *
|
---|
79 | *
|
---|
80 | *
|
---|
81 | * @subsubsection UNC paths
|
---|
82 | *
|
---|
83 | * For host OSes which supports UNC paths these are supported but for the chdir
|
---|
84 | * command.
|
---|
85 | *
|
---|
86 | * The Path Component Separator is still '/' for UNC paths.
|
---|
87 | *
|
---|
88 | *
|
---|
89 | *
|
---|
90 | * @subsubsection Wildchars
|
---|
91 | *
|
---|
92 | * '*' and '?' are accepted as wildchars.
|
---|
93 | *
|
---|
94 | * '*' means 0 or more characters. <br>
|
---|
95 | * '?' means 1 character.
|
---|
96 | *
|
---|
97 | * When the term 'pattern' is use in command description this means that
|
---|
98 | * wildchars are accepted.
|
---|
99 | *
|
---|
100 | *
|
---|
101 | *
|
---|
102 | * @subsubsection Quoting
|
---|
103 | *
|
---|
104 | * Use double quotes (") to quote filenames or executables containing spaces.
|
---|
105 | *
|
---|
106 | *
|
---|
107 | *
|
---|
108 | * @subsubsection Execute Program
|
---|
109 | *
|
---|
110 | * If the first, possibly quoted, word of a commandline if not found as an
|
---|
111 | * internal command will be tried executed. If no path it will be searched
|
---|
112 | * for in the PATH environment variable.
|
---|
113 | *
|
---|
114 | *
|
---|
115 | *
|
---|
116 | * @subsubsection Commands
|
---|
117 | *
|
---|
118 | * This section will describe the commands implemented by the shell.
|
---|
119 | *
|
---|
120 | *
|
---|
121 | *
|
---|
122 | * @subsubsubsection copy
|
---|
123 | * Copies one or more files to a target file or directory.
|
---|
124 | *
|
---|
125 | * <b>Syntax: copy <source file pattern> [more sources] <target> </b>
|
---|
126 | *
|
---|
127 | * Specify one or more source file patterns.
|
---|
128 | *
|
---|
129 | * Specify exactly one target. The target may be a directory or a file.
|
---|
130 | * If it's a file and multiple source files specified either thru pattern or
|
---|
131 | * multiple source file specifications, the target file will be a copy of the
|
---|
132 | * last one.
|
---|
133 | *
|
---|
134 | * The command fails if a source file isn't found. It also fails on read or
|
---|
135 | * write errors.
|
---|
136 | *
|
---|
137 | *
|
---|
138 | *
|
---|
139 | * @subsubsubsection copytree
|
---|
140 | * Copies one or more files to a target file or directory.
|
---|
141 | *
|
---|
142 | * <b>Syntax: copytree <source directory> <target directory> </b>
|
---|
143 | *
|
---|
144 | * Specify exactly one source directory.
|
---|
145 | *
|
---|
146 | * Specify exactly one target directory. The target directory path will be
|
---|
147 | * created if doesn't exist.
|
---|
148 | *
|
---|
149 | * The command fails if source directory isn't found. It also fails on read or
|
---|
150 | * write errors.
|
---|
151 | *
|
---|
152 | *
|
---|
153 | *
|
---|
154 | * @subsubsubsection rm
|
---|
155 | * Deletes one or more files.
|
---|
156 | *
|
---|
157 | * <b>Syntax: rm [file pattern] [more files] </b>
|
---|
158 | *
|
---|
159 | * Specify 0 or more file patterns for deletion.
|
---|
160 | *
|
---|
161 | * This command fails if it cannot delete a file. It will not fail if a file
|
---|
162 | * doesn't exist. It will neither fail if no files are specified.
|
---|
163 | *
|
---|
164 | *
|
---|
165 | *
|
---|
166 | * @subsubsubsection rmtree
|
---|
167 | * Deletes one or more directory trees.
|
---|
168 | *
|
---|
169 | * <b>Syntax: rmtree [directory pattern] [directories] </b>
|
---|
170 | *
|
---|
171 | * Specify 0 or more directory patterns for deletion.
|
---|
172 | *
|
---|
173 | * This command fails if it cannot delete a file or directory. It will not fail
|
---|
174 | * if a directory doesn't exist. It will neither fail if no files are specified.
|
---|
175 | *
|
---|
176 | *
|
---|
177 | *
|
---|
178 | * @subsubsubsection chdir
|
---|
179 | * Changes the current directory.
|
---|
180 | *
|
---|
181 | * This updates the .CWD macro to the new current directory path.
|
---|
182 | *
|
---|
183 | * <b>Syntax: chdir <directory> </b>
|
---|
184 | *
|
---|
185 | *
|
---|
186 | *
|
---|
187 | * @subsubsubsection mkdir
|
---|
188 | * Create directory.
|
---|
189 | *
|
---|
190 | * <b>Syntax: mkdir <directory> </b>
|
---|
191 | *
|
---|
192 | * Specify one directory to create.
|
---|
193 | *
|
---|
194 | *
|
---|
195 | *
|
---|
196 | * @subsubsubsection rmdir
|
---|
197 | * Remove directory.
|
---|
198 | *
|
---|
199 | * <b>Syntax: rmdir <directory> </b>
|
---|
200 | *
|
---|
201 | * Specify one directory to remove. The directory must be empty.
|
---|
202 | *
|
---|
203 | * This command failes if directory isn't empty. It will not fail if
|
---|
204 | * the directory doesn't exist.
|
---|
205 | *
|
---|
206 | *
|
---|
207 | *
|
---|
208 | * @subsubsubsection set
|
---|
209 | * Set environment variable.
|
---|
210 | *
|
---|
211 | * <b>Syntax: set <envvar>=<value> </b>
|
---|
212 | *
|
---|
213 | *
|
---|
214 | *
|
---|
215 | * @subsubsubsection unset
|
---|
216 | * Unset enviornment variable(s).
|
---|
217 | *
|
---|
218 | * <b>Syntax: unset <envvar pattern> [more envvars] </b>
|
---|
219 | *
|
---|
220 | * Specify on or more environment variable patterns.
|
---|
221 | *
|
---|
222 | *
|
---|
223 | *
|
---|
224 | * @subsubsubsection pushenv
|
---|
225 | * Pushes a set of environment variables onto the environment stack. The
|
---|
226 | * variables can later be popped back using the popenv command.
|
---|
227 | *
|
---|
228 | * If '*' is specified as pattern the complete enviornment is pushed and
|
---|
229 | * when popped it will <b>replace</b> the enviornment.
|
---|
230 | *
|
---|
231 | * <b>Syntax: pushenv <envvar pattern> [more envvars] </b>
|
---|
232 | * <b>Syntax: pushenv * </b>
|
---|
233 | *
|
---|
234 | *
|
---|
235 | *
|
---|
236 | * @subsubsubsection popenv
|
---|
237 | * Pop a set of environment variables from the environment stack. If a '*'
|
---|
238 | * push was done, we'll replace the enviornment with the variables poped off
|
---|
239 | * the stack.
|
---|
240 | *
|
---|
241 | * <b>Syntax: popenv </b>
|
---|
242 | *
|
---|
243 | *
|
---|
244 | *
|
---|
245 | * @subsubsubsection echo
|
---|
246 | * Prints a message to stdout.
|
---|
247 | *
|
---|
248 | * <b>Syntax: echo <level> <message>
|
---|
249 | *
|
---|
250 | * Level is verbosity level of the message. This is compared with the
|
---|
251 | * KBUILD_MSG_LEVEL environment variable. The message is suppressed if the
|
---|
252 | * level is lower that KBUILD_MSG_LEVEL.
|
---|
253 | *
|
---|
254 | * The message can be empty. Then a blank line will be printed.
|
---|
255 | *
|
---|
256 | *
|
---|
257 | *
|
---|
258 | */
|
---|