Introduce a new target type for simple commands
This commit is contained in:
parent
c4be63a8ed
commit
ce6ab849ea
@ -123,8 +123,8 @@ const HostKernelMap mHostKernel[] =
|
|||||||
{ HO_UNKNOWN, "unknown", NULL, NULL }
|
{ HO_UNKNOWN, "unknown", NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const String * sTargetType[TT_COUNT] = { "binary", "library", "libtool",
|
const String * sTargetType[TT_COUNT] = { "binary", "command", "library",
|
||||||
"object", "plugin", "script", NULL };
|
"libtool", "object", "plugin", "script", NULL };
|
||||||
const struct ExtensionType _sExtensionType[] =
|
const struct ExtensionType _sExtensionType[] =
|
||||||
{
|
{
|
||||||
{ "c", OT_C_SOURCE },
|
{ "c", OT_C_SOURCE },
|
||||||
|
@ -87,8 +87,8 @@ extern const HostKernelMap sHostKernel[HK_COUNT];
|
|||||||
|
|
||||||
typedef enum _TargetType
|
typedef enum _TargetType
|
||||||
{
|
{
|
||||||
TT_BINARY = 0, TT_LIBRARY, TT_LIBTOOL, TT_OBJECT, TT_PLUGIN, TT_SCRIPT,
|
TT_BINARY = 0, TT_COMMAND, TT_LIBRARY, TT_LIBTOOL, TT_OBJECT, TT_PLUGIN,
|
||||||
TT_UNKNOWN
|
TT_SCRIPT, TT_UNKNOWN
|
||||||
} TargetType;
|
} TargetType;
|
||||||
# define TT_LAST TT_UNKNOWN
|
# define TT_LAST TT_UNKNOWN
|
||||||
# define TT_COUNT (TT_LAST + 1)
|
# define TT_COUNT (TT_LAST + 1)
|
||||||
|
@ -335,6 +335,10 @@ static int _variables_targets(Makefile * makefile)
|
|||||||
" $(OBJDIR)%s$(EXEEXT)",
|
" $(OBJDIR)%s$(EXEEXT)",
|
||||||
prints);
|
prints);
|
||||||
break;
|
break;
|
||||||
|
case TT_COMMAND:
|
||||||
|
_makefile_print(makefile, " %s",
|
||||||
|
prints);
|
||||||
|
break;
|
||||||
case TT_LIBRARY:
|
case TT_LIBRARY:
|
||||||
ret |= _variables_targets_library(
|
ret |= _variables_targets_library(
|
||||||
makefile, prints);
|
makefile, prints);
|
||||||
@ -490,6 +494,8 @@ static void _executables_variables(Makefile * makefile,
|
|||||||
_variables_binary(makefile, done);
|
_variables_binary(makefile, done);
|
||||||
done[TT_OBJECT] = 1;
|
done[TT_OBJECT] = 1;
|
||||||
break;
|
break;
|
||||||
|
case TT_COMMAND:
|
||||||
|
break;
|
||||||
case TT_OBJECT:
|
case TT_OBJECT:
|
||||||
_variables_binary(makefile, done);
|
_variables_binary(makefile, done);
|
||||||
done[TT_BINARY] = 1;
|
done[TT_BINARY] = 1;
|
||||||
@ -897,6 +903,7 @@ static int _targets_subdirs(Makefile * makefile)
|
|||||||
|
|
||||||
static int _target_objs(Makefile * makefile, String const * target);
|
static int _target_objs(Makefile * makefile, String const * target);
|
||||||
static int _target_binary(Makefile * makefile, String const * target);
|
static int _target_binary(Makefile * makefile, String const * target);
|
||||||
|
static int _target_command(Makefile * makefile, String const * target);
|
||||||
static int _target_library(Makefile * makefile, String const * target);
|
static int _target_library(Makefile * makefile, String const * target);
|
||||||
static int _target_library_static(Makefile * makefile, String const * target);
|
static int _target_library_static(Makefile * makefile, String const * target);
|
||||||
static int _target_libtool(Makefile * makefile, String const * target);
|
static int _target_libtool(Makefile * makefile, String const * target);
|
||||||
@ -919,6 +926,8 @@ static int _targets_target(Makefile * makefile, String const * target)
|
|||||||
{
|
{
|
||||||
case TT_BINARY:
|
case TT_BINARY:
|
||||||
return _target_binary(makefile, target);
|
return _target_binary(makefile, target);
|
||||||
|
case TT_COMMAND:
|
||||||
|
return _target_command(makefile, target);
|
||||||
case TT_LIBRARY:
|
case TT_LIBRARY:
|
||||||
return _target_library(makefile, target);
|
return _target_library(makefile, target);
|
||||||
case TT_LIBTOOL:
|
case TT_LIBTOOL:
|
||||||
@ -1174,6 +1183,20 @@ static void _flags_verilog(Makefile * makefile, String const * target)
|
|||||||
_makefile_print(makefile, "%c", '\n');
|
_makefile_print(makefile, "%c", '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _target_command(Makefile * makefile, String const * target)
|
||||||
|
{
|
||||||
|
String const * p;
|
||||||
|
|
||||||
|
_makefile_print(makefile, "\n%s:", target);
|
||||||
|
if((p = _makefile_get_config(makefile, target, "depends")) != NULL
|
||||||
|
&& _makefile_expand(makefile, p) != 0)
|
||||||
|
return error_print(PROGNAME);
|
||||||
|
if((p = _makefile_get_config(makefile, target, "command")) == NULL)
|
||||||
|
return error_print(PROGNAME);
|
||||||
|
_makefile_print(makefile, "\n\t%s\n", p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int _target_library(Makefile * makefile, String const * target)
|
static int _target_library(Makefile * makefile, String const * target)
|
||||||
{
|
{
|
||||||
String const * p;
|
String const * p;
|
||||||
@ -2103,6 +2126,8 @@ static int _install_target(Makefile * makefile, String const * target)
|
|||||||
case TT_BINARY:
|
case TT_BINARY:
|
||||||
_install_target_binary(makefile, target);
|
_install_target_binary(makefile, target);
|
||||||
break;
|
break;
|
||||||
|
case TT_COMMAND:
|
||||||
|
break;
|
||||||
case TT_LIBRARY:
|
case TT_LIBRARY:
|
||||||
ret = _install_target_library(makefile, target);
|
ret = _install_target_library(makefile, target);
|
||||||
break;
|
break;
|
||||||
@ -2572,6 +2597,8 @@ static int _uninstall_target(Makefile * makefile,
|
|||||||
_makefile_print(makefile, "\t%s%s/%s%s\n", rm_destdir,
|
_makefile_print(makefile, "\t%s%s/%s%s\n", rm_destdir,
|
||||||
path, target, "$(EXEEXT)");
|
path, target, "$(EXEEXT)");
|
||||||
break;
|
break;
|
||||||
|
case TT_COMMAND:
|
||||||
|
break;
|
||||||
case TT_LIBRARY:
|
case TT_LIBRARY:
|
||||||
if(_uninstall_target_library(makefile, target,
|
if(_uninstall_target_library(makefile, target,
|
||||||
path) != 0)
|
path) != 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user