home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.utils.bug
- Path: sparky!uunet!cis.ohio-state.edu!transarc.com!Bob_Sidebotham
- From: Bob_Sidebotham@transarc.com
- Subject: dependency chaining bug
- Message-ID: <MecuRpL0BwwS412306@transarc.com>
- Sender: gnulists@ai.mit.edu
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Tue, 1 Sep 1992 09:25:09 GMT
- Approved: bug-gnu-utils@prep.ai.mit.edu
- Lines: 79
-
- There's a bug in the way that dependencies of the form -l<lib> work. In
- the following makefile, "baz" and "bar" are made in a similar manner,
- except that baz is made implicitly with a dependency list of "baz.o
- -lfoo", while bar is made with a dependency list of "bar.o libfoo.a". If
- the file "foo.h" is touched, the object file and library will not be
- remade if you type "make baz", but will be remade if you type "make bar".
-
- To try this out, put this makefile in a clean directory, and type
- "make". It will create all the necessary files. Then type "make baz" and
- "make bar". You should see the following results:
-
- [make-bug] make -v
- GNU Make version 3.62, by Richard Stallman and Roland McGrath.
- Copyright (C) 1988-1991 Free Software Foundation, Inc.
- This is free software; see the source for copying conditions.
- There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
- PARTICULAR PURPOSE.
-
- echo "main() {}" > bar.c
- cc -c bar.c -o bar.o
- echo "/* a library component */" > foo.c
- echo "/* a header file */" > foo.h
- cc -c foo.c -o foo.o
- ar rv libfoo.a foo.o
- ar: creating an archive file libfoo.a
- a - foo.o
- cc -L. bar.o libfoo.a -o bar
- echo "main() {}" > baz.c
- cc -c baz.c -o baz.o
- cc -L. baz.o -lfoo -o baz
- [make-bug] touch foo.h
- [make-bug] make baz
- make: `baz' is up to date.
- [make-bug] make bar
- cc -c foo.c -o foo.o
- ar rv libfoo.a foo.o
- r - foo.o
- cc -L. bar.o libfoo.a -o bar
-
- Here's the makefile:
-
- ------------------CUT HERE-----------------
- vpath .
- LDFLAGS= -L.
-
- all: bar baz
-
- foo.c:
- echo "/* a library component */" > foo.c
-
- foo.h:
- echo "/* a header file */" > foo.h
-
- bar.c:
- echo "main() {}" > bar.c
-
- baz.c:
- echo "main() {}" > baz.c
-
- foo.o: foo.c foo.h
-
- libfoo.a: foo.o
- ar rv libfoo.a foo.o
-
- bar: bar.o libfoo.a
-
- baz: baz.o -lfoo
-
- clean:
- $(RM) foo.c foo.h bar.c bar.o baz.c baz.o foo.o libfoo.a bar baz
- --------------------END Makefile---------------
-
- Thanks,
-
- Bob Sidebotham bob@transarc.com
- Transarc Corporation 412-338-4367
-
-
-
-