makefiles: Automatically output appropriate target flags.

This commit is contained in:
Alexandre Julliard 2014-01-01 21:38:30 +01:00
parent e9afeb2a50
commit b192879597
10 changed files with 24 additions and 19 deletions

View File

@ -14,7 +14,7 @@
DEFS = -D__WINESRC__ $(EXTRADEFS)
ALLCFLAGS = $(DEFS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
IDLFLAGS = $(DEFS) $(EXTRAIDLFLAGS)
RCFLAGS = --nostdinc $(PORCFLAGS) $(TARGETFLAGS) $(DEFS) $(EXTRARCFLAGS)
RCFLAGS = --nostdinc $(PORCFLAGS) $(DEFS)
OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(OBJC_SRCS:.m=.o) \
$(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)

View File

@ -65,8 +65,8 @@ LIBPORT = $(top_builddir)/libs/port/libwine_port.a
LIBWPP = $(top_builddir)/libs/wpp/libwpp.a
LIBWINE = -L$(top_builddir)/libs/wine -lwine
LIBWINE_STATIC = $(top_builddir)/libs/wine/libwine_static.a
WINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc $(TARGETFLAGS) -B$(TOOLSDIR)/tools/winebuild --sysroot=$(top_builddir) @UNWINDFLAGS@
CROSSWINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc $(CROSSTARGET:%=-b %) -B$(TOOLSDIR)/tools/winebuild --sysroot=$(top_builddir) --lib-suffix=.cross.a
WINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc -B$(TOOLSDIR)/tools/winebuild --sysroot=$(top_builddir) @UNWINDFLAGS@
CROSSWINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc -B$(TOOLSDIR)/tools/winebuild --sysroot=$(top_builddir) --lib-suffix=.cross.a
SED_CMD = LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' -e 's,@PACKAGE_VERSION\@,@PACKAGE_VERSION@,g'
LDRPATH_INSTALL = @LDRPATH_INSTALL@
LDRPATH_LOCAL = @LDRPATH_LOCAL@

View File

@ -2,7 +2,6 @@ MODULE = display.drv16
IMPORTS = user32
EXTRADLLFLAGS = -m16
EXTRARCFLAGS = -m16
C_SRCS = display.c

View File

@ -2,7 +2,6 @@ MODULE = gdi.exe16
IMPORTS = user32 advapi32 gdi32
EXTRADLLFLAGS = -m16 -Wb,--main-module,gdi32.dll,--heap,65520
EXTRARCFLAGS = -m16
C_SRCS = \
bidi.c \

View File

@ -3,7 +3,6 @@ IMPORTLIB = kernel
IMPORTS = winecrt0 kernel32 ntdll
DELAYIMPORTS = ddraw dsound user32
EXTRADLLFLAGS = -m16 -nodefaultlibs -Wb,--dll-name,kernel
EXTRARCFLAGS = -m16
C_SRCS = \
atom.c \

View File

@ -2,7 +2,6 @@ MODULE = mouse.drv16
IMPORTS = user32
EXTRADLLFLAGS = -m16
EXTRARCFLAGS = -m16
C_SRCS = mouse.c

View File

@ -1,7 +1,6 @@
MODULE = ole2nls.dll16
EXTRADLLFLAGS = -m16 -Wb,--main-module,ole32.dll
EXTRARCFLAGS = -m16
C_SRCS = ole2nls.c

View File

@ -2,7 +2,6 @@ MODULE = shell.dll16
IMPORTS = shell32 user32 gdi32 advapi32
EXTRADLLFLAGS = -m16 -Wb,--main-module,shell32.dll
EXTRARCFLAGS = -m16
C_SRCS = shell.c

View File

@ -1,7 +1,6 @@
MODULE = user.exe16
IMPORTS = mpr user32 gdi32
EXTRADLLFLAGS = -m16 -Wb,--main-module,user32.dll,--heap,65520
EXTRARCFLAGS = -m16
C_SRCS = \
bidi.c \

View File

@ -1361,7 +1361,7 @@ static void output_include( struct incl_file *pFile, struct incl_file *owner )
static struct strarray output_sources(void)
{
struct incl_file *source;
int i;
int i, is_win16 = 0;
const char *dllext = ".so";
struct strarray object_files = empty_strarray;
struct strarray crossobj_files = empty_strarray;
@ -1379,7 +1379,9 @@ static struct strarray output_sources(void)
struct strarray dllflags = get_expanded_make_var_array( "DLLFLAGS" );
struct strarray imports = get_expanded_make_var_array( "IMPORTS" );
struct strarray all_targets = get_expanded_make_var_array( "PROGRAMS" );
struct strarray targetflags = get_expanded_make_var_array( "TARGETFLAGS" );
struct strarray delayimports = get_expanded_make_var_array( "DELAYIMPORTS" );
struct strarray extradllflags = get_expanded_make_var_array( "EXTRADLLFLAGS" );
char *module = get_expanded_make_variable( "MODULE" );
char *exeext = get_expanded_make_variable( "EXEEXT" );
char *testdll = get_expanded_make_variable( "TESTDLL" );
@ -1389,6 +1391,7 @@ static struct strarray output_sources(void)
if (exeext && !strcmp( exeext, ".exe" )) dllext = "";
if (module && strendswith( module, ".a" )) staticlib = module;
for (i = 0; i < extradllflags.count; i++) if (!strcmp( extradllflags.str[i], "-m16" )) is_win16 = 1;
strarray_add( &includes, "-I." );
if (src_dir) strarray_add( &includes, strmake( "-I%s", src_dir ));
@ -1457,6 +1460,8 @@ static struct strarray output_sources(void)
output( "%s.res: $(WRC) $(ALL_MO_FILES) %s\n", obj, sourcedep );
output( "\t$(WRC) -o $@ %s", source->filename );
output_filenames( includes );
if (is_win16) output_filename( "-m16" );
else output_filenames( targetflags );
output_filename( "$(RCFLAGS)" );
output( "\n" );
output( "%s.res rsrc.pot:", obj );
@ -1467,6 +1472,8 @@ static struct strarray output_sources(void)
output( "%s.res: $(WRC) %s\n", obj, sourcedep );
output( "\t$(WRC) -o $@ %s", source->filename );
output_filenames( includes );
if (is_win16) output_filename( "-m16" );
else output_filenames( targetflags );
output_filename( "$(RCFLAGS)" );
output( "\n" );
output( "%s.res:", obj );
@ -1502,7 +1509,7 @@ static struct strarray output_sources(void)
output( ": $(WIDL)\n" );
output( "\t$(WIDL) -o $@ %s", source->filename );
output_filenames( includes );
output_filename( "$(TARGETFLAGS)" );
output_filenames( targetflags );
output_filename( "$(IDLFLAGS)" );
output( "\n" );
output_filenames( targets );
@ -1621,6 +1628,8 @@ static struct strarray output_sources(void)
output( "\n" );
output( "\t$(WRC) -O pot -o $@" );
output_filenames( includes );
if (is_win16) output_filename( "-m16" );
else output_filenames( targetflags );
output_filename( "$(RCFLAGS)" );
output_filenames( po_files );
output( "\n" );
@ -1648,7 +1657,6 @@ static struct strarray output_sources(void)
if (module && !staticlib)
{
int is_win16 = strendswith( module, "16" );
char *importlib = get_expanded_make_variable( "IMPORTLIB" );
struct strarray all_libs = empty_strarray;
char *spec_file = appmode ? NULL : replace_extension( module, ".dll", ".spec" );
@ -1681,10 +1689,11 @@ static struct strarray output_sources(void)
output_filenames( res_files );
output( "\n" );
output( "\t$(WINEGCC) -o $@" );
output_filenames( targetflags );
if (spec_file)
{
output( " -shared %s", spec_file );
output_filenames( get_expanded_make_var_array( "EXTRADLLFLAGS" ));
output_filenames( extradllflags );
}
else output_filename( appmode );
output_filenames( object_files );
@ -1700,7 +1709,7 @@ static struct strarray output_sources(void)
strarray_add( &clean_files, strmake( "lib%s.def", importlib ));
output( "lib%s.def: %s\n", importlib, spec_file );
output( "\t$(WINEBUILD) -w --def -o $@ --export %s", spec_file );
output_filenames( get_expanded_make_var_array( "TARGETFLAGS" ));
output_filenames( targetflags );
if (is_win16) output_filename( "-m16" );
output( "\n" );
if (implib_objs.count)
@ -1723,7 +1732,7 @@ static struct strarray output_sources(void)
output_filenames( implib_objs );
output( "\n" );
output( "\t$(WINEBUILD) -w --implib -o $@ --export %s", spec_file );
output_filenames( get_expanded_make_var_array( "TARGETFLAGS" ));
output_filenames( targetflags );
output_filenames( implib_objs );
output( "\n" );
}
@ -1816,6 +1825,7 @@ static struct strarray output_sources(void)
strarray_add( &clean_files, strmake( "%s%s", stripped, dllext ));
output( "%s%s:\n", testmodule, dllext );
output( "\t$(WINEGCC) -o $@" );
output_filenames( targetflags );
if (appmode) output_filename( appmode );
output_filenames( object_files );
output_filenames( res_files );
@ -1823,7 +1833,9 @@ static struct strarray output_sources(void)
output_filename( "$(LDFLAGS)" );
output( "\n" );
output( "%s%s:\n", stripped, dllext );
output( "\t$(WINEGCC) -s -o $@ -Wb,-F,%s", testmodule );
output( "\t$(WINEGCC) -s -o $@" );
output_filenames( targetflags );
output_filename( strmake( "-Wb,-F,%s", testmodule ));
if (appmode) output_filename( appmode );
output_filenames( object_files );
output_filenames( res_files );
@ -1840,7 +1852,7 @@ static struct strarray output_sources(void)
char *testres = replace_extension( testdll, ".dll", "_test.res" );
output( "all: %s/programs/winetest/%s\n", top_obj_dir, testres );
output( "%s/programs/winetest/%s: %s%s\n", top_obj_dir, testres, stripped, dllext );
output( "\techo \"%s TESTRES \\\"%s%s\\\"\" | $(WRC) $(RCFLAGS) -o $@\n",
output( "\techo \"%s TESTRES \\\"%s%s\\\"\" | $(WRC) -o $@\n",
testmodule, stripped, dllext );
}
@ -1854,7 +1866,7 @@ static struct strarray output_sources(void)
output_filenames( crossobj_files );
output_filenames( res_files );
output( "\n" );
output( "\t$(CROSSWINEGCC) -o $@" );
output( "\t$(CROSSWINEGCC) -o $@ -b %s", crosstarget );
output_filenames( crossobj_files );
output_filenames( res_files );
output_filenames( all_libs );