I would like recipes in GNU Make to use environment variables instead of command line arguments, to make them shorter, so that I can concentrate better on what changes in each command. For example, instead of seeing:
g++ -g -I/path1 -I/path2 -DFLAG -Wall -c hello.cpp -o hello.o
I would like to see something like:
g++ -c hello.cpp -o hello.o
where g++ would read include directories and everything else from environment variables. Therefore, instead of using this:
compile.cxx = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c
%.o: %.cpp
$(compile.cxx) $< -o $@
I am using this:
compile.cxx = CXXFLAGS="$CPATH="$(CXXFLAGSCPATH)" CPPFLAGS="$LIBRARY_PATH="$(CPPFLAGSLIBRARY_PATH)" bash -c $(CXX) -c
%.o: %.cpp
$(compile.cxx) $< -o $@
But I get this output:
CXXFLAGS="irrelevant"CPATH="irrelevant" CPPFLAGS="irrelevant"LIBRARY_PATH="irrelevant" bash -c g++ -c hello.cpp -o hello.o
g++: fatal error: no input files
Hence, it seems that g++ does not receive its arguments.
I am also open to alternatives that achieve a similar effect (that is: short recipes).