Date: Mon, 9 Aug 1999 10:19:48 +0200 (CEST) From: mikko@dynas.se To: FreeBSD-gnats-submit@freebsd.org Subject: bin/13039: make cannot find archive members Message-ID: <199908090819.KAA06421@mt.dynas.se>
next in thread | raw e-mail | index | archive | help
>Number: 13039
>Category: bin
>Synopsis: make cannot find archive members
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Aug 9 01:20:00 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator: Mikko Työläjärvi
>Release: FreeBSD 4.0-CURRENT i386
>Organization:
>Environment:
Any FreeBSD/i386 between 3.1 (the oldest I have tested) and
4.0-CURRENT Fri Aug 6 18:44:10 CEST 1999
>Description:
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.
>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.
>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:
diff -ru /usr/src/usr.bin/make/arch.c /tmp/make/arch.c
--- /usr/src/usr.bin/make/arch.c Thu Oct 29 19:17:44 1998
+++ /tmp/make/arch.c Mon Aug 9 09:53:40 1999
@@ -118,7 +118,7 @@
static void ArchFree __P((ClientData));
static struct ar_hdr *ArchStatMember __P((char *, char *, Boolean));
static FILE *ArchFindMember __P((char *, char *, struct ar_hdr *, char *));
-#if defined(__svr4__) || defined(__SVR4)
+#if defined(__svr4__) || defined(__SVR4) || defined(__ELF__)
#define SVR4ARCHIVES
static int ArchSVR4Entry __P((Arch *, char *, size_t, FILE *));
#endif
@@ -474,7 +474,7 @@
* the comparisons easier...
*/
cp = strrchr (member, '/');
- if (cp != (char *) NULL) {
+ if (cp != (char *) NULL && strcmp(member, RANLIBMAG) != 0) {
member = cp + 1;
}
diff -ru /usr/src/usr.bin/make/config.h /tmp/make/config.h
--- /usr/src/usr.bin/make/config.h Thu Oct 29 19:17:45 1998
+++ /tmp/make/config.h Mon Aug 9 09:53:06 1999
@@ -114,4 +114,8 @@
# ifndef RANLIBMAG
# define RANLIBMAG "__.SYMDEF"
# endif
+#else
+# ifndef RANLIBMAG
+# define RANLIBMAG "/"
+# endif
#endif
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908090819.KAA06421>
