diff --git a/src/cmd/INIT/include/link_ar.mam b/src/cmd/INIT/include/link_ar.mam index bec1cc25ac14..6b5ace35655b 100644 --- a/src/cmd/INIT/include/link_ar.mam +++ b/src/cmd/INIT/include/link_ar.mam @@ -4,13 +4,17 @@ note * note * - %{@} - name of archive (like libfoo.a) note * - %{^} - all the *.o files note * - %{?} - the *.o files that changed in this run -note * + +note * Use path and flags detected by make.probe (e.g. AIX needs '-X any') + +setv AR %{mam_cc_AR} %{mam_cc_AR_ARFLAGS} + note * This code avoids rebuilding the archive from scratch on each run, note * updating only the object files that have changed. exec - if test -f %{@} -exec - then ar -r -c %{@} %{?} # add changed *.o -exec - else ar -r -c %{@} %{^} # add all *.o +exec - then %{AR} -r -c %{@} %{?} # add changed *.o +exec - else %{AR} -r -c %{@} %{^} # add all *.o exec - fi || exit note * Sometimes, obsolete object files can interfere due to intercepts, so @@ -18,7 +22,7 @@ note * delete any old object files that we no longer build from the archive exec - set +x # avoid noisy log exec - to_delete= -exec - for o in $(ar -t %{@}) +exec - for o in $(%{AR} -t %{@}) exec - do case $o in exec - *.o) case ' %{^} ' in exec - *" $o "*) @@ -31,6 +35,6 @@ exec - esac exec - done exec - case ${to_delete:+y} in exec - y) set -x -exec - ar -d %{@} $to_delete +exec - %{AR} -d %{@} $to_delete exec - ;; exec - esac diff --git a/src/cmd/ksh93/Mamfile b/src/cmd/ksh93/Mamfile index 3030f6540f68..1041d19a75d8 100644 --- a/src/cmd/ksh93/Mamfile +++ b/src/cmd/ksh93/Mamfile @@ -6,7 +6,6 @@ note * setv MAMAKE_STRICT 5 setv INSTALLROOT ../../.. setv CC cc -setv AR %{mam_cc_AR} %{mam_cc_AR_ARFLAGS} setv mam_cc_FLAGS %{mam_cc_TARGET} %{mam_cc_DLL} %{-debug-symbols?1?%{mam_cc_DEBUG} -D_BLD_DEBUG?%{mam_cc_OPTIMIZE}?} setv CCFLAGS setv CCLDFLAGS %{-strip-symbols?1?%{mam_cc_LD_STRIP}??} diff --git a/src/lib/libast/Mamfile b/src/lib/libast/Mamfile index 3d65ab6aaf93..e4bb02614744 100644 --- a/src/lib/libast/Mamfile +++ b/src/lib/libast/Mamfile @@ -8,7 +8,6 @@ setv INSTALLROOT ../../.. setv PACKAGEROOT ../../../../.. setv INCLUDE_AST %{INSTALLROOT}/include/ast setv CC cc -setv AR %{mam_cc_AR} %{mam_cc_AR_ARFLAGS} setv mam_cc_FLAGS %{mam_cc_TARGET} %{mam_cc_DLL} -D_BLD_ast %{-debug-symbols?1?%{mam_cc_DEBUG} -D_BLD_DEBUG?%{mam_cc_OPTIMIZE}?} setv CCFLAGS setv CCLDFLAGS %{-strip-symbols?1?%{mam_cc_LD_STRIP}??} diff --git a/src/lib/libcmd/Mamfile b/src/lib/libcmd/Mamfile index 17cc0530483d..152a07446796 100644 --- a/src/lib/libcmd/Mamfile +++ b/src/lib/libcmd/Mamfile @@ -6,7 +6,6 @@ note * setv MAMAKE_STRICT 5 setv INSTALLROOT ../../.. setv CC cc -setv AR %{mam_cc_AR} %{mam_cc_AR_ARFLAGS} setv mam_cc_FLAGS %{mam_cc_TARGET} %{mam_cc_DLL} %{-debug-symbols?1?%{mam_cc_DEBUG} -D_BLD_DEBUG?%{mam_cc_OPTIMIZE}?} %{mam_cc_NOSTRICTALIASING} -DERROR_CATALOG=\""libcmd"\" -DHOSTTYPE=\""%{mam_cc_HOSTTYPE}"\" -D_BLD_cmd setv CCFLAGS setv IFFEFLAGS @@ -298,9 +297,10 @@ make install virtual done done make sumlib.o + note * extract sumlib.o from libsum.a bind -lsum exec - set -- %{mam_libsum} - exec - %{AR} x "$1" sumlib.o + exec - %{mam_cc_AR} %{mam_cc_AR_ARFLAGS} -x "$1" sumlib.o done note * include shell action for linking the library diff --git a/src/lib/libdll/Mamfile b/src/lib/libdll/Mamfile index 411cda6fcdcc..41ec31876120 100644 --- a/src/lib/libdll/Mamfile +++ b/src/lib/libdll/Mamfile @@ -6,7 +6,6 @@ note * setv MAMAKE_STRICT 5 setv INSTALLROOT ../../.. setv CC cc -setv AR %{mam_cc_AR} %{mam_cc_AR_ARFLAGS} setv mam_cc_FLAGS %{mam_cc_TARGET} %{mam_cc_DLL} %{-debug-symbols?1?%{mam_cc_DEBUG} -D_BLD_DEBUG?%{mam_cc_OPTIMIZE}?} setv CCFLAGS setv IFFEFLAGS diff --git a/src/lib/libsum/Mamfile b/src/lib/libsum/Mamfile index 6b0ac58860d1..6d3a885b89f1 100644 --- a/src/lib/libsum/Mamfile +++ b/src/lib/libsum/Mamfile @@ -6,7 +6,6 @@ note * setv MAMAKE_STRICT 5 setv INSTALLROOT ../../.. setv CC cc -setv AR %{mam_cc_AR} %{mam_cc_AR_ARFLAGS} setv mam_cc_FLAGS %{mam_cc_TARGET} %{mam_cc_DLL} %{mam_cc_PIC} %{-debug-symbols?1?%{mam_cc_DEBUG} -D_BLD_DEBUG?%{mam_cc_OPTIMIZE}?} setv CCFLAGS setv IFFEFLAGS