remove hand-written crt1.s and Scrt1.s files for all archs
[musl] / Makefile
index 5f74005..844a017 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -119,11 +119,19 @@ $(dir $(patsubst %/,%,$(dir $(1))))$(notdir $(1:.s=.o)): $(1)
 endef
 $(foreach s,$(wildcard src/*/$(ARCH)*/*.s),$(eval $(call mkasmdep,$(s))))
 
+# Choose invocation of assembler to be used
+# $(1) is input file, $(2) is output file, $(3) is assembler flags
+ifeq ($(ADD_CFI),yes)
+       AS_CMD = LC_ALL=C awk -f tools/add-cfi.common.awk -f tools/add-cfi.$(ARCH).awk $< | $(CC) -x assembler -c -o $@ -
+else
+       AS_CMD = $(CC) -c -o $@ $<
+endif
+
 %.o: $(ARCH)$(ASMSUBARCH)/%.sub
        $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $(dir $<)$(shell cat $<)
 
 %.o: $(ARCH)/%.s
-       $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<
+       $(AS_CMD) $(CFLAGS_ALL_STATIC)
 
 %.o: %.c $(GENH) $(IMPH)
        $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<
@@ -132,7 +140,7 @@ $(foreach s,$(wildcard src/*/$(ARCH)*/*.s),$(eval $(call mkasmdep,$(s))))
        $(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $(dir $<)$(shell cat $<)
 
 %.lo: $(ARCH)/%.s
-       $(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $<
+       $(AS_CMD) $(CFLAGS_ALL_SHARED)
 
 %.lo: %.c $(GENH) $(IMPH)
        $(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $<
@@ -195,6 +203,4 @@ musl-git-%.tar.gz: .git
 musl-%.tar.gz: .git
         git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ v$(patsubst musl-%.tar.gz,%,$@)
 
-.PRECIOUS: $(CRT_LIBS:lib/%=crt/%)
-
 .PHONY: all clean install install-libs install-headers install-tools