help-make
[Top][All Lists]
Advanced

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

Re: Hard time figuring out what order-only prerequisites really do.(atta


From: Paul D. Smith
Subject: Re: Hard time figuring out what order-only prerequisites really do.(attachment again)
Date: Fri, 1 Jul 2005 09:42:05 -0400

%% "Angel Tsankov" <address@hidden> writes:

  at> Here're the file contents:

I see why you tried to attach them: all the initial whitespace is
fried.

Seriously, you need a better mail client: the one you're using has
issues.


I tried your makefile with some temporary files:

    SourceFiles/foo.cpp
    SourceFiles/bar.cpp

and it worked fine for me (with GNU make 3.80 on a Debian GNU/Linux
system): the first time through it created the directory and the .o
files, and the second time through it didn't.

Please add the -d option to your make invocation to get some debug
output (you'll have to redirect it to a file, there will be a lot of
it), and look there to see why make decides to rebuild your object
files.

  at> ObjectFiles := $(patsubst SourceFiles/%, IntermediateFiles/%,$(patsubst 
  at> %.cpp, %.o, $(SourceFiles)))

This is more easily done as just:

    ObjectFiles := $(patsubst 
SourceFiles/%.cpp,IntermediateFiles/%.o,$(SourceFiles)

  at> # Ensures that intermediate files folder exists.

  at> IntermediateFiles:
  at>       if [ ! -d IntermediateFiles ]; then mkdir IntermediateFiles; fi

  at> IntermediateFiles/%.o: SourceFiles/%.cpp | IntermediateFiles
  at>       gcc -c $< -o $@

Technically, this command line should be:

    gcc -o $@ -c $<

or even:

    gcc -c -o $@ $<

The filename is not an argument to the -c option: it's a normal argument
by itself.  The -c option doesn't take an argument: it's a standalone
option.

However, GCC, like most GNU tools, doesn't require all options to come
before other arguments.  This is not your problem.

-- 
-------------------------------------------------------------------------------
 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]