home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!mcsun!sunic!sics.se!eua.ericsson.se!etxaha
- From: etxaha@eua.ericsson.se (Anders Hallberg)
- Subject: make: bug?
- Message-ID: <1992Aug26.150451.10614@eua.ericsson.se>
- Summary: Error in make when using : sh = macros
- Keywords: make
- Sender: news@eua.ericsson.se
- Nntp-Posting-Host: euas20.eua.ericsson.se
- Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
- Date: Wed, 26 Aug 1992 15:04:51 GMT
- Lines: 48
-
- I wanted to create a make file that collected all files in a directory
- tree with a given extension into a variable so I made the following
- makefile as a test:
-
- % cat Makefile
- ALL_SRC :sh = find . -name '*.cc' -print
- ALL_LIBS :sh = find . -name '*.a' -print
-
- all:
- @echo '.cc files:'
- @echo $(ALL_SRC)
- @echo '.a files:'
- @echo $(ALL_LIBS)
-
- I then created a directory tree with a number of .cc files but no .a
- files and...
-
- % make
- .cc files:
- ./a/a/a/a.cc ./a/a/b/b.cc ./a/a/c/c.cc ./a/b/a/d.cc ./a/b/a/e.cc ./a/b/b/f.cc\
- /a/c/g.cc ./a/c/h.cc
- .a files:
- a/a/a.cc ./a/a/b/b.cc ./a/a/c/c.cc ./a/b/a/d.cc ./a/b/a/e.cc ./a/b/b/f.cc\
- ./a/c/g.cc ./a/c/h.cc
-
- Not what I expected. Then I created a .a file.
-
- % touch a/a/a/a.a
- % make
- .cc files:
- ./a/a/a/a.cc ./a/a/b/b.cc ./a/a/c/c.cc ./a/b/a/d.cc ./a/b/a/e.cc ./a/b/b/f.cc\
- ./a/c/g.cc ./a/c/h.cc
- .a files:
- ./a/a/a/a.a
-
- Suddenly, it works. Apparently the value of the macro is undefined if
- there is no output from the shell command. Changing the order of the
- two macro definitions in the first case (no .a files) gave a different
- value for ALL_LIBS. I.e. when ALL_LIBS was defined first it became
- empty.
-
- As for versions and such, this is from the man pages of make:
-
- Sun Release 4.1 Last change: 15 September 1989
-
- Now, is this an error? I think it is.
-
- /Anders Hallberg
-