5.14. Compiling and Loading C Code |
(lsh/libc/make.lsh) |
Class LushMake provides a familiar interface for controlling the compilation of these subroutines and for loading them into the Lush system.
(let ((lm (new LushMake))) ;; Define the rules (==> lm rule "foo.o" '("foo.c" "foo.h")) (==> lm rule "bar.o" '("bar.f" "foo.h") "$F77 $DEFS $LUSHFLAGS -c $SRC -o $OBJ" ) ;; Compile and load (==> lm make) (==> lm load) )
A more extensive example can be seen in "packages/sn28/sn28common.lsh" .
5.14.0. (new LushMake [srcdir [objdir]]) |
[CLASS] (lsh/libc/make.lsh) |
The source files will be searched under directory srcdir . The default is to search source files under the directory containing the file being loaded. The object files will be created in architecture dependent subdirectories of objdir . The default is to create these subdirectories inside the source directory.
5.14.1. (==> lushmake setdirs srcdir [objdir]) |
[MSG] (lsh/libc/make.lsh) |
5.14.2. (==> lushmake setflags flags) |
[MSG] (lsh/libc/make.lsh) |
5.14.3. (==> lushmake rule target deps [command]) |
[MSG] (lsh/libc/make.lsh) |
Argument target is the name of the object file to create relative to an architecture dependent subdirectory of the object directory.
Argument deps is a list containing the names of the files on which the target depends. The target is rebuilt if any of these files is more recent than the current target.
The optional argument command is a string containing the command to execute to rebuild target . The default command is provided in variable dhc-make-command and should be adequate for C programs. Environment variables in the command are expanded using getenv or getconf . The following additional variables are also defined:
See: dhc-make-command
See: dhc-make-lushflags
See: (dhc-substitute-env str
[ htable ])
See: (dhc-generate-include-flags [
includepath ])
5.14.4. (==> lushmake show [...target...]) |
[MSG] (lsh/libc/make.lsh) |
5.14.5. (==> lushmake make [...target...]) |
[MSG] (lsh/libc/make.lsh) |
Calling this method without arguments processes all targets defined by the rules.
5.14.6. (==> lushmake load [...targets...]) |
[MSG] (lsh/libc/make.lsh) |
Calling this method without arguments processes all object file targets defined by the rules.