Hi Britton.

Assuming you have a Makefile like this:

    all: test.o
    
    clean:
        rm -rf *.o
    
    .PHONY: all clean

You can create two empty directories and perform make in each by setting VPATH 
and build flags:

    $ make -f ../src/Makefile CFLAGS=-DBUILD_1 VPATH=../src
    cc -DBUILD_1   -c -o test.o ../src/test.c

The output file will be created in current dir, but the source will be found in 
../src

The existing Makefile may be written so that not everything works with VPATH.

Or Better migrate to Autotools and use VPATH builds.


04.07.2018 23:08, Britton Kerin пишет:
> I'm frequently rebuilding and uploading both ends of a tx/rx system
> and it's just slow enough to be annoying.  I'd like to rebuild the Tx
> and Rx ends in parallel but they need different build options for the
> same sources.
> 
> I'm guessing the easiest approach is to do cp -r or so from a script
> and run make from there, and the tree is small enough that that will
> probably work ok, but I'm curious if anyone has a trick to do it in
> place somehow to avoid the cp and full rebuild of everything?
> Something like automagically injecting $$ into all non-phony targets
> or something?
> 
> Thanks,
> Britton
> 
> _______________________________________________
> Help-make mailing list
> Help-make@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-make
> 

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

Reply via email to