Try replacing ENV=2
with GCC_PREPROCESSOR_DEFINITIONS="ENV=2"
on your command line. I don't think you need to set the 'Preprocessor Macros' in the Build Settings as it will be overridden anyway.
See xcodebuild - how to define preprocessor macro? for more information.