-source_dirs =
-
-VPATH = $(addprefix $(srcdir)/, $(source_dirs))
-
-all: build-crt build-libc build-libm
-
-install: install-crt install-libc install-headers install-libm
-
-clean: clean-crt clean-libc clean-libm
-
-
-crt_all_objs = \
- crt430x110.o crt430x112.o \
- crt430x1101.o crt430x1111.o crt430x1121.o \
- crt430x1122.o crt430x1132.o \
- crt430x122.o crt430x123.o \
- crt430x1222.o crt430x1232.o \
- crt430x133.o crt430x135.o \
- crt430x1331.o crt430x1351.o \
- crt430x147.o crt430x148.o crt430x149.o \
- crt430x1471.o crt430x1481.o crt430x1491.o \
- crt430x155.o crt430x156.o crt430x157.o \
- crt430x167.o crt430x168.o crt430x169.o crt430x1610.o crt430x1611.o crt430x1612.o \
- crt430x2001.o crt430x2011.o \
- crt430x2002.o crt430x2012.o \
- crt430x2003.o crt430x2013.o \
- crt430x2101.o crt430x2111.o crt430x2121.o crt430x2131.o \
- crt430x2234.o crt430x2254.o crt430x2274.o \
- crt430x247.o crt430x248.o crt430x249.o crt430x2410.o \
- crt430x2471.o crt430x2481.o crt430x2491.o \
- crt430x2416.o crt430x2417.o crt430x2418.o crt430x2419.o \
- crt430x2616.o crt430x2617.o crt430x2618.o crt430x2619.o \
- crt430x311.o crt430x312.o crt430x313.o crt430x314.o crt430x315.o \
- crt430x323.o crt430x325.o crt430x336.o crt430x337.o \
- crt430x412.o crt430x413.o crt430x415.o crt430x417.o \
- crt430x423.o crt430x425.o crt430x427.o \
- crt430x4250.o crt430x4260.o crt430x4270.o \
- crt430xE423.o crt430xE425.o crt430xE427.o \
- crt430xW423.o crt430xW425.o crt430xW427.o \
- crt430xG437.o crt430xG438.o crt430xG439.o \
- crt430x435.o crt430x436.o crt430x437.o \
- crt430x447.o crt430x448.o crt430x449.o \
- crt430xG4616.o crt430xG4617.o crt430xG4618.o crt430xG4619.o
-
-build-crt: ${crt_all_objs}
+.PHONY: clean clean-crt clean-multilib
+
+#--------- crt ---------------------------------------
+BUILDDIR := $(BUILD_ROOT)
+MCU_MSP_LIST := $(strip $(shell $(CC) --target-help | sed -n '/Known MCU names/,/no/p' | sed -n '/msp430/p' 2>/dev/null))
+MCU_CC430_LIST := $(strip $(shell $(CC) --target-help | sed -n '/Known MCU names/,/no/p' | sed -n '/cc430/p' 2>/dev/null))
+CRT_MSP_OBJS := $(addprefix $(BUILDDIR)/, $(addsuffix .o,$(subst msp,crt,$(MCU_MSP_LIST))))
+CRT_CC430_OBJS := $(addprefix $(BUILDDIR)/, $(addsuffix .o,$(subst cc430,crtcc430,$(MCU_CC430_LIST))))