Bug 13039

Summary: make cannot find archive members
Product: Base System Reporter: mikko <mikko>
Component: binAssignee: Julian Elischer <julian>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description mikko 1999-08-09 09:20:00 UTC
Make no longer properly parses archive files, so using archive members
as make targets, as described in PSD:12 section 4.2, does not work.

Fix: It looks like "ar" and friends from the GNU binutils build SVR4-ish
archives, with the index list in an entry called "/", and the long
file name table in one called "//".  See the comments in
"/usr/src/contrib/binutils/bfd/archive.c"

Most of the relevant code is already present in "make" - it is mainly
a matter of ifdeffing.  For example, like so:

How-To-Repeat: 

Create a makefile, building a tiny archive. Type "make" a couple of
times, and watch make re-build the last target every time (actually,
not if make:ing several times within the same second).

  mt% echo 'int foo;' > x.c
  mt% cat > Makefile
  OBJS = x.o
  libx.a: libx.a($(OBJS))
	  ar crs $@ $?
  mt% make
  cc -O -pipe -c x.c
  ar crs libx.a x.o
  mt% make
  ar crs libx.a x.o
  mt% make
  ar crs libx.a x.o
  mt% make -dm
  Examining x.c...modified 9:54:47 Aug 9, 1999...up-to-date.
  Examining x.o...modified 9:55:19 Aug 9, 1999...up-to-date.
  Examining libx.a(x.o)...non-existent...modified before source...out-of-date.
			  ^^^^^^^^^^^^- not true...
  update time: 9:55:26 Aug 9, 1999
  Examining libx.a...modified 9:55:23 Aug 9, 1999...library...out-of-date.
  ar crs libx.a x.o
  update time: 9:55:26 Aug 9, 1999

Try the same thing with GNU make:

  mt% gmake
  gmake: `libx.a' is up to date.
  
You can even remove the object file (as per documentation for pmake):
  
  mt% rm x.o
  mt% gmake
  gmake: `libx.a' is up to date.
Comment 1 tim 1999-08-22 06:10:05 UTC
>
>   make cannot find archive members

This is more or less a duplicate of bin/10274, but I'm leaving both open.
Comment 2 Julian Elischer 1999-09-10 22:29:48 UTC
I have checked this change into -current.
I will wait a little before adding it to 3.x

julian
Comment 3 Julian Elischer 1999-09-10 22:31:07 UTC
I believe 10274 is a different problem..
This fix doesn't seem to affect that.

julian
Comment 4 Sheldon Hearn freebsd_committer freebsd_triage 1999-09-13 17:24:06 UTC
Responsible Changed
From-To: freebsd-bugs->julian

Julian will MFC. 
Comment 5 Julian Elischer freebsd_committer freebsd_triage 1999-09-16 01:27:31 UTC
State Changed
From-To: open->closed

patch applied to -current and 3.x