Pre-process assembly files only when relevant

This removes the use of CPPFLAGS otherwise.
This commit is contained in:
Pierre Pronchery 2018-03-18 23:26:24 +01:00
parent 64447f3df6
commit 51513a3b56

View File

@ -1050,6 +1050,7 @@ static int _target_binary(Makefile * makefile, String const * target)
} }
static void _flags_asm(Makefile * makefile, String const * target); static void _flags_asm(Makefile * makefile, String const * target);
static void _flags_asmpp(Makefile * makefile, String const * target);
static void _flags_c(Makefile * makefile, String const * target); static void _flags_c(Makefile * makefile, String const * target);
static void _flags_cxx(Makefile * makefile, String const * target); static void _flags_cxx(Makefile * makefile, String const * target);
static void _flags_verilog(Makefile * makefile, String const * target); static void _flags_verilog(Makefile * makefile, String const * target);
@ -1092,8 +1093,14 @@ static int _target_flags(Makefile * makefile, String const * target)
if(!done[type]) if(!done[type])
switch(type) switch(type)
{ {
case OT_ASM_SOURCE:
case OT_ASMPP_SOURCE: case OT_ASMPP_SOURCE:
done[OT_ASMPP_SOURCE] = 1;
_flags_asmpp(makefile, target);
if(done[OT_ASM_SOURCE])
break;
/* fallback */
case OT_ASM_SOURCE:
done[OT_ASM_SOURCE] = 1;
_flags_asm(makefile, target); _flags_asm(makefile, target);
break; break;
case OT_OBJC_SOURCE: case OT_OBJC_SOURCE:
@ -1131,13 +1138,24 @@ static void _flags_asm(Makefile * makefile, String const * target)
{ {
String const * p; String const * p;
_makefile_print(makefile, "%s%s", target, "_ASFLAGS = $(CPPFLAGSF)" _makefile_print(makefile, "%s%s", target, "_ASFLAGS = $(ASFLAGSF)"
" $(CPPFLAGS) $(ASFLAGSF) $(ASFLAGS)"); " $(ASFLAGS)");
if((p = _makefile_get_config(makefile, target, "asflags")) != NULL) if((p = _makefile_get_config(makefile, target, "asflags")) != NULL)
_makefile_print(makefile, " %s", p); _makefile_print(makefile, " %s", p);
_makefile_print(makefile, "%c", '\n'); _makefile_print(makefile, "%c", '\n');
} }
static void _flags_asmpp(Makefile * makefile, String const * target)
{
String const * p;
_makefile_print(makefile, "%s%s", target, "_CPPFLAGS = $(CPPFLAGSF)"
" $(CPPFLAGS)");
if((p = _makefile_get_config(makefile, target, "cppflags")) != NULL)
_makefile_print(makefile, " %s", p);
_makefile_print(makefile, "%c", '\n');
}
static void _flags_c(Makefile * makefile, String const * target) static void _flags_c(Makefile * makefile, String const * target)
{ {
String const * p; String const * p;
@ -1384,11 +1402,24 @@ static int _target_object(Makefile * makefile,
switch(source_type(extension)) switch(source_type(extension))
{ {
case OT_ASM_SOURCE: case OT_ASM_SOURCE:
case OT_ASMPP_SOURCE: _makefile_print(makefile, "\n%s%s%s\n%s%s",
_makefile_print(makefile, "\n%s%s%s%s\n%s%s", target, "_OBJS = $(OBJDIR)", target,
target, "_OBJS = ", "$(OBJDIR)", target,
target, "_ASFLAGS =" target, "_ASFLAGS ="
" $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGSF)" " $(ASFLAGSF) $(ASFLAGS)");
if((p = _makefile_get_config(makefile, target,
"asflags")) != NULL)
_makefile_print(makefile, " %s", p);
_makefile_print(makefile, "%c", '\n');
break;
case OT_ASMPP_SOURCE:
_makefile_print(makefile, "\n%s%s%s\n%s%s%s",
target, "_OBJS = $(OBJDIR)", target,
target, "_ASFLAGS = $(", target,
"_CPPFLAGS)");
if((p = _makefile_get_config(makefile, target,
"cppflags")) != NULL)
_makefile_print(makefile, " %s", p);
_makefile_print(makefile, "%s", " $(ASFLAGSF)"
" $(ASFLAGS)"); " $(ASFLAGS)");
if((p = _makefile_get_config(makefile, target, if((p = _makefile_get_config(makefile, target,
"asflags")) != NULL) "asflags")) != NULL)