Add initial support for Java
This is currently limited to: - one source file at a time (type=object) - in-place compilation (no OBJDIR support) - class files (as opposed to jars)
This commit is contained in:
parent
123d6709a7
commit
cb46d84fba
@ -136,6 +136,7 @@ const struct ExtensionType _sExtensionType[] =
|
|||||||
{ "s", OT_ASM_SOURCE },
|
{ "s", OT_ASM_SOURCE },
|
||||||
{ "S", OT_ASMPP_SOURCE },
|
{ "S", OT_ASMPP_SOURCE },
|
||||||
{ "sx", OT_ASMPP_SOURCE },
|
{ "sx", OT_ASMPP_SOURCE },
|
||||||
|
{ "java", OT_JAVA_SOURCE },
|
||||||
{ "m", OT_OBJC_SOURCE },
|
{ "m", OT_OBJC_SOURCE },
|
||||||
{ "mm", OT_OBJCXX_SOURCE },
|
{ "mm", OT_OBJCXX_SOURCE },
|
||||||
{ "v", OT_VERILOG_SOURCE },
|
{ "v", OT_VERILOG_SOURCE },
|
||||||
|
@ -100,6 +100,7 @@ typedef enum _ObjectType
|
|||||||
OT_CXX_SOURCE,
|
OT_CXX_SOURCE,
|
||||||
OT_ASM_SOURCE,
|
OT_ASM_SOURCE,
|
||||||
OT_ASMPP_SOURCE,
|
OT_ASMPP_SOURCE,
|
||||||
|
OT_JAVA_SOURCE,
|
||||||
OT_OBJC_SOURCE,
|
OT_OBJC_SOURCE,
|
||||||
OT_OBJCXX_SOURCE,
|
OT_OBJCXX_SOURCE,
|
||||||
OT_VERILOG_SOURCE,
|
OT_VERILOG_SOURCE,
|
||||||
|
@ -528,6 +528,7 @@ static void _targets_cflags(Makefile * makefile);
|
|||||||
static void _targets_cxxflags(Makefile * makefile);
|
static void _targets_cxxflags(Makefile * makefile);
|
||||||
static void _targets_exeext(Makefile * makefile);
|
static void _targets_exeext(Makefile * makefile);
|
||||||
static void _targets_ldflags(Makefile * makefile);
|
static void _targets_ldflags(Makefile * makefile);
|
||||||
|
static void _targets_jflags(Makefile * makefile);
|
||||||
static void _targets_vflags(Makefile * makefile);
|
static void _targets_vflags(Makefile * makefile);
|
||||||
static void _binary_ldflags(Makefile * makefile, String const * ldflags);
|
static void _binary_ldflags(Makefile * makefile, String const * ldflags);
|
||||||
static void _variables_binary(Makefile * makefile, char * done)
|
static void _variables_binary(Makefile * makefile, char * done)
|
||||||
@ -546,6 +547,7 @@ static void _variables_binary(Makefile * makefile, char * done)
|
|||||||
_targets_cflags(makefile);
|
_targets_cflags(makefile);
|
||||||
_targets_cxxflags(makefile);
|
_targets_cxxflags(makefile);
|
||||||
_targets_ldflags(makefile);
|
_targets_ldflags(makefile);
|
||||||
|
_targets_jflags(makefile);
|
||||||
_targets_vflags(makefile);
|
_targets_vflags(makefile);
|
||||||
_targets_exeext(makefile);
|
_targets_exeext(makefile);
|
||||||
}
|
}
|
||||||
@ -656,6 +658,23 @@ static void _targets_ldflags(Makefile * makefile)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _targets_jflags(Makefile * makefile)
|
||||||
|
{
|
||||||
|
String const * j;
|
||||||
|
String const * jff;
|
||||||
|
String const * jf;
|
||||||
|
|
||||||
|
j = _makefile_get_config(makefile, NULL, "javac");
|
||||||
|
jff = _makefile_get_config(makefile, NULL, "jflags_force");
|
||||||
|
jf = _makefile_get_config(makefile, NULL, "jflags");
|
||||||
|
if(j != NULL || jff != NULL || jf != NULL)
|
||||||
|
_makefile_output_program(makefile, "javac", 1);
|
||||||
|
if(jff != NULL)
|
||||||
|
_makefile_output_variable(makefile, "JFLAGSF", jff);
|
||||||
|
if(jf != NULL)
|
||||||
|
_makefile_output_variable(makefile, "JFLAGS", jf);
|
||||||
|
}
|
||||||
|
|
||||||
static void _targets_vflags(Makefile * makefile)
|
static void _targets_vflags(Makefile * makefile)
|
||||||
{
|
{
|
||||||
String const * v;
|
String const * v;
|
||||||
@ -1011,6 +1030,10 @@ static int _objs_source(Makefile * makefile, String * source, TargetType tt)
|
|||||||
source,
|
source,
|
||||||
(tt == TT_LIBTOOL) ? ".lo" : ".o");
|
(tt == TT_LIBTOOL) ? ".lo" : ".o");
|
||||||
break;
|
break;
|
||||||
|
case OT_JAVA_SOURCE:
|
||||||
|
_makefile_print(makefile, "%s%s%s", " $(OBJDIR)",
|
||||||
|
source, ".class");
|
||||||
|
break;
|
||||||
case OT_VERILOG_SOURCE:
|
case OT_VERILOG_SOURCE:
|
||||||
_makefile_print(makefile, "%s%s%s", " $(OBJDIR)",
|
_makefile_print(makefile, "%s%s%s", " $(OBJDIR)",
|
||||||
source, ".o");
|
source, ".o");
|
||||||
@ -1053,6 +1076,7 @@ static void _flags_asm(Makefile * makefile, String const * target);
|
|||||||
static void _flags_asmpp(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_java(Makefile * makefile, String const * target);
|
||||||
static void _flags_verilog(Makefile * makefile, String const * target);
|
static void _flags_verilog(Makefile * makefile, String const * target);
|
||||||
static int _target_flags(Makefile * makefile, String const * target)
|
static int _target_flags(Makefile * makefile, String const * target)
|
||||||
{
|
{
|
||||||
@ -1103,6 +1127,10 @@ static int _target_flags(Makefile * makefile, String const * target)
|
|||||||
done[OT_ASM_SOURCE] = 1;
|
done[OT_ASM_SOURCE] = 1;
|
||||||
_flags_asm(makefile, target);
|
_flags_asm(makefile, target);
|
||||||
break;
|
break;
|
||||||
|
case OT_JAVA_SOURCE:
|
||||||
|
done[OT_JAVA_SOURCE] = 1;
|
||||||
|
_flags_java(makefile, target);
|
||||||
|
break;
|
||||||
case OT_OBJC_SOURCE:
|
case OT_OBJC_SOURCE:
|
||||||
done[OT_C_SOURCE] = 1;
|
done[OT_C_SOURCE] = 1;
|
||||||
/* fallback */
|
/* fallback */
|
||||||
@ -1197,6 +1225,17 @@ static void _flags_cxx(Makefile * makefile, String const * target)
|
|||||||
_makefile_print(makefile, "%c", '\n');
|
_makefile_print(makefile, "%c", '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _flags_java(Makefile * makefile, String const * target)
|
||||||
|
{
|
||||||
|
String const * p;
|
||||||
|
|
||||||
|
_makefile_print(makefile, "%s%s", target,
|
||||||
|
"_JFLAGS = $(JFLAGSF) $(JFLAGS)");
|
||||||
|
if((p = _makefile_get_config(makefile, target, "jflags")) != NULL)
|
||||||
|
_makefile_print(makefile, " %s", p);
|
||||||
|
_makefile_print(makefile, "%c", '\n');
|
||||||
|
}
|
||||||
|
|
||||||
static void _flags_verilog(Makefile * makefile, String const * target)
|
static void _flags_verilog(Makefile * makefile, String const * target)
|
||||||
{
|
{
|
||||||
String const * p;
|
String const * p;
|
||||||
@ -1458,6 +1497,16 @@ static int _target_object(Makefile * makefile,
|
|||||||
_makefile_print(makefile, " %s", p);
|
_makefile_print(makefile, " %s", p);
|
||||||
_makefile_print(makefile, "%c", '\n');
|
_makefile_print(makefile, "%c", '\n');
|
||||||
break;
|
break;
|
||||||
|
case OT_JAVA_SOURCE:
|
||||||
|
_makefile_print(makefile, "\n%s%s%s%s\n%s%s",
|
||||||
|
target, "_OBJS = ",
|
||||||
|
"$(OBJDIR)", target, target, "_JFLAGS ="
|
||||||
|
" $(JFLAGSF) $(JFLAGS)");
|
||||||
|
if((p = _makefile_get_config(makefile, target,
|
||||||
|
"jflags")) != NULL)
|
||||||
|
_makefile_print(makefile, " %s", p);
|
||||||
|
_makefile_print(makefile, "%c", '\n');
|
||||||
|
break;
|
||||||
case OT_VERILOG_SOURCE:
|
case OT_VERILOG_SOURCE:
|
||||||
_makefile_print(makefile, "\n%s%s%s%s\n%s%s",
|
_makefile_print(makefile, "\n%s%s%s%s\n%s%s",
|
||||||
target, "_OBJS = ",
|
target, "_OBJS = ",
|
||||||
@ -1832,6 +1881,25 @@ static int _target_source(Makefile * makefile,
|
|||||||
_makefile_print(makefile, "%s%s%s%s\n", " -c ", source, ".",
|
_makefile_print(makefile, "%s%s%s%s\n", " -c ", source, ".",
|
||||||
extension);
|
extension);
|
||||||
break;
|
break;
|
||||||
|
case OT_JAVA_SOURCE:
|
||||||
|
_makefile_print(makefile, "%s%s", "\n$(OBJDIR)",
|
||||||
|
target);
|
||||||
|
_makefile_print(makefile, "%s%s%s%s", ": ", source, ".",
|
||||||
|
extension);
|
||||||
|
source[len] = '.'; /* FIXME ugly */
|
||||||
|
_source_depends(makefile, source);
|
||||||
|
_makefile_print(makefile, "%s", "\n\t");
|
||||||
|
if(strchr(source, '/') != NULL)
|
||||||
|
ret = _source_subdir(makefile, source);
|
||||||
|
q = _makefile_get_config(makefile, source, "jflags");
|
||||||
|
source[len] = '\0';
|
||||||
|
_makefile_print(makefile, "%s%s%s", "$(JAVAC) $(",
|
||||||
|
target, "_JFLAGS)");
|
||||||
|
if(q != NULL)
|
||||||
|
_makefile_print(makefile, " %s", q);
|
||||||
|
_makefile_print(makefile, "%s%s%s%s%c", " ", source,
|
||||||
|
".", extension, '\n');
|
||||||
|
break;
|
||||||
case OT_VERILOG_SOURCE:
|
case OT_VERILOG_SOURCE:
|
||||||
if(tt == TT_OBJECT)
|
if(tt == TT_OBJECT)
|
||||||
_makefile_print(makefile, "%s%s", "\n$(OBJDIR)",
|
_makefile_print(makefile, "%s%s", "\n$(OBJDIR)",
|
||||||
|
Loading…
Reference in New Issue
Block a user