Introduced the script target
This commit is contained in:
parent
cb787f68de
commit
06816f09c2
@ -34,7 +34,7 @@ makedepend: $(makedepend_OBJS)
|
|||||||
configure.o: configure.c configure.h makefile.h ../config.h
|
configure.o: configure.c configure.h makefile.h ../config.h
|
||||||
$(CC) $(configure_CFLAGS) -c configure.c
|
$(CC) $(configure_CFLAGS) -c configure.c
|
||||||
|
|
||||||
makefile.o: makefile.c configure.h settings.h
|
makefile.o: makefile.c configure.h settings.h ../config.h
|
||||||
$(CC) $(configure_CFLAGS) -c makefile.c
|
$(CC) $(configure_CFLAGS) -c makefile.c
|
||||||
|
|
||||||
settings.o: settings.c settings.h
|
settings.o: settings.c settings.h
|
||||||
|
@ -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", "plugin", NULL };
|
"object", "plugin", "script", 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,7 @@ extern const struct HostKernel sHostKernel[HK_COUNT];
|
|||||||
|
|
||||||
typedef enum _TargetType
|
typedef enum _TargetType
|
||||||
{
|
{
|
||||||
TT_BINARY = 0, TT_LIBRARY, TT_LIBTOOL, TT_OBJECT, TT_PLUGIN,
|
TT_BINARY = 0, TT_LIBRARY, TT_LIBTOOL, TT_OBJECT, TT_PLUGIN, TT_SCRIPT,
|
||||||
TT_UNKNOWN
|
TT_UNKNOWN
|
||||||
} TargetType;
|
} TargetType;
|
||||||
# define TT_LAST TT_UNKNOWN
|
# define TT_LAST TT_UNKNOWN
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "configure.h"
|
#include "configure.h"
|
||||||
|
#include "../config.h"
|
||||||
|
|
||||||
ARRAY(Config *, config)
|
ARRAY(Config *, config)
|
||||||
|
|
||||||
@ -131,7 +132,7 @@ static int _variables_package(Configure * configure, FILE * fp,
|
|||||||
{
|
{
|
||||||
if(configure->prefs->flags & PREFS_v)
|
if(configure->prefs->flags & PREFS_v)
|
||||||
fputc('\n', stdout);
|
fputc('\n', stdout);
|
||||||
fprintf(stderr, "%s%s%s", "configure: ", directory,
|
fprintf(stderr, "%s%s%s", PACKAGE ": ", directory,
|
||||||
": \"package\" needs \"version\"\n");
|
": \"package\" needs \"version\"\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -253,6 +254,7 @@ static int _variables_targets(Configure * configure, FILE * fp)
|
|||||||
{
|
{
|
||||||
case TT_BINARY:
|
case TT_BINARY:
|
||||||
case TT_OBJECT:
|
case TT_OBJECT:
|
||||||
|
case TT_SCRIPT:
|
||||||
case TT_UNKNOWN:
|
case TT_UNKNOWN:
|
||||||
fprintf(fp, " %s", prints);
|
fprintf(fp, " %s", prints);
|
||||||
break;
|
break;
|
||||||
@ -365,6 +367,7 @@ static void _executables_variables(Configure * configure, FILE * fp,
|
|||||||
_variables_libtool(configure, fp, done);
|
_variables_libtool(configure, fp, done);
|
||||||
break;
|
break;
|
||||||
case TT_OBJECT:
|
case TT_OBJECT:
|
||||||
|
case TT_SCRIPT:
|
||||||
case TT_UNKNOWN:
|
case TT_UNKNOWN:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -677,6 +680,8 @@ static int _target_object(Configure * configure, FILE * fp,
|
|||||||
String const * target);
|
String const * target);
|
||||||
static int _target_plugin(Configure * configure, FILE * fp,
|
static int _target_plugin(Configure * configure, FILE * fp,
|
||||||
String const * target);
|
String const * target);
|
||||||
|
static int _target_script(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)
|
||||||
{
|
{
|
||||||
@ -685,7 +690,7 @@ static int _targets_target(Configure * configure, FILE * fp,
|
|||||||
|
|
||||||
if((type = config_get(configure->config, target, "type")) == NULL)
|
if((type = config_get(configure->config, target, "type")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s%s%s", "configure: ", target,
|
fprintf(stderr, "%s%s%s", PACKAGE ": ", target,
|
||||||
": no type defined for target\n");
|
": no type defined for target\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -702,8 +707,10 @@ static int _targets_target(Configure * configure, FILE * fp,
|
|||||||
return _target_object(configure, fp, target);
|
return _target_object(configure, fp, target);
|
||||||
case TT_PLUGIN:
|
case TT_PLUGIN:
|
||||||
return _target_plugin(configure, fp, target);
|
return _target_plugin(configure, fp, target);
|
||||||
|
case TT_SCRIPT:
|
||||||
|
return _target_script(configure, fp, target);
|
||||||
case TT_UNKNOWN:
|
case TT_UNKNOWN:
|
||||||
fprintf(stderr, "%s%s%s", "configure: ", target,
|
fprintf(stderr, "%s%s%s", PACKAGE ": ", target,
|
||||||
": unknown type for target\n");
|
": unknown type for target\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -727,7 +734,7 @@ static int _target_objs(Configure * configure, FILE * fp,
|
|||||||
tt = enum_string(TT_LAST, sTargetType, p);
|
tt = enum_string(TT_LAST, sTargetType, p);
|
||||||
if((p = config_get(configure->config, target, "sources")) == NULL)
|
if((p = config_get(configure->config, target, "sources")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s%s%s", "configure: ", target,
|
fprintf(stderr, "%s%s%s", PACKAGE ": ", target,
|
||||||
": no sources defined for target\n");
|
": no sources defined for target\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -763,7 +770,7 @@ static int _objs_source(Prefs * prefs, FILE * fp, String * source,
|
|||||||
|
|
||||||
if((extension = _source_extension(source)) == NULL)
|
if((extension = _source_extension(source)) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s%s%s", "configure: ", source,
|
fprintf(stderr, "%s%s%s", PACKAGE ": ", source,
|
||||||
": no extension for source\n");
|
": no extension for source\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -782,7 +789,7 @@ static int _objs_source(Prefs * prefs, FILE * fp, String * source,
|
|||||||
break;
|
break;
|
||||||
case OT_UNKNOWN:
|
case OT_UNKNOWN:
|
||||||
ret = 1;
|
ret = 1;
|
||||||
fprintf(stderr, "%s%s%s", "configure: ", source,
|
fprintf(stderr, "%s%s%s", PACKAGE ": ", source,
|
||||||
": unknown extension for source\n");
|
": unknown extension for source\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -996,13 +1003,13 @@ static int _target_object(Configure * configure, FILE * fp,
|
|||||||
|
|
||||||
if((p = config_get(configure->config, target, "sources")) == NULL)
|
if((p = config_get(configure->config, target, "sources")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s%s%s", "configure: ", target,
|
fprintf(stderr, "%s%s%s", PACKAGE ": ", target,
|
||||||
": No sources for target\n");
|
": No sources for target\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(strchr(p, ',') != NULL)
|
if(strchr(p, ',') != NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s%s%s", "configure: ", target,
|
fprintf(stderr, "%s%s%s", PACKAGE ": ", target,
|
||||||
": An object can have only one source file\n");
|
": An object can have only one source file\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1043,7 +1050,7 @@ static int _target_object(Configure * configure, FILE * fp,
|
|||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
break;
|
break;
|
||||||
case OT_UNKNOWN:
|
case OT_UNKNOWN:
|
||||||
fprintf(stderr, "%s%s%s", "configure: ", target,
|
fprintf(stderr, "%s%s%s", PACKAGE ": ", target,
|
||||||
": Unknown source type for object\n");
|
": Unknown source type for object\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1112,6 +1119,28 @@ static int _write_objects(Configure * configure, FILE * fp)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _target_script(Configure * configure, FILE * fp,
|
||||||
|
String const * target)
|
||||||
|
{
|
||||||
|
String const * script;
|
||||||
|
String const * p;
|
||||||
|
|
||||||
|
if((script = config_get(configure->config, target, "script")) == NULL)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s%s%s", PACKAGE ": ", target,
|
||||||
|
": No script for target\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(configure->prefs->flags & PREFS_n)
|
||||||
|
return 0;
|
||||||
|
fprintf(fp, "\n%s:", target);
|
||||||
|
if((p = config_get(configure->config, target, "depends")) != NULL)
|
||||||
|
fprintf(fp, " %s", p);
|
||||||
|
fputc('\n', fp);
|
||||||
|
fprintf(fp, "\t%s \"%s\"\n", script, target);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int _target_source(Configure * configure, FILE * fp,
|
static int _target_source(Configure * configure, FILE * fp,
|
||||||
String const * target, String * source);
|
String const * target, String * source);
|
||||||
static int _objects_target(Configure * configure, FILE * fp,
|
static int _objects_target(Configure * configure, FILE * fp,
|
||||||
@ -1510,6 +1539,8 @@ static void _install_target_object(Config * config, FILE * fp,
|
|||||||
String const * target);
|
String const * target);
|
||||||
static void _install_target_plugin(Config * config, FILE * fp,
|
static void _install_target_plugin(Config * config, FILE * fp,
|
||||||
String const * target);
|
String const * target);
|
||||||
|
static void _install_target_script(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;
|
||||||
@ -1535,6 +1566,9 @@ static int _install_target(Config * config, FILE * fp, String const * target)
|
|||||||
case TT_PLUGIN:
|
case TT_PLUGIN:
|
||||||
_install_target_plugin(config, fp, target);
|
_install_target_plugin(config, fp, target);
|
||||||
break;
|
break;
|
||||||
|
case TT_SCRIPT:
|
||||||
|
_install_target_script(config, fp, target);
|
||||||
|
break;
|
||||||
case TT_UNKNOWN:
|
case TT_UNKNOWN:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1619,6 +1653,21 @@ static void _install_target_plugin(Config * config, FILE * fp,
|
|||||||
".so $(DESTDIR)", path, target, ".so\n");
|
".so $(DESTDIR)", path, target, ".so\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _install_target_script(Config * config, FILE * fp,
|
||||||
|
String const * target)
|
||||||
|
{
|
||||||
|
String const * path;
|
||||||
|
String const * script;
|
||||||
|
|
||||||
|
if((path = config_get(config, target, "install")) == NULL)
|
||||||
|
return;
|
||||||
|
if((script = config_get(config, target, "script")) == NULL)
|
||||||
|
return;
|
||||||
|
fprintf(fp, "\t%s%s%s%s%s%s%s", script, " -p \"$(PREFIX)",
|
||||||
|
*path ? "/" : "", *path ? path : "", "\" install \"",
|
||||||
|
target, "\"\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)
|
||||||
{
|
{
|
||||||
@ -1782,6 +1831,8 @@ static int _write_uninstall(Configure * configure, FILE * fp)
|
|||||||
|
|
||||||
static void _uninstall_target_library(Config * config, FILE * fp,
|
static void _uninstall_target_library(Config * config, FILE * fp,
|
||||||
String const * target, String const * path);
|
String const * target, String const * path);
|
||||||
|
static void _uninstall_target_script(Config * config, FILE * fp,
|
||||||
|
String const * target, String const * path);
|
||||||
static int _uninstall_target(Config * config, FILE * fp, String const * target)
|
static int _uninstall_target(Config * config, FILE * fp, String const * target)
|
||||||
{
|
{
|
||||||
String const * type;
|
String const * type;
|
||||||
@ -1814,6 +1865,9 @@ static int _uninstall_target(Config * config, FILE * fp, String const * target)
|
|||||||
fprintf(fp, "\t%s%s/%s%s\n", rm_destdir, path, target,
|
fprintf(fp, "\t%s%s/%s%s\n", rm_destdir, path, target,
|
||||||
".so");
|
".so");
|
||||||
break;
|
break;
|
||||||
|
case TT_SCRIPT:
|
||||||
|
_uninstall_target_script(config, fp, target, path);
|
||||||
|
break;
|
||||||
case TT_UNKNOWN:
|
case TT_UNKNOWN:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1841,6 +1895,18 @@ static void _uninstall_target_library(Config * config, FILE * fp,
|
|||||||
fprintf(fp, format, rm_destdir, path, target, ".so\n");
|
fprintf(fp, format, rm_destdir, path, target, ".so\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _uninstall_target_script(Config * config, FILE * fp,
|
||||||
|
String const * target, String const * path)
|
||||||
|
{
|
||||||
|
String const * script;
|
||||||
|
|
||||||
|
if((script = config_get(config, target, "script")) == NULL)
|
||||||
|
return;
|
||||||
|
fprintf(fp, "\t%s%s%s%s%s%s%s", script, " -p \"$(PREFIX)",
|
||||||
|
*path ? "/" : "", *path ? path : "", "\" uninstall \"",
|
||||||
|
target, "\"\n");
|
||||||
|
}
|
||||||
|
|
||||||
static int _uninstall_include(Config * config, FILE * fp,
|
static int _uninstall_include(Config * config, FILE * fp,
|
||||||
String const * include)
|
String const * include)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2007 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Devel configure */
|
/* This file is part of DeforaOS Devel configure */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -14,7 +14,7 @@ install=$(BINDIR)
|
|||||||
depends=configure.h,makefile.h,../config.h
|
depends=configure.h,makefile.h,../config.h
|
||||||
|
|
||||||
[makefile.c]
|
[makefile.c]
|
||||||
depends=configure.h,settings.h
|
depends=configure.h,settings.h,../config.h
|
||||||
|
|
||||||
[settings.c]
|
[settings.c]
|
||||||
depends=settings.h
|
depends=settings.h
|
||||||
|
Loading…
Reference in New Issue
Block a user