]> granicus.if.org Git - postgresql/commitdiff
Unlink static libraries before rebuilding them.
authorNoah Misch <noah@leadboat.com>
Sun, 1 Mar 2015 18:05:23 +0000 (13:05 -0500)
committerNoah Misch <noah@leadboat.com>
Sun, 1 Mar 2015 18:08:48 +0000 (13:08 -0500)
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
src/port/Makefile

index b1ab58072236370a81c7eeda8ef542be45626208..8616eb6f8fd01aa7713ac7ba698cc1cd016224bf 100644 (file)
@@ -342,6 +342,7 @@ all-shared-lib: $(shlib)
 
 ifndef haslibarule
 $(stlib): $(OBJS)
+       rm -f $@
        $(LINK.static) $@ $^
        $(RANLIB) $@
 endif #haslibarule
@@ -384,6 +385,7 @@ else # PORTNAME == aix
 
 # AIX case
 $(shlib) $(stlib): $(OBJS)
+       rm -f $(stlib)
        $(LINK.static) $(stlib) $^
        $(RANLIB) $(stlib)
        $(MKLDEXPORT) $(stlib) >$(exports_file)
@@ -404,6 +406,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) $@
 
index c9b153d7dacb7303f01cd610d932d79146d53bbe..8589108f55c10586106d85070f9fe58de1a8e324 100644 (file)
@@ -52,6 +52,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)
@@ -63,6 +64,7 @@ thread.o: thread.c
 #
 
 libpgport_srv.a: $(OBJS_SRV)
+       rm -f $@
        $(AR) $(AROPT) $@ $^
 
 %_srv.o: %.c