home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sunic!dkuug!mentor.dk!not-for-mail
- From: tm@mentor.dk (Tonny Madsen)
- Newsgroups: comp.lang.perl
- Subject: Re: Makefile parsing (challenge)
- Date: 11 Jan 1993 11:30:53 +0100
- Organization: Mentor Informatik, Denmark
- Lines: 39
- Message-ID: <1iri8tINNspv@bach.mentor.dk>
- References: <1993Jan9.215626.25646@uvaarpa.Virginia.EDU>
- NNTP-Posting-Host: bach.mentor.dk
-
- Kevin Burton <noran!iowa!kburton@uunet.uu.net> writes:
-
- >I want to extract certain variables defined in a makefile.
-
- The easiest way to parse a makefile, is to let make do the parsing!!!
-
- Try something like the following (please note that none of these
- fragments have been tested!):
-
- TMPFILES=${TMPDIR:-/tmp}/t.$$.
- trap 'rm -rf ${TMPFILES}*' 0
- echo '.printSOURCES:; echo "$(SOURCES)"' > ${TMPFILES}mk
- make -f ${makefile} -f ${TMPFILES}mk .printSOURCES:
-
- (This is comp.lang.perl, I know, and it shouldn't be that difficult to
- perlify this.)
-
- Some make's even let you do:
-
- TMPFILES=${TMPDIR:-/tmp}/t.$$.
- trap 'rm -rf ${TMPFILES}*' 0
- echo '.printSOURCES:; echo "$(SOURCES)"' |
- make -f ${makefile} -f - .printSOURCES:
-
- Note that not all make's implements multiple use of the f option. If
- none of the above examples work, then try:
-
- TMPFILES=${TMPDIR:-/tmp}/t.$$.
- trap 'rm -rf ${TMPFILES}*' 0
- echo '.printSOURCES:; echo "$(SOURCES)"' > ${TMPFILES}mk
- cat ${makefile} >> ${TMPFILES}mk
- make -f ${TMPFILES}mk .printSOURCES:
-
- -- tonny
- --
- -----
- Tonny Madsen, Mentor Informatik a/s, Fredens Torv 6, DK-8000 Arhus C, Denmark
- telephone: +45 86 20 13 33 telefax : +45 86 13 01 33
- e-mail : tm@mentor.dk
-