help-make
[Top][All Lists]
Advanced

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

Re: source and objfiles on different paths


From: Riccardo Manfrin
Subject: Re: source and objfiles on different paths
Date: Fri, 07 Jun 2013 15:07:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

On 06/07/2013 12:01 AM, Jed Brown wrote:
Something like this?

$(OBJDIR)/%.o : %.cpp
        $(COMPILE) -c  ... $< -o $@

If subdirectories might not exist in OBJDIR, you can create them like
this:


.SECONDEXPANSION:               # to expand $$(@D)/.DIR

$(OBJDIR)/%.o : %.cpp | $$(@D)/.DIR
        $(COMPILE) -c  ... $< -o $@

%/.DIR :
        @mkdir -p $(@D)
        @touch $@


Your solution is cool but will recreate the source's directory structure in my build path (plus needs secondexpansion).
If I wanted to keep all obj code in the same folder what would I need to do?

Thank you for your help!

RM



reply via email to

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