help-make
[Top][All Lists]
Advanced

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

Re: multiple default goals


From: Paul D. Smith
Subject: Re: multiple default goals
Date: Mon, 26 Jul 2004 18:37:14 -0400

%% hotquietday <address@hidden> writes:

  h> My current Makefile looks like this (relevant
  h> portion only):

  h> <code>
  h> all: createDll createJava

  h> createDll: $(OBJS)
  h>    $(CXX) -tWD -eocr.dll $(CXXFLAGS) $(OBJS)

  h> createJava: Ocr.java
  h>    javac $<
  h>    javah -classpath . Ocr
  h> </code>

  h> The problem is, the commands createJava and
  h> createDll get run everytime, even if Ocr.java
  h> and the object files are up to date.

Make works by comparing the timestamps of the target file with the
prerequisites.  If any prerequisite is newer than the target file, then
the target is rebuilt.

If the target doesn't exist then obviously the prerequisite is newer.
It doesn't look to me like your rules ever create the target files
(createDll or createJava), so the prerequisites will always be newer and
they will always be rebuilt.

Try adding a line like:

        @touch $@

to the end of your rules to update the target file.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          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]