[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: source and objfiles on different paths
From: |
Jed Brown |
Subject: |
Re: source and objfiles on different paths |
Date: |
Thu, 06 Jun 2013 17:01:18 -0500 |
User-agent: |
Notmuch/0.15.2+129~g1907b1d (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) |
Riccardo Manfrin <address@hidden> writes:
> and then mux their compiling process with rules like the following:
>
> %.o : %.cpp
> $(COMPILE) -c ... $< -o $@
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 $@
An alternative is to invoke make from the build directory and use VPATH
to locate the source files, but that looks less natural from what you've
shown.