makefiles: Build programs that link against libwine twice with appropriate rpaths.

One rpath is for installing and one is for running inside the build tree.
This commit is contained in:
Alexandre Julliard 2007-06-20 20:03:30 +02:00
parent 4906ffaa5b
commit 1f11333c7b
9 changed files with 76 additions and 33 deletions

7
.gitignore vendored
View File

@ -744,9 +744,13 @@ libs/wpp/ppy.tab.c
libs/wpp/ppy.tab.h
loader/wine
loader/wine-glibc
loader/wine-glibc-installed
loader/wine-kthread
loader/wine-kthread-installed
loader/wine-preloader
loader/wine-preloader-installed
loader/wine-pthread
loader/wine-pthread-installed
loader/wine.man
programs/Makeprog.rules
programs/clock/clock
@ -912,6 +916,7 @@ programs/wordpad/wordpad.ico
programs/xcopy/rsrc.res
programs/xcopy/xcopy
server/wineserver
server/wineserver-installed
server/wineserver.man
tools/bin2res
tools/fnt2bdf
@ -939,9 +944,11 @@ tools/wineprefixcreate.man
tools/wmc/mcy.tab.c
tools/wmc/mcy.tab.h
tools/wmc/wmc
tools/wmc/wmc-installed
tools/wmc/wmc.man
tools/wrc/parser.tab.c
tools/wrc/parser.tab.h
tools/wrc/parser.yy.c
tools/wrc/wrc
tools/wrc/wrc-installed
tools/wrc/wrc.man

View File

@ -83,7 +83,8 @@ DLLDIR = $(TOPOBJDIR)/dlls
LIBPORT = $(TOPOBJDIR)/libs/port/libwine_port.a
LIBWPP = $(TOPOBJDIR)/libs/wpp/libwpp.a
LIBWINE = -L$(TOPOBJDIR)/libs/wine -lwine
LIBWINE_LDFLAGS = @LIBWINE_LDFLAGS@ $(LIBWINE)
LDRPATH_INSTALL = @LDRPATH_INSTALL@
LDRPATH_LOCAL = @LDRPATH_LOCAL@
@SET_MAKE@

19
configure vendored
View File

@ -744,7 +744,8 @@ LDSHARED
LDDLLFLAGS
LIBEXT
IMPLIBEXT
LIBWINE_LDFLAGS
LDRPATH_INSTALL
LDRPATH_LOCAL
DLLTOOL
DLLWRAP
MINGWAR
@ -12850,7 +12851,9 @@ LIBEXT="so"
IMPLIBEXT="def"
LIBWINE_LDFLAGS=""
LDRPATH_INSTALL=""
LDRPATH_LOCAL=""
case $host_os in
@ -13160,6 +13163,7 @@ fi
LIBWINE_LDFLAGS="-multiply_defined suppress"
LDSHARED="\$(CC) -dynamiclib"
STRIP="$STRIP -u -r"
LDRPATH_LOCAL="&& install_name_tool -change @executable_path/\`\$(RELPATH) \$(bindir) \$(libdir)\`/libwine.1.dylib @executable_path/\$(TOPOBJDIR)/libs/wine/libwine.1.dylib \$@ || \$(RM) \$@"
COREFOUNDATIONLIB="-framework CoreFoundation"
IOKITLIB="-framework IOKit -framework CoreFoundation"
@ -13650,7 +13654,8 @@ ac_res=`eval echo '${'$as_ac_var'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
LIBWINE_LDFLAGS="-Wl,--rpath,\\\$\$ORIGIN/\`\$(RELPATH) \$(bindir) \$(libdir)\`"
LDRPATH_INSTALL="-Wl,--rpath,\\\$\$ORIGIN/\`\$(RELPATH) \$(bindir) \$(libdir)\`"
LDRPATH_LOCAL="-Wl,--rpath,\\\$\$ORIGIN/\$(TOPOBJDIR)/libs/wine"
else
as_ac_var=`echo "ac_cv_cflags_-fPIC -Wl,-R,\$ORIGIN/../lib" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking whether the compiler supports -fPIC -Wl,-R,\$ORIGIN/../lib" >&5
@ -13709,7 +13714,8 @@ ac_res=`eval echo '${'$as_ac_var'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
LIBWINE_LDFLAGS="-Wl,-R,\\\$\$ORIGIN/\`\$(RELPATH) \$(bindir) \$(libdir)\`"
LDRPATH_INSTALL="-Wl,-R,\\\$\$ORIGIN/\`\$(RELPATH) \$(bindir) \$(libdir)\`"
LDRPATH_LOCAL="-Wl,-R,\\\$\$ORIGIN/\$(TOPOBJDIR)/libs/wine"
fi
fi
@ -22222,7 +22228,8 @@ LDSHARED!$LDSHARED$ac_delim
LDDLLFLAGS!$LDDLLFLAGS$ac_delim
LIBEXT!$LIBEXT$ac_delim
IMPLIBEXT!$IMPLIBEXT$ac_delim
LIBWINE_LDFLAGS!$LIBWINE_LDFLAGS$ac_delim
LDRPATH_INSTALL!$LDRPATH_INSTALL$ac_delim
LDRPATH_LOCAL!$LDRPATH_LOCAL$ac_delim
DLLTOOL!$DLLTOOL$ac_delim
DLLWRAP!$DLLWRAP$ac_delim
MINGWAR!$MINGWAR$ac_delim
@ -22248,7 +22255,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 72; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View File

@ -915,7 +915,8 @@ AC_SUBST(LDSHARED,"")
AC_SUBST(LDDLLFLAGS,"")
AC_SUBST(LIBEXT,"so")
AC_SUBST(IMPLIBEXT,"def")
AC_SUBST(LIBWINE_LDFLAGS,"")
AC_SUBST(LDRPATH_INSTALL,"")
AC_SUBST(LDRPATH_LOCAL,"")
case $host_os in
cygwin*|mingw32*)
@ -941,6 +942,7 @@ case $host_os in
LIBWINE_LDFLAGS="-multiply_defined suppress"
LDSHARED="\$(CC) -dynamiclib"
STRIP="$STRIP -u -r"
LDRPATH_LOCAL="&& install_name_tool -change @executable_path/\`\$(RELPATH) \$(bindir) \$(libdir)\`/libwine.1.dylib @executable_path/\$(TOPOBJDIR)/libs/wine/libwine.1.dylib \$@ || \$(RM) \$@"
dnl declare needed frameworks
AC_SUBST(COREFOUNDATIONLIB,"-framework CoreFoundation")
AC_SUBST(IOKITLIB,"-framework IOKit -framework CoreFoundation")
@ -996,9 +998,11 @@ case $host_os in
[AC_SUBST(LDEXECFLAGS,["-Wl,--export-dynamic"])])
WINE_TRY_CFLAGS([-fPIC -Wl,--rpath,\$ORIGIN/../lib],
[LIBWINE_LDFLAGS="-Wl,--rpath,\\\$\$ORIGIN/\`\$(RELPATH) \$(bindir) \$(libdir)\`"],
[LDRPATH_INSTALL="-Wl,--rpath,\\\$\$ORIGIN/\`\$(RELPATH) \$(bindir) \$(libdir)\`"
LDRPATH_LOCAL="-Wl,--rpath,\\\$\$ORIGIN/\$(TOPOBJDIR)/libs/wine"],
[WINE_TRY_CFLAGS([-fPIC -Wl,-R,\$ORIGIN/../lib],
[LIBWINE_LDFLAGS="-Wl,-R,\\\$\$ORIGIN/\`\$(RELPATH) \$(bindir) \$(libdir)\`"])])
[LDRPATH_INSTALL="-Wl,-R,\\\$\$ORIGIN/\`\$(RELPATH) \$(bindir) \$(libdir)\`"
LDRPATH_LOCAL="-Wl,-R,\\\$\$ORIGIN/\$(TOPOBJDIR)/libs/wine"])])
case $host_cpu in
*i[[3456789]]86* | x86_64)

View File

@ -21,15 +21,19 @@ WINE_BINARIES = $(MAIN_BINARY) $(EXTRA_BINARIES)
PROGRAMS = \
wine \
wine-glibc \
wine-glibc-installed \
wine-kthread \
wine-kthread-installed \
wine-preloader \
wine-pthread\
wine-preloader-installed \
wine-pthread \
wine-pthread-installed
MANPAGES = wine.man
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
all: $(WINE_BINARIES) $(MODULE) $(MANPAGES)
all: $(WINE_BINARIES) $(WINE_BINARIES:%=%-installed) $(MODULE) $(MANPAGES)
@MAKE_RULES@
@ -37,25 +41,34 @@ LIBPTHREAD = @LIBPTHREAD@
LDEXECFLAGS = @LDEXECFLAGS@
wine-glibc: glibc.o Makefile.in
$(CC) -o $@ glibc.o $(LIBWINE_LDFLAGS) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS)
$(CC) -o $@ glibc.o $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_LOCAL)
wine-preloader: preloader.o Makefile.in
wine-glibc-installed: glibc.o Makefile.in
$(CC) -o $@ glibc.o $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_INSTALL)
wine-preloader wine-preloader-installed: preloader.o Makefile.in
$(CC) -o $@ -static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7c000000 preloader.o $(LIBPORT) $(LDFLAGS)
wine-kthread: $(KTHREAD_OBJS) Makefile.in
$(CC) -o $@ $(LDEXECFLAGS) $(KTHREAD_OBJS) $(LIBWINE_LDFLAGS) $(LIBPORT) $(EXTRALIBS) $(LDFLAGS)
$(CC) -o $@ $(LDEXECFLAGS) $(KTHREAD_OBJS) $(LIBWINE) $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_LOCAL)
wine-kthread-installed: $(KTHREAD_OBJS) Makefile.in
$(CC) -o $@ $(LDEXECFLAGS) $(KTHREAD_OBJS) $(LIBWINE) $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_INSTALL)
wine-pthread: $(PTHREAD_OBJS) Makefile.in
$(CC) -o $@ $(LDEXECFLAGS) $(PTHREAD_OBJS) $(LIBWINE_LDFLAGS) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS)
$(CC) -o $@ $(LDEXECFLAGS) $(PTHREAD_OBJS) $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_LOCAL)
wine-pthread-installed: $(PTHREAD_OBJS) Makefile.in
$(CC) -o $@ $(LDEXECFLAGS) $(PTHREAD_OBJS) $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_INSTALL)
$(MODULE): $(MAIN_BINARY)
$(RM) $(MODULE) && $(LN_S) $(MAIN_BINARY) $(MODULE)
install:: $(WINE_BINARIES) $(MANPAGES) $(INSTALLDIRS)
install:: $(WINE_BINARIES:%=%-installed) $(MANPAGES) $(INSTALLDIRS)
for f in $(WINE_BINARIES); do \
if [ "$(MAIN_BINARY)" = "$$f" ]; \
then $(INSTALL_PROGRAM) $$f $(DESTDIR)$(bindir)/$(MODULE); \
else $(INSTALL_PROGRAM) $$f $(DESTDIR)$(bindir)/$$f; \
then $(INSTALL_PROGRAM) $$f-installed $(DESTDIR)$(bindir)/$(MODULE); \
else $(INSTALL_PROGRAM) $$f-installed $(DESTDIR)$(bindir)/$$f; \
fi; \
done
$(INSTALL_DATA) wine.man $(DESTDIR)$(mandir)/man$(prog_manext)/wine.$(prog_manext)

View File

@ -55,7 +55,7 @@ C_SRCS = \
window.c \
winstation.c
PROGRAMS = wineserver
PROGRAMS = wineserver wineserver-installed
MANPAGES = wineserver.man
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
@ -65,10 +65,13 @@ all: $(PROGRAMS) $(MANPAGES)
@MAKE_RULES@
wineserver: $(OBJS)
$(CC) -o $@ $(OBJS) $(LIBWINE_LDFLAGS) $(LIBPORT) $(LDFLAGS) $(LIBS)
$(CC) -o $@ $(OBJS) $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(LIBS) $(LDRPATH_LOCAL)
install:: $(PROGRAMS) $(MANPAGES) $(INSTALLDIRS)
$(INSTALL_PROGRAM) wineserver $(DESTDIR)$(bindir)/wineserver
wineserver-installed: $(OBJS)
$(CC) -o $@ $(OBJS) $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(LIBS) $(LDRPATH_INSTALL)
install:: wineserver-installed $(MANPAGES) $(INSTALLDIRS)
$(INSTALL_PROGRAM) wineserver-installed $(DESTDIR)$(bindir)/wineserver
$(INSTALL_DATA) wineserver.man $(DESTDIR)$(mandir)/man$(prog_manext)/wineserver.$(prog_manext)
uninstall::

View File

@ -69,8 +69,8 @@ fnt2fon$(EXEEXT): fnt2fon.o
relpath$(EXEEXT): relpath.o
$(CC) $(CFLAGS) -o $@ relpath.o $(LIBPORT) $(LDFLAGS)
sfnt2fnt$(EXEEXT): sfnt2fnt.o
$(CC) $(CFLAGS) -o $@ sfnt2fnt.o $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(FREETYPELIBS)
sfnt2fnt$(EXEEXT): sfnt2fnt.o relpath$(EXEEXT)
$(CC) $(CFLAGS) -o $@ sfnt2fnt.o $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(FREETYPELIBS) $(LDRPATH_LOCAL)
bin2res$(EXEEXT): bin2res.o
$(CC) $(CFLAGS) -o $@ bin2res.o $(LIBPORT) $(LDFLAGS)
@ -94,6 +94,8 @@ uninstall::
$(RM) $(DESTDIR)$(bindir)/winemaker $(DESTDIR)$(bindir)/wineprefixcreate $(DESTDIR)$(mandir)/man$(prog_manext)/winemaker.$(prog_manext) $(DESTDIR)$(mandir)/man$(prog_manext)/wineprefixcreate.$(prog_manext) $(DESTDIR)$(datadir)/wine/wine.inf $(DESTDIR)$(datadir)/applications/wine.desktop
-$(UPDATE_DESKTOP_DATABASE)
wmc wrc: relpath$(EXEEXT)
@DEPENDENCIES@ # everything below this line is overwritten by make depend
Makefile: makedep$(EXEEXT)

View File

@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
EXEEXT = @EXEEXT@
PROGRAMS = wmc$(EXEEXT)
PROGRAMS = wmc$(EXEEXT) wmc-installed
MANPAGES = wmc.man
MODULE = none
@ -24,11 +24,14 @@ all: $(PROGRAMS) $(MANPAGES)
@MAKE_RULES@
wmc$(EXEEXT): $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWINE_LDFLAGS) $(LIBPORT) $(LDFLAGS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(LDRPATH_LOCAL)
install:: $(PROGRAMS) $(MANPAGES) $(INSTALLDIRS)
wmc-installed: $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(LDRPATH_INSTALL)
install:: wmc-installed $(MANPAGES) $(INSTALLDIRS)
$(INSTALL_DATA) wmc.man $(DESTDIR)$(mandir)/man$(prog_manext)/wmc.$(prog_manext)
$(INSTALL_PROGRAM) wmc$(EXEEXT) $(DESTDIR)$(bindir)/wmc$(EXEEXT)
$(INSTALL_PROGRAM) wmc-installed $(DESTDIR)$(bindir)/wmc$(EXEEXT)
uninstall::
$(RM) $(DESTDIR)$(bindir)/wmc$(EXEEXT) $(DESTDIR)$(mandir)/man$(prog_manext)/wmc.$(prog_manext)

View File

@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
EXEEXT = @EXEEXT@
PROGRAMS = wrc$(EXEEXT)
PROGRAMS = wrc$(EXEEXT) wrc-installed
MANPAGES = wrc.man
MODULE = none
@ -29,11 +29,14 @@ all: $(PROGRAMS) $(MANPAGES)
@MAKE_RULES@
wrc$(EXEEXT): $(OBJS) $(LIBWPP)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWPP) $(LIBWINE_LDFLAGS) $(LIBPORT) $(LDFLAGS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWPP) $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(LDRPATH_LOCAL)
install:: $(PROGRAMS) $(MANPAGES) $(INSTALLDIRS)
wrc-installed: $(OBJS) $(LIBWPP)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWPP) $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(LDRPATH_INSTALL)
install:: wrc-installed $(MANPAGES) $(INSTALLDIRS)
$(INSTALL_DATA) wrc.man $(DESTDIR)$(mandir)/man$(prog_manext)/wrc.$(prog_manext)
$(INSTALL_PROGRAM) wrc$(EXEEXT) $(DESTDIR)$(bindir)/wrc$(EXEEXT)
$(INSTALL_PROGRAM) wrc-installed $(DESTDIR)$(bindir)/wrc$(EXEEXT)
uninstall::
$(RM) $(DESTDIR)$(bindir)/wrc$(EXEEXT) $(DESTDIR)$(mandir)/man$(prog_manext)/wrc.$(prog_manext)