commit dc9fe59959430deab97fae62ec77299607a5b639
parent cae8360ac9e7b5358c2eb38c43051c3052fbba81
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 4 Feb 2021 13:07:49 -0500
Manage hare dependencies via gen-stdlib
Diffstat:
4 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
@@ -23,21 +23,10 @@ $(HARECACHE)/hare.ssa: $(hare_srcs)
@printf 'HAREC\t$@\n'
@$(HAREC) -o $@ $(hare_srcs)
-hare_deps=\
- $(stdlib_ascii) \
- $(stdlib_bytes) \
- $(stdlib_encoding_utf8) \
- $(stdlib_fmt) \
- $(stdlib_io) \
- $(stdlib_os) \
- $(stdlib_strconv) \
- $(stdlib_strings)
-
-hare: $(hare_deps) $(stdlib_rt) $(stdlib_start) $(HARECACHE)/hare.o
+hare: $(stdlib_start) $(hare_deps) $(HARECACHE)/hare.o
@printf 'LD\t$@\n'
@$(LD) -T $(rtscript) -o $@ \
- $(stdlib_start) $(HARECACHE)/hare.o $(stdlib_rt) \
- $(hare_deps)
+ $(stdlib_start) $(HARECACHE)/hare.o $(hare_deps)
clean:
@rm -rf cache
diff --git a/gen-stdlib b/gen-stdlib
@@ -52,6 +52,7 @@ rt() {
stdlib_rt=\$($cache)/rt/rt.a
stdlib_start=\$($cache)/rt/start.o
+hare_deps+=\$(stdlib_rt)
EOF
}
diff --git a/mk/gen-stdlib.sh b/mk/gen-stdlib.sh
@@ -54,6 +54,7 @@ gen_lib() {
path=$(mod_path "$mod")
file=$(mod_file "$mod")
var=$(mod_var "$mod")
- printf "stdlib_$var=\$($cache)/$path/$file.o\n\n"
+ printf "stdlib_$var=\$($cache)/$path/$file.o\n"
+ printf 'hare_deps+=$(stdlib_%s)\n\n' "$var"
}
diff --git a/mk/stdlib.mk b/mk/stdlib.mk
@@ -38,6 +38,7 @@ $(HARECACHE)/rt/rt.a: $(HARECACHE)/rt/rt.o $(HARECACHE)/rt/syscall.o
stdlib_rt=$(HARECACHE)/rt/rt.a
stdlib_start=$(HARECACHE)/rt/start.o
+hare_deps+=$(stdlib_rt)
# ascii
libascii_srcs= \
@@ -50,6 +51,7 @@ $(HARECACHE)/ascii/ascii.ssa: $(libascii_srcs) $(stdlib_rt)
-t$(HARECACHE)/ascii/ascii.td $(libascii_srcs)
stdlib_ascii=$(HARECACHE)/ascii/ascii.o
+hare_deps+=$(stdlib_ascii)
# bytes
libbytes_srcs= \
@@ -65,6 +67,7 @@ $(HARECACHE)/bytes/bytes.ssa: $(libbytes_srcs) $(stdlib_rt)
-t$(HARECACHE)/bytes/bytes.td $(libbytes_srcs)
stdlib_bytes=$(HARECACHE)/bytes/bytes.o
+hare_deps+=$(stdlib_bytes)
# types
libtypes_srcs= \
@@ -79,6 +82,7 @@ $(HARECACHE)/types/types.ssa: $(libtypes_srcs) $(stdlib_rt)
-t$(HARECACHE)/types/types.td $(libtypes_srcs)
stdlib_types=$(HARECACHE)/types/types.o
+hare_deps+=$(stdlib_types)
# strconv
libstrconv_srcs= \
@@ -93,6 +97,7 @@ $(HARECACHE)/strconv/strconv.ssa: $(libstrconv_srcs) $(stdlib_rt) $(stdlib_types
-t$(HARECACHE)/strconv/strconv.td $(libstrconv_srcs)
stdlib_strconv=$(HARECACHE)/strconv/strconv.o
+hare_deps+=$(stdlib_strconv)
# io
libio_srcs= \
@@ -108,6 +113,7 @@ $(HARECACHE)/io/io.ssa: $(libio_srcs) $(stdlib_rt)
-t$(HARECACHE)/io/io.td $(libio_srcs)
stdlib_io=$(HARECACHE)/io/io.o
+hare_deps+=$(stdlib_io)
# encoding::utf8
libencoding_utf8_srcs= \
@@ -122,6 +128,7 @@ $(HARECACHE)/encoding/utf8/encoding.utf8.ssa: $(libencoding_utf8_srcs) $(stdlib_
-t$(HARECACHE)/encoding/utf8/encoding.utf8.td $(libencoding_utf8_srcs)
stdlib_encoding_utf8=$(HARECACHE)/encoding/utf8/encoding.utf8.o
+hare_deps+=$(stdlib_encoding_utf8)
# strings
libstrings_srcs= \
@@ -137,6 +144,7 @@ $(HARECACHE)/strings/strings.ssa: $(libstrings_srcs) $(stdlib_rt) $(stdlib_encod
-t$(HARECACHE)/strings/strings.td $(libstrings_srcs)
stdlib_strings=$(HARECACHE)/strings/strings.o
+hare_deps+=$(stdlib_strings)
# os
libos_srcs= \
@@ -156,6 +164,7 @@ $(HARECACHE)/os/os.ssa: $(libos_srcs) $(stdlib_rt) $(stdlib_strings) $(stdlib_ty
-t$(HARECACHE)/os/os.td $(libos_srcs)
stdlib_os=$(HARECACHE)/os/os.o
+hare_deps+=$(stdlib_os)
# fmt
libfmt_srcs= \
@@ -168,4 +177,5 @@ $(HARECACHE)/fmt/fmt.ssa: $(libfmt_srcs) $(stdlib_rt) $(stdlib_io) $(stdlib_os)
-t$(HARECACHE)/fmt/fmt.td $(libfmt_srcs)
stdlib_fmt=$(HARECACHE)/fmt/fmt.o
+hare_deps+=$(stdlib_fmt)