bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Expansion of recursively expanded variables


From: Paul D. Smith
Subject: RE: Expansion of recursively expanded variables
Date: Tue, 26 Feb 2002 18:00:42 -0500

%% Matt Hastie <address@hidden> writes:

  mh> My apologies, plain text it is. 

Unfortunately that didn't do the job :(.  Are you using Outlook?  If you
ever figure out how to convince Outlook to not send HTML versions of
mail, please tell me.  I've never used it myself, but I've never known
anyone who managed to do it.   @#$%&...

  mh> I'm using the $(shell ...) function to provide make with
  mh> information that cannot be determined via built-in
  mh> functions.

Sure.  It's not the use of $(shell ...) that I'm wondering about, but
rather why you _need_ it in this situation.

IOW, it's not really useful, typically, to use $(shell ...) within a
command script, because a command script is, itself, a shell script!

The place $(shell ...) is useful is if you need it _outside_ of a
command script; say, to set a make variable.

  mh> What I'd like to do is use nawk to extract information from the
  mh> make include file I am generating (targets.d in the example
  mh> below), to prevent the output of duplicate targets.

Sounds OK.

  mh> In the following example two files are shown below, the rules.mk
  mh> file, although complex, hides the general complexity of make from
  mh> my simpleton users, and ensures that complete dependency checking
  mh> is maintained. The actual makefile for a module is shown beneath
  mh> the rules file.


  mh> # in file rules.mk 

  mh> previously-created-targets = $(shell nawk '/javacc-target/ { print $3 }' 
targets.d) 

  mh> define create-target-java-class-from-jj-file 
  mh> $(if $(findstring commontarget,$(previously-created-targets),, \
                                                                 ^^
There is a bug here, right; there should be another ")"?  Otherwise I
don't understand this code?

  mh> echo "# javacc-target commontarget" \
  mh> echo "commontarget : commonsource" >> targets.d \
  mh> echo >> targets.d )
  mh> echo "$(output-target $(1)) : $(1)" >> targets.d 
  mh> echo >> targets.d 
  mh> endef 

What I'm saying is, why use $(shell ...)?  Why not rewrite the above
something like this:

  define create-target-java-class-from-jj-file 
  case "`nawk '/javacc-target/ { print $$3 }' targets.d`" in \
    *commontarget*) : do nothing ;; \
    *) echo "commontarget : commonsource" >> targets.d; \
       echo >> targets.d ;; \
  esac
  echo "$(output-target $(1)) : $(1)" >> targets.d
  echo >> targets.d
  endef 

?? (I didn't test the above so it might not be 100% right, but you get
the idea).

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist



reply via email to

[Prev in Thread] Current Thread [Next in Thread]