makedep: Don't store install rules in the makefile object.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2015-11-10 12:03:52 +09:00
parent b4fc81bdf2
commit bf6af2825c
1 changed files with 44 additions and 38 deletions

View File

@ -122,6 +122,8 @@ struct strarray
static const struct strarray empty_strarray;
enum install_rules { INSTALL_LIB, INSTALL_DEV, NB_INSTALL_RULES };
/* variables common to all makefiles */
static struct strarray linguas;
static struct strarray dll_flags;
@ -157,8 +159,6 @@ struct makefile
struct strarray extradllflags;
struct strarray install_lib;
struct strarray install_dev;
struct strarray install_lib_rules;
struct strarray install_dev_rules;
struct list sources;
struct list includes;
const char *base_dir;
@ -1837,18 +1837,18 @@ static void get_dependencies( struct strarray *deps, struct incl_file *file, str
/*******************************************************************
* add_install_rule
*/
static void add_install_rule( struct makefile *make, const char *target,
const char *file, const char *dest )
static void add_install_rule( struct makefile *make, struct strarray *install_rules,
const char *target, const char *file, const char *dest )
{
if (strarray_exists( &make->install_lib, target ))
{
strarray_add( &make->install_lib_rules, file );
strarray_add( &make->install_lib_rules, dest );
strarray_add( &install_rules[INSTALL_LIB], file );
strarray_add( &install_rules[INSTALL_LIB], dest );
}
else if (strarray_exists( &make->install_dev, target ))
{
strarray_add( &make->install_dev_rules, file );
strarray_add( &make->install_dev_rules, dest );
strarray_add( &install_rules[INSTALL_DEV], file );
strarray_add( &install_rules[INSTALL_DEV], dest );
}
}
@ -1958,9 +1958,12 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
struct strarray subdirs = empty_strarray;
struct strarray phony_targets = empty_strarray;
struct strarray all_targets = empty_strarray;
struct strarray install_rules[NB_INSTALL_RULES];
char *ldrpath_local = get_expanded_make_variable( make, "LDRPATH_LOCAL" );
char *ldrpath_install = get_expanded_make_variable( make, "LDRPATH_INSTALL" );
for (i = 0; i < NB_INSTALL_RULES; i++) install_rules[i] = empty_strarray;
for (i = 0; i < linguas.count; i++)
strarray_add( &mo_files, strmake( "%s/%s.mo", top_obj_dir_path( make, "po" ), linguas.str[i] ));
@ -2019,11 +2022,11 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
tools_dir_path( make, "make_xftmpl" ), tools_ext, source->filename );
if (source->file->flags & FLAG_INSTALL)
{
strarray_add( &make->install_dev_rules, source->name );
strarray_add( &make->install_dev_rules,
strarray_add( &install_rules[INSTALL_DEV], source->name );
strarray_add( &install_rules[INSTALL_DEV],
strmake( "D$(includedir)/%s", get_include_install_path( source->name ) ));
strarray_add( &make->install_dev_rules, strmake( "%s.h", obj ));
strarray_add( &make->install_dev_rules,
strarray_add( &install_rules[INSTALL_DEV], strmake( "%s.h", obj ));
strarray_add( &install_rules[INSTALL_DEV],
strmake( "d$(includedir)/%s.h", get_include_install_path( obj ) ));
}
}
@ -2103,13 +2106,13 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
if (source->file->flags & FLAG_IDL_PROXY) strarray_add( &dlldata_files, source->name );
if (source->file->flags & FLAG_INSTALL)
{
strarray_add( &make->install_dev_rules, xstrdup( source->name ));
strarray_add( &make->install_dev_rules,
strarray_add( &install_rules[INSTALL_DEV], xstrdup( source->name ));
strarray_add( &install_rules[INSTALL_DEV],
strmake( "D$(includedir)/%s.idl", get_include_install_path( obj ) ));
if (source->file->flags & FLAG_IDL_HEADER)
{
strarray_add( &make->install_dev_rules, strmake( "%s.h", obj ));
strarray_add( &make->install_dev_rules,
strarray_add( &install_rules[INSTALL_DEV], strmake( "%s.h", obj ));
strarray_add( &install_rules[INSTALL_DEV],
strmake( "d$(includedir)/%s.h", get_include_install_path( obj ) ));
}
}
@ -2143,10 +2146,12 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
dir = strmake( "$(mandir)/%s/man%s", lang, section );
}
else dir = strmake( "$(mandir)/man%s", section );
add_install_rule( make, dest, xstrdup(obj), strmake( "d%s/%s.%s", dir, dest, section ));
add_install_rule( make, install_rules, dest, xstrdup(obj),
strmake( "d%s/%s.%s", dir, dest, section ));
symlinks = get_expanded_make_var_array( make, file_local_var( dest, "SYMLINKS" ));
for (i = 0; i < symlinks.count; i++)
add_install_rule( make, symlinks.str[i], strmake( "%s.%s", dest, section ),
add_install_rule( make, install_rules, symlinks.str[i],
strmake( "%s.%s", dest, section ),
strmake( "y%s/%s.%s", dir, symlinks.str[i], section ));
free( dest );
free( dir );
@ -2171,8 +2176,8 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
}
if (source->file->flags & FLAG_INSTALL)
{
strarray_add( &make->install_lib_rules, strmake( "%s.ttf", obj ));
strarray_add( &make->install_lib_rules, strmake( "D$(fontdir)/%s.ttf", obj ));
strarray_add( &install_rules[INSTALL_LIB], strmake( "%s.ttf", obj ));
strarray_add( &install_rules[INSTALL_LIB], strmake( "D$(fontdir)/%s.ttf", obj ));
}
if (source->file->flags & FLAG_SFD_FONTS)
{
@ -2187,8 +2192,8 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
output( "%s: %s %s\n", obj_dir_path( make, font ),
tools_path( make, "sfnt2fon" ), ttf_file );
output( "\t%s -o $@ %s %s\n", tools_path( make, "sfnt2fon" ), ttf_file, args );
strarray_add( &make->install_lib_rules, xstrdup(font) );
strarray_add( &make->install_lib_rules, strmake( "d$(fontdir)/%s", font ));
strarray_add( &install_rules[INSTALL_LIB], xstrdup(font) );
strarray_add( &install_rules[INSTALL_LIB], strmake( "d$(fontdir)/%s", font ));
}
}
}
@ -2218,8 +2223,8 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
}
else
{
strarray_add( &make->install_dev_rules, source->name );
strarray_add( &make->install_dev_rules,
strarray_add( &install_rules[INSTALL_DEV], source->name );
strarray_add( &install_rules[INSTALL_DEV],
strmake( "D$(includedir)/%s", get_include_install_path( source->name ) ));
}
}
@ -2341,16 +2346,16 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
{
strarray_add( &all_targets, strmake( "%s%s", make->module, dll_ext ));
strarray_add( &all_targets, strmake( "%s.fake", make->module ));
add_install_rule( make, make->module, strmake( "%s%s", make->module, dll_ext ),
add_install_rule( make, install_rules, make->module, strmake( "%s%s", make->module, dll_ext ),
strmake( "p$(dlldir)/%s%s", make->module, dll_ext ));
add_install_rule( make, make->module, strmake( "%s.fake", make->module ),
add_install_rule( make, install_rules, make->module, strmake( "%s.fake", make->module ),
strmake( "d$(fakedlldir)/%s", make->module ));
output( "%s%s %s.fake:", module_path, dll_ext, module_path );
}
else
{
strarray_add( &all_targets, make->module );
add_install_rule( make, make->module, make->module,
add_install_rule( make, install_rules, make->module, make->module,
strmake( "p$(%s)/%s", spec_file ? "dlldir" : "bindir", make->module ));
output( "%s:", module_path );
}
@ -2386,7 +2391,8 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
output_filenames( target_flags );
if (make->is_win16) output_filename( "-m16" );
output( "\n" );
add_install_rule( make, make->importlib, strmake( "lib%s.def", make->importlib ),
add_install_rule( make, install_rules, make->importlib,
strmake( "lib%s.def", make->importlib ),
strmake( "d$(dlldir)/lib%s.def", make->importlib ));
if (implib_objs.count)
{
@ -2399,7 +2405,8 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
output_filenames_obj_dir( make, implib_objs );
output( "\n" );
output( "\t$(RANLIB) $@\n" );
add_install_rule( make, make->importlib, strmake( "lib%s.def.a", make->importlib ),
add_install_rule( make, install_rules, make->importlib,
strmake( "lib%s.def.a", make->importlib ),
strmake( "d$(dlldir)/lib%s.def.a", make->importlib ));
}
}
@ -2413,7 +2420,8 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
output_filenames( target_flags );
output_filenames_obj_dir( make, implib_objs );
output( "\n" );
add_install_rule( make, make->importlib, strmake( "lib%s.a", make->importlib ),
add_install_rule( make, install_rules, make->importlib,
strmake( "lib%s.a", make->importlib ),
strmake( "d$(dlldir)/lib%s.a", make->importlib ));
}
if (crosstarget && !make->is_win16)
@ -2476,7 +2484,7 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
else if (*dll_ext)
{
char *binary = replace_extension( make->module, ".exe", "" );
add_install_rule( make, binary, tools_dir_path( make, "wineapploader" ),
add_install_rule( make, install_rules, binary, tools_dir_path( make, "wineapploader" ),
strmake( "s$(bindir)/%s", binary ));
}
}
@ -2648,15 +2656,15 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
strarray_addall( &all_targets, symlinks );
}
add_install_rule( make, program, program_installed ? program_installed : program,
add_install_rule( make, install_rules, program, program_installed ? program_installed : program,
strmake( "p$(bindir)/%s", program ));
for (j = 0; j < symlinks.count; j++)
add_install_rule( make, symlinks.str[j], program,
add_install_rule( make, install_rules, symlinks.str[j], program,
strmake( "y$(bindir)/%s%s", symlinks.str[j], exe_ext ));
}
for (i = 0; i < make->scripts.count; i++)
add_install_rule( make, make->scripts.str[i], make->scripts.str[i],
add_install_rule( make, install_rules, make->scripts.str[i], make->scripts.str[i],
strmake( "S$(bindir)/%s", make->scripts.str[i] ));
if (all_targets.count)
@ -2666,8 +2674,8 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
output( "\n" );
}
output_install_rules( make, make->install_lib_rules, "install-lib", &phony_targets );
output_install_rules( make, make->install_dev_rules, "install-dev", &phony_targets );
output_install_rules( make, install_rules[INSTALL_LIB], "install-lib", &phony_targets );
output_install_rules( make, install_rules[INSTALL_DEV], "install-dev", &phony_targets );
strarray_addall( &clean_files, object_files );
strarray_addall( &clean_files, crossobj_files );
@ -2964,8 +2972,6 @@ static void update_makefile( const char *path )
make->use_msvcrt = !strncmp( make->imports.str[i], "msvcr", 5 ) ||
!strcmp( make->imports.str[i], "ucrtbase" );
make->install_lib_rules = empty_strarray;
make->install_dev_rules = empty_strarray;
if (make->module && !make->install_lib.count) strarray_add( &make->install_lib, make->module );
make->include_args = empty_strarray;