+$(CRT_LIBS:lib/%=crt/%): CFLAGS_ALL += -DCRT
+
+# This incantation ensures that changes to any subarch asm files will
+# force the corresponding object file to be rebuilt, even if the implicit
+# rule below goes indirectly through a .sub file.
+define mkasmdep
+$(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 $<)