How to concat variables in platformio.ini file?

I’m trying to make the following ini work

rev_var = !echo "-DPIO_SRC_REV="$(git rev-parse HEAD)

build_flags = -Wl,-Map=$BUILD_DIR/

build_flags = ${env.build_flags} ${common.rev_var}
build_flags = ${env.build_flags}

But rev_var is not resolved during concat phase in nodemcuv2_linux and is placed as plain text !echo "-DPIO_SRC_REV="$(git rev-parse HEAD)
Also -D options doesn’t concat to env.build_flags in nodemcuv2_cross

The goal of the config is to let the project build on Windows and Linux machines and have an option to run git command or not, depending on environment. Can you tell me if this possible to implement with platformio.ini config and how?

Place them in different lines:

build_flags = 
   -D ...