I am trying to validate and choose the execution path of a makefile macro using ifeq makefile conditional...
I am using makefiles inside mingw and a very old version of make (3.79.1) but the build system cannot be altered to update to the latest make version.
I am sending parameters to the user function and based on these parameters I would like to evaluate the execution path:
define CHECK_FILE
if ($(1),))
$(error Empty file provided to check! - $(1))
endif
ifeq ($(wildcard $(1)),)
$(error Invalid file provided for checking (file does not exist)! - $(1)!)
endif
ifeq ($(2),SPEED)
$(ROOT_PATH)/Tools/testSpeed.exe $(1)
else ifeq ($(2),ENDURANCE)
$(ROOT_PATH)/Tools/testStability.exe $(1)
else ifeq ($(2),MEMORY)
$(ROOT_PATH)/Tools/check_leaks.exe 8079 $(1)
else
$(error Bad test provided - $(2)!)
endif
enddef
The problem is that I always get the "Empty file provided to check! - ..." error.. What am I doing wrong?
I cant even add an echo in this macro.... it simply wont print out anything! so that`s all about debugging...
Given my current experience - I hate gnu make and msys/mingw with each and every cell of my body... I appreciate any help to avoid hating it in the future.
The macro is called from several places, including lots of foreach loops:
someTArget:
@$(foreach external,$(INCLUDED_FILES),$(call CHECK_FILE,$(FILE_OUT_PATH)/$(outFile),MEMORY))
@$(foreach outFile,$(BUILT_BIN_FILES),$(call CHECK_FILE,$(FILE_OUT_PATH)/$(outFile),ENDURANCE))
@$(foreach outFile,$(BUILT_BIN_FILES),$(call CHECK_FILE,$(FILE_OUT_PATH)/$(outFile),SPEED))
using MSDOS batch files in msys/mingw/make would not work as it does not see the parameters %1...%n and can`t evaluate environment variables.
Thank you!
Aucun commentaire:
Enregistrer un commentaire