help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

building libs on solaris


From: Jens Schweikhardt
Subject: building libs on solaris
Date: Wed, 11 Apr 2001 17:46:07 +0200
User-agent: Mutt/1.2.5i

Paul et al,

I'm trying to use implicit rules to build libraries. The same Makefile
works perfectly with gmake 3.79.1 on FreeBSD but not with 3.79.1 on Solaris
2.6.  To reproduce (watch out with cut and paste -- there's a tab
before $(CC)):

echo > hello.h
echo '#include "hello.h"' > hello.c
echo 'int i = 0;' >> hello.c

cat <<'EOF' > hello.d
hello.d hello.o: hello.c \
 hello.h
# Targets needed to avoid 'no rule to make ...' error:
hello.c:
hello.h:
EOF

cat <<'EOF' > GNUmakefile
# reduce noise when -d is in effect
.SUFFIXES:
% :: %,v
% :: RCS/%,v
% :: RCS/%
% :: s.%
% :: SCCS/s.%

%.o: %.c
        $(CC) $(CFLAGS) -o $@ -c $<

LIB := libfoo.a
$(LIB): $(LIB)(hello.o)

include hello.d
EOF

touch hello.d # just to make sure it's younger than hello.c

FreeBSD:

address@hidden:~/tmp/test-lib-build $ gmake
cc  -o hello.o -c hello.c
ar rv libfoo.a hello.o
r - hello.o
address@hidden:~/tmp/test-lib-build $ gmake
gmake: Nothing to be done for `libfoo.a'.

That's how it should be.

Solaris 2.6:

address@hidden:~/tmp/test-lib-build $ gmake
cc  -o hello.o -c hello.c
ar rv libfoo.a hello.o
a - hello.o
ar: creating libfoo.a
ar: writing libfoo.a
address@hidden:~/tmp/test-lib-build $ gmake
ar rv libfoo.a hello.o
r - hello.o
ar: writing libfoo.a

Why is libfoo.a considered out-of date?
Sometimes I also get the following:
gmake: *** Warning: File `libfoo.a' has modification time in the future 
(2001-04-11 17:24:21.1366 > 2001-04-11 17:24:20.997938443)
but this is not reproducible. It seems to depend on the phase of the moon.
However, the lib is rebuilt even if this error is not reported.


Regards,

        Jens
-- 
Jens Schweikhardt  http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]