|5.14. Compiling and Loading C Code
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]])
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])
|5.14.2. (==> lushmake setflags flags)
|5.14.3. (==> lushmake rule target deps [command])
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-substitute-env str [ htable ])
See: (dhc-generate-include-flags [ includepath ])
|5.14.4. (==> lushmake show [...target...])
|5.14.5. (==> lushmake make [...target...])
Calling this method without arguments processes all targets defined by the rules.
|5.14.6. (==> lushmake load [...targets...])
Calling this method without arguments processes all object file targets defined by the rules.