libc: refactor picolibc build deps

Signed-off-by: Karol Gugala <kgugala@antmicro.com>
This commit is contained in:
Karol Gugala 2021-09-28 14:16:34 +02:00
parent b9c4d7ba51
commit 9f1108c2fc
1 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,7 @@
include ../include/generated/variables.mak include ../include/generated/variables.mak
include $(SOC_DIRECTORY)/software/common.mak include $(SOC_DIRECTORY)/software/common.mak
all: libc.a stdio.c.o missing.c.o all: libc.a
CFLAGS = $(COMMONFLAGS) -fexceptions -Wpragmas CFLAGS = $(COMMONFLAGS) -fexceptions -Wpragmas
@ -32,7 +32,7 @@ export CROSSFILE
cross.txt: cross.txt:
@echo "$$CROSSFILE" > $@ @echo "$$CROSSFILE" > $@
libc.a: cross.txt __libc.a: cross.txt
if [ -d "$(LIBC_DIRECTORY)/$(CPUFAMILY)" ]; then \ if [ -d "$(LIBC_DIRECTORY)/$(CPUFAMILY)" ]; then \
cp $(LIBC_DIRECTORY)/$(CPUFAMILY)/* $(PICOLIBC_DIRECTORY)/newlib/libc/machine/$(CPUFAMILY)/ ;\ cp $(LIBC_DIRECTORY)/$(CPUFAMILY)/* $(PICOLIBC_DIRECTORY)/newlib/libc/machine/$(CPUFAMILY)/ ;\
fi fi
@ -49,13 +49,15 @@ libc.a: cross.txt
--cross-file cross.txt --cross-file cross.txt
meson compile meson compile
cp newlib/libc.a libc.a cp newlib/libc.a __libc.a
stdio.c.o: $(LIBC_DIRECTORY)/stdio.c libc.a _libc.a: $(LIBC_DIRECTORY)/stdio.c __libc.a
$(compile) $(compile)
$(AR) csr libc.a $@ $(AR) csr __libc.a $@
cp __libc.a _libc.a
missing.c.o: $(LIBC_DIRECTORY)/missing.c libc.a libc.a: $(LIBC_DIRECTORY)/missing.c _libc.a
$(compile) $(compile)
$(AR) csr libc.a $@ $(AR) csr _libc.a $@
cp _libc.a libc.a