mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Makefile.base: use thin static archives.
Normal, or thick archives contain a copy of the object code. Thin archives, on the contrary, are just an index to the .o files. This patch does two things: 1. Change ARFLAGS to enable the "T" options. 2. Call AR with all relative paths. The second step is necessary because the build system handles all absolute paths. If the index in the thin archive contains absolute paths, archives created in docker are no usable outside, and moving the objects breaks the archive. If all arguments to AR are relative, the resulting archive contains filenames *relative to the .a file* and nothing should break as long as the relative location of the .a and .o remains unchanged. Compilation time is unchanged, but disc usage is reduced by approximately 50%. These are the result of a full RIOT build: | Thin Archive | no | yes | Savings (%) | | -------------- | ------: | ----: | ----------- | | pkg (10e6 KiB) | 1 790 | 905 | 49% | | Non pkg | 71 | 71 | 1% | | Total | 1 812 | 976 | 46 % |
This commit is contained in:
parent
741d5437a7
commit
24ddf285d2
@ -67,10 +67,12 @@ $(BINDIR)/$(MODULE)/:
|
||||
|
||||
$(BINDIR)/$(MODULE).a $(OBJ): | $(BINDIR)/$(MODULE)/
|
||||
|
||||
relpath = $(shell realpath --relative-to=$(abspath .) $(1))
|
||||
|
||||
$(BINDIR)/$(MODULE).a: $(OBJ) | $(DIRS:%=ALL--%)
|
||||
@# Recreate archive to cleanup deleted/non selected source files objects
|
||||
$(Q)$(RM) $@
|
||||
$(Q)$(AR) $(ARFLAGS) $@ $^
|
||||
$(Q)$(AR) $(ARFLAGS) $(foreach f,$@ $^,$(call relpath,$f))
|
||||
|
||||
CXXFLAGS = $(filter-out $(CXXUWFLAGS), $(CFLAGS)) $(CXXEXFLAGS)
|
||||
CCASFLAGS = $(filter-out $(CCASUWFLAGS), $(CFLAGS)) $(CCASEXFLAGS)
|
||||
|
@ -65,5 +65,5 @@ CFLAGS += $(filter-out $(OPTIONAL_CFLAGS_BLACKLIST),$(OPTIONAL_CFLAGS))
|
||||
# Default ARFLAGS for platforms which do not specify it.
|
||||
# Note: make by default provides ARFLAGS=rv which we want to override
|
||||
ifeq ($(origin ARFLAGS),default)
|
||||
ARFLAGS = rcs
|
||||
ARFLAGS = rcTs
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user