winegcc: Automatically add the correct lib paths when building inside the Wine tree.
This commit is contained in:
parent
645cd6ff50
commit
523e46debb
|
@ -81,7 +81,6 @@ RCFLAGS = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)$(EXEEXT)
|
|||
# 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 @@ $(BASEMODULE): $(WINEWRAPPER)
|
|||
# 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
|
||||
|
||||
|
|
|
@ -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 @@ static void compile(struct options* opts, const char* lang)
|
|||
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 @@ static void compile(struct options* opts, const char* lang)
|
|||
#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 @@ int main(int argc, char **argv)
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue