mirror of git://git.musl-libc.org/musl
rework makefile subarch logic to allow shared files
instead of subarchs getting their own .s files which are used directly by the makefile to replace the .c file, they now must provide a .sub file whose contents are a pathname, relative to the location of the .sub file, which will substitute for the .c file. essentially these files are acting as symbolic links, but implemented as text files.
This commit is contained in:
parent
4ce6bd8345
commit
fb72a97df9
16
Makefile
16
Makefile
|
@ -90,8 +90,16 @@ $(OPTIMIZE_SRCS:%.c=%.o) $(OPTIMIZE_SRCS:%.c=%.lo): CFLAGS += -O3
|
||||||
MEMOPS_SRCS = src/string/memcpy.c src/string/memmove.c src/string/memcmp.c src/string/memset.c
|
MEMOPS_SRCS = src/string/memcpy.c src/string/memmove.c src/string/memcmp.c src/string/memset.c
|
||||||
$(MEMOPS_SRCS:%.c=%.o) $(MEMOPS_SRCS:%.c=%.lo): CFLAGS += $(CFLAGS_MEMOPS)
|
$(MEMOPS_SRCS:%.c=%.o) $(MEMOPS_SRCS:%.c=%.lo): CFLAGS += $(CFLAGS_MEMOPS)
|
||||||
|
|
||||||
%.o: $(ARCH)$(ASMSUBARCH)/%.s
|
# This incantation ensures that changes to any subarch asm files will
|
||||||
$(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<
|
# 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))))
|
||||||
|
|
||||||
|
%.o: $(ARCH)$(ASMSUBARCH)/%.sub
|
||||||
|
$(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $(dir $<)$(shell cat $<)
|
||||||
|
|
||||||
%.o: $(ARCH)/%.s
|
%.o: $(ARCH)/%.s
|
||||||
$(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<
|
$(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<
|
||||||
|
@ -99,8 +107,8 @@ $(MEMOPS_SRCS:%.c=%.o) $(MEMOPS_SRCS:%.c=%.lo): CFLAGS += $(CFLAGS_MEMOPS)
|
||||||
%.o: %.c $(GENH) $(IMPH)
|
%.o: %.c $(GENH) $(IMPH)
|
||||||
$(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<
|
$(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<
|
||||||
|
|
||||||
%.lo: $(ARCH)$(ASMSUBARCH)/%.s
|
%.lo: $(ARCH)$(ASMSUBARCH)/%.sub
|
||||||
$(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $<
|
$(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $(dir $<)$(shell cat $<)
|
||||||
|
|
||||||
%.lo: $(ARCH)/%.s
|
%.lo: $(ARCH)/%.s
|
||||||
$(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $<
|
$(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $<
|
||||||
|
|
Loading…
Reference in New Issue