automake
[Top][All Lists]
Advanced

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

right way to wrap/intercept submakes


From: John Richetta
Subject: right way to wrap/intercept submakes
Date: Tue, 9 Sep 2008 20:12:17 -0700

If I want to execute a script between a top level make invocation and a submake, it appears that the only straightforward way to do it that is likely to be portable and reliable(?) is to redefine $MAKE. If I understand correctly, the right way to do this is as follows.

Add the following to the top-level Makefile.am:

   REAL_MAKE = @SET_MAKE@
   MAKE = ./my_script_that_calls_make.sh ${REAL_MAKE}

In my_script_that_calls_make.sh, do something like this:

   # In the following, $@ picks up all arguments, which should be
   # what's called "REAL_MAKE" above, plus any arguments that were
   # passed to it (by automake):

   CommandToExec = "$@"
   ...
   Result = exec "${CommandToExec}"
   exit ${Result}

Then in configure.ac, all I need is:

   AC_PROG_MAKE_SET
   AC_CONFIG_FILES (<list of my sub-Makefiles>)

Is this about right? Any portability issues with this? Will the parameters passed to make normally, such as the target to compile, and any required make flags, be handled correctly by the machinery above? Are there better ways to do this?

Thanks for any advice.  -jar




reply via email to

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