Application.mk: Support the ability to change the CFLAGS for the compilation of a single file. Set special compiler options as follows the rule:

sourcefile + fixed suffix "_[A|C|CPP|CXX]FLAGS"

apps/examples/hello/Makefile:
  $(SRCDIR)/hello_main.c_CFLAGS = -DTEST
This commit is contained in:
Xiang Xiao 2019-10-03 06:52:25 -06:00 committed by Gregory Nutt
parent e73ca15c99
commit 1342426431
2 changed files with 7 additions and 7 deletions

View File

@ -124,17 +124,17 @@ else
define ELFASSEMBLE
@echo "AS: $1"
$(Q) $(CC) -c $(AELFFLAGS) $1 -o $2
$(Q) $(CC) -c $(AELFFLAGS) $($(strip $1)_AELFFLAGS) $1 -o $2
endef
define ELFCOMPILE
@echo "CC: $1"
$(Q) $(CC) -c $(CELFFLAGS) $1 -o $2
$(Q) $(CC) -c $(CELFFLAGS) $($(strip $1)_CELFFLAGS) $1 -o $2
endef
define ELFCOMPILEXX
@echo "CXX: $1"
$(Q) $(CXX) -c $(CXXELFFLAGS) $1 -o $2
$(Q) $(CXX) -c $(CXXELFFLAGS) $($(strip $1)_CXXELFFLAGS) $1 -o $2
endef
$(AOBJS): %$(OBJEXT): %.S

View File

@ -66,22 +66,22 @@ LIBEXT ?= .a
define PREPROCESS
@echo "CPP: $1->$2"
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
endef
define COMPILE
@echo "CC: $1"
$(Q) $(CC) -c $(CFLAGS) $1 -o $2
$(Q) $(CC) -c $(CFLAGS) $($(strip $1)_CFLAGS) $1 -o $2
endef
define COMPILEXX
@echo "CXX: $1"
$(Q) $(CXX) -c $(CXXFLAGS) $1 -o $2
$(Q) $(CXX) -c $(CXXFLAGS) $($(strip $1)_CXXFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
$(Q) $(CC) -c $(AFLAGS) $1 -o $2
$(Q) $(CC) -c $(AFLAGS) $($(strip $1)_AFLAGS) $1 -o $2
endef
# Environment-specific definitions