From 22dd465d34f55b5a5b1790a5b5582fef9558d84b Mon Sep 17 00:00:00 2001 From: Noah Misch Date: Sun, 1 Mar 2015 13:05:23 -0500 Subject: [PATCH] Unlink static libraries before rebuilding them. When the library already exists in the build directory, "ar" preserves members not named on its command line. This mattered when, for example, a "configure" rerun dropped a file from $(LIBOBJS). libpgport carried the obsolete member until "make clean". Back-patch to 9.0 (all supported versions). --- src/Makefile.shlib | 3 +++ src/common/Makefile | 2 ++ src/port/Makefile | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/Makefile.shlib b/src/Makefile.shlib index 0ebb767e82..c6d184f660 100644 --- a/src/Makefile.shlib +++ b/src/Makefile.shlib @@ -300,6 +300,7 @@ all-shared-lib: $(shlib) ifndef haslibarule $(stlib): $(OBJS) | $(SHLIB_PREREQS) + rm -f $@ $(LINK.static) $@ $^ $(RANLIB) $@ endif #haslibarule @@ -341,6 +342,7 @@ else # PORTNAME == aix # AIX case $(shlib) $(stlib): $(OBJS) | $(SHLIB_PREREQS) + rm -f $(stlib) $(LINK.static) $(stlib) $^ $(RANLIB) $(stlib) $(MKLDEXPORT) $(stlib) >$(exports_file) @@ -360,6 +362,7 @@ $(shlib): $(OBJS) | $(SHLIB_PREREQS) $(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE) $(stlib): $(OBJS) | $(SHLIB_PREREQS) + rm -f $@ $(LINK.static) $@ $^ $(RANLIB) $@ diff --git a/src/common/Makefile b/src/common/Makefile index e5c345d7de..d99ed4bada 100644 --- a/src/common/Makefile +++ b/src/common/Makefile @@ -42,6 +42,7 @@ uninstall: rm -f '$(DESTDIR)$(libdir)/libpgcommon.a' libpgcommon.a: $(OBJS_FRONTEND) + rm -f $@ $(AR) $(AROPT) $@ $^ # @@ -49,6 +50,7 @@ libpgcommon.a: $(OBJS_FRONTEND) # libpgcommon_srv.a: $(OBJS_SRV) + rm -f $@ $(AR) $(AROPT) $@ $^ # Because this uses its own compilation rule, it doesn't use the diff --git a/src/port/Makefile b/src/port/Makefile index 1be4ff57a2..6dc642cd3e 100644 --- a/src/port/Makefile +++ b/src/port/Makefile @@ -51,6 +51,7 @@ uninstall: rm -f '$(DESTDIR)$(libdir)/libpgport.a' libpgport.a: $(OBJS) + rm -f $@ $(AR) $(AROPT) $@ $^ # thread.o needs PTHREAD_CFLAGS (but thread_srv.o does not) @@ -61,6 +62,7 @@ thread.o: CFLAGS+=$(PTHREAD_CFLAGS) # libpgport_srv.a: $(OBJS_SRV) + rm -f $@ $(AR) $(AROPT) $@ $^ # Because this uses its own compilation rule, it doesn't use the -- 2.40.0