I am automating the building and unit testing of a personal project using bash scripts (parts of the unit testing have been reviewed on Code Review), cmake and make on the latest version of Fedora Linux. The postive test passes on on the build system, however, when I force an LD failure in one of the unit tests the build still passes at the higher levels. It needs to fail at all levels.
Here is the error message from the make generated by a cmake command:
/home/pacman/Documents/projects/VMWithEditor/VMWithEditor/human_readable_program_format.c:179: multiple definition of `HRF_delete_linked_list_of_program_steps'; CMakeFiles/Run_All_Unit_Tests.exe.dir/home/pacman/Documents/projects/VMWithEditor/VMWithEditor/UnitTests/HRF_UnitTest/HRF_UnitTest/unit_test_human_readable_program_format.c.o:/home/pacman/Documents/projects/VMWithEditor/VMWithEditor/UnitTests/RunAllUnitTests/RunAllUnitTests/../../../human_readable_program_format.c:179: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/Run_All_Unit_Tests.exe.dir/build.make:433: Run_All_Unit_Tests.exe] Error 1
make[2]: Leaving directory '/home/pacman/Documents/projects/VMWithEditor/VMWithEditor/UnitTests/RunAllUnitTests/RunAllUnitTests/Debug'
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/Run_All_Unit_Tests.exe.dir/all] Error 2
make[1]: Leaving directory '/home/pacman/Documents/projects/VMWithEditor/VMWithEditor/UnitTests/RunAllUnitTests/RunAllUnitTests/Debug'
make: *** [Makefile:103: all] Error 2
This is the output of the top level shell script, the last 2 builds should not execute:
Building CommandLine_UnitTest/CommandLine_UnitTest
Building ControlConsole_UnitTest/ControlConsole_UnitTest
Building Editor_UnitTest/Editor_UnitTest
Building HRF_UnitTest/HRF_UnitTest
Building Parser_Unit_Test/Parser_Unit_Test
Building RunAllUnitTests/RunAllUnitTests
Building State_Machine_Unit_Test/State_Machine_Unit_Test
Building VirtualMachine_UnitTest/VirtualMachine_UnitTest
This is the shell script that doesn't fail when it should:
buildDebug.sh
#! /bin/sh
# Create a Debug build directory and then build the target within the Debug directory
# Stop on any build errors and stop the parent process.
mkdir Debug
cd Debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
retVal=$?
if [ $retVal -ne 0 ]; then
echo "\n\ncmake failed $retval!\n\n"
exit $retVal
fi
make VERBOSE=1
if [ $retVal -ne 0 ]; then
echo "\n\nmake failed! $retval\n\n"
exit $retVal
fi
The previous shell script is called by this shell script, there are 8 instances of the previous shell script in subdirectories.
buildAllDebug.sh
#! /bin/sh
# Build the debug version of all the unit tests
# Stop on any build errors.
for i in *
do
if [ -d $i ] ; then
TESTDIRECTORY="$i/$i"
SHELLFILE="$TESTDIRECTORY/buildDebug.sh";
if [ -f $SHELLFILE ] ; then
echo "Building $TESTDIRECTORY";
cd "$TESTDIRECTORY"
./buildDebug.sh >& buildDebuglog.txt
retVal=$?
if [ $retVal -ne 0 ]; then
exit $retVal
fi
cd ../..
fi
fi
done;
This generates the make file that is reporting the error:
CMakeLists.txt
cmake_minimum_required(VERSION 3.18.4)
set(EXECUTABLE_NAME "Run_All_Unit_Tests.exe")
project(${EXECUTABLE_NAME} LANGUAGES C VERSION 1.0)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(GCC_WARN_COMPILE_FLAGS " -Wall ")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_WARN_COMPILE_FLAGS}")
endif()
set(VM_SRC_DIR "../../..")
set(COMMON_TEST_DIR "../../Common_UnitTest_Code")
set(LEXICAL_TEST_DIR "../../State_Machine_Unit_Test/State_Machine_Unit_Test")
set(PARSER_TEST_DIR "../../Parser_Unit_Test/Parser_Unit_Test")
set(CMD_LINE_TEST_DIR "../../CommandLine_UnitTest/CommandLine_UnitTest")
set(HRF_TEST_DIR "../../HRF_UnitTest/HRF_UnitTest")
add_executable(${EXECUTABLE_NAME}
run_all_unit_tests_main.c
${HRF_TEST_DIR}/hrf_unit_test_main.c
${HRF_TEST_DIR}/unit_test_human_readable_program_format.c
${LEXICAL_TEST_DIR}/lexical_analyzer_unit_test_main.c
${LEXICAL_TEST_DIR}/internal_character_transition_unit_tests.c
${LEXICAL_TEST_DIR}/internal_sytax_state_tests.c
${LEXICAL_TEST_DIR}/lexical_analyzer_test_data.c
${LEXICAL_TEST_DIR}/lexical_analyzer_unit_test_utilities.c
${VM_SRC_DIR}/error_reporting.c
${VM_SRC_DIR}/safe_string_functions.c
${VM_SRC_DIR}/arg_flags.c
${VM_SRC_DIR}/file_io_vm.c
${VM_SRC_DIR}/opcode.c
${VM_SRC_DIR}/parser.c
${VM_SRC_DIR}/default_program.c
${VM_SRC_DIR}/human_readable_program_format.c
${VM_SRC_DIR}/lexical_analyzer.c
${VM_SRC_DIR}/virtual_machine.c
${PARSER_TEST_DIR}/parser_unit_test_main.c
${PARSER_TEST_DIR}/internal_parser_tests.c
${PARSER_TEST_DIR}/parser_unit_test.c
${CMD_LINE_TEST_DIR}/command_line_unit_test_main.c
${VM_SRC_DIR}/error_reporting.c
${VM_SRC_DIR}/arg_flags.c
${VM_SRC_DIR}/safe_string_functions.c
${COMMON_TEST_DIR}/unit_test_logging.c
)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED True)
configure_file(VMWithEditorConfig.h.in VMWithEditorConfig.h)
target_compile_definitions(${EXECUTABLE_NAME} PUBLIC UNIT_TESTING)
target_compile_definitions(${EXECUTABLE_NAME} PUBLIC ALL_UNIT_TESTING)
target_include_directories(${EXECUTABLE_NAME} PUBLIC "${PROJECT_BINARY_DIR}")
target_include_directories(${EXECUTABLE_NAME} PRIVATE "${VM_SRC_DIR}")
target_include_directories(${EXECUTABLE_NAME} PRIVATE "${COMMON_TEST_DIR}")
target_include_directories(${EXECUTABLE_NAME} PRIVATE "${LEXICAL_TEST_DIR}")
target_include_directories(${EXECUTABLE_NAME} PRIVATE "${CMD_LINE_TEST_DIR}")
target_include_directories(${EXECUTABLE_NAME} PRIVATE "${PARSER_TEST_DIR}")
target_include_directories(${EXECUTABLE_NAME} PRIVATE "${HRF_TEST_DIR}")
The Directory Stucture for the builds:
This was generated by ls -R and then edited to remove what isn't necessary for this question.
/UnitTests/:
buildAllDebug.sh
buildAll.log
buildDebug.sh
buildRelease.sh
CommandLine_UnitTest
Common_UnitTest_Code
ControlConsole_UnitTest
DirStructure.txt
Editor_UnitTest
HRF_UnitTest
Parser_Unit_Test
RunAllUnitTests
State_Machine_Unit_Test
UnitTests
VirtualMachine_UnitTest
/UnitTests/CommandLine_UnitTest:
/UnitTests/CommandLine_UnitTest/CommandLine_UnitTest:
buildDebuglog.txt
buildDebug.sh
buildRelease.sh
CMakeLists.txt
/UnitTests/Common_UnitTest_Code:
/UnitTests/ControlConsole_UnitTest:
/UnitTests/ControlConsole_UnitTest/ControlConsole_UnitTest:
buildDebug.sh
buildRelease.sh
CMakeLists.txt
/UnitTests/Editor_UnitTest:
/UnitTests/Editor_UnitTest/Editor_UnitTest:
buildDebug.sh
buildRelease.sh
CMakeLists.txt
/UnitTests/HRF_UnitTest:
/UnitTests/HRF_UnitTest/HRF_UnitTest:
buildDebug.sh
buildRelease.sh
CMakeLists.txt
/UnitTests/Parser_Unit_Test:
/UnitTests/Parser_Unit_Test/Parser_Unit_Test:
buildDebug.sh
buildRelease.sh
CMakeLists.txt
/UnitTests/RunAllUnitTests:
/UnitTests/RunAllUnitTests/RunAllUnitTests:
buildDebug.sh
buildRelease.sh
CMakeLists.txt
/UnitTests/State_Machine_Unit_Test:
/UnitTests/State_Machine_Unit_Test/State_Machine_Unit_Test:
buildDebug.sh
buildRelease.sh
CMakeLists.txt
/UnitTests/UnitTests:
/UnitTests/VirtualMachine_UnitTest:
/UnitTests/VirtualMachine_UnitTest/VirtualMachine_UnitTest:
buildDebug.sh
buildRelease.sh
CMakeLists.txt
You have:
make VERBOSE=1
if [ $retVal -ne 0 ]; then
but retVal is still the return code of the cmake command. Either reset it or test $? directly.
Related
I have the following Makefile target:
target1:
$(eval count_abc := $(shell grep -c "ABC" myFileA))
$(eval count_def := $(shell grep -c "DEF" myFileB))
echo $(count_abc)
echo $(count_def)
ifeq ($(count_abc),$(count_def))
echo "TRUE"
else
echo "FALSE"
endif
But the output is always TRUE, e.g.:
echo 22
22
echo 21
21
echo TRUE
TRUE
What am I doing wrong here? What I want is INSIDE the target do 2 greps and compare their outputs and do something or something else based on the result. Please note that the greps must be done within the target since myFileA and myFileB get created on the target before and don't exist at the beginning when running make.
Thanks,
Amir
The rule file for "make" is declarative in nature - the makefile defines rules and targets, and then the make program evaluate the rules, and decide which action to take based on the target. As a result, execution is not always in the order the lines are entered into the file.
More specifically, the "ifeq" is evaluated at the rule definition stage, but the actions for building the target (eval count_abc ...) are executed when the target is built. As a result, when the ifeq is processed, both count_abc and count_def are still uninitialized, expanded to empty strings.
For the specific case you described - building a target that will compare the grep -c output from the two files, you can try something like below, effectively using shell variables (evaluated when target is evaluated), and not make variables (which are mostly declarative, evaluated when makefile is read)
target1:
count_abc=$(grep -c "ABC" myFileA) ; \
count_def=$(grep -c "DEF" myFileB) ; \
echo $(count_abc) ; \
echo $(count_def) ; \
if [ "$count_abc" -eq "$count_def" ] ; then echo TRUE ; else echo FALSE ; fi
Disclaimer: I did not run the revised makefile, not having access to desktop at this time.
The following structure works fine on a native ubuntu machine:
Makefile
Makefile-Debug
Makefile-impl
I call make with make CONF=Debug
Contents of Makefile are:
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
build: .build-post
.build-pre:
.build-post: .build-impl
clean: .clean-post
.clean-pre:
.clean-post: .clean-impl
clobber: .clobber-post
.clobber-pre:
.clobber-post: .clobber-impl
all: .all-post
.all-pre:
.all-post: .all-impl
build-tests: .build-tests-post
.build-tests-pre:
.build-tests-post: .build-tests-impl
test: .test-post
.test-pre: build-tests
.test-post: .test-impl
help: .help-post
.help-pre:
.help-post: .help-impl
include Makefile-impl.mk <<----this file gets executed
include Makefile-variables.mk
Now, Makefile-impl.mk has the following line where it is checked whether the makefile corresponding to the Debug configuration -- Makefile-Debug -- actually exists:
.validate-impl:
#if [ ! -f Makefile-${CONF}.mk ]; \ <<------ this line produces an error in MinGW
then \
echo ""; \
echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
echo "See 'make help' for details."; \
echo "Current directory: " `pwd`; \
echo ""; \
fi
#if [ ! -f Makefile-${CONF}.mk ]; \
then \
exit 1; \
fi
The above works perfectly fine on the native ubuntu machine.
When mingw32-make.exe processes the above on a windows machine, I obtain an error:
! was unexpected at this time.
mingw32-make: *** [Makefile-impl.mk:90: .validate-impl] Error 255
Is there any workaround for this? I also obtain other errors, such as for -n on the following different line in Makefile-impl.mk
#if [ -n "${MAKE_VERSION}" ]; then \
Here the error is:
-n was unexpected at this time.
mingw32-make: *** [Makefile-impl.mk:78: .depcheck-impl] Error 255
I want to add the LSM6DS3 sensor driver in my AOSP source code. I am using SC600T device.
I have already add lsm6ds3 to the location
/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9/drivers/iio/imu/st_lsm6ds3, with Makefile and Kconfig files.
Added below line to /../../iio/imu/Kconfig file:
source "drivers/iio/imu/st_lsm6ds3/Kconfig"
Added below line to /../../iio/imu/Makefile.
obj-y += st_lsm6ds3/
Content of /SC600T/../../iio/imu/st_lsm6ds3/Makefile:
# SPDX-License-Identifier: GPL-2.0-only
st_lsm6dsx-y := st_lsm6dsx_core.o st_lsm6dsx_buffer.o \
st_lsm6dsx_shub.o
obj-$(CONFIG_IIO_ST_LSM6DSX) += st_lsm6dsx.o
obj-$(CONFIG_IIO_ST_LSM6DSX_I2C) += st_lsm6dsx_i2c.o
obj-$(CONFIG_IIO_ST_LSM6DSX_SPI) += st_lsm6dsx_spi.o
obj-$(CONFIG_IIO_ST_LSM6DSX_I3C) += st_lsm6dsx_i3c.o
I have also added lsm6ds3 node in the device tree file:
&i2c_2 {
status = "ok";
#address-cells = <0x1>;
#size-cells = <0x0>;
lsm6ds3#6b {
compatible = "st,lsm6ds3";
reg = <0x6b>;
interrupt-parent = <&tlmm>;
interrupt-gpios = <&tlmm 45 0x2008>;
interrupts = <45 0x02>;
};
I have connected LSM6DS3 accelerometer Sensor on SENSOR_I2C_SCL (Pin number 131) and SENSOR_I2C_SDA (Pin number 132).
After that I have compiled the source code and flash boot and dtbo on target device(SC600T) successfully.
When I am trying to check sensor data using adb shell >> /sys/bus/devices/i2C/devices node is available and
lsm6ds3 address node which is 6b is also available.
But lsm6ds3 sensor is not probed.
enter image description here
enter image description here
Then after I will add below lines in msm8953_defconfig file.
Added below lines in msm8953_defconfig fie:
CONFIG_IIO_ST_LSM6DSX=y
CONFIG_IIO_ST_LSM6DSX_I2C=y
CONFIG_IIO_ST_LSM6DSX_SPI=y
CONFIG_IIO_ST_LSM6DSX_I3C=y
after adding this file when i compiling the source code getting below errors:
[ 2% 309/12824] Building kernel...
FAILED: out/target/product/msm8953_64/obj/kernel/msm-4.9/arch/arm64/boot/Image.gz-dtb
/bin/bash -c "(rm -rf out/target/product/msm8953_64/obj/kernel/msm-4.9/arch/arm64/boot/dts ) && (make -j3 -C kernel/msm-4.9 O=../../out/target/product/msm8953_64/obj/kernel/msm-4.9 DTC_EXT=dtc CONFIG_BUILD_ARM64_DT_OVERLAY=y ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- KCFLAGS=-mno-android ) && (make -j3 -C kernel/msm-4.9 O=../../out/target/product/msm8953_64/obj/kernel/msm-4.9 DTC_EXT=dtc CONFIG_BUILD_ARM64_DT_OVERLAY=y ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- KCFLAGS=-mno-android modules ) && (make -j3 -C kernel/msm-4.9 O=../../out/target/product/msm8953_64/obj/kernel/msm-4.9 INSTALL_MOD_PATH=../../../dlkm INSTALL_MOD_STRIP=1 DTC_EXT=dtc CONFIG_BUILD_ARM64_DT_OVERLAY=y ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- modules_install ) && (mdpath=\`find out/target/product/msm8953_64/dlkm/lib/modules -type f -name modules.dep\`; if [ \"\$mdpath\" != \"\" ];then mpath=\`dirname \$mdpath\`; ko=\`find \$mpath/kernel -type f -name *.ko\`; for i in \$ko; do mv \$i out/target/product/msm8953_64/dlkm/lib/modules/; done; fi ) && (mdpath=\`find out/target/product/msm8953_64/dlkm/lib/modules -type f -name modules.dep\`; if [ \"\$mdpath\" != \"\" ];then mpath=\`dirname \$mdpath\`; rm -rf \$mpath; fi )"
make: Entering directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9'
make[1]: Entering directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/out/target/product/msm8953_64/obj/kernel/msm-4.9'
GEN ./Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
make[2]: Leaving directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/out/target/product/msm8953_64/obj/kernel/msm-4.9'
make[1]: Entering directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/out/target/product/msm8953_64/obj/kernel/msm-4.9'
CHK include/config/kernel.release
GEN ./Makefile
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
Using /media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9 as source for kernel
/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9 is not clean, please run 'make mrproper'
in the '/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9' directory.
make[2]: *** [prepare3] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/out/target/product/msm8953_64/obj/kernel/msm-4.9'
make: *** [sub-make] Error 2
make: Leaving directory `/media/ubuntu/Vezo_360/SC600T/SC60_SC600_Android9.0.0_kernel4.9_r029/kernel/msm-4.9'
[ 2% 312/12824] target C: libdsutils <= vendor/qcom/proprietary/data/dsutils/src/ds_util.c
vendor/qcom/proprietary/data/dsutils/src/ds_util.c:719:7: warning: unused variable 'adb_lvl' [-Wunused-variable]
int adb_lvl = 0;
^
vendor/qcom/proprietary/data/dsutils/src/ds_util.c:2357:5: warning: unused function 'ds_can_exec' [-Wunused-function]
int ds_can_exec
^
2 warnings generated.
[ 2% 314/12824] target C++: KmInstallKeybox <= ven...ecuremsm/keymaster_install_toolbox/InstallKeybox.cpp
ninja: build stopped: subcommand failed.
20:36:27 ninja failed with: exit status 1
#### failed to build some targets (42 seconds) ####
Adding any custom sensor in the AOSP, are this all steps mandatory or not?
Why lsm6ds3 sensor is not probed? Do I need to check anything from the hardware side?
Sensors on Quectel SC600 devices go through something called ADSP, that is closed source. Under this system, sensors are configured through the vendor/qcom/proprietary/sensors/dsps/reg_defaults/sensor_def_qcomdev.conf file.
There is a list of compatible sensors that can work with the ADSP. You have to ask it to your Quectel representative. Otherwise you have to ask them to integrate the sensor you want, and this is, of course, too much to ask, so consider it impossible (unless Qualcomm hands you the ADSP source code, which I don't think it is going to happen).
Am trying to create a debian package of my Eiffel application.
Either make or make -j4 (which is the called one from dpkg-buildpackage) within the root structure does the job without error
but when called from dpkg-buildpackage -us -uc which calls the Makefile it exits with an error
In file included from big_file_C7_c.c:40:0:
lo322.c: In function ‘inline_F425_4447’:
lo322.c:97:5: error: format not a string literal and no format arguments [-Werror=format-security]
syslog(arg1, arg2);
^~~~~~
cc1: some warnings being treated as errors
My makefile for info is as following:
#Build variables
MY_EC = $(shell which ec)
BUILT_TARGET = EIFGENs/$(TARGET_NAME)/F_code/$(APP_NAME)
# This target will compile all files
all: build
build:
# Checks eiffel compiler
# #echo "MY EC IS: ${MY_EC}"
#if [ -z "${MY_EC}" ]; then
echo "Compiler not found";
else
echo "Eiffel compiler found";
fi
# Compilation
echo '---------->finalizing'
ec -finalize -config $(APP_NAME).ecf -target $(TARGET_NAME) || (echo "last command failed $$="; exit 1)
cd $(FINAL_EXE_DIR); \
echo '---------->Finish freezing';\
finish_freezing || (echo "A problem occured during finish_freezing!!!"; exit 1)
The issue is caused by the feature c_logging_write_log of the class LOG_WRITER_SYSTEM in EiffelStudio 18.11 and earlier that makes the following call:
syslog($priority, $msg);
Replacing it with
syslog($priority, "%s", (char *) $msg);
(in $ISE_EIFFEL/library/runtime/logging/writers/log_writer_system.e) and recompiling the system (from scratch, if the logging library is marked as read-only) should fix the problem.
I am trying to write 'if' check in define directive in one of our make file.
Actually I am trying to check platform and proceed with environment setting.
define templ_32
mkdir -p $(#D)
if [ "$(PLAT)" = "x86_64" ]; then env PERLLIB=$(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/5.10.0 --template $<; fi
if [ "$(PLAT)" = "aarch64" ]; then env PERLLIB=$(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/5.8.0 --template $<; fi
endef
I am using above define directive in one of my target recipe as follows.
some/%.c: test/tmpl-%.c $(NEW_DATA32)
$(templ_32) --initialization $(NEW_DATA32)
When I run the build with above changes. I am getting error :
/bin/sh: -c: line 0: syntax error near unexpected token `--initialization'
And also from the log I am seeing whole 'if' condition as follows.
if [ "aarch64" = "x86_64" ]; then env PERLLIB=$(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/5.8.0 --template /test/deploy/tmpl-kt.c ; fi --initialization /work/deploy/test.pl
From my success log which has no conational 'if' statements I can see only
env PERLLIB=$(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/5.8.0 --template /test/deploy/tmpl-kt.c --initialization /work/deploy/test.pl
I don't want to get the 'if' checks along with 'env' command.. I am only interested in
env PERLLIB=$(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/5.8.0 --template
How can I fix this issue?
You could use make conditionals instead of shell if statements:
ifeq ($(PLAT),x86_64)
PERLVERSION = 5.10.0
else ifeq ($(PLAT),aarch64)
PERLVERSION = 5.8.0
else
$(error "Unknown arhictecture: $(PLAT)")
endif
And then:
PERLLIB = $(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/$(PERLVERSION)
some/%.c: test/tmpl-%.c $(NEW_DATA32)
mkdir -p $(#D); \
env PERLLIB=$(PERLLIB) --template $< --initialization $(NEW_DATA32)
You should just use constructed macro names for this. For example:
PLATFORMS := x86_64 aarch64
$(or $(filter $(PLAT),$(PLATFORMS)),$(error Unknown architecture: $(PLAT)))
x86_64_PERLVER := 5.10.0
aarch64_PERLVER := 5.8.0
PERLLIB = $(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/$($(PLAT)_PERLVER)
More on this here.