Skip to content

plugins/Makefile: use files to avoid hitting ARG_MAX during build #775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,7 @@ endif

clean:
rm -f *.a
rm -f plugin_objs_list.txt mini_plugin_objs_list.txt
rm -rf $(BUILD_DIR)
rm -rf surgext/build

Expand Down Expand Up @@ -2060,12 +2061,18 @@ custom_per_file_names = -D${1}=${2}_${1}
plugins$(TARGET_SUFFIX).a: $(PLUGIN_OBJS)
@echo "Creating $@"
$(SILENT)rm -f $@
$(SILENT)$(AR) crs $@ $^
# Write object file list to a response file and use it in the `ar` command
# to avoid hitting stack limits when using large number of modules
$(SILENT)$(file > plugin_objs_list.txt,$(PLUGIN_OBJS))
$(SILENT)$(AR) crs $@ @plugin_objs_list.txt
$(SILENT)rm -f plugin_objs_list.txt

plugins-mini$(TARGET_SUFFIX).a: $(MINIPLUGIN_OBJS)
@echo "Creating $@"
$(SILENT)rm -f $@
$(SILENT)$(AR) crs $@ $^
$(SILENT)$(file > mini_plugin_objs_list.txt,$(MINIPLUGIN_OBJS))
$(SILENT)$(AR) crs $@ @mini_plugin_objs_list.txt
$(SILENT)rm -f mini_plugin_objs_list.txt

$(BUILD_DIR)/%.bin.c: % ../deps/res2c.py
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
Expand Down
Loading