makefile - Automatic variables in the tests of conditionals: GNU Make -
I stuck here. We have two makefiles (a requirement that I can not change)
- defs.mk: Include source file name and amp; For example:
C_FILES = c / src / main / rule_main.c rule_main_OPTIONAL_FLAG = + w127 rule_main_DEBUG = true
- for their additional compilation flags (different standard flags)
-
Makefile: There are rules in it.
Now I would like to add a feature so that I am in file specific flags (and optional file specific debug flag):
CUSTOM_DEBUG_FLAG = $ ($ (Basename $ (notdir $ @) _ some endif debug) ## defs.mk ifeq to rule_main_DEBUG macro ($ (CUSTOM_DEBUG_FLAG), TRUE) Afterwards not supported in conditional is not working. There is no other way to do this
I usually take advantage of:?
SPECIFIC_FLAGS = $ ($ if (findstring $ (CUSTOM_FLAG), correct), $ (IF_TRUE), $ (IF_FALSE)) or your own Use define function:
debug_defs = $ ($ if (findstring $ (1), file1 file2), - DDEBUG, -DNDEBUG% o:. Src / $$ (% notdir) c @cc -c $ (CFLAGS) $ (call debug_defs, $ (nodir $ (basename $ @))
Comments
Post a Comment