help-make
[Top][All Lists]
Advanced

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

targets in subdirectories


From: kilgore trout
Subject: targets in subdirectories
Date: Tue, 19 Jun 2007 13:15:24 -0700 (PDT)

Greetings,
 
I am using gmake via Msys on a win xp box.
The project that I am trying to build, has a 'build_dir' off of the root of the project tree which is where I am to keep all the object files.  I am having a problem writing a rule that will correctly detect if that file is missing/up-to-date.  I have, for example:
 
BUILD_DIR=$(PROJ_ROOT)/build_dir
 
$(BUILD_DIR)/%.o : %.c
    mkdir -p $(BUILD_DIR)
    $(CC) $(CFLAGS) $< -o $@
    mv $@ $(BUILD_DIR)
 
but it will build if the .o files are missing from the local dir, and then not copy to the build_dir.
If I remove the $(BUILD_DIR) from the rule, it will always rebuild the .o files, and copy them.
 
What am I missing?  Can I not include a path in a target rule?  How can I (properly) do this?
 
Any and all help appreciated!
 
-kt.
 

reply via email to

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