[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: targets in subdirectories
From: |
Paul Smith |
Subject: |
Re: targets in subdirectories |
Date: |
Wed, 20 Jun 2007 09:49:58 -0400 |
On Wed, 2007-06-20 at 06:29 -0700, kilgore trout wrote:
> When the commands are echoed to the console, $@ expands to CAN_init.o
> rather than c:/ashell/trunk/ashell/build_dir/CAN_init.o (where
> $(BUILD_DIR) is c:/ashell/trunk/ashell/build_dir ). So that the
> compiler output is put in the local (current) directory rather than
> $(BUILD_DIR)/CAN_init.o .
Are you SURE it's using that rule? I suspect it's really using the
default %.o : %.c rule. When it prints the commands does it show the
mkdir, etc. part?
You have only provided half of the information needed to debug your
problem: you show the rule but not the prerequisites that match it.
Probably you have this somewhere in your makefile:
foo: foo.o bar.o baz.o
You can't do that: "foo.o" cannot match a pattern "$(BUILD_DIR)/%.o".
You have to write:
foo: $(BUILD_DIR)/foo.o $(BUILD_DIR)/bar.o $(BUILD_DIR)/baz.o
or use make functions like $(addprefix ...).
--
-------------------------------------------------------------------------------
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