about summary refs log tree commit diff
path: root/mk/rt.mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk/rt.mk')
-rw-r--r--mk/rt.mk31
1 files changed, 31 insertions, 0 deletions
diff --git a/mk/rt.mk b/mk/rt.mk
index f2226b1ae3e..ebb1f83398e 100644
--- a/mk/rt.mk
+++ b/mk/rt.mk
@@ -217,6 +217,37 @@ $$(LIBUV_DIR_$(1))/Release/libuv.a: $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)) \
 
 endif
 
+################################################################################
+# compiler-rt
+################################################################################
+
+ifdef CFG_ENABLE_FAST_MAKE
+COMPRT_DEPS := $(S)/.gitmodules
+else
+COMPRT_DEPS := $(wildcard \
+              $(S)src/compiler-rt/* \
+              $(S)src/compiler-rt/*/* \
+              $(S)src/compiler-rt/*/*/* \
+              $(S)src/compiler-rt/*/*/*/*)
+endif
+
+COMPRT_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
+COMPRT_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(COMPRT_NAME_$(1))
+COMPRT_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/compiler-rt
+
+$$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS)
+	@$$(call E, make: compiler-rt)
+	$$(Q)$$(MAKE) -C "$(S)src/compiler-rt" \
+		ProjSrcRoot="$(S)src/compiler-rt" \
+		ProjObjRoot="$$(abspath $$(COMPRT_BUILD_DIR_$(1)))" \
+		CC="$$(CC_$(1))" \
+		AR="$$(AR_$(1))" \
+		RANLIB="$$(AR_$(1)) s" \
+		CFLAGS="$$(CFG_GCCISH_CFLAGS_$(1))" \
+		TargetTriple=$(1) \
+		triple-runtime
+	$$(Q)cp $$(COMPRT_BUILD_DIR_$(1))/triple/runtime/libcompiler_rt.a $$(COMPRT_LIB_$(1))
+
 endef
 
 # Instantiate template for all stages/targets