Clean up hardcoded ar(1) flags in the tree to use the global ARFLAGS in

share/mk/sys.mk instead.

This is part of a medium term project to permit deterministic builds of
FreeBSD.

Submitted by:	Erik Cederstrand <erik@cederstrand.dk>
Reviewed by:	imp, toolchain@
Approved by:	cperciva
MFC after:	2 weeks
This commit is contained in:
eadler 2012-12-06 01:31:25 +00:00
parent d63ec4c24b
commit 0af88b7eae
27 changed files with 55 additions and 52 deletions

View File

@ -284,7 +284,7 @@ MAKEINFOFLAGS = --split-size=5000000
AS = @AS@
AR = @AR@
AR_FLAGS = rc
ARFLAGS = @ARFLAGS@
CC = @CC@
CXX = @CXX@
DLLTOOL = @DLLTOOL@
@ -474,7 +474,7 @@ BASE_FLAGS_TO_PASS = \
"SHELL=$(SHELL)" \
"YACC=$(YACC)" \
"`echo 'ADAFLAGS=$(ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
"AR_FLAGS=$(AR_FLAGS)" \
"AR_FLAGS=$(ARFLAGS)" \
"`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
"BOOT_CFLAGS=$(BOOT_CFLAGS)" \
"BOOT_LDFLAGS=$(BOOT_LDFLAGS)" \

View File

@ -287,7 +287,7 @@ MAKEINFOFLAGS = --split-size=5000000
AS = @AS@
AR = @AR@
AR_FLAGS = rc
ARFLAGS = @ARFLAGS@
CC = @CC@
CXX = @CXX@
DLLTOOL = @DLLTOOL@

View File

@ -56,7 +56,7 @@ mkinstalldirs = $(SHELL) $(libiberty_topdir)/mkinstalldirs
OUTPUT_OPTION = @OUTPUT_OPTION@
AR = @AR@
AR_FLAGS = rc
ARFLAGS = @ARFLAGS@
CC = @CC@
CFLAGS = @CFLAGS@
@ -81,7 +81,7 @@ EXTRA_OFILES =
# Flags to pass to a recursive make.
FLAGS_TO_PASS = \
"AR=$(AR)" \
"AR_FLAGS=$(AR_FLAGS)" \
"AR_FLAGS=$(ARFLAGS)" \
"CC=$(CC)" \
"CFLAGS=$(CFLAGS)" \
"DESTDIR=$(DESTDIR)" \
@ -224,12 +224,12 @@ INSTALLED_HEADERS = \
$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
-rm -f $(TARGETLIB) pic/$(TARGETLIB)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(AR) $(ARFLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(RANLIB) $(TARGETLIB)
if [ x"$(PICFLAG)" != x ]; then \
cd pic; \
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(AR) $(ARFLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
cd ..; \
@ -237,7 +237,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(TESTLIB): $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
-rm -f $(TESTLIB)
$(AR) $(AR_FLAGS) $(TESTLIB) \
$(AR) $(ARFLAGS) $(TESTLIB) \
$(REQUIRED_OFILES) $(CONFIGURED_OFILES)
$(RANLIB) $(TESTLIB)

View File

@ -41,8 +41,8 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
AR = ar
ARFLAGS = cru
AR = @AR@
ARFLAGS = @ARFLAGS@
libdiff_a_AR = $(AR) $(ARFLAGS)
libdiff_a_LIBADD =
am_libdiff_a_OBJECTS = diff.$(OBJEXT) diff3.$(OBJEXT) \

View File

@ -63,8 +63,8 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = fnmatch.h
LIBRARIES = $(noinst_LIBRARIES)
AR = ar
ARFLAGS = cru
AR = @AR@
ARFLAGS = @ARFLAGS@
libcvs_a_AR = $(AR) $(ARFLAGS)
libcvs_a_DEPENDENCIES = @LIBOBJS@
am_libcvs_a_OBJECTS = argmatch.$(OBJEXT) getdate.$(OBJEXT) \

View File

@ -48,7 +48,7 @@ ifdef V
VECHO = :
else
VECHO = echo " "
ARFLAGS = rc
ARFLAGS ?= rc
.SILENT:
endif

View File

@ -238,7 +238,7 @@ BISONFLAGS =
FLEX = @FLEX@
FLEXFLAGS =
AR = @AR@
AR_FLAGS = rc
ARFLAGS = @ARFLAGS@
NM = @NM@
RANLIB = @RANLIB@
RANLIB_FLAGS = @ranlib_flags@
@ -1303,7 +1303,7 @@ compilations: $(BACKEND)
# This archive is strictly for the host.
libbackend.a: $(OBJS@onestep@)
-rm -rf libbackend.a
$(AR) $(AR_FLAGS) libbackend.a $(OBJS@onestep@)
$(AR) $(ARFLAGS) libbackend.a $(OBJS@onestep@)
-$(RANLIB) $(RANLIB_FLAGS) libbackend.a
# We call this executable `xgcc' rather than `gcc'

View File

@ -26,8 +26,8 @@ srcdir = @srcdir@
top_builddir = .
VPATH = @srcdir@
INSTALL = @INSTALL@
AR = ar
ARFLAGS = cru
AR = @AR@
ARFLAGS = @ARFLAGS@
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@

View File

@ -26,8 +26,8 @@ srcdir = @srcdir@
top_builddir = .
VPATH = @srcdir@
INSTALL = @INSTALL@
AR = ar
ARFLAGS = cru
AR = @AR@
ARFLAGS = @ARFLAGS@
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@

View File

@ -56,7 +56,7 @@ mkinstalldirs = $(SHELL) $(libiberty_topdir)/mkinstalldirs
OUTPUT_OPTION = @OUTPUT_OPTION@
AR = @AR@
AR_FLAGS = rc
ARFLAGS = @ARFLAGS@
CC = @CC@
CFLAGS = @CFLAGS@
@ -81,7 +81,7 @@ EXTRA_OFILES =
# Flags to pass to a recursive make.
FLAGS_TO_PASS = \
"AR=$(AR)" \
"AR_FLAGS=$(AR_FLAGS)" \
"AR_FLAGS=$(ARFLAGS)" \
"CC=$(CC)" \
"CFLAGS=$(CFLAGS)" \
"DESTDIR=$(DESTDIR)" \
@ -224,12 +224,12 @@ INSTALLED_HEADERS = \
$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
-rm -f $(TARGETLIB) pic/$(TARGETLIB)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(AR) $(ARFLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(RANLIB) $(TARGETLIB)
if [ x"$(PICFLAG)" != x ]; then \
cd pic; \
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(AR) $(ARFLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
cd ..; \
@ -237,7 +237,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(TESTLIB): $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
-rm -f $(TESTLIB)
$(AR) $(AR_FLAGS) $(TESTLIB) \
$(AR) $(ARFLAGS) $(TESTLIB) \
$(REQUIRED_OFILES) $(CONFIGURED_OFILES)
$(RANLIB) $(TESTLIB)

View File

@ -26,6 +26,8 @@
.SUFFIXES: .c .o
CC = cc
CFLAGS = -g
AR ?= ar
ARFLAGS ?= ruv
.c.o:
$(CC) -c $(CFLAGS) $*.c
@ -52,12 +54,12 @@ gdtoa.a: dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c g_dfmt.c\
strtopx.c strtopxL.c strtorQ.c strtord.c strtordd.c strtorf.c\
strtorx.c strtorxL.c sum.c ulp.c
$(CC) -c $(CFLAGS) $?
x=`echo $? | sed 's/\.c/.o/g'` && ar ruv gdtoa.a $$x && rm $$x
x=`echo $? | sed 's/\.c/.o/g'` && $(AR) $(ARFLAGS) gdtoa.a $$x && rm $$x
ranlib gdtoa.a || true
Printf: all printf.c
$(CC) -c $(CFLAGS) printf.c
ar ruv gdtoa.a printf.o
$(AR) $(ARFLAGS) gdtoa.a printf.o
rm printf.o
touch Printf

View File

@ -43,8 +43,8 @@ CXXCPP = @CXXCPP@
# Both C and C++ compiler
OBJEXT = @OBJEXT@
# Other
AR = ar
AR_FLAGS = rc
AR = @AR@
ARFLAGS = @ARFLAGS@
RANLIB = @RANLIB@
MV = mv
LN = ln
@ -71,7 +71,7 @@ all : $(TARGETLIB)
$(TARGETLIB): $(OBJECTS)
$(RM) $@
$(AR) $(AR_FLAGS) $@ $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
$(RANLIB) $@
# Don't use implicit rules, since AIX "make" and OSF/1 "make" don't always

View File

@ -50,8 +50,8 @@ mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
AR = ar
ARFLAGS = cru
AR = @AR@
ARFLAGS = @ARFLAGS@
libares_a_AR = $(AR) $(ARFLAGS)
libares_a_LIBADD =
am_libares_a_OBJECTS = arlib.$(OBJEXT)

View File

@ -52,7 +52,7 @@ CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
ARFLAGS = @ARFLAGS@
libntp_a_AR = $(AR) $(ARFLAGS)
libntp_a_LIBADD =
am__objects_1 = a_md5encrypt$U.$(OBJEXT) adjtime$U.$(OBJEXT) \

View File

@ -52,7 +52,7 @@ CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
ARFLAGS ?= cru
libparse_a_AR = $(AR) $(ARFLAGS)
libparse_a_LIBADD =
am_libparse_a_OBJECTS = parse$U.$(OBJEXT) parse_conf$U.$(OBJEXT) \

View File

@ -58,7 +58,7 @@ CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
ARFLAGS = @ARFLAGS@
libntpd_a_AR = $(AR) $(ARFLAGS)
libntpd_a_LIBADD =
am_libntpd_a_OBJECTS = ntp_control$U.$(OBJEXT) ntp_crypto$U.$(OBJEXT) \

View File

@ -22,7 +22,7 @@ TARGET=libmissing.a
all: $(TARGET)
$(TARGET): $(OBJS)
ar cr $(TARGET) $(OBJS)
@AR@ @ARFLAGS@ $(TARGET) $(OBJS)
@RANLIB@ $(TARGET)
clean:

View File

@ -23,7 +23,7 @@ TARGET=libopie.a
all: $(TARGET)
$(TARGET): $(OBJS)
ar cr $(TARGET) $(OBJS)
@AR@ @ARFLAGS@ $(TARGET) $(OBJS)
@RANLIB@ $(TARGET)
clean:

View File

@ -139,7 +139,7 @@ epix:
freebsd:
@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP=-DNETGROUP TLI= \
RANLIB=ranlib ARFLAGS=$(ARFLAGS) AUX_OBJ= NETGROUP=-DNETGROUP TLI= \
EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DINET6 -DUSE_GETIPNODEBY" \
VSYSLOG= all
@ -401,7 +401,7 @@ machten:
RANLIB = ranlib # have ranlib (BSD-ish UNIX)
#RANLIB = echo # no ranlib (SYSV-ish UNIX)
ARFLAGS = rv # most systems
ARFLAGS ?= rv # most systems
#ARFLAGS= rvs # IRIX 4.0.x
AR = ar

View File

@ -366,7 +366,7 @@ $(PROG): $(OBJ) @V_PCAPDEP@
$(LIBNETDISSECT): $(LIBNETDISSECT_OBJ)
@rm -f $@
$(AR) cr $@ $(LIBNETDISSECT_OBJ)
$(AR) $(ARFLAGS) $@ $(LIBNETDISSECT_OBJ)
$(RANLIB) $@
datalinks.o: $(srcdir)/missing/datalinks.c

View File

@ -96,7 +96,7 @@ CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
ARFLAGS ?= cru
libcommon_a_AR = $(AR) $(ARFLAGS)
libcommon_a_LIBADD =
am_libcommon_a_OBJECTS = sockbuf.$(OBJEXT) buffer.$(OBJEXT)

View File

@ -96,7 +96,7 @@ CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
ARFLAGS ?= cru
libtelnet_a_AR = $(AR) $(ARFLAGS)
libtelnet_a_LIBADD =
am_libtelnet_a_OBJECTS = auth.$(OBJEXT) enc_des.$(OBJEXT) \

View File

@ -63,8 +63,8 @@ DEPFLAG=
PEX_LIBS=
EX_LIBS=
EXE_EXT=
ARFLAGS=
AR=ar $(ARFLAGS) r
ARFLAGS?= r
AR=ar $(ARFLAGS)
RANLIB= ranlib
NM= nm
PERL= perl

View File

@ -13,7 +13,8 @@ MAKEDEPPROG= makedepend
MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
MAKEFILE= Makefile
RM= rm -f
AR= ar r
ARFLAGS?= r
AR= ar ${ARFLAGS}
RECURSIVE_MAKE= [ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
(cd $$i && echo "making $$target in $(DIR)/$$i..." && \

View File

@ -341,7 +341,7 @@ CLEANFILES += libgcc.map
libgcc_eh.a: ${EH_OBJS_T}
@${ECHO} building static gcc_eh library
@rm -f ${.TARGET}
@${AR} cq ${.TARGET} `lorder ${EH_OBJS_T} | tsort -q`
@${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_T} | tsort -q`
${RANLIB} ${.TARGET}
all: libgcc_eh.a
@ -350,7 +350,7 @@ all: libgcc_eh.a
libgcc_eh_p.a: ${EH_OBJS_P}
@${ECHO} building profiled gcc_eh library
@rm -f ${.TARGET}
@${AR} cq ${.TARGET} `lorder ${EH_OBJS_P} | tsort -q`
@${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_P} | tsort -q`
${RANLIB} ${.TARGET}
all: libgcc_eh_p.a
.endif

View File

@ -512,7 +512,7 @@ ${_src:R:S/$/.o/}: ${_src}
${LIBIBERTY}: ${LIBIBERTY_OBJS}
@rm -f ${.TARGET}
@${AR} cq ${.TARGET} `lorder ${LIBIBERTY_OBJS} | tsort -q`
@${AR} ${ARFLAGS} ${.TARGET} `lorder ${LIBIBERTY_OBJS} | tsort -q`
${RANLIB} ${.TARGET}
CLEANFILES+= ${LIBIBERTY} ${LIBIBERTY_OBJS}

View File

@ -135,9 +135,9 @@ lib${LIB}.a: ${OBJS} ${STATICOBJS}
@${ECHO} building static ${LIB} library
@rm -f ${.TARGET}
.if !defined(NM)
@${AR} cq ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
@${AR} ${ARFLAGS} ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
.else
@${AR} cq ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
@${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
.endif
${RANLIB} ${.TARGET}
.endif
@ -152,9 +152,9 @@ lib${LIB}_p.a: ${POBJS}
@${ECHO} building profiled ${LIB} library
@rm -f ${.TARGET}
.if !defined(NM)
@${AR} cq ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD}
@${AR} ${ARFLAGS} ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD}
.else
@${AR} cq ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD}
@${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD}
.endif
${RANLIB} ${.TARGET}
.endif
@ -202,7 +202,7 @@ _LIBS+= lib${LIB}_pic.a
lib${LIB}_pic.a: ${SOBJS}
@${ECHO} building special pic ${LIB} library
@rm -f ${.TARGET}
@${AR} cq ${.TARGET} ${SOBJS} ${ARADD}
@${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD}
${RANLIB} ${.TARGET}
.endif