| 1 | /* $Id: kmkdocs.c 17 2002-10-16 23:21:16Z bird $
|
|---|
| 2 | *
|
|---|
| 3 | * kmk design and documentation.
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright (c) 2002 knut st. osmundsen <bird@anduin.net>
|
|---|
| 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 rm
|
|---|
| 140 | * Deletes one or more files.
|
|---|
| 141 | *
|
|---|
| 142 | * <b>Syntax: rm [file pattern] [more files] </b>
|
|---|
| 143 | *
|
|---|
| 144 | * Specify 0 or more file patterns for deletion.
|
|---|
| 145 | *
|
|---|
| 146 | * This command fails if it cannot delete a file. It will not fail if a file
|
|---|
| 147 | * doesn't exist. It will neither fail if no files are specified.
|
|---|
| 148 | *
|
|---|
| 149 | *
|
|---|
| 150 | *
|
|---|
| 151 | * @subsubsubsection chdir
|
|---|
| 152 | * Changes the current directory.
|
|---|
| 153 | *
|
|---|
| 154 | * This updates the .CWD macro to the new current directory path.
|
|---|
| 155 | *
|
|---|
| 156 | * <b>Syntax: chdir <directory> </b>
|
|---|
| 157 | *
|
|---|
| 158 | *
|
|---|
| 159 | *
|
|---|
| 160 | * @subsubsubsection mkdir
|
|---|
| 161 | * Create directory.
|
|---|
| 162 | *
|
|---|
| 163 | * <b>Syntax: mkdir <directory> </b>
|
|---|
| 164 | *
|
|---|
| 165 | * Specify one directory to create.
|
|---|
| 166 | *
|
|---|
| 167 | *
|
|---|
| 168 | *
|
|---|
| 169 | * @subsubsubsection rmdir
|
|---|
| 170 | * Remove directory.
|
|---|
| 171 | *
|
|---|
| 172 | * <b>Syntax: rmdir <directory> </b>
|
|---|
| 173 | *
|
|---|
| 174 | * Specify one directory to remove. The directory must be empty.
|
|---|
| 175 | *
|
|---|
| 176 | * This command failes if directory isn't empty. It will not fail if
|
|---|
| 177 | * the directory doesn't exist.
|
|---|
| 178 | *
|
|---|
| 179 | *
|
|---|
| 180 | *
|
|---|
| 181 | * @subsubsubsection set
|
|---|
| 182 | * Set environment variable.
|
|---|
| 183 | *
|
|---|
| 184 | * <b>Syntax: set <envvar>=<value> </b>
|
|---|
| 185 | *
|
|---|
| 186 | *
|
|---|
| 187 | *
|
|---|
| 188 | * @subsubsubsection unset
|
|---|
| 189 | * Unset enviornment variable(s).
|
|---|
| 190 | *
|
|---|
| 191 | * <b>Syntax: unset <envvar pattern> [more envvars] </b>
|
|---|
| 192 | *
|
|---|
| 193 | * Specify on or more environment variable patterns.
|
|---|
| 194 | *
|
|---|
| 195 | *
|
|---|
| 196 | *
|
|---|
| 197 | * @subsubsubsection pushenv
|
|---|
| 198 | * Pushes a set of environment variables onto the environment stack. The
|
|---|
| 199 | * variables can later be popped back using the popenv command.
|
|---|
| 200 | *
|
|---|
| 201 | * If '*' is specified as pattern the complete enviornment is pushed and
|
|---|
| 202 | * when popped it will <b>replace</b> the enviornment.
|
|---|
| 203 | *
|
|---|
| 204 | * <b>Syntax: pushenv <envvar pattern> [more envvars] </b>
|
|---|
| 205 | * <b>Syntax: pushenv * </b>
|
|---|
| 206 | *
|
|---|
| 207 | *
|
|---|
| 208 | *
|
|---|
| 209 | * @subsubsubsection popenv
|
|---|
| 210 | * Pop a set of environment variables from the environment stack. If a '*'
|
|---|
| 211 | * push was done, we'll replace the enviornment with the variables poped off
|
|---|
| 212 | * the stack.
|
|---|
| 213 | *
|
|---|
| 214 | * <b>Syntax: popenv </b>
|
|---|
| 215 | *
|
|---|
| 216 | *
|
|---|
| 217 | */
|
|---|