home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sgiblab!bridge2!alantec!paul
- From: paul@alantec.com (G. Paul Ziemba)
- Newsgroups: comp.lang.perl
- Subject: Re: Makefile parsing (challenge)
- Message-ID: <paul.726777126@alantec>
- Date: 11 Jan 93 18:32:06 GMT
- References: <1993Jan9.215626.25646@uvaarpa.Virginia.EDU>
- Sender: news@alantec.COM
- Lines: 32
-
- noran!iowa!kburton@uunet.uu.net (Kevin Burton) writes:
-
-
- >I want to extract certain variables defined in a makefile.
-
- > SOURCES= foo.c boo.c\
- > tmp.c tmp1.c \
- > a.c b.c c.c
-
- Rather than use perl to parse the makefile (*gasp*), why not add a target
- to the makefile that emits the value of the macro you're interested
- in? This technique avoids any problems you might encounter if make's
- parsing is different from your script's parsing.
-
- For instance:
-
- emit-sources-value:
- @echo $(SOURCES)
-
- If you were interested in an arbitrary macro's value, you could
- use perl to construct a makefile fragment with the desired rule,
- and then run make on it together with the makefile in question
- to get the value, with make's -f flag.
-
- cheers,
-
- ~!paul
- --
- Paul Ziemba paul@alantec.com alantec!paul 408.955.9000 x227
-
- "The first TV I ever owned...I threw from a third story window at a burglar"
- - sjackson@parc.xerox.com
-