aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/Makefile')
-rw-r--r--runtime/Makefile13
1 files changed, 12 insertions, 1 deletions
diff --git a/runtime/Makefile b/runtime/Makefile
index 641c9fdc..b819991d 100644
--- a/runtime/Makefile
+++ b/runtime/Makefile
@@ -52,8 +52,19 @@ $(LIB): $(OBJS)
%.o: %.S
$(CASMRUNTIME) -DMODEL_$(MODEL) -DABI_$(ABI) -DENDIANNESS_$(ENDIANNESS) -DSYS_$(SYSTEM) -o $@ $^
+# If no asm implementation available, compile the portable C implementation
+# with CompCert. Since CompCert rejects the "__i64_" identifiers, the C
+# implementation uses "i64_" identifiers, and we rename them in the
+# generated assembly
+
+%.o: c/%.c c/i64.h ../ccomp
+ ../ccomp -O2 -S -o $*.s -I./c c/$*.c
+ sed -i -e 's/i64_/__i64_/g' $*.s
+ $(CASMRUNTIME) -o $*.o $*.s
+ @rm -f $*.s
+
clean::
- rm -f *.o $(LIB)
+ rm -f *.o $(LIB) *.tmp?.s
ifeq ($(strip $(HAS_RUNTIME_LIB)),true)
install::