makefiles: Generate rules for building tool binaries.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2015-10-27 12:13:26 +09:00
parent 12111d8c3b
commit 7626728b56
13 changed files with 71 additions and 56 deletions

3
configure vendored
View File

@ -14940,7 +14940,8 @@ preloader_EXTRADEFS = $BUILTINFLAG
;;
esac
as_fn_append LOADER_RULES "
PROGRAMS = $loader_programs
EXTRA_TARGETS = $loader_programs
all: $loader_programs
"

View File

@ -2058,7 +2058,8 @@ preloader_EXTRADEFS = $BUILTINFLAG
;;
esac
AS_VAR_APPEND([LOADER_RULES],["
PROGRAMS = $loader_programs
EXTRA_TARGETS = $loader_programs
all: $loader_programs
"])
dnl **** Check for functions ****

View File

@ -45,7 +45,7 @@ C_SRCS = \
window.c \
winstation.c
PROGRAMS = wineserver wineserver-installed
EXTRA_TARGETS = wineserver wineserver-installed
MANPAGES = \
wineserver.de.UTF-8.man.in \
@ -54,6 +54,8 @@ MANPAGES = \
OBJS = $(C_SRCS:.c=.o)
all: $(EXTRA_TARGETS)
wineserver: $(OBJS)
$(CC) -o $@ $(OBJS) $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(EXTRALIBS) $(LIBS) $(LDRPATH_LOCAL)

View File

@ -1,5 +1,5 @@
PROGRAMS = \
make_xftmpl$(EXEEXT)
make_xftmpl
MANPAGES = \
winemaker.de.UTF-8.man.in \
@ -7,17 +7,13 @@ MANPAGES = \
winemaker.man.in
C_SRCS = \
make_xftmpl.c \
makedep.c
make_xftmpl.c
IN_SRCS = \
wineapploader.in
all: wineapploader
make_xftmpl$(EXEEXT): make_xftmpl.o
$(CC) $(CFLAGS) -o $@ make_xftmpl.o $(LIBPORT) $(LDFLAGS)
.PHONY: install install-dev uninstall
install install-dev:: install-man-pages

View File

@ -110,6 +110,7 @@ my %ignored_source_files = (
"dlls/wineps.drv/afm2c.c" => 1,
"dlls/wineps.drv/mkagl.c" => 1,
"programs/winetest/dist.rc" => 1,
"tools/makedep.c" => 1,
);
my (@linguas, @makefiles, %makefiles);

View File

@ -149,6 +149,7 @@ struct makefile
struct strarray vars;
struct strarray include_args;
struct strarray define_args;
struct strarray programs;
struct strarray appmode;
struct strarray imports;
struct strarray delayimports;
@ -1559,6 +1560,19 @@ static struct strarray get_expanded_make_var_array( struct makefile *make, const
}
/*******************************************************************
* file_local_var
*/
static char *file_local_var( const char *file, const char *name )
{
char *p, *var;
var = strmake( "%s_%s", file, name );
for (p = var; *p; p++) if (!isalnum( *p )) *p = '_';
return var;
}
/*******************************************************************
* set_make_variable
*/
@ -1763,7 +1777,7 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
struct strarray includes = empty_strarray;
struct strarray subdirs = empty_strarray;
struct strarray phony_targets = empty_strarray;
struct strarray all_targets = get_expanded_make_var_array( make, "PROGRAMS" );
struct strarray all_targets = 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] ));
@ -1793,7 +1807,7 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
strarray_add_uniq( &subdirs, subdir );
}
extradefs = get_expanded_make_var_array( make, strmake( "%s_EXTRADEFS", obj ));
extradefs = get_expanded_make_var_array( make, file_local_var( obj, "EXTRADEFS" ));
if (!strcmp( ext, "y" )) /* yacc file */
{
@ -2269,7 +2283,7 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
for (i = 0; i < make->imports.count; i++)
strarray_add( &all_libs, strmake( "-l%s", make->imports.str[i] ));
strarray_addall( &all_libs, get_expanded_make_var_array( make, "LIBS" ));
strarray_addall( &all_libs, libs );
strarray_add( &all_targets, strmake( "%s%s", testmodule, dll_ext ));
strarray_add( &clean_files, strmake( "%s%s", stripped, dll_ext ));
@ -2349,6 +2363,30 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
*testlist_files = strarray_replace_extension( &ok_files, ".ok", "" );
}
for (i = 0; i < make->programs.count; i++)
{
char *program = strmake( "%s%s", make->programs.str[i], exe_ext );
struct strarray all_libs = empty_strarray;
struct strarray objs = get_expanded_make_var_array( make,
file_local_var( make->programs.str[i], "OBJS" ));
if (!objs.count) objs = object_files;
output( "%s:", obj_dir_path( make, program ) );
output_filenames_obj_dir( make, objs );
output( "\n" );
output( "\t$(CC) -o $@" );
output_filenames_obj_dir( make, objs );
strarray_add( &all_libs, top_obj_dir_path( make, "libs/port/libwine_port.a" ));
strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" ));
strarray_addall( &all_libs, libs );
strarray_addall( &all_libs, get_expanded_make_var_array( make,
file_local_var( make->programs.str[i], "LDFLAGS" )));
output_filenames( all_libs );
output_filename( "$(LDFLAGS)" );
output( "\n" );
strarray_add( &all_targets, program );
}
if (all_targets.count)
{
output( "all:" );
@ -2632,6 +2670,7 @@ static void update_makefile( const char *path )
make->staticlib = get_expanded_make_variable( make, "STATICLIB" );
make->importlib = get_expanded_make_variable( make, "IMPORTLIB" );
make->programs = get_expanded_make_var_array( make, "PROGRAMS" );
make->appmode = get_expanded_make_var_array( make, "APPMODE" );
make->imports = get_expanded_make_var_array( make, "IMPORTS" );
make->delayimports = get_expanded_make_var_array( make, "DELAYIMPORTS" );
@ -2816,6 +2855,7 @@ int main( int argc, char *argv[] )
if (root_src_dir && !strcmp( root_src_dir, "." )) root_src_dir = NULL;
if (tools_dir && !strcmp( tools_dir, "." )) tools_dir = NULL;
if (!exe_ext) exe_ext = "";
if (!tools_ext) tools_ext = "";
if (!dll_prefix) dll_prefix = "";
if (!man_ext) man_ext = "3w";

View File

@ -1,9 +1,6 @@
PROGRAMS = sfnt2fon$(EXEEXT)
PROGRAMS = sfnt2fon
C_SRCS = sfnt2fon.c
EXTRAINCL = $(FREETYPE_CFLAGS)
EXTRALIBS = $(FREETYPE_LIBS)
sfnt2fon$(EXEEXT): sfnt2fon.o
$(CC) $(CFLAGS) -o $@ sfnt2fon.o $(LIBWINE_STATIC) $(LIBPORT) $(EXTRALIBS) $(LDFLAGS)
EXTRALIBS = $(FREETYPE_LIBS) $(LIBWINE_STATIC)

View File

@ -1,4 +1,4 @@
PROGRAMS = widl$(EXEEXT)
PROGRAMS = widl
MANPAGES = widl.man.in
C_SRCS = \
@ -21,14 +21,11 @@ BISON_SRCS = parser.y
widl_EXTRADEFS = -DDEFAULT_INCLUDE_DIR=\"${includedir}/windows/\"
OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o)
widl$(EXEEXT): $(OBJS) $(LIBWPP)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWPP) $(LIBPORT) $(LDFLAGS)
EXTRALIBS = $(LIBWPP)
.PHONY: install install-dev uninstall
install install-dev:: $(PROGRAMS) install-man-pages
install install-dev:: widl$(EXEEXT) install-man-pages
$(INSTALL_PROGRAM) widl$(EXEEXT) $(DESTDIR)$(bindir)/widl$(EXEEXT)
uninstall::

View File

@ -1,4 +1,4 @@
PROGRAMS = winebuild$(EXEEXT)
PROGRAMS = winebuild
MANPAGES = winebuild.man.in
C_SRCS = \
@ -12,14 +12,9 @@ C_SRCS = \
spec32.c \
utils.c
OBJS = $(C_SRCS:.c=.o)
winebuild$(EXEEXT): $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBPORT) $(LDFLAGS)
.PHONY: install install-dev uninstall
install install-dev:: $(PROGRAMS) install-man-pages
install install-dev:: winebuild$(EXEEXT) install-man-pages
$(INSTALL_PROGRAM) winebuild$(EXEEXT) $(DESTDIR)$(bindir)/winebuild$(EXEEXT)
uninstall::

View File

@ -1,4 +1,4 @@
PROGRAMS = winedump$(EXEEXT)
PROGRAMS = winedump
MANPAGES = winedump.man.in
C_SRCS = \
@ -23,14 +23,9 @@ C_SRCS = \
symbol.c \
tlb.c
OBJS = $(C_SRCS:.c=.o)
winedump$(EXEEXT): $(OBJS)
$(CC) $(CFLAGS) -o winedump$(EXEEXT) $(OBJS) $(LIBPORT) $(LDFLAGS)
.PHONY: install install-dev uninstall
install install-dev:: $(PROGRAMS) install-man-pages
install install-dev:: winedump$(EXEEXT) install-man-pages
$(INSTALL_PROGRAM) winedump$(EXEEXT) $(DESTDIR)$(bindir)/winedump$(EXEEXT)
$(INSTALL_SCRIPT) $(srcdir)/function_grep.pl $(DESTDIR)$(bindir)/function_grep.pl

View File

@ -1,7 +1,4 @@
PROGRAMS = \
winecpp$(EXEEXT) \
winegcc$(EXEEXT) \
wineg++$(EXEEXT)
PROGRAMS = winegcc
MANPAGES = winegcc.man.in
@ -19,15 +16,16 @@ winegcc_EXTRADEFS = \
-DLD="\"$(LD)\"" \
-DPRELINK="\"$(PRELINK)\""
winegcc$(EXEEXT): winegcc.o utils.o
$(CC) $(CFLAGS) -o $@ winegcc.o utils.o $(LIBPORT) $(LDFLAGS)
EXTRA_TARGETS = winecpp$(EXEEXT) wineg++$(EXEEXT)
all: $(EXTRA_TARGETS)
winecpp$(EXEEXT) wineg++$(EXEEXT): winegcc$(EXEEXT)
$(RM) $@ && $(LN_S) winegcc$(EXEEXT) $@
.PHONY: install install-dev uninstall
install install-dev:: $(PROGRAMS) install-man-pages
install install-dev:: winegcc$(EXEEXT) install-man-pages
$(INSTALL_PROGRAM) winegcc$(EXEEXT) $(DESTDIR)$(bindir)/winegcc$(EXEEXT)
cd $(DESTDIR)$(bindir) && $(RM) wineg++$(EXEEXT) && $(LN_S) winegcc$(EXEEXT) wineg++$(EXEEXT)
cd $(DESTDIR)$(bindir) && $(RM) winecpp$(EXEEXT) && $(LN_S) winegcc$(EXEEXT) winecpp$(EXEEXT)

View File

@ -1,6 +1,5 @@
PROGRAMS = wmc$(EXEEXT)
PROGRAMS = wmc
MANPAGES = wmc.man.in
ALL_LIBS = $(GETTEXTPO_LIBS) $(LIBWINE_STATIC) $(LIBPORT)
C_SRCS = \
lang.c \
@ -12,10 +11,7 @@ C_SRCS = \
BISON_SRCS = mcy.y
OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o)
wmc$(EXEEXT): $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(ALL_LIBS) $(LDFLAGS)
EXTRALIBS = $(GETTEXTPO_LIBS) $(LIBWINE_STATIC)
.PHONY: install install-dev uninstall

View File

@ -1,6 +1,5 @@
PROGRAMS = wrc$(EXEEXT)
PROGRAMS = wrc
MANPAGES = wrc.man.in
ALL_LIBS = $(GETTEXTPO_LIBS) $(LIBWPP) $(LIBWINE_STATIC) $(LIBPORT)
C_SRCS = \
dumpres.c \
@ -18,10 +17,7 @@ BISON_SRCS = parser.y
wrc_EXTRADEFS = -DINCLUDEDIR="\"${includedir}\""
OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o)
wrc$(EXEEXT): $(OBJS) $(LIBWPP)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(ALL_LIBS) $(LDFLAGS)
EXTRALIBS = $(GETTEXTPO_LIBS) $(LIBWPP) $(LIBWINE_STATIC)
.PHONY: install install-dev uninstall