diff --git a/Makefile.base b/Makefile.base index e16f028f8..7d0e89aa0 100644 --- a/Makefile.base +++ b/Makefile.base @@ -49,7 +49,7 @@ $(BINDIR)$(MODULE)/: $(BINDIR)$(MODULE).a $(OBJ): | $(BINDIR)$(MODULE)/ $(BINDIR)$(MODULE).a: $(OBJ) | ${DIRS:%=ALL--%} - $(AD)$(AR) -rcs $@ $? + $(AD)$(AR) $(ARFLAGS) $@ $? CXXFLAGS = $(filter-out $(CXXUWFLAGS), $(CFLAGS)) $(CXXEXFLAGS) diff --git a/Makefile.cflags b/Makefile.cflags index 39049324d..89381ef4f 100644 --- a/Makefile.cflags +++ b/Makefile.cflags @@ -50,3 +50,9 @@ endif # Forbid common symbols to prevent accidental aliasing. CFLAGS += -fno-common + +# 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 +endif diff --git a/Makefile.vars b/Makefile.vars index 571c625a6..7896e67a0 100644 --- a/Makefile.vars +++ b/Makefile.vars @@ -26,6 +26,7 @@ export CFLAGS # The compiler flags. Must only ever be used with ` export CXXUWFLAGS # (Patters of) flags in CFLAGS, that should not be passed to CXX. export CXXEXFLAGS # Additional flags that should be passed to CXX. export AR # The command to create the object file archives. +export ARFLAGS # Command-line options to pass to AR, default `rcs`. export AS # The assembler. export ASFLAGS # Flags for the assembler. export LINK # The command used to link the files. Must take the same parameters as GCC, i.e. "ld" won't work.