Alexandre Julliard : winegcc:
Automatically add the correct lib paths when building inside the Wine
tree .
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jul 12 06:53:36 CDT 2006
Module: wine
Branch: master
Commit: 523e46debbe004ff8023d47d5b514811a7c76679
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=523e46debbe004ff8023d47d5b514811a7c76679
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Jul 11 21:32:36 2006 +0200
winegcc: Automatically add the correct lib paths when building inside the Wine tree.
---
Make.rules.in | 1 -
dlls/Makedll.rules.in | 6 +++---
dlls/Maketest.rules.in | 2 +-
programs/Makeprog.rules.in | 6 +++---
tools/winegcc/winegcc.c | 19 +++++++++++++------
5 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/Make.rules.in b/Make.rules.in
index 6255888..4facbe5 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -81,7 +81,6 @@ RCFLAGS = --nostdinc $(INCLUDES) $(
RC16FLAGS = -O res16 $(RCFLAGS)
LDPATH = @LDPATH@
DLLDIR = $(TOPOBJDIR)/dlls
-LIBDIR = $(TOPOBJDIR)/libs
LIBPORT = $(TOPOBJDIR)/libs/port/libwine_port.a
LIBWPP = $(TOPOBJDIR)/libs/wpp/libwpp.a
LIBWINE = -L$(TOPOBJDIR)/libs/wine -lwine
diff --git a/dlls/Makedll.rules.in b/dlls/Makedll.rules.in
index f3ff734..94425b7 100644
--- a/dlls/Makedll.rules.in
+++ b/dlls/Makedll.rules.in
@@ -19,7 +19,7 @@ MAINSPEC = $(BASEMODULE).spec
SPEC_DEF = lib$(BASEMODULE).def
WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
ALL_OBJS = @WIN16_FILES@ $(OBJS) $(RC_SRCS:.rc=.res)
-ALL_LIBS = -L$(LIBDIR) -lwine $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
+ALL_LIBS = $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
ALL_IMPORTS = $(DELAYIMPORTS) $(IMPORTS)
IMPLIB_OBJS = $(IMPLIB_SRCS:.c=.o)
STATICIMPLIB= $(IMPORTLIB:.def=.def.a)
@@ -32,12 +32,12 @@ all: $(MODULE)$(DLLEXT) $(SUBDIRS)
# Rules for .so files
$(MODULE).so: $(MAINSPEC) $(ALL_OBJS) Makefile.in
- $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(SUBSYSTEM:%=-Wb,--subsystem,%) $(BASEADDRESS:%=-Wl,--image-base,%) $(LDRPATH) -o $@ -L$(DLLDIR) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
+ $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(SUBSYSTEM:%=-Wb,--subsystem,%) $(BASEADDRESS:%=-Wl,--image-base,%) $(LDRPATH) -o $@ $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
# Rules for .dll files
$(MODULE): $(RCOBJS) $(OBJS) $(SPEC_DEF) Makefile.in
- $(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(DLL_LDPATH) $(ALL_IMPORTS:%=-l%) $(ALL_LIBS)
+ $(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(DLL_LDPATH) $(ALL_IMPORTS:%=-l%) $(LIBWINE) $(ALL_LIBS)
# Rules for import libraries
diff --git a/dlls/Maketest.rules.in b/dlls/Maketest.rules.in
index f1272c4..0250b66 100644
--- a/dlls/Maketest.rules.in
+++ b/dlls/Maketest.rules.in
@@ -33,7 +33,7 @@ all: $(TESTPROGRAM)
# Rules for .so main module
$(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
- $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) -L$(DLLDIR) -L$(LIBDIR) $(ALL_LIBS)
+ $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) $(ALL_LIBS)
# Rules for .exe main module
diff --git a/programs/Makeprog.rules.in b/programs/Makeprog.rules.in
index 019c726..6c15560 100644
--- a/programs/Makeprog.rules.in
+++ b/programs/Makeprog.rules.in
@@ -13,7 +13,7 @@ DLLFLAGS = @DLLFLAGS@
LDRPATH = @LDDLLRPATH@
DEFS = $(EXTRADEFS)
ALL_IMPORTS = $(DELAYIMPORTS) $(IMPORTS)
-ALL_LIBS = $(ALL_IMPORTS:%=-l%) -L$(LIBDIR) -lwine $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
+ALL_LIBS = $(ALL_IMPORTS:%=-l%) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
BASEMODULE = $(MODULE:.exe=)
RUNTESTFLAGS= -q -P wine -T $(TOPOBJDIR)
@@ -24,7 +24,7 @@ all: $(MODULE)$(DLLEXT) $(BASEMODULE)$(E
# Rules for .so main module
$(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
- $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild $(APPMODE) $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LDRPATH) -L$(DLLDIR) $(ALL_LIBS) $(DELAYIMPORTS:%=-Wb,-d%)
+ $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild $(APPMODE) $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LDRPATH) $(ALL_LIBS) $(DELAYIMPORTS:%=-Wb,-d%)
$(BASEMODULE): $(WINEWRAPPER)
$(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
@@ -32,7 +32,7 @@ # Rules for .so main module
# Rules for .exe main module
$(MODULE): $(OBJS) $(RCOBJS) Makefile.in
- $(CC) $(APPMODE) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
+ $(CC) $(APPMODE) $(OBJS) $(RCOBJS) -o $@ $(LIBWINE) $(ALL_LIBS)
# Rules for testing
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 07d0ac1..e31d93d 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -157,7 +157,7 @@ struct options
int gui_app;
int unicode_app;
int compile_only;
- int wine_mode;
+ const char* wine_objdir;
const char* output_name;
const char* image_base;
strarray* prefix;
@@ -260,7 +260,7 @@ #endif
if (opts->processor != proc_cpp)
{
#ifdef CC_FLAG_SHORT_WCHAR
- if (!opts->wine_mode && !opts->noshortwchar)
+ if (!opts->wine_objdir && !opts->noshortwchar)
{
strarray_add(comp_args, CC_FLAG_SHORT_WCHAR);
strarray_add(comp_args, "-DWINE_UNICODE_NATIVE");
@@ -346,7 +346,7 @@ #define SYS_INCLUDE "-isystem"
#else
#define SYS_INCLUDE "-I"
#endif
- if (!opts->wine_mode && !opts->nostdinc)
+ if (!opts->wine_objdir && !opts->nostdinc)
{
if (opts->use_msvcrt)
{
@@ -472,11 +472,16 @@ static void build(struct options* opts)
/* prepare the linking path */
lib_dirs = strarray_dup(opts->lib_dirs);
- if (!opts->wine_mode)
+ if (!opts->wine_objdir)
{
for ( j = 0; j < sizeof(stdlibpath)/sizeof(stdlibpath[0]); j++ )
strarray_add(lib_dirs, stdlibpath[j]);
}
+ else
+ {
+ strarray_add(lib_dirs, strmake("%s/dlls", opts->wine_objdir));
+ strarray_add(lib_dirs, strmake("%s/libs/wine", opts->wine_objdir));
+ }
/* mark the files with their appropriate type */
spec_file = lang = 0;
@@ -530,7 +535,7 @@ static void build(struct options* opts)
/* add the default libraries, if needed */
if (!opts->nostdlib && opts->use_msvcrt) add_library(lib_dirs, files, "msvcrt");
- if (!opts->wine_mode && !opts->nodefaultlibs)
+ if (!opts->wine_objdir && !opts->nodefaultlibs)
{
if (opts->gui_app)
{
@@ -870,7 +875,9 @@ #endif
str = strdup(option_arg);
if (strendswith(str, "/tools/winebuild"))
{
- opts.wine_mode = 1;
+ char *objdir = strdup(str);
+ objdir[strlen(objdir) - sizeof("/tools/winebuild") + 1] = 0;
+ opts.wine_objdir = objdir;
/* don't pass it to the compiler, this generates warnings */
raw_compiler_arg = raw_linker_arg = 0;
}
More information about the wine-cvs
mailing list