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

_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to