diff options
Diffstat (limited to 'm4/open-axiom-deps.m4')
-rw-r--r-- | m4/open-axiom-deps.m4 | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/m4/open-axiom-deps.m4 b/m4/open-axiom-deps.m4 new file mode 100644 index 00000000..595c6da3 --- /dev/null +++ b/m4/open-axiom-deps.m4 @@ -0,0 +1,28 @@ +# Resolve dependencies between *.boot, *.lisp, *.clisp +# and other OpenAxiom source files within the given directory. +# Dependencies will be written (appended) to the makefile: +# +# OA_RESOLVE_DEPENDENCIES(directory, makefile) +# +# Example: +# +# OA_RESOLVE_DEPENDENCIES([src/boot/strap], [Makefile]) +# +# ----------------------------- +AC_DEFUN([OA_RESOLVE_DEPENDENCIES], +[ AC_MSG_CHECKING([dependencies in $1]) + for f in $1/*.clisp $1/*.lisp $1/*.boot + do + AS_IF([test -f "$f"], + [AS_CASE(["$f"], + [*.boot], [OA_EXTRACT_BOOT([/^import @<:@^ @:>@+$/], [/^import /], [/$/], [$1], ["$f"]) >> $2], + [*.clisp], [OA_EXTRACT_LISP([/\((IMPORT-MODULE|import-module) "/], [/"\)/], [$1], ["$f"]) >> $2], + [*.lisp], [OA_EXTRACT_LISP([/\((IMPORT-MODULE|import-module) "/], [/"\)/], [$1], ["$f"]) >> $2])]) + done + AC_MSG_RESULT([done])]) + +AC_DEFUN([OA_EXTRACT_LISP], [OA_EXTRACT([$1], [$1], [$2], [$3], [$4])]) +AC_DEFUN([OA_EXTRACT_BOOT], [OA_EXTRACT([$1], [$2], [$3], [$4], [$5])]) + +AC_DEFUN([OA_EXTRACT], +[$AWK 'BEGIN {t=ARGV@<:@1@:>@; sub(/\.@<:@^.@:>@+$/,".$(FASLEXT)",t)} $1 {gsub ($2, "$4/"); gsub($3, ".$(FASLEXT)"); gsub(/_-/, "-"); r=r " " @S|@0} END {printf("%s:%s\n", t, r)}' $5]) |