%% "Reynolds, John" <[EMAIL PROTECTED]> writes:

  rj> I have an application development kit that provides me with a template
  rj> make file named "makefile". Its contents are something like this:

  rj> APP_NAME        := myapp 

  rj> APP_SRCS        := myAppMain.c \ 
  rj>                 screen1.c \ 
  rj>                 screen2.c 

  rj> include ../appmake.make 

  rj> If I do nothing more than type "make" at the command line,
  rj> makefile is read, ../appmake.make is read and because no targets
  rj> are specified, the default "help" target message is echoed:

  rj> I have complete control over makefile. In fact, I need to edit it
  rj> so that my source files are included in the variable APP_SRCS. I
  rj> should not change appmake.make because it can be overwritten
  rj> during updates to the development kit.

  rj> At a minimum, I'd like to echo a line like "add -Dproduction=1
  rj> after the target name to build a production version" as a reminder
  rj> every time make is run.

Since you don't give any details about how appmake.make is written, it's
hard to give you exact advice.  There's certainly no way you can
implement these without some knowledge of the internals of appmake.make.

We'll assume that the default target in appmake.make, if you don't
override it, is called "help".

Then, if the "help" target is a double-colon target your life is simple;
just add another double-colon target to your makefile before or after
the "include ../appmake.make", depending on where you want to see your
extra message:

  help::
        @echo "add -Dproduction=1 after the target name to build a production version"

If "help" is not a double-colon target, you'll have to get tricky.  For
example you could do this:

  my-help: help
        @echo "add -Dproduction=1 after the target name to build a production version"

  include ../appmake.make

Now the default target is "my-help", not "help", and that target will be
built if the user doesn't give any override.  Your version prints your
message but depends on the original "help", so the original would be
printed then your message.

Or, alternatively:

  include ../appmake.make

  help: my-help
  my-help:
        @echo "add -Dproduction=1 after the target name to build a production version"

Now the default "help" target depends on your local target, so your
message will be printed first, followed by the default message.

  rj> Ideally, I'd like to add some logic to the template makefile that
  rj> I have control over so that I can intercept the target name, set
  rj> the variable and then include ../appmake.make.

I don't quite understand what you're getting at here.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          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

_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to