Skip to content

Commit 6b61b64

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 82e0d6e commit 6b61b64

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
@@ -342,6 +342,7 @@ all-shared-lib: $(shlib)
342342

343343
ifndef haslibarule
344344
$(stlib): $(OBJS)
345+
rm -f $@
345346
$(LINK.static) $@ $^
346347
$(RANLIB) $@
347348
endif #haslibarule
@@ -384,6 +385,7 @@ else # PORTNAME == aix
384385

385386
# AIX case
386387
$(shlib) $(stlib): $(OBJS)
388+
rm -f $(stlib)
387389
$(LINK.static) $(stlib) $^
388390
$(RANLIB) $(stlib)
389391
$(MKLDEXPORT) $(stlib) >$(exports_file)
@@ -404,6 +406,7 @@ $(shlib): $(OBJS) | $(SHLIB_PREREQS)
404406
$(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE)
405407

406408
$(stlib): $(OBJS) | $(SHLIB_PREREQS)
409+
rm -f $@
407410
$(LINK.static) $@ $^
408411
$(RANLIB) $@
409412

src/port/Makefile

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

5454
libpgport.a: $(OBJS)
55+
rm -f $@
5556
$(AR) $(AROPT) $@ $^
5657

5758
# thread.o needs PTHREAD_CFLAGS (but thread_srv.o does not)
@@ -63,6 +64,7 @@ thread.o: thread.c
6364
#
6465

6566
libpgport_srv.a: $(OBJS_SRV)
67+
rm -f $@
6668
$(AR) $(AROPT) $@ $^
6769

6870
%_srv.o: %.c

0 commit comments

Comments
 (0)