summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2015-03-01 13:05:23 -0500
committerNoah Misch <noah@leadboat.com>2015-03-01 13:07:17 -0500
commit1c966854b241f0df77bec24612142e7ad7fc9e38 (patch)
tree4a13b60068bc4c179b93772d45150071810f3dbf
parent5c8dabecdb2e8324436e9c6a5a98fc3162743cb1 (diff)
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).
-rw-r--r--src/Makefile.shlib3
-rw-r--r--src/port/Makefile2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 4af852e1e46..7b062a93faf 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -343,6 +343,7 @@ all-shared-lib: $(shlib)
ifndef haslibarule
$(stlib): $(OBJS) | $(SHLIB_PREREQS)
+ rm -f $@
$(LINK.static) $@ $^
$(RANLIB) $@
endif #haslibarule
@@ -385,6 +386,7 @@ else # PORTNAME == aix
# AIX case
$(shlib) $(stlib): $(OBJS) | $(SHLIB_PREREQS)
+ rm -f $(stlib)
$(LINK.static) $(stlib) $^
$(RANLIB) $(stlib)
$(MKLDEXPORT) $(stlib) >$(exports_file)
@@ -405,6 +407,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/port/Makefile b/src/port/Makefile
index 60295dcdefd..63cd5c97b88 100644
--- a/src/port/Makefile
+++ b/src/port/Makefile
@@ -50,6 +50,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: thread.c
#
libpgport_srv.a: $(OBJS_SRV)
+ rm -f $@
$(AR) $(AROPT) $@ $^
%_srv.o: %.c