aboutsummaryrefslogtreecommitdiff
path: root/m4/open-axiom-deps.m4
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2022-10-29 15:37:18 +0200
committerIgor Pashev <pashev.igor@gmail.com>2022-12-05 18:48:51 +0200
commit4ae82c64d8f219666c2f8315a8a5ab9e30a1c1af (patch)
treec6b6cdec7660f287802ae1397e0dce087969a375 /m4/open-axiom-deps.m4
parent088873fbc7f92c3d8d582f29eb44e39a136e944d (diff)
downloadopen-axiom-new-build.tar.gz
Diffstat (limited to 'm4/open-axiom-deps.m4')
-rw-r--r--m4/open-axiom-deps.m428
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])