help-make
[Top][All Lists]
Advanced

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

Re: Implicit Rules with Different Source and Object Directory Question


From: redcomet
Subject: Re: Implicit Rules with Different Source and Object Directory Question
Date: Thu, 26 Nov 2009 14:37:55 -0800 (PST)

Because I no longer wanted to have to write out 

SOURCES= \
main.c

LINUX_SOURCES = \
printline.c
dosomething.c

VPATH=$(SOURCES)/linux
OBJECTS=$(SOURCES:%.c=$(BUILD_DIR)/%.o)
$(LINUX_SOURCES:/linux/%.c=$(BUILD_DIR)/%.o)

all the time I decided to add
$(shell mkdir -p $(dir $SOURCES))
and list all the sources under one variable like so

SOURCES = \
main.c \
linux/printline.c \
linux/dosomething.c

This is probably what is considered the 'right' way to do this, I am sure
more than one of you questioned the idea of printing all objects to the same
dir, and insisted that I just allowed build/linux/printline.o to work.

However! What would you nay sayers do about sources built in from another
directory all together.
For examples

If my project sources are in
/usr/src/special/subproject/src
and it needs to build in 
/usr/src/special/common/getopt.c

now my sources list becomes
SOURCES = \
main.c \
linux/printline.c \
linux/dosomething.c \
../common/getopt.c

and I CANT have object files appearing in 
/usr/src/special/subproject/src/../common/getopt.o
aka /usr/src/special/subproject/common/getopt.o

as they would if I do the 'right' thing.

I dont think anyone can doubt the logic of having a common source directory
for certain common files.  So what is the 'right' way to handle this
situation?
(other than generating object files in the source directory :P)
-- 
View this message in context: 
http://old.nabble.com/Implicit-Rules-with-Different-Source-and-Object-Directory-Question-tp26520309p26535787.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.





reply via email to

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