I have two makefiles, for native and cross compilation. The only difference between them is compiler name:
# makefile CC = g++ ...
# makefile-cc CC = arm-linux-gnueabihf-g++ ...
To make native compilation, I execute make, to make cross-compilation, I execute make -f makefile-cc. I want to have one makefile, which should be executed using make for native compilation, and make cross for cross-compilation. What is correct syntax to do this, something like:
# makefile (C-like pseudo-code)
if cross
CC = arm-linux-gnueabihf-g++
else
CC = g++
You can assign/append variables for specific targets by using the syntax target:assignment on a line. Here is an example:
calling
(or just
make, here) printsand calling
prints
So you can use your usual compilation line with $(CC)