home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!minyos.xx.rmit.oz.au!s902113
- From: s902113@minyos.xx.rmit.oz.au (Luke Mewburn)
- Subject: evaluation of shell stuff in Makefiles
- Organization: RMIT Computer Centre, Melbourne Australia.
- Date: Thu, 3 Sep 1992 01:42:48 EST
- Message-ID: <1992Sep3.014248.16259@minyos.xx.rmit.oz.au>
- Lines: 64
-
-
- I have this slight problem with a Makefile. I have a shell expression
- which I use to extract the version number of the program from a header
- file, but make evaluates this expression everywhere the variable is
- used, which slows things down a bit... Is there a way I can get make
- to evaluate it once???
-
- An extract of the makefile is below. The output of make tar is something
- like: (wrapped for clarity)
-
- --
- mkdir flon-`/bin/sed -ne 's/.*VERSION."\(.*\)".*/\1/p;/VERSION/q'
- lon.h`
- cp Makefile lon.h getfile.c main.c init.c print.c flon.nro
- Installation eg.friends tags Notes flon-`/bin/sed -ne
- 's/.*VERSION."\(.*\)".*/\1/p;/VERSION/q' lon.h`
- tar -cf flon-`/bin/sed -ne 's/.*VERSION."\(.*\)".*/\1/p;/VERSION/q'
- lon.h`.tar flon-`/bin/sed -ne 's/.*VERSION."\(.*\)".*/\1/p;/VERSION/q' lon.h`
- compress flon-`/bin/sed -ne 's/.*VERSION."\(.*\)".*/\1/p;/VERSION/q'
- lon.h`.tar
- rm -rf flon-`/bin/sed -ne 's/.*VERSION."\(.*\)".*/\1/p;/VERSION/q'
- lon.h`
- --
-
- As you can see, this would be slow (and messy too :). So, any suggestions
- how to clean this up?
-
-
- Thanx in advance,
- Luke.
-
-
- -- extract from Makefile --
- #[...]
-
- #
- # Version number
- #
- VERSION=`/bin/sed -ne 's/.*VERSION."\(.*\)".*/\1/p;/VERSION/q' lon.h`
-
- #
- # Executable name
- #
- EXEC=flon
-
- #
- # Archive name
- #
- ARCNAM=$(EXEC)-$(VERSION)
-
- # [...]
- tar:
- mkdir $(ARCNAM)
- cp $(ALLF) $(ARCNAM)
- tar -cf $(ARCNAM).tar $(ARCNAM)
- compress $(ARCNAM).tar
- rm -rf $(ARCNAM)
-
- shar:
- mkdir $(ARCNAM)
- cp $(ALLF) $(ARCNAM)
- shar $(ARCNAM) > $(ARCNAM).shar
- rm -rf $(ARCNAM)
- -- end extract --
-