makefilegnu-make

Variable assignment in gmake seems broken?


I know this must be something that I'm doing wrong, but I'm lost.

I have a makefile with a portion that looks like

COMMON_CFLAGS = $(DMFLAGS) \
-I$(subst ;, -I,$(DRV_INCLUDE_LIST)) \
-I$(subst ;, -I,$(SEN_INCLUDE_LIST)) \
-I$(subst ;, -I,$(DRV_EXT_INCLUDE_LIST)) \
-D$(BAMBOO_EXT_EXPAT_PARSER_ENTROPY_CONFIG)

# Add the license module dependencies. We only link to the release version of the license module.
ifeq ($(RTU),1)
COMMON_CFLAGS += -I$(SIMBALICENSE_DIR)/Include -DDO_LICENSE_CHECK
endif

$(warning In Makefile_FLAGS.mak: $${COMMON_CFLAGS}= '${COMMON_CFLAGS}')


##--------------------------------------------------------------------------------------------------
## There are no platform specific FLAGS for this project except Solaris.
##--------------------------------------------------------------------------------------------------
CFLAGS = $(COMMON_CFLAGS) -DHAVE_MEMMOVE -DOPENSSL_API_COMPAT=0x10000000L

$(warning In Makefile_FLAGS.mak: $${CFLAGS}= '${CFLAGS}')

I added the $(warning) calls to try & debug an issue where it seems like CFLAGS wasn't getting set correctly.

The output I'm getting while running the build looks like

[2024-09-21T00:46:06.935Z] Makefile_FLAGS.mak:37: In Makefile_FLAGS.mak: ${COMMON_CFLAGS}= '-DSIZEOF_LONG_INT=4 -DSQL_WCHART_CONVERT -DHAVE_LONG_LONG -I /home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/driver-dev-essentials/centos7/gcc4_8/debug32/include/odbcheaders -I. -I../Include -I../Include/Concurrency -I../Include/CustomDataTypes/StringSqlTypes -I../Include/DataEngine -I../Include/DataEngine/Metadata -I../Include/SQLEngineUtils -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/driver-dev-essentials/centos7/gcc4_8/debug32/include/Tools -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/driver-dev-essentials/centos7/gcc4_8/debug32/include -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/driver-dev-essentials/centos7/gcc4_8/debug32/include/DSI -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/driver-dev-essentials/centos7/gcc4_8/debug32/include/DSI/Client -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/driver-dev-essentials/centos7/gcc4_8/debug32/include/Support -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/driver-dev-essentials/centos7/gcc4_8/debug32/include/Support/Exceptions -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/driver-dev-essentials/centos7/gcc4_8/debug32/include/Support/Queues -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/driver-dev-essentials/centos7/gcc4_8/debug32/include/Support/Threading -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/driver-dev-essentials/centos7/gcc4_8/debug32/include/Support/TypedDataWrapper -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/sql-engine/centos7/gcc4_8/debug32/include/SQLEngine -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/sql-engine/centos7/gcc4_8/debug32/include/SQLEngine/DSIExt -I/home/ec2-user/jk/packagey/artifact-library/expat/2.5.0/base/centos7/gcc4_8/release32/include -I/home/ec2-user/jk/packagey/artifact-library/openssl/3.0/base/centos7/gcc4_8/release32/include -I/home/ec2-user/jk/packagey/artifact-library/shared-licensing/3.0/base/centos7/gcc4_8/debug32/include -I/home/ec2-user/jk/packagey/vcpkg/buildtrees/shared-driversupport/build_configuration-dbg/dependencies/first-party/rapidjson/include -I/home/ec2-user/jk/packagey/artifact-library/sen-sdk/10.3/driver-dev-essentials/centos7/gcc4_8/debug32/include/odbcheaders -D"XML_POOR_ENTROPY"'

[2024-09-21T00:46:06.936Z] 

[2024-09-21T00:46:06.936Z] Makefile_FLAGS.mak:45: In Makefile_FLAGS.mak: ${CFLAGS}= '-O3 -fPIC -m32'

Umm, what? Shouldn't CFLAGS be guaranteed to have $(COMMON_CFLAGS) as a prefix and -DHAVE_MEMMOVE -DOPENSSL_API_COMPAT=0x10000000L as a suffix after the line CFLAGS = $(COMMON_CFLAGS) -DHAVE_MEMMOVE -DOPENSSL_API_COMPAT=0x10000000L?


Solution

  • I just realized that the makefile was being invoked w/ the command-line parameter "CFLAGS=-O3 -fPIC -m32", which explains it...