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 esac
as_fn_append LOADER_RULES " 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 esac
AS_VAR_APPEND([LOADER_RULES],[" AS_VAR_APPEND([LOADER_RULES],["
PROGRAMS = $loader_programs EXTRA_TARGETS = $loader_programs
all: $loader_programs
"]) "])
dnl **** Check for functions **** dnl **** Check for functions ****

View File

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

View File

@ -1,5 +1,5 @@
PROGRAMS = \ PROGRAMS = \
make_xftmpl$(EXEEXT) make_xftmpl
MANPAGES = \ MANPAGES = \
winemaker.de.UTF-8.man.in \ winemaker.de.UTF-8.man.in \
@ -7,17 +7,13 @@ MANPAGES = \
winemaker.man.in winemaker.man.in
C_SRCS = \ C_SRCS = \
make_xftmpl.c \ make_xftmpl.c
makedep.c
IN_SRCS = \ IN_SRCS = \
wineapploader.in wineapploader.in
all: wineapploader all: wineapploader
make_xftmpl$(EXEEXT): make_xftmpl.o
$(CC) $(CFLAGS) -o $@ make_xftmpl.o $(LIBPORT) $(LDFLAGS)
.PHONY: install install-dev uninstall .PHONY: install install-dev uninstall
install install-dev:: install-man-pages 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/afm2c.c" => 1,
"dlls/wineps.drv/mkagl.c" => 1, "dlls/wineps.drv/mkagl.c" => 1,
"programs/winetest/dist.rc" => 1, "programs/winetest/dist.rc" => 1,
"tools/makedep.c" => 1,
); );
my (@linguas, @makefiles, %makefiles); my (@linguas, @makefiles, %makefiles);

View File

@ -149,6 +149,7 @@ struct makefile
struct strarray vars; struct strarray vars;
struct strarray include_args; struct strarray include_args;
struct strarray define_args; struct strarray define_args;
struct strarray programs;
struct strarray appmode; struct strarray appmode;
struct strarray imports; struct strarray imports;
struct strarray delayimports; 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 * 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 includes = empty_strarray;
struct strarray subdirs = empty_strarray; struct strarray subdirs = empty_strarray;
struct strarray phony_targets = 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++) for (i = 0; i < linguas.count; i++)
strarray_add( &mo_files, strmake( "%s/%s.mo", top_obj_dir_path( make, "po" ), linguas.str[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 ); 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 */ 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++) for (i = 0; i < make->imports.count; i++)
strarray_add( &all_libs, strmake( "-l%s", make->imports.str[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( &all_targets, strmake( "%s%s", testmodule, dll_ext ));
strarray_add( &clean_files, strmake( "%s%s", stripped, 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", "" ); *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) if (all_targets.count)
{ {
output( "all:" ); output( "all:" );
@ -2632,6 +2670,7 @@ static void update_makefile( const char *path )
make->staticlib = get_expanded_make_variable( make, "STATICLIB" ); make->staticlib = get_expanded_make_variable( make, "STATICLIB" );
make->importlib = get_expanded_make_variable( make, "IMPORTLIB" ); 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->appmode = get_expanded_make_var_array( make, "APPMODE" );
make->imports = get_expanded_make_var_array( make, "IMPORTS" ); make->imports = get_expanded_make_var_array( make, "IMPORTS" );
make->delayimports = get_expanded_make_var_array( make, "DELAYIMPORTS" ); 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 (root_src_dir && !strcmp( root_src_dir, "." )) root_src_dir = NULL;
if (tools_dir && !strcmp( tools_dir, "." )) tools_dir = NULL; if (tools_dir && !strcmp( tools_dir, "." )) tools_dir = NULL;
if (!exe_ext) exe_ext = "";
if (!tools_ext) tools_ext = ""; if (!tools_ext) tools_ext = "";
if (!dll_prefix) dll_prefix = ""; if (!dll_prefix) dll_prefix = "";
if (!man_ext) man_ext = "3w"; if (!man_ext) man_ext = "3w";

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,4 @@
PROGRAMS = \ PROGRAMS = winegcc
winecpp$(EXEEXT) \
winegcc$(EXEEXT) \
wineg++$(EXEEXT)
MANPAGES = winegcc.man.in MANPAGES = winegcc.man.in
@ -19,15 +16,16 @@ winegcc_EXTRADEFS = \
-DLD="\"$(LD)\"" \ -DLD="\"$(LD)\"" \
-DPRELINK="\"$(PRELINK)\"" -DPRELINK="\"$(PRELINK)\""
winegcc$(EXEEXT): winegcc.o utils.o EXTRA_TARGETS = winecpp$(EXEEXT) wineg++$(EXEEXT)
$(CC) $(CFLAGS) -o $@ winegcc.o utils.o $(LIBPORT) $(LDFLAGS)
all: $(EXTRA_TARGETS)
winecpp$(EXEEXT) wineg++$(EXEEXT): winegcc$(EXEEXT) winecpp$(EXEEXT) wineg++$(EXEEXT): winegcc$(EXEEXT)
$(RM) $@ && $(LN_S) winegcc$(EXEEXT) $@ $(RM) $@ && $(LN_S) winegcc$(EXEEXT) $@
.PHONY: install install-dev uninstall .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) $(INSTALL_PROGRAM) winegcc$(EXEEXT) $(DESTDIR)$(bindir)/winegcc$(EXEEXT)
cd $(DESTDIR)$(bindir) && $(RM) wineg++$(EXEEXT) && $(LN_S) winegcc$(EXEEXT) wineg++$(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) 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 MANPAGES = wmc.man.in
ALL_LIBS = $(GETTEXTPO_LIBS) $(LIBWINE_STATIC) $(LIBPORT)
C_SRCS = \ C_SRCS = \
lang.c \ lang.c \
@ -12,10 +11,7 @@ C_SRCS = \
BISON_SRCS = mcy.y BISON_SRCS = mcy.y
OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) EXTRALIBS = $(GETTEXTPO_LIBS) $(LIBWINE_STATIC)
wmc$(EXEEXT): $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(ALL_LIBS) $(LDFLAGS)
.PHONY: install install-dev uninstall .PHONY: install install-dev uninstall

View File

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