In my makefile, I am trying to capture the output from a shell function call on a make variable containing the command string without success. When I run the shell function on the string directly, it works. I don't understand what the difference is between running the shell function on the command string versus running the shell function on a make variable containing the command string.
PG_CONFIG = "/usr/pgsql-9.4/bin/pg_config/"
PG_INCLUDE1 = $(shell $$PG_CONFIG)
PG_INCLUDE2 = $(shell /usr/pgsql-9.4/bin/pg_config --includedir-server)
.PHONY: print
print:
@echo "PG_CONFIG="$(PG_CONFIG)
@echo "PG_INCLUDE1="$(PG_INCLUDE1)
@echo "PG_INCLUDE2="$(PG_INCLUDE2)
The output is:
$make -f Makefile.test print
PG_CONFIG=/usr/pgsql-9.4/bin/pg_config/
PG_INCLUDE1=
PG_INCLUDE2=/usr/pgsql-9.4/include/server
PG_INCLUDE1 = $(shell $(PG_CONFIG))