Added a plugin target
This commit is contained in:
parent
a7381714ea
commit
de44434d82
@ -66,7 +66,7 @@ const struct HostKernel sHostKernel[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
const String * sTargetType[TT_COUNT] = { "binary", "library", "libtool",
|
const String * sTargetType[TT_COUNT] = { "binary", "library", "libtool",
|
||||||
"object", NULL };
|
"object", "plugin", NULL };
|
||||||
const String * sObjectType[OT_COUNT] = { "c", "cc", "cpp", "S", NULL };
|
const String * sObjectType[OT_COUNT] = { "c", "cc", "cpp", "S", NULL };
|
||||||
|
|
||||||
String const * _source_extension(String const * source)
|
String const * _source_extension(String const * source)
|
||||||
|
@ -66,7 +66,8 @@ extern const struct HostKernel sHostKernel[HK_COUNT];
|
|||||||
|
|
||||||
typedef enum _TargetType
|
typedef enum _TargetType
|
||||||
{
|
{
|
||||||
TT_BINARY = 0, TT_LIBRARY, TT_LIBTOOL, TT_OBJECT, TT_UNKNOWN
|
TT_BINARY = 0, TT_LIBRARY, TT_LIBTOOL, TT_OBJECT, TT_PLUGIN,
|
||||||
|
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)
|
||||||
|
@ -264,6 +264,9 @@ static int _variables_targets(Configure * configure, FILE * fp)
|
|||||||
case TT_LIBTOOL:
|
case TT_LIBTOOL:
|
||||||
fprintf(fp, " %s%s", prints, ".la");
|
fprintf(fp, " %s%s", prints, ".la");
|
||||||
break;
|
break;
|
||||||
|
case TT_PLUGIN:
|
||||||
|
fprintf(fp, " %s%s", prints, ".so");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if(c == '\0')
|
if(c == '\0')
|
||||||
break;
|
break;
|
||||||
@ -356,6 +359,7 @@ static void _executables_variables(Configure * configure, FILE * fp,
|
|||||||
_variables_binary(configure, fp, done);
|
_variables_binary(configure, fp, done);
|
||||||
break;
|
break;
|
||||||
case TT_LIBRARY:
|
case TT_LIBRARY:
|
||||||
|
case TT_PLUGIN:
|
||||||
_variables_library(configure, fp, done);
|
_variables_library(configure, fp, done);
|
||||||
break;
|
break;
|
||||||
case TT_LIBTOOL:
|
case TT_LIBTOOL:
|
||||||
@ -661,6 +665,8 @@ static int _target_libtool(Configure * configure, FILE * fp,
|
|||||||
String const * target);
|
String const * target);
|
||||||
static int _target_object(Configure * configure, FILE * fp,
|
static int _target_object(Configure * configure, FILE * fp,
|
||||||
String const * target);
|
String const * target);
|
||||||
|
static int _target_plugin(Configure * configure, FILE * fp,
|
||||||
|
String const * target);
|
||||||
static int _targets_target(Configure * configure, FILE * fp,
|
static int _targets_target(Configure * configure, FILE * fp,
|
||||||
String const * target)
|
String const * target)
|
||||||
{
|
{
|
||||||
@ -684,6 +690,8 @@ static int _targets_target(Configure * configure, FILE * fp,
|
|||||||
return _target_libtool(configure, fp, target);
|
return _target_libtool(configure, fp, target);
|
||||||
case TT_OBJECT:
|
case TT_OBJECT:
|
||||||
return _target_object(configure, fp, target);
|
return _target_object(configure, fp, target);
|
||||||
|
case TT_PLUGIN:
|
||||||
|
return _target_plugin(configure, fp, target);
|
||||||
case TT_UNKNOWN:
|
case TT_UNKNOWN:
|
||||||
fprintf(stderr, "%s%s%s", "configure: ", target,
|
fprintf(stderr, "%s%s%s", "configure: ", target,
|
||||||
": unknown type for target\n");
|
": unknown type for target\n");
|
||||||
@ -1032,6 +1040,36 @@ static int _target_object(Configure * configure, FILE * fp,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _target_plugin(Configure * configure, FILE * fp,
|
||||||
|
String const * target)
|
||||||
|
{
|
||||||
|
String const * p;
|
||||||
|
String * q;
|
||||||
|
|
||||||
|
if(_target_objs(configure, fp, target) != 0)
|
||||||
|
return 1;
|
||||||
|
if(configure->prefs->flags & PREFS_n)
|
||||||
|
return 0;
|
||||||
|
_target_flags(configure, fp, target);
|
||||||
|
fprintf(fp, "\n%s%s%s%s", target, ".so: $(", target, "_OBJS)");
|
||||||
|
if((p = config_get(configure->config, target, "depends")) != NULL)
|
||||||
|
fprintf(fp, " %s", p);
|
||||||
|
fputc('\n', fp);
|
||||||
|
fprintf(fp, "%s%s%s%s%s", "\t$(LD) -o ", target, ".so $(", target,
|
||||||
|
"_OBJS)");
|
||||||
|
if((p = config_get(configure->config, target, "ldflags")) != NULL)
|
||||||
|
fprintf(fp, " %s", p);
|
||||||
|
if((q = malloc(strlen(target) + 4)) != NULL)
|
||||||
|
{
|
||||||
|
sprintf(q, "%s.so", target);
|
||||||
|
if((p = config_get(configure->config, q, "ldflags")) != NULL)
|
||||||
|
fprintf(fp, " %s", p);
|
||||||
|
free(q);
|
||||||
|
}
|
||||||
|
fputc('\n', fp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int _objects_target(Configure * configure, FILE * fp,
|
static int _objects_target(Configure * configure, FILE * fp,
|
||||||
String const * target);
|
String const * target);
|
||||||
static int _write_objects(Configure * configure, FILE * fp)
|
static int _write_objects(Configure * configure, FILE * fp)
|
||||||
@ -1460,6 +1498,8 @@ static void _install_target_libtool(Config * config, FILE * fp,
|
|||||||
String const * target);
|
String const * target);
|
||||||
static void _install_target_object(Config * config, FILE * fp,
|
static void _install_target_object(Config * config, FILE * fp,
|
||||||
String const * target);
|
String const * target);
|
||||||
|
static void _install_target_plugin(Config * config, FILE * fp,
|
||||||
|
String const * target);
|
||||||
static int _install_target(Config * config, FILE * fp, String const * target)
|
static int _install_target(Config * config, FILE * fp, String const * target)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -1482,6 +1522,9 @@ static int _install_target(Config * config, FILE * fp, String const * target)
|
|||||||
case TT_OBJECT:
|
case TT_OBJECT:
|
||||||
_install_target_object(config, fp, target);
|
_install_target_object(config, fp, target);
|
||||||
break;
|
break;
|
||||||
|
case TT_PLUGIN:
|
||||||
|
_install_target_plugin(config, fp, target);
|
||||||
|
break;
|
||||||
case TT_UNKNOWN:
|
case TT_UNKNOWN:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1554,6 +1597,18 @@ static void _install_target_object(Config * config, FILE * fp,
|
|||||||
" $(DESTDIR)", path, target);
|
" $(DESTDIR)", path, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _install_target_plugin(Config * config, FILE * fp,
|
||||||
|
String const * target)
|
||||||
|
{
|
||||||
|
String const * path;
|
||||||
|
|
||||||
|
if((path = config_get(config, target, "install")) == NULL)
|
||||||
|
return;
|
||||||
|
fprintf(fp, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", path);
|
||||||
|
fprintf(fp, "%s%s%s%s/%s%s", "\t$(INSTALL) -m 0644 ", target,
|
||||||
|
".so $(DESTDIR)", path, target, ".so\n");
|
||||||
|
}
|
||||||
|
|
||||||
static int _install_include(Config * config, FILE * fp, String const * include);
|
static int _install_include(Config * config, FILE * fp, String const * include);
|
||||||
static int _install_includes(Configure * configure, FILE * fp)
|
static int _install_includes(Configure * configure, FILE * fp)
|
||||||
{
|
{
|
||||||
@ -1745,6 +1800,10 @@ static int _uninstall_target(Config * config, FILE * fp, String const * target)
|
|||||||
case TT_OBJECT:
|
case TT_OBJECT:
|
||||||
fprintf(fp, "\t%s%s/%s\n", rm_destdir, path, target);
|
fprintf(fp, "\t%s%s/%s\n", rm_destdir, path, target);
|
||||||
break;
|
break;
|
||||||
|
case TT_PLUGIN:
|
||||||
|
fprintf(fp, "\t%s%s/%s%s\n", rm_destdir, path, target,
|
||||||
|
".so");
|
||||||
|
break;
|
||||||
case TT_UNKNOWN:
|
case TT_UNKNOWN:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user