Skip to content

Commit 913e58e

Browse files
authored
Avoid rebuilding empty placeholder libraries (#550)
Previously, these were rebuilt each time as a part of the phone `dummy_libs` target. This change only rebuilds them if they don't exist.
1 parent fe15980 commit 913e58e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -883,23 +883,25 @@ endif
883883

884884
libc: include_dirs $(STATIC_LIBS)
885885

886-
dummy_libs:
886+
DUMMY := m rt pthread crypt util xnet resolv
887+
DUMMY_LIBS := $(patsubst %,$(SYSROOT_LIB)/lib%.a,$(DUMMY))
888+
$(DUMMY_LIBS):
887889
#
888890
# Create empty placeholder libraries.
889891
#
890-
mkdir -p "$(SYSROOT_LIB)" && \
891-
for name in m rt pthread crypt util xnet resolv; do \
892-
$(AR) crs "$(SYSROOT_LIB)/lib$${name}.a"; \
892+
mkdir -p "$(SYSROOT_LIB)"
893+
for lib in $@; do \
894+
$(AR) crs "$$lib"; \
893895
done
894896

895-
finish: startup_files libc dummy_libs
897+
finish: startup_files libc $(DUMMY_LIBS)
896898
#
897899
# The build succeeded! The generated sysroot is in $(SYSROOT).
898900
#
899901

900902
ifeq ($(LTO),no)
901903
# The check for defined and undefined symbols expects there to be a heap
902-
# alloctor (providing malloc, calloc, free, etc). Skip this step if the build
904+
# allocator (providing malloc, calloc, free, etc). Skip this step if the build
903905
# is done without a malloc implementation.
904906
ifneq ($(MALLOC_IMPL),none)
905907
finish: check-symbols
@@ -1099,4 +1101,4 @@ clean:
10991101
$(RM) -r "$(OBJDIR)"
11001102
$(RM) -r "$(SYSROOT)"
11011103

1102-
.PHONY: default startup_files libc libc_so dummy_libs finish install include_dirs clean check-symbols bindings
1104+
.PHONY: default startup_files libc libc_so finish install include_dirs clean check-symbols bindings

0 commit comments

Comments
 (0)