From cba11c3d51bd3eb44a16284990b08c3039caeaa2 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 21 Mar 2018 01:55:59 +0100 Subject: [PATCH] Add support for "cppflags" for C/C++ source files --- src/makefile.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/makefile.c b/src/makefile.c index 48c1678..ec8e98c 100644 --- a/src/makefile.c +++ b/src/makefile.c @@ -1428,10 +1428,14 @@ static int _target_object(Makefile * makefile, break; case OT_C_SOURCE: case OT_OBJC_SOURCE: - _makefile_print(makefile, "\n%s%s%s%s\n%s%s", - target, "_OBJS = ", "$(OBJDIR)", target, - target, "_CFLAGS =" - " $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF)" + _makefile_print(makefile, "\n%s%s%s%s", target, + "_OBJS = ", "$(OBJDIR)", target); + _makefile_print(makefile, "\n%s%s", target, "_CFLAGS =" + " $(CPPFLAGSF) $(CPPFLAGS)"); + if((p = _makefile_get_config(makefile, target, + "cppflags")) != NULL) + _makefile_print(makefile, " %s", p); + _makefile_print(makefile, "%s", " $(CFLAGSF)" " $(CFLAGS)"); if((p = _makefile_get_config(makefile, target, "cflags")) != NULL) @@ -1440,10 +1444,14 @@ static int _target_object(Makefile * makefile, break; case OT_CXX_SOURCE: case OT_OBJCXX_SOURCE: - _makefile_print(makefile, "\n%s%s%s%s\n%s%s", - target, "_OBJS = ", "$(OBJDIR)", target, - target, "_CXXFLAGS =" - " $(CPPFLAGSF) $(CPPFLAGS) $(CXXFLAGSF)" + _makefile_print(makefile, "\n%s%s%s%s", target, + "_OBJS = ", "$(OBJDIR)", target); + _makefile_print(makefile, "\n%s%s", target, + "_CXXFLAGS = $(CPPFLAGSF) $(CPPFLAGS)"); + if((p = _makefile_get_config(makefile, target, + "cppflags")) != NULL) + _makefile_print(makefile, " %s", p); + _makefile_print(makefile, "%s", " $(CXXFLAGSF)" " $(CXXFLAGS)"); if((p = _makefile_get_config(makefile, target, "cxxflags")) != NULL)