Skip to content

Commit c3b0baf

Browse files
committed
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).
1 parent 6f41995 commit c3b0baf

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/Makefile.shlib

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ all-shared-lib: $(shlib)
318318

319319
ifndef haslibarule
320320
$(stlib): $(OBJS) | $(SHLIB_PREREQS)
321+
rm -f $@
321322
$(LINK.static) $@ $^
322323
$(RANLIB) $@
323324
endif #haslibarule
@@ -360,6 +361,7 @@ else # PORTNAME == aix
360361

361362
# AIX case
362363
$(shlib) $(stlib): $(OBJS) | $(SHLIB_PREREQS)
364+
rm -f $(stlib)
363365
$(LINK.static) $(stlib) $^
364366
$(RANLIB) $(stlib)
365367
$(MKLDEXPORT) $(stlib) >$(exports_file)
@@ -380,6 +382,7 @@ $(shlib): $(OBJS) | $(SHLIB_PREREQS)
380382
$(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE)
381383

382384
$(stlib): $(OBJS) | $(SHLIB_PREREQS)
385+
rm -f $@
383386
$(LINK.static) $@ $^
384387
$(RANLIB) $@
385388

src/port/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ uninstall:
5050
rm -f '$(DESTDIR)$(libdir)/libpgport.a'
5151

5252
libpgport.a: $(OBJS)
53+
rm -f $@
5354
$(AR) $(AROPT) $@ $^
5455

5556
# thread.o needs PTHREAD_CFLAGS (but thread_srv.o does not)
@@ -60,6 +61,7 @@ thread.o: CFLAGS+=$(PTHREAD_CFLAGS)
6061
#
6162

6263
libpgport_srv.a: $(OBJS_SRV)
64+
rm -f $@
6365
$(AR) $(AROPT) $@ $^
6466

6567
# Because this uses its own compilation rule, it doesn't use the

0 commit comments

Comments
 (0)