diff --git a/configure b/configure index 508cb0b82e6..1dac6ce9ea0 100755 --- a/configure +++ b/configure @@ -14940,7 +14940,8 @@ preloader_EXTRADEFS = $BUILTINFLAG ;; esac as_fn_append LOADER_RULES " -PROGRAMS = $loader_programs +EXTRA_TARGETS = $loader_programs +all: $loader_programs " diff --git a/configure.ac b/configure.ac index 8bbb3f7b023..b2cd9324772 100644 --- a/configure.ac +++ b/configure.ac @@ -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 **** diff --git a/server/Makefile.in b/server/Makefile.in index 19a4facbd2d..e7fb6030575 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -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) diff --git a/tools/Makefile.in b/tools/Makefile.in index 0aecc9f80d4..2ed8179ad26 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -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 diff --git a/tools/make_makefiles b/tools/make_makefiles index 266f33a6da7..069d0ae9b7c 100755 --- a/tools/make_makefiles +++ b/tools/make_makefiles @@ -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); diff --git a/tools/makedep.c b/tools/makedep.c index 3c30a0c9ec7..8c5abde2940 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -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"; diff --git a/tools/sfnt2fon/Makefile.in b/tools/sfnt2fon/Makefile.in index a97515406dc..5a92d853aa4 100644 --- a/tools/sfnt2fon/Makefile.in +++ b/tools/sfnt2fon/Makefile.in @@ -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) diff --git a/tools/widl/Makefile.in b/tools/widl/Makefile.in index a57f54fb622..0c5595ee7af 100644 --- a/tools/widl/Makefile.in +++ b/tools/widl/Makefile.in @@ -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:: diff --git a/tools/winebuild/Makefile.in b/tools/winebuild/Makefile.in index f5f460302c3..39589027a51 100644 --- a/tools/winebuild/Makefile.in +++ b/tools/winebuild/Makefile.in @@ -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:: diff --git a/tools/winedump/Makefile.in b/tools/winedump/Makefile.in index 7b925c35072..dd36cff9d27 100644 --- a/tools/winedump/Makefile.in +++ b/tools/winedump/Makefile.in @@ -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 diff --git a/tools/winegcc/Makefile.in b/tools/winegcc/Makefile.in index 370a2e4b56e..3c0670beab5 100644 --- a/tools/winegcc/Makefile.in +++ b/tools/winegcc/Makefile.in @@ -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) diff --git a/tools/wmc/Makefile.in b/tools/wmc/Makefile.in index c163e34302c..12a917d2908 100644 --- a/tools/wmc/Makefile.in +++ b/tools/wmc/Makefile.in @@ -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 diff --git a/tools/wrc/Makefile.in b/tools/wrc/Makefile.in index 056de1cb343..b6f80936776 100644 --- a/tools/wrc/Makefile.in +++ b/tools/wrc/Makefile.in @@ -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