summaryrefslogtreecommitdiff
path: root/libstd
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-03-05 11:37:16 -0800
committerOri Bernstein <ori@eigenstate.org>2015-03-05 11:37:16 -0800
commit41a1d7f0e0cd1d54c1b568739dea557441e2191b (patch)
tree9c3370cb484b3a137f4b556efc1c3912fccfffcd /libstd
parentf015b7cbb577ea4ba9ff9c8a6ad40e545b3d0a02 (diff)
downloadmc-41a1d7f0e0cd1d54c1b568739dea557441e2191b.tar.gz
Speed up build.
We get combinatorial explosions of tested patterns when using make matches. Use a script to fix this. (ugh).
Diffstat (limited to 'libstd')
-rw-r--r--libstd/Makefile55
1 files changed, 29 insertions, 26 deletions
diff --git a/libstd/Makefile b/libstd/Makefile
index c0df0e3..d1e75e2 100644
--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -79,32 +79,35 @@ include ../config.mk
all: lib$(STDLIB).a $(MYRBIN)
-%.myr: %+$(SYSCLASS)-$(ARCH).myr
- cp $< $@
-
-%.myr: %+$(SYSCLASS)-$(SYS).myr
- cp $< $@
-
-%.myr: %+$(SYSCLASS).myr
- cp $< $@
-
-%.myr: %+$(SYS)-$(ARCH).myr
- cp $< $@
-
-%.myr: %+$(SYS).myr
- cp $< $@
-
-%.myr: %+$(ARCH).myr
- cp $< $@
-
-%.s: %+$(SYSCLASS)-$(ARCH).s
- cp $< $@
-
-%.s: %+$(SYS)-$(ARCH).s
- cp $< $@
-
-%.s: %+$(ARCH).s
- cp $< $@
+# HACK HACK HACK.
+# Ideally we would have patterns for the
+# foo+arch-suffix.myr instead of a loop,
+# but that leads to a combinatorial explosion
+# of patterns that Make will try, leading to
+# millions of files getting statted. This
+# works around that.
+COPYTARG = for suff in $(SYSCLASS)-$(SYS)-$(ARCH) \
+ $(SYSCLASS)-$(SYS) \
+ $(SYSCLASS)-$(ARCH) \
+ $(SYSCLASS) \
+ $(SYS)-$(ARCH) \
+ $(SYS) \
+ $(ARCH); do \
+ if [ -f $*+$$targ.$$ext ] ; then \
+ echo $$targ; \
+ echo cp $*+$$targ.$$ext $@; \
+ cp $*+$$targ.$$ext $@; \
+ exit 0; \
+ fi; \
+ done; \
+
+%.myr: %+*.myr
+ @export ext=myr; \
+ $(COPYTARG)
+
+%.s: %+*.s
+ @export ext=s; \
+ $(COPYTARG)
lib$(STDLIB).a: $(STDSRC) $(ASMSRC) lib$(SYSLIB).a ../6/6m
export MYR_MC=../6/6m && \