Alexandre Julliard : makefiles: Generate rules for installing symlinks.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Oct 29 09:32:12 CDT 2015
Module: wine
Branch: master
Commit: 356e46a1ef9f866f4a548674b4811a98d1b1847c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=356e46a1ef9f866f4a548674b4811a98d1b1847c
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Oct 29 18:06:35 2015 +0900
makefiles: Generate rules for installing symlinks.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/makedep.c | 23 ++++++++++++++++++++++-
tools/winegcc/Makefile.in | 21 +++------------------
2 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c
index ffd286f..30bbc3e 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -1831,6 +1831,9 @@ static void output_install_rules( struct makefile *make, struct strarray files,
output( "\t%s $(INSTALL_SCRIPT_FLAGS) %s $(DESTDIR)%s\n",
install_sh, src_dir_path( make, file ), dest + 1 );
break;
+ case 'y': /* symlink */
+ output( "\t$(RM) $(DESTDIR)%s && $(LN_S) %s $(DESTDIR)%s\n", dest + 1, file, dest + 1 );
+ break;
default:
assert(0);
}
@@ -1853,7 +1856,7 @@ static void output_install_rules( struct makefile *make, struct strarray files,
static struct strarray output_sources( struct makefile *make, struct strarray *testlist_files )
{
struct incl_file *source;
- unsigned int i;
+ unsigned int i, j;
struct strarray object_files = empty_strarray;
struct strarray crossobj_files = empty_strarray;
struct strarray res_files = empty_strarray;
@@ -2018,6 +2021,7 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
{
if (strendswith( obj, ".man" ) && source->file->args)
{
+ struct strarray symlinks;
char *dir, *dest = replace_extension( obj, ".man", "" );
char *lang = strchr( dest, '.' );
char *section = source->file->args;
@@ -2028,6 +2032,10 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
}
else dir = strmake( "$(mandir)/man%s", section );
add_install_rule( make, dest, xstrdup(obj), strmake( "d%s/%s.%s", dir, dest, section ));
+ symlinks = get_expanded_make_var_array( make, file_local_var( dest, "SYMLINKS" ));
+ for (j = 0; j < symlinks.count; j++)
+ add_install_rule( make, symlinks.str[j], strmake( "%s.%s", dest, section ),
+ strmake( "y%s/%s.%s", dir, symlinks.str[j], section ));
free( dest );
free( dir );
strarray_add( &all_targets, xstrdup(obj) );
@@ -2447,6 +2455,8 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
struct strarray all_libs = empty_strarray;
struct strarray objs = get_expanded_make_var_array( make,
file_local_var( make->programs.str[i], "OBJS" ));
+ struct strarray symlinks = get_expanded_make_var_array( make,
+ file_local_var( make->programs.str[i], "SYMLINKS" ));
if (!objs.count) objs = object_files;
output( "%s:", obj_dir_path( make, program ) );
@@ -2485,8 +2495,19 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
output( "\n" );
strarray_add( &all_targets, program );
+ if (symlinks.count)
+ {
+ output_filenames_obj_dir( make, symlinks );
+ output( ": %s\n", obj_dir_path( make, program ));
+ output( "\t$(RM) $@ && $(LN_S) %s $@\n", obj_dir_path( make, program ));
+ strarray_addall( &all_targets, symlinks );
+ }
+
add_install_rule( make, 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,
+ strmake( "y$(bindir)/%s%s", symlinks.str[j], exe_ext ));
}
for (i = 0; i < make->scripts.count; i++)
diff --git a/tools/winegcc/Makefile.in b/tools/winegcc/Makefile.in
index 1a3b2a7..daeb91b 100644
--- a/tools/winegcc/Makefile.in
+++ b/tools/winegcc/Makefile.in
@@ -2,6 +2,8 @@ PROGRAMS = winegcc
MANPAGES = winegcc.man.in
+winegcc_SYMLINKS = winecpp wineg++
+
C_SRCS = \
utils.c \
winegcc.c
@@ -16,21 +18,4 @@ winegcc_EXTRADEFS = \
-DLD="\"$(LD)\"" \
-DPRELINK="\"$(PRELINK)\""
-INSTALL_DEV = $(PROGRAMS)
-
-EXTRA_TARGETS = winecpp$(EXEEXT) wineg++$(EXEEXT)
-
-all: $(EXTRA_TARGETS)
-
-winecpp$(EXEEXT) wineg++$(EXEEXT): winegcc$(EXEEXT)
- $(RM) $@ && $(LN_S) winegcc$(EXEEXT) $@
-
-install install-dev::
- cd $(DESTDIR)$(bindir) && $(RM) wineg++$(EXEEXT) && $(LN_S) winegcc$(EXEEXT) wineg++$(EXEEXT)
- cd $(DESTDIR)$(bindir) && $(RM) winecpp$(EXEEXT) && $(LN_S) winegcc$(EXEEXT) winecpp$(EXEEXT)
- cd $(DESTDIR)$(mandir)/man$(prog_manext) && $(RM) wineg++.$(prog_manext) && $(LN_S) winegcc.$(prog_manext) wineg++.$(prog_manext)
- cd $(DESTDIR)$(mandir)/man$(prog_manext) && $(RM) winecpp.$(prog_manext) && $(LN_S) winegcc.$(prog_manext) winecpp.$(prog_manext)
-
-uninstall::
- $(RM) $(DESTDIR)$(bindir)/wineg++$(EXEEXT) $(DESTDIR)$(bindir)/winecpp$(EXEEXT)
- $(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/wineg++.$(prog_manext) $(DESTDIR)$(mandir)/man$(prog_manext)/winecpp.$(prog_manext)
+INSTALL_DEV = $(PROGRAMS) $(winegcc_SYMLINKS)
More information about the wine-cvs
mailing list