help-gnu-utils
[Top][All Lists]
Advanced

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

Re: Gmake: just execute commant


From: Paul D. Smith
Subject: Re: Gmake: just execute commant
Date: 22 Mar 2006 10:36:13 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

%% kristof.loots@gmail.com writes:

  kl> Makefiles are totally new for me and I do understand there
  kl> strengths but I just want to have a command that is always
  kl> executed at the starting of the makefile.  I know, it is not what
  kl> make is build for, but anyway. It is sometimes useful to be able
  kl> to execute some commands without having to add them to all
  kl> targets.

  kl> #here a command that I want to execute. How can I do this?
  kl> echo "Just some useful stuff"

If you're willing to restrict yourself to GNU make, you can do it.

If you provided a more realistic example we'd be able to help you
better.  If all you want to do is print something, you can use:

    $(warning Just some useful stuff)

(there's an $(info ...) in the next version of GNU make).

If you want to actually run some commands that do more than just print
things, then try:

    __dummy := $(shell do some useful stuff)

Look up the $(shell ...) function in the GNU make manual for details on
what this does... it works like backquotes in the shell so be thoughtful
about where you use it and what it will print out.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@gnu.org>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "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]