diff --git a/Makefile.in b/Makefile.in index 1f905e0ffc0..307a95b3b1a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -30,8 +30,6 @@ includedir = @includedir@ fontdir = ${datadir}/wine/fonts nlsdir = ${datadir}/wine/nls dlldir = ${libdir}/wine -top_srcdir = @top_srcdir@ -top_builddir = @top_builddir@ srcdir = @srcdir@ SHELL = /bin/sh CC = @CC@ @@ -111,7 +109,7 @@ distclean:: clean # Rules for API documentation install-manpages:: manpages - for i in documentation/man$(api_manext)/*.$(api_manext); do $(top_srcdir)/tools/install-sh -m 644 $(INSTALL_DATA_FLAGS) $$i $(DESTDIR)$(mandir)/$$i; done + for i in documentation/man$(api_manext)/*.$(api_manext); do $(srcdir)/tools/install-sh -m 644 $(INSTALL_DATA_FLAGS) $$i $(DESTDIR)$(mandir)/$$i; done .PHONY: install-manpages @@ -136,8 +134,8 @@ TAGSFLAGS = --langmap='c:+.idl.l.rh,make:(Make*.in)' TAGS etags: rm -f TAGS - (test -d .git && git ls-files || find -L $(top_srcdir) -name '*.[ch]' -print) | xargs etags -a $(TAGSFLAGS) + (test -d .git && git ls-files || find -L $(srcdir) -name '*.[ch]' -print) | xargs etags -a $(TAGSFLAGS) tags ctags: rm -f tags - (test -d .git && git ls-files || find -L $(top_srcdir) -name '*.[ch]' -print) | xargs ctags -a $(TAGSFLAGS) + (test -d .git && git ls-files || find -L $(srcdir) -name '*.[ch]' -print) | xargs ctags -a $(TAGSFLAGS) diff --git a/aclocal.m4 b/aclocal.m4 index a5917c10fc6..c5edd85cee4 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -121,8 +121,6 @@ ac_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS $ac_cflags" $6 CPPFLAGS=$ac_save_CPPFLAGS -test -z "$ac_cflags" || ac_cflags=`echo " $ac_cflags" | sed 's/ -I\([[^/]]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$ac_libs" || ac_libs=`echo " $ac_libs" | sed 's/ -L\([[^/]]\)/ -L\$(top_builddir)\/\1/g'` AS_VAR_POPDEF([ac_libs])dnl AS_VAR_POPDEF([ac_cflags])])dnl diff --git a/configure b/configure index c600b73d1f3..e8d97610f27 100755 --- a/configure +++ b/configure @@ -5838,16 +5838,12 @@ fi $as_echo "$wine_cv_toolsdir" >&6; } if test -z "$wine_cv_toolsdir"; then wine_makedep=tools/makedep - TOOLSDIR="\$(top_builddir)" + TOOLSDIR="." elif test -d "$wine_cv_toolsdir/tools/winebuild"; then wine_makedep=$wine_cv_toolsdir/tools/makedep - case "$wine_cv_toolsdir" in - /*) TOOLSDIR=$wine_cv_toolsdir - ;; - *) TOOLSDIR="\$(top_builddir)/$wine_cv_toolsdir" - ;; - esac + TOOLSDIR=$wine_cv_toolsdir + enable_tools=${enable_tools:-no} test -f "$wine_makedep" || as_fn_error $? "the Wine tools have not yet been built in $wine_cv_toolsdir" "$LINENO" 5 else @@ -13152,8 +13148,6 @@ fi XML2_LIBS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$XML2_CFLAGS" || XML2_CFLAGS=`echo " $XML2_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$XML2_LIBS" || XML2_LIBS=`echo " $XML2_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "$ac_cv_lib_xml2_xmlParseMemory" != "yes"; then : @@ -13262,8 +13256,6 @@ fi XSLT_CFLAGS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$XSLT_CFLAGS" || XSLT_CFLAGS=`echo " $XSLT_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$XSLT_LIBS" || XSLT_LIBS=`echo " $XSLT_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_xslt" = "x"; then : @@ -13350,8 +13342,6 @@ else fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$INOTIFY_CFLAGS" || INOTIFY_CFLAGS=`echo " $INOTIFY_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$INOTIFY_LIBS" || INOTIFY_LIBS=`echo " $INOTIFY_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "$ac_cv_header_sys_inotify_h" != "yes"; then : @@ -13446,8 +13436,6 @@ fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$DBUS_CFLAGS" || DBUS_CFLAGS=`echo " $DBUS_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$DBUS_LIBS" || DBUS_LIBS=`echo " $DBUS_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_dbus_1" = "x" -a \ @@ -13543,8 +13531,6 @@ fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$HAL_CFLAGS" || HAL_CFLAGS=`echo " $HAL_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$HAL_LIBS" || HAL_LIBS=`echo " $HAL_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` if test "x$ac_cv_lib_soname_hal" = "x" -a \ "x$ac_cv_header_DiskArbitration_DiskArbitration_h" != "xyes"; then : @@ -13671,8 +13657,6 @@ fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$GNUTLS_CFLAGS" || GNUTLS_CFLAGS=`echo " $GNUTLS_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$GNUTLS_LIBS" || GNUTLS_LIBS=`echo " $GNUTLS_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_gnutls" = "x"; then : @@ -13907,8 +13891,6 @@ fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$SANE_CFLAGS" || SANE_CFLAGS=`echo " $SANE_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$SANE_LIBS" || SANE_LIBS=`echo " $SANE_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_sane" = "x"; then : @@ -13990,8 +13972,6 @@ fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$USB_CFLAGS" || USB_CFLAGS=`echo " $USB_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$USB_LIBS" || USB_LIBS=`echo " $USB_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "$ac_cv_lib_usb_1_0_libusb_interrupt_event_handler" != "yes"; then : @@ -14143,8 +14123,6 @@ fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$GPHOTO2_CFLAGS" || GPHOTO2_CFLAGS=`echo " $GPHOTO2_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$GPHOTO2_LIBS" || GPHOTO2_LIBS=`echo " $GPHOTO2_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` if ${GPHOTO2_PORT_CFLAGS:+false} :; then : if ${PKG_CONFIG+:} false; then : @@ -14215,8 +14193,6 @@ fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$GPHOTO2_PORT_CFLAGS" || GPHOTO2_PORT_CFLAGS=`echo " $GPHOTO2_PORT_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$GPHOTO2_PORT_LIBS" || GPHOTO2_PORT_LIBS=`echo " $GPHOTO2_PORT_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "$ac_cv_lib_gphoto2_gp_camera_new" != "yes"; then : @@ -14413,8 +14389,6 @@ fi LCMS2_LIBS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$LCMS2_CFLAGS" || LCMS2_CFLAGS=`echo " $LCMS2_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$LCMS2_LIBS" || LCMS2_LIBS=`echo " $LCMS2_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "$ac_cv_lib_lcms2_cmsOpenProfileFromFile" != "yes"; then : @@ -14534,8 +14508,6 @@ fi FREETYPE_LIBS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$FREETYPE_CFLAGS" || FREETYPE_CFLAGS=`echo " $FREETYPE_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$FREETYPE_LIBS" || FREETYPE_LIBS=`echo " $FREETYPE_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_freetype" = x; then : @@ -14708,8 +14680,6 @@ fi done CPPFLAGS=$ac_save_CPPFLAGS -test -z "$PULSE_CFLAGS" || PULSE_CFLAGS=`echo " $PULSE_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$PULSE_LIBS" || PULSE_LIBS=`echo " $PULSE_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test -z "$PULSE_LIBS"; then : @@ -14819,8 +14789,6 @@ fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$GSTREAMER_CFLAGS" || GSTREAMER_CFLAGS=`echo " $GSTREAMER_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$GSTREAMER_LIBS" || GSTREAMER_LIBS=`echo " $GSTREAMER_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_glib2_broken" != xyes -a "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" != xyes -a "x$ac_cv_header_QuickTime_ImageCompression_h" != xyes ; then : @@ -15051,8 +15019,6 @@ fi done CPPFLAGS=$ac_save_CPPFLAGS -test -z "$UDEV_CFLAGS" || UDEV_CFLAGS=`echo " $UDEV_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$UDEV_LIBS" || UDEV_LIBS=`echo " $UDEV_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$UDEV_LIBS" = "x"; then : @@ -15152,8 +15118,6 @@ $as_echo "#define HAVE_LIBUNWIND 1" >>confdefs.h fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$UNWIND_CFLAGS" || UNWIND_CFLAGS=`echo " $UNWIND_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$UNWIND_LIBS" || UNWIND_LIBS=`echo " $UNWIND_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi case $host in @@ -15255,8 +15219,6 @@ fi done CPPFLAGS=$ac_save_CPPFLAGS -test -z "$SDL2_CFLAGS" || SDL2_CFLAGS=`echo " $SDL2_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$SDL2_LIBS" || SDL2_LIBS=`echo " $SDL2_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_SDL2" = "x"; then : @@ -15374,8 +15336,6 @@ done LIBS="$ac_wine_check_funcs_save_LIBS" CPPFLAGS=$ac_save_CPPFLAGS -test -z "$FAUDIO_CFLAGS" || FAUDIO_CFLAGS=`echo " $FAUDIO_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$FAUDIO_LIBS" || FAUDIO_LIBS=`echo " $FAUDIO_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_FAudio" = "x"; then : @@ -15480,8 +15440,6 @@ _ACEOF fi fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$CAPI20_CFLAGS" || CAPI20_CFLAGS=`echo " $CAPI20_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$CAPI20_LIBS" || CAPI20_LIBS=`echo " $CAPI20_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_capi20" = "x"; then : @@ -15588,8 +15546,6 @@ fi CUPS_LIBS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$CUPS_CFLAGS" || CUPS_CFLAGS=`echo " $CUPS_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$CUPS_LIBS" || CUPS_LIBS=`echo " $CUPS_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_cups" = "x"; then : @@ -15694,8 +15650,6 @@ fi FONTCONFIG_CFLAGS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$FONTCONFIG_CFLAGS" || FONTCONFIG_CFLAGS=`echo " $FONTCONFIG_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$FONTCONFIG_LIBS" || FONTCONFIG_LIBS=`echo " $FONTCONFIG_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_fontconfig" = "x"; then : @@ -15868,8 +15822,6 @@ fi KRB5_CFLAGS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$KRB5_CFLAGS" || KRB5_CFLAGS=`echo " $KRB5_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$KRB5_LIBS" || KRB5_LIBS=`echo " $KRB5_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_krb5" = "x"; then : @@ -15976,8 +15928,6 @@ fi GSSAPI_CFLAGS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$GSSAPI_CFLAGS" || GSSAPI_CFLAGS=`echo " $GSSAPI_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$GSSAPI_LIBS" || GSSAPI_LIBS=`echo " $GSSAPI_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_gssapi_krb5" = "x"; then : @@ -16082,8 +16032,6 @@ fi JPEG_CFLAGS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$JPEG_CFLAGS" || JPEG_CFLAGS=`echo " $JPEG_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$JPEG_LIBS" || JPEG_LIBS=`echo " $JPEG_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_jpeg" = "x"; then : @@ -16188,8 +16136,6 @@ fi PNG_CFLAGS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$PNG_CFLAGS" || PNG_CFLAGS=`echo " $PNG_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$PNG_LIBS" || PNG_LIBS=`echo " $PNG_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_png" = "x"; then : @@ -16292,8 +16238,6 @@ _ACEOF fi fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$TIFF_CFLAGS" || TIFF_CFLAGS=`echo " $TIFF_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$TIFF_LIBS" || TIFF_LIBS=`echo " $TIFF_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_tiff" = "x"; then : @@ -16386,8 +16330,6 @@ fi MPG123_LIBS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$MPG123_CFLAGS" || MPG123_CFLAGS=`echo " $MPG123_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$MPG123_LIBS" || MPG123_LIBS=`echo " $MPG123_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_mpg123_mpg123_feed" != xyes -a x"$ac_cv_header_CoreAudio_CoreAudio_h" != xyes; then : @@ -16744,8 +16686,6 @@ _ACEOF fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$NETAPI_CFLAGS" || NETAPI_CFLAGS=`echo " $NETAPI_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$NETAPI_LIBS" || NETAPI_LIBS=`echo " $NETAPI_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi @@ -16956,8 +16896,6 @@ _ACEOF fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$VKD3D_CFLAGS" || VKD3D_CFLAGS=`echo " $VKD3D_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$VKD3D_LIBS" || VKD3D_LIBS=`echo " $VKD3D_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$ac_cv_lib_soname_vkd3d" = "x"; then : @@ -18447,8 +18385,6 @@ LIBS="$ac_wine_check_funcs_save_LIBS" LDAP_LIBS="" fi CPPFLAGS=$ac_save_CPPFLAGS -test -z "$LDAP_CFLAGS" || LDAP_CFLAGS=`echo " $LDAP_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` -test -z "$LDAP_LIBS" || LDAP_LIBS=`echo " $LDAP_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` fi if test "x$LDAP_LIBS" = "x"; then : diff --git a/configure.ac b/configure.ac index 1cda4276d25..20ae7577fa9 100644 --- a/configure.ac +++ b/configure.ac @@ -239,13 +239,10 @@ AC_CACHE_CHECK([for the directory containing the Wine tools], wine_cv_toolsdir, fi]) if test -z "$wine_cv_toolsdir"; then wine_makedep=tools/makedep - AC_SUBST(TOOLSDIR,"\$(top_builddir)") + AC_SUBST(TOOLSDIR,".") elif test -d "$wine_cv_toolsdir/tools/winebuild"; then wine_makedep=$wine_cv_toolsdir/tools/makedep - case "$wine_cv_toolsdir" in - /*) AC_SUBST(TOOLSDIR,$wine_cv_toolsdir) ;; - *) AC_SUBST(TOOLSDIR,"\$(top_builddir)/$wine_cv_toolsdir") ;; - esac + AC_SUBST(TOOLSDIR,$wine_cv_toolsdir) enable_tools=${enable_tools:-no} test -f "$wine_makedep" || AC_MSG_ERROR([the Wine tools have not yet been built in $wine_cv_toolsdir]) else diff --git a/tools/makedep.c b/tools/makedep.c index cc09a0e1ce6..7fe2c4daf54 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -91,7 +91,6 @@ struct incl_file #define FLAG_GENERATED 0x000001 /* generated file */ #define FLAG_INSTALL 0x000002 /* file to install */ -#define FLAG_PARENTDIR 0x000004 /* file comes from parent dir */ #define FLAG_IDL_PROXY 0x000100 /* generates a proxy (_p.c) file */ #define FLAG_IDL_CLIENT 0x000200 /* generates a client (_c.c) file */ #define FLAG_IDL_SERVER 0x000400 /* generates a server (_s.c) file */ @@ -141,6 +140,7 @@ static struct strarray lddll_flags; static struct strarray libs; static struct strarray enable_tests; static struct strarray cmdline_vars; +static struct strarray subdirs; static struct strarray disabled_dirs; static struct strarray cross_import_libs; static struct strarray delay_import_libs; @@ -178,7 +178,6 @@ struct makefile struct strarray programs; struct strarray scripts; struct strarray imports; - struct strarray subdirs; struct strarray delayimports; struct strarray extradllflags; struct strarray install_lib; @@ -187,11 +186,8 @@ struct makefile struct strarray extra_imports; struct list sources; struct list includes; - const char *base_dir; const char *src_dir; const char *obj_dir; - const char *top_src_dir; - const char *top_obj_dir; const char *parent_dir; const char *module; const char *testdll; @@ -204,7 +200,6 @@ struct makefile int is_cross; int is_win16; int is_exe; - struct makefile **submakes; /* values generated at output time */ struct strarray in_files; @@ -229,6 +224,7 @@ struct makefile }; static struct makefile *top_makefile; +static struct makefile **submakes; static const char separator[] = "### Dependencies"; static const char *output_makefile_name = "Makefile"; @@ -742,15 +738,6 @@ static char *concat_paths( const char *base, const char *path ) } -/******************************************************************* - * base_dir_path - */ -static char *base_dir_path( const struct makefile *make, const char *path ) -{ - return concat_paths( make->base_dir, path ); -} - - /******************************************************************* * obj_dir_path */ @@ -771,28 +758,9 @@ static char *src_dir_path( const struct makefile *make, const char *path ) /******************************************************************* - * top_obj_dir_path + * root_src_dir_path */ -static char *top_obj_dir_path( const struct makefile *make, const char *path ) -{ - return concat_paths( make->top_obj_dir, path ); -} - - -/******************************************************************* - * top_src_dir_path - */ -static char *top_src_dir_path( const struct makefile *make, const char *path ) -{ - if (make->top_src_dir) return concat_paths( make->top_src_dir, path ); - return top_obj_dir_path( make, path ); -} - - -/******************************************************************* - * root_dir_path - */ -static char *root_dir_path( const char *path ) +static char *root_src_dir_path( const char *path ) { return concat_paths( root_src_dir, path ); } @@ -803,8 +771,8 @@ static char *root_dir_path( const char *path ) */ static char *tools_dir_path( const struct makefile *make, const char *path ) { - if (tools_dir) return top_obj_dir_path( make, strmake( "%s/tools/%s", tools_dir, path )); - return top_obj_dir_path( make, strmake( "tools/%s", path )); + if (tools_dir) return strmake( "%s/tools/%s", tools_dir, path ); + return strmake( "tools/%s", path ); } @@ -1401,7 +1369,6 @@ static struct file *open_file_same_dir( const struct incl_file *parent, const ch struct file *ret = load_file( src_path ); if (ret) *filename = replace_filename( parent->filename, name ); - free( src_path ); return ret; } @@ -1413,7 +1380,7 @@ static struct file *open_file_same_dir( const struct incl_file *parent, const ch */ static struct file *open_local_file( const struct makefile *make, const char *path, char **filename ) { - char *src_path = root_dir_path( base_dir_path( make, path )); + char *src_path = src_dir_path( make, path ); struct file *ret = load_file( src_path ); /* if not found, try parent dir */ @@ -1421,13 +1388,11 @@ static struct file *open_local_file( const struct makefile *make, const char *pa { free( src_path ); path = strmake( "%s/%s", make->parent_dir, path ); - src_path = root_dir_path( base_dir_path( make, path )); + src_path = src_dir_path( make, path ); ret = load_file( src_path ); - if (ret) ret->flags |= FLAG_PARENTDIR; } - if (ret) *filename = src_dir_path( make, path ); - free( src_path ); + if (ret) *filename = src_path; return ret; } @@ -1439,11 +1404,10 @@ static struct file *open_local_file( const struct makefile *make, const char *pa */ static struct file *open_global_file( const struct makefile *make, const char *path, char **filename ) { - char *src_path = root_dir_path( path ); + char *src_path = root_src_dir_path( path ); struct file *ret = load_file( src_path ); - if (ret) *filename = top_src_dir_path( make, path ); - free( src_path ); + if (ret) *filename = src_path; return ret; } @@ -1529,7 +1493,7 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ (file = open_global_header( make, replace_extension( pFile->name, ".h", ".idl" ), &filename ))) { pFile->sourcename = filename; - pFile->filename = top_obj_dir_path( make, strmake( "include/%s", pFile->name )); + pFile->filename = strmake( "include/%s", pFile->name ); return file; } @@ -1539,7 +1503,7 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ (file = open_global_header( make, replace_extension( pFile->name, ".h", ".h.in" ), &filename ))) { pFile->sourcename = filename; - pFile->filename = top_obj_dir_path( make, strmake( "include/%s", pFile->name )); + pFile->filename = strmake( "include/%s", pFile->name ); return file; } @@ -1549,7 +1513,7 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ (file = open_global_header( make, replace_extension( pFile->name, ".h", ".x" ), &filename ))) { pFile->sourcename = filename; - pFile->filename = top_obj_dir_path( make, strmake( "include/%s", pFile->name )); + pFile->filename = strmake( "include/%s", pFile->name ); return file; } @@ -1559,7 +1523,7 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ (file = open_global_header( make, replace_extension( pFile->name, ".tlb", ".idl" ), &filename ))) { pFile->sourcename = filename; - pFile->filename = top_obj_dir_path( make, strmake( "include/%s", pFile->name )); + pFile->filename = strmake( "include/%s", pFile->name ); return file; } @@ -1576,18 +1540,17 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ for (i = 0; i < make->include_paths.count; i++) { const char *dir = make->include_paths.str[i]; - const char *prefix = make->top_src_dir ? make->top_src_dir : make->top_obj_dir; - if (prefix) + if (root_src_dir) { - len = strlen( prefix ); - if (!strncmp( dir, prefix, len ) && (!dir[len] || dir[len] == '/')) + len = strlen( root_src_dir ); + if (!strncmp( dir, root_src_dir, len ) && (!dir[len] || dir[len] == '/')) { while (dir[len] == '/') len++; file = open_global_file( make, concat_paths( dir + len, pFile->name ), &pFile->filename ); if (file) return file; } - if (make->top_src_dir) continue; /* ignore paths that don't point to the top source dir */ + continue; /* ignore paths that don't point to the top source dir */ } if (*dir != '/') { @@ -1743,8 +1706,8 @@ static FILE *open_input_makefile( const struct makefile *make ) { FILE *ret; - if (make->base_dir) - input_file_name = root_dir_path( base_dir_path( make, strmake( "%s.in", output_makefile_name ))); + if (make->obj_dir) + input_file_name = root_src_dir_path( obj_dir_path( make, strmake( "%s.in", output_makefile_name ))); else input_file_name = output_makefile_name; /* always use output name for main Makefile */ @@ -1877,7 +1840,8 @@ static struct makefile *parse_makefile( const char *path ) struct makefile *make = xmalloc( sizeof(*make) ); memset( make, 0, sizeof(*make) ); - make->obj_dir = make->base_dir = path; + make->obj_dir = path; + if (root_src_dir) make->src_dir = root_src_dir_path( make->obj_dir ); file = open_input_makefile( make ); while ((buffer = get_line( file ))) @@ -2056,7 +2020,7 @@ static void create_file_directories( const struct makefile *make, struct strarra for (i = 0; i < files.count; i++) { if (!strchr( files.str[i], '/' )) continue; - dir = base_dir_path( make, files.str[i] ); + dir = obj_dir_path( make, files.str[i] ); *strrchr( dir, '/' ) = 0; strarray_add_uniq( &subdirs, dir ); } @@ -2131,7 +2095,7 @@ static const char *get_static_lib( const struct makefile *make, const char *name if (strncmp( make->staticlib, "lib", 3 )) return NULL; if (strncmp( make->staticlib + 3, name, strlen(name) )) return NULL; if (strcmp( make->staticlib + 3 + strlen(name), ".a" )) return NULL; - return base_dir_path( make, make->staticlib ); + return obj_dir_path( make, make->staticlib ); } @@ -2143,12 +2107,12 @@ static struct makefile *get_parent_makefile( struct makefile *make ) char *dir, *p; int i; - if (!make->base_dir) return NULL; - dir = xstrdup( make->base_dir ); + if (!make->obj_dir) return NULL; + dir = xstrdup( make->obj_dir ); if (!(p = strrchr( dir, '/' ))) return NULL; *p = 0; - for (i = 0; i < top_makefile->subdirs.count; i++) - if (!strcmp( top_makefile->submakes[i]->base_dir, dir )) return top_makefile->submakes[i]; + for (i = 0; i < subdirs.count; i++) + if (!strcmp( submakes[i]->obj_dir, dir )) return submakes[i]; return NULL; } @@ -2193,7 +2157,7 @@ static int needs_implib_symlink( const struct makefile *make ) if (!make->module) return 0; if (!make->importlib) return 0; if (make->is_win16 && make->disabled) return 0; - if (strncmp( make->base_dir, "dlls/", 5 )) return 0; + if (strncmp( make->obj_dir, "dlls/", 5 )) return 0; if (!strcmp( make->module, make->importlib )) return 0; if (!strchr( make->importlib, '.' ) && !strncmp( make->module, make->importlib, strlen( make->importlib )) && @@ -2228,17 +2192,12 @@ static struct strarray add_default_libraries( const struct makefile *make, struc { const char *name = all_libs.str[i] + 2; - for (j = 0; j < top_makefile->subdirs.count; j++) - { - const struct makefile *submake = top_makefile->submakes[j]; - - if ((lib = get_static_lib( submake, name ))) break; - } + for (j = 0; j < subdirs.count; j++) + if ((lib = get_static_lib( submakes[j], name ))) break; } if (lib) { - lib = top_obj_dir_path( make, lib ); strarray_add( deps, lib ); strarray_add( &ret, lib ); } @@ -2270,25 +2229,22 @@ static struct strarray add_import_libs( const struct makefile *make, struct stra if (strarray_exists( &make->extradllflags, "-nodefaultlibs" )) continue; } - for (j = 0; j < top_makefile->subdirs.count; j++) + for (j = 0; j < subdirs.count; j++) { - const struct makefile *submake = top_makefile->submakes[j]; - - if (submake->importlib && !strcmp( submake->importlib, name )) + if (submakes[j]->importlib && !strcmp( submakes[j]->importlib, name )) { - if (is_cross || !*dll_ext || submake->staticimplib) - lib = base_dir_path( submake, strmake( "lib%s.a", name )); + if (is_cross || !*dll_ext || submakes[j]->staticimplib) + lib = obj_dir_path( submakes[j], strmake( "lib%s.a", name )); else { - strarray_add( deps, top_obj_dir_path( make, - strmake( "%s/lib%s.def", submake->base_dir, name ))); - if (needs_implib_symlink( submake )) - strarray_add( deps, top_obj_dir_path( make, strmake( "dlls/lib%s.def", name ))); + strarray_add( deps, strmake( "%s/lib%s.def", submakes[j]->obj_dir, name )); + if (needs_implib_symlink( submakes[j] )) + strarray_add( deps, strmake( "dlls/lib%s.def", name )); } break; } - if ((lib = get_static_lib( submake, name ))) break; + if ((lib = get_static_lib( submakes[j], name ))) break; } if (lib) @@ -2298,12 +2254,10 @@ static struct strarray add_import_libs( const struct makefile *make, struct stra if (delay && !delay_load_flag && (is_cross || !*dll_ext)) ext = ".delay.a"; else if (is_cross) ext = ".cross.a"; if (ext) lib = replace_extension( lib, ".a", ext ); - lib = top_obj_dir_path( make, lib ); strarray_add( deps, lib ); strarray_add( &ret, lib ); - if (needs_implib_symlink( top_makefile->submakes[j] )) - strarray_add( deps, top_obj_dir_path( make, - strmake( "dlls/lib%s%s", name, ext ? ext : ".a" ))); + if (needs_implib_symlink( submakes[j] )) + strarray_add( deps, strmake( "dlls/lib%s%s", name, ext ? ext : ".a" )); } else strarray_add( &ret, strmake( "-l%s", name )); } @@ -2357,15 +2311,15 @@ static void add_install_rule( struct makefile *make, const char *target, const char *file, const char *dest ) { if (strarray_exists( &make->install_lib, target ) || - strarray_exists( &top_install_lib, make->base_dir ) || - strarray_exists( &top_install_lib, base_dir_path( make, target ))) + strarray_exists( &top_install_lib, make->obj_dir ) || + strarray_exists( &top_install_lib, obj_dir_path( make, target ))) { strarray_add( &make->install_rules[INSTALL_LIB], file ); strarray_add( &make->install_rules[INSTALL_LIB], dest ); } else if (strarray_exists( &make->install_dev, target ) || - strarray_exists( &top_install_dev, make->base_dir ) || - strarray_exists( &top_install_dev, base_dir_path( make, target ))) + strarray_exists( &top_install_dev, make->obj_dir ) || + strarray_exists( &top_install_dev, obj_dir_path( make, target ))) { strarray_add( &make->install_rules[INSTALL_DEV], file ); strarray_add( &make->install_rules[INSTALL_DEV], dest ); @@ -2433,7 +2387,7 @@ static struct strarray get_source_defines( struct makefile *make, struct incl_fi strarray_addall( &ret, make->include_args ); if (source->use_msvcrt) - strarray_add( &ret, strmake( "-I%s", top_src_dir_path( make, "include/msvcrt" ))); + strarray_add( &ret, strmake( "-I%s", root_src_dir_path( "include/msvcrt" ))); for (i = 0; i < make->include_paths.count; i++) strarray_add( &ret, strmake( "-I%s", make->include_paths.str[i] )); strarray_addall( &ret, make->define_args ); @@ -2462,8 +2416,7 @@ static const char *get_debug_file( struct makefile *make, const char *name ) static void output_winegcc_command( struct makefile *make, int is_cross ) { output( "\t%s -o $@", tools_path( make, "winegcc" )); - output_filename( "--wine-objdir" ); - output_filename( top_obj_dir_path( make, "" )); + output_filename( "--wine-objdir ." ); if (tools_dir) { output_filename( "--winebuild" ); @@ -2536,18 +2489,16 @@ static void output_srcdir_symlink( struct makefile *make, const char *obj ) /******************************************************************* * output_install_commands */ -static void output_install_commands( struct makefile *make, const struct makefile *submake, - struct strarray files ) +static void output_install_commands( struct makefile *make, struct strarray files ) { unsigned int i; - char *install_sh = top_src_dir_path( make, "tools/install-sh" ); + char *install_sh = root_src_dir_path( "tools/install-sh" ); for (i = 0; i < files.count; i += 2) { const char *file = files.str[i]; const char *dest = strmake( "$(DESTDIR)%s", files.str[i + 1] + 1 ); - if (submake) file = base_dir_path( submake, file ); switch (*files.str[i + 1]) { case 'c': /* cross-compiled program */ @@ -2624,8 +2575,7 @@ static void output_install_rules( struct makefile *make, enum install_rules rule output( "%s %s::", obj_dir_path( make, "install" ), obj_dir_path( make, target )); output_filenames( targets ); output( "\n" ); - output_install_commands( make, NULL, files ); - + output_install_commands( make, files ); strarray_add_uniq( &make->phony_targets, obj_dir_path( make, "install" )); strarray_add_uniq( &make->phony_targets, obj_dir_path( make, target )); } @@ -2650,7 +2600,7 @@ static void output_uninstall_rules( struct makefile *make ) static const char *dirs_order[] = { "$(includedir)", "$(mandir)", "$(fontdir)", "$(datadir)", "$(dlldir)" }; - struct strarray subdirs = empty_strarray; + struct strarray uninstall_dirs = empty_strarray; unsigned int i, j; if (!make->uninstall_files.count) return; @@ -2658,31 +2608,31 @@ static void output_uninstall_rules( struct makefile *make ) output_rm_filenames( make->uninstall_files ); strarray_add_uniq( &make->phony_targets, "uninstall" ); - if (!make->subdirs.count) return; + if (!subdirs.count) return; for (i = 0; i < make->uninstall_files.count; i++) { char *dir = xstrdup( make->uninstall_files.str[i] ); while (strchr( dir, '/' )) { *strrchr( dir, '/' ) = 0; - strarray_add_uniq( &subdirs, xstrdup(dir) ); + strarray_add_uniq( &uninstall_dirs, xstrdup(dir) ); } } - strarray_qsort( &subdirs, cmp_string_length ); + strarray_qsort( &uninstall_dirs, cmp_string_length ); output( "\t-rmdir" ); for (i = 0; i < sizeof(dirs_order)/sizeof(dirs_order[0]); i++) { - for (j = 0; j < subdirs.count; j++) + for (j = 0; j < uninstall_dirs.count; j++) { - if (!subdirs.str[j]) continue; - if (strncmp( subdirs.str[j] + strlen("$(DESTDIR)"), dirs_order[i], strlen(dirs_order[i]) )) + if (!uninstall_dirs.str[j]) continue; + if (strncmp( uninstall_dirs.str[j] + strlen("$(DESTDIR)"), dirs_order[i], strlen(dirs_order[i]) )) continue; - output_filename( subdirs.str[j] ); - subdirs.str[j] = NULL; + output_filename( uninstall_dirs.str[j] ); + uninstall_dirs.str[j] = NULL; } } - for (j = 0; j < subdirs.count; j++) - if (subdirs.str[j]) output_filename( subdirs.str[j] ); + for (j = 0; j < uninstall_dirs.count; j++) + if (uninstall_dirs.str[j]) output_filename( uninstall_dirs.str[j] ); output( "\n" ); } @@ -2703,9 +2653,9 @@ static struct strarray output_importlib_symlinks( const struct makefile *make ) for (i = 0; i < count; i++) { lib = strmake( "lib%s.%s", make->importlib, ext[i] ); - dst = concat_paths( obj_dir_path( top_makefile, "dlls" ), lib ); - output( "%s: %s\n", dst, base_dir_path( make, lib )); - output_symlink_rule( concat_paths( make->base_dir + strlen("dlls/"), lib ), dst ); + dst = strmake( "dlls/%s", lib ); + output( "%s: %s\n", dst, obj_dir_path( make, lib )); + output_symlink_rule( concat_paths( make->obj_dir + strlen("dlls/"), lib ), dst ); strarray_add( &ret, dst ); } return ret; @@ -2793,11 +2743,11 @@ static void output_source_h( struct makefile *make, struct incl_file *source, co static void output_source_rc( struct makefile *make, struct incl_file *source, const char *obj ) { struct strarray defines = get_source_defines( make, source, obj ); - char *po_dir = NULL; + const char *po_dir = NULL; unsigned int i; if (source->file->flags & FLAG_GENERATED) strarray_add( &make->clean_files, source->name ); - if (linguas.count && (source->file->flags & FLAG_RC_PO)) po_dir = top_obj_dir_path( make, "po" ); + if (linguas.count && (source->file->flags & FLAG_RC_PO)) po_dir = "po"; strarray_add( &make->res_files, strmake( "%s.res", obj )); if (source->file->flags & FLAG_RC_PO) { @@ -2843,12 +2793,11 @@ static void output_source_mc( struct makefile *make, struct incl_file *source, c output( "\t%s -u -o $@ %s", tools_path( make, "wmc" ), source->filename ); if (linguas.count) { - char *po_dir = top_obj_dir_path( make, "po" ); - output_filename( strmake( "--po-dir=%s", po_dir )); + output_filename( "--po-dir=po" ); output( "\n" ); output( "%s.res:", obj_dir_path( make, obj )); for (i = 0; i < linguas.count; i++) - output_filename( strmake( "%s/%s.mo", po_dir, linguas.str[i] )); + output_filename( strmake( "po/%s.mo", linguas.str[i] )); } output( "\n" ); } @@ -2955,7 +2904,7 @@ static void output_source_sfd( struct makefile *make, struct incl_file *source, { output( "%s: %s\n", ttf_file, source->filename ); output( "\t%s -script %s %s $@\n", - fontforge, top_src_dir_path( make, "fonts/genttf.ff" ), source->filename ); + fontforge, root_src_dir_path( "fonts/genttf.ff" ), source->filename ); if (!(source->file->flags & FLAG_SFD_FONTS)) strarray_add( &make->font_files, ttf_obj ); } if (source->file->flags & FLAG_INSTALL) @@ -3000,7 +2949,7 @@ static void output_source_svg( struct makefile *make, struct incl_file *source, { output( "%s.%s: %s\n", src_dir_path( make, obj ), images[i], source->filename ); output( "\tCONVERT=\"%s\" ICOTOOL=\"%s\" RSVG=\"%s\" %s %s $@\n", convert, icotool, rsvg, - top_src_dir_path( make, "tools/buildimage" ), source->filename ); + root_src_dir_path( "tools/buildimage" ), source->filename ); } } } @@ -3189,8 +3138,8 @@ static void output_source_default( struct makefile *make, struct incl_file *sour { strarray_add( &make->ok_files, strmake( "%s.ok", obj )); output( "%s.ok:\n", obj_dir_path( make, obj )); - output( "\t%s $(RUNTESTFLAGS) -T %s -M %s -p %s%s %s && touch $@\n", - top_src_dir_path( make, "tools/runtest" ), top_obj_dir_path( make, "" ), make->testdll, + output( "\t%s $(RUNTESTFLAGS) -T . -M %s -p %s%s %s && touch $@\n", + root_src_dir_path( "tools/runtest" ), make->testdll, obj_dir_path( make, replace_extension( make->testdll, ".dll", "_test.exe" )), make->is_cross ? "" : dll_ext, obj ); } @@ -3266,35 +3215,31 @@ static void output_man_pages( struct makefile *make ) char *spec_file = src_dir_path( make, replace_extension( make->module, ".dll", ".spec" )); output( "manpages::\n" ); - output( "\t%s -w %s", top_src_dir_path( make, "tools/c2man.pl" ), spec_file ); - output_filename( strmake( "-R%s", top_src_dir_path( make, "" ))); - output_filename( strmake( "-I%s", top_src_dir_path( make, "include" ))); - output_filename( strmake( "-o %s/man%s", - top_obj_dir_path( make, "documentation" ), man_ext )); + output( "\t%s -w %s", root_src_dir_path( "tools/c2man.pl" ), spec_file ); + output_filename( strmake( "-R%s", root_src_dir_path( "" ))); + output_filename( strmake( "-I%s", root_src_dir_path( "include" ))); + output_filename( strmake( "-o documentation/man%s", man_ext )); output_filenames( make->c2man_files ); output( "\n" ); output( "htmlpages::\n" ); - output( "\t%s -Th -w %s", top_src_dir_path( make, "tools/c2man.pl" ), spec_file ); - output_filename( strmake( "-R%s", top_src_dir_path( make, "" ))); - output_filename( strmake( "-I%s", top_src_dir_path( make, "include" ))); - output_filename( strmake( "-o %s", - top_obj_dir_path( make, "documentation/html" ))); + output( "\t%s -Th -w %s", root_src_dir_path( "tools/c2man.pl" ), spec_file ); + output_filename( strmake( "-R%s", root_src_dir_path( "" ))); + output_filename( strmake( "-I%s", root_src_dir_path( "include" ))); + output_filename( "-o documentation/html" ); output_filenames( make->c2man_files ); output( "\n" ); output( "sgmlpages::\n" ); - output( "\t%s -Ts -w %s", top_src_dir_path( make, "tools/c2man.pl" ), spec_file ); - output_filename( strmake( "-R%s", top_src_dir_path( make, "" ))); - output_filename( strmake( "-I%s", top_src_dir_path( make, "include" ))); - output_filename( strmake( "-o %s", - top_obj_dir_path( make, "documentation/api-guide" ))); + output( "\t%s -Ts -w %s", root_src_dir_path( "tools/c2man.pl" ), spec_file ); + output_filename( strmake( "-R%s", root_src_dir_path( "" ))); + output_filename( strmake( "-I%s", root_src_dir_path( "include" ))); + output_filename( "-o documentation/api-guide" ); output_filenames( make->c2man_files ); output( "\n" ); output( "xmlpages::\n" ); - output( "\t%s -Tx -w %s", top_src_dir_path( make, "tools/c2man.pl" ), spec_file ); - output_filename( strmake( "-R%s", top_src_dir_path( make, "" ))); - output_filename( strmake( "-I%s", top_src_dir_path( make, "include" ))); - output_filename( strmake( "-o %s", - top_obj_dir_path( make, "documentation/api-guide-xml" ))); + output( "\t%s -Tx -w %s", root_src_dir_path( "tools/c2man.pl" ), spec_file ); + output_filename( strmake( "-R%s", root_src_dir_path( "" ))); + output_filename( strmake( "-I%s", root_src_dir_path( "include" ))); + output_filename( "-o documentation/api-guide-xml" ); output_filenames( make->c2man_files ); output( "\n" ); strarray_add( &make->phony_targets, "manpages" ); @@ -3617,8 +3562,7 @@ static void output_test_module( struct makefile *make ) output_filename( tools_path( make, "winegcc" )); output( "\n" ); - output( "%s/%s: %s%s\n", top_obj_dir_path( make, "programs/winetest" ), testres, - obj_dir_path( make, stripped ), ext ); + output( "programs/winetest/%s: %s%s\n", testres, obj_dir_path( make, stripped ), ext ); output( "\techo \"%s TESTRES \\\"%s%s\\\"\" | %s -u -o $@\n", testmodule, obj_dir_path( make, stripped ), ext, tools_path( make, "wrc" )); @@ -3707,31 +3651,28 @@ static void output_subdirs( struct makefile *make ) strarray_addall( &clean_files, make->clean_files ); strarray_addall( &distclean_files, make->distclean_files ); strarray_addall( &all_targets, make->all_targets ); - for (i = 0; i < make->subdirs.count; i++) + for (i = 0; i < subdirs.count; i++) { - const struct makefile *submake = make->submakes[i]; + strarray_add( &makefile_deps, src_dir_path( submakes[i], strmake ( "%s.in", output_makefile_name ))); + strarray_addall_uniq( &make->phony_targets, submakes[i]->phony_targets ); + strarray_addall_uniq( &make->uninstall_files, submakes[i]->uninstall_files ); + strarray_addall_uniq( &dependencies, submakes[i]->dependencies ); + strarray_addall_path( &clean_files, submakes[i]->obj_dir, submakes[i]->clean_files ); + strarray_addall_path( &distclean_files, submakes[i]->obj_dir, submakes[i]->distclean_files ); + strarray_addall_path( &testclean_files, submakes[i]->obj_dir, submakes[i]->ok_files ); + strarray_addall_path( &make->pot_files, submakes[i]->obj_dir, submakes[i]->pot_files ); - strarray_add( &makefile_deps, top_src_dir_path( make, base_dir_path( submake, - strmake ( "%s.in", output_makefile_name )))); - strarray_addall_uniq( &make->phony_targets, submake->phony_targets ); - strarray_addall_uniq( &make->uninstall_files, submake->uninstall_files ); - strarray_addall_uniq( &dependencies, submake->dependencies ); - strarray_addall_path( &clean_files, submake->obj_dir, submake->clean_files ); - strarray_addall_path( &distclean_files, submake->obj_dir, submake->distclean_files ); - strarray_addall_path( &testclean_files, submake->obj_dir, submake->ok_files ); - strarray_addall_path( &make->pot_files, submake->obj_dir, submake->pot_files ); + if (submakes[i]->disabled) continue; - if (submake->disabled) continue; - - strarray_addall_path( &all_targets, submake->obj_dir, submake->all_targets ); - if (!strcmp( submake->obj_dir, "tools" ) || !strncmp( submake->obj_dir, "tools/", 6 )) - strarray_add( &tooldeps_deps, obj_dir_path( submake, "all" )); - if (submake->testdll) - strarray_add( &buildtest_deps, obj_dir_path( submake, "all" )); - if (submake->install_rules[INSTALL_LIB].count) - strarray_add( &install_lib_deps, obj_dir_path( submake, "install-lib" )); - if (submake->install_rules[INSTALL_DEV].count) - strarray_add( &install_dev_deps, obj_dir_path( submake, "install-dev" )); + strarray_addall_path( &all_targets, submakes[i]->obj_dir, submakes[i]->all_targets ); + if (!strcmp( submakes[i]->obj_dir, "tools" ) || !strncmp( submakes[i]->obj_dir, "tools/", 6 )) + strarray_add( &tooldeps_deps, obj_dir_path( submakes[i], "all" )); + if (submakes[i]->testdll) + strarray_add( &buildtest_deps, obj_dir_path( submakes[i], "all" )); + if (submakes[i]->install_rules[INSTALL_LIB].count) + strarray_add( &install_lib_deps, obj_dir_path( submakes[i], "install-lib" )); + if (submakes[i]->install_rules[INSTALL_DEV].count) + strarray_add( &install_dev_deps, obj_dir_path( submakes[i], "install-dev" )); } strarray_addall( &dependencies, makefile_deps ); output( "all:" ); @@ -3827,13 +3768,13 @@ static void output_sources( struct makefile *make ) } /* special case for winetest: add resource files from other test dirs */ - if (make->base_dir && !strcmp( make->base_dir, "programs/winetest" )) + if (make->obj_dir && !strcmp( make->obj_dir, "programs/winetest" )) { struct strarray tests = enable_tests; if (!tests.count) - for (i = 0; i < top_makefile->subdirs.count; i++) - if (top_makefile->submakes[i]->testdll && !top_makefile->submakes[i]->disabled) - strarray_add( &tests, top_makefile->submakes[i]->testdll ); + for (i = 0; i < subdirs.count; i++) + if (submakes[i]->testdll && !submakes[i]->disabled) + strarray_add( &tests, submakes[i]->testdll ); for (i = 0; i < tests.count; i++) strarray_add( &make->res_files, replace_extension( tests.str[i], ".dll", "_test.res" )); } @@ -3867,9 +3808,9 @@ static void output_sources( struct makefile *make ) strarray_add( &make->distclean_files, "Makefile" ); if (make->testdll) strarray_add( &make->distclean_files, "testlist.c" ); - if (!make->base_dir) + if (!make->obj_dir) strarray_addall( &make->distclean_files, get_expanded_make_var_array( make, "CONFIGURE_TARGETS" )); - else if (!strcmp( make->base_dir, "po" )) + else if (!strcmp( make->obj_dir, "po" )) strarray_add( &make->distclean_files, "LINGUAS" ); strarray_addall( &make->clean_files, make->object_files ); @@ -3880,7 +3821,7 @@ static void output_sources( struct makefile *make ) strarray_addall( &make->clean_files, make->debug_files ); strarray_addall( &make->clean_files, make->all_targets ); - if (make->subdirs.count) + if (make == top_makefile) { output_subdirs( make ); return; @@ -4001,7 +3942,7 @@ static void rename_temp_file_if_changed( const char *dest ) */ static void output_linguas( const struct makefile *make ) { - const char *dest = base_dir_path( make, "LINGUAS" ); + const char *dest = obj_dir_path( make, "LINGUAS" ); struct incl_file *source; output_file = create_temp_file( dest ); @@ -4022,7 +3963,7 @@ static void output_linguas( const struct makefile *make ) */ static void output_testlist( const struct makefile *make ) { - const char *dest = base_dir_path( make, "testlist.c" ); + const char *dest = obj_dir_path( make, "testlist.c" ); struct strarray files = empty_strarray; unsigned int i; @@ -4116,9 +4057,9 @@ static void output_dependencies( struct makefile *make ) FILE *src_file; int i, found = 0; - if (make->base_dir) create_dir( make->base_dir ); + if (make->obj_dir) create_dir( make->obj_dir ); - output_file_name = base_dir_path( make, output_makefile_name ); + output_file_name = obj_dir_path( make, output_makefile_name ); output_file = create_temp_file( output_file_name ); /* copy the contents of the source makefile */ @@ -4133,9 +4074,9 @@ static void output_dependencies( struct makefile *make ) if (!found) output( "\n%s (everything below this line is auto-generated; DO NOT EDIT!!)\n", separator ); - if (!make->base_dir) + if (make == top_makefile) { - for (i = 0; i < make->subdirs.count; i++) output_sources( make->submakes[i] ); + for (i = 0; i < subdirs.count; i++) output_sources( submakes[i] ); output_sources( make ); } else output_stub_makefile( make ); @@ -4147,8 +4088,8 @@ static void output_dependencies( struct makefile *make ) strarray_addall( &ignore_files, make->distclean_files ); strarray_addall( &ignore_files, make->clean_files ); if (make->testdll) output_testlist( make ); - if (make->base_dir && !strcmp( make->base_dir, "po" )) output_linguas( make ); - if (!make->src_dir) output_gitignore( base_dir_path( make, ".gitignore" ), ignore_files ); + if (make->obj_dir && !strcmp( make->obj_dir, "po" )) output_linguas( make ); + if (!make->src_dir) output_gitignore( obj_dir_path( make, ".gitignore" ), ignore_files ); create_file_directories( make, ignore_files ); @@ -4185,13 +4126,7 @@ static void load_sources( struct makefile *make ) struct strarray value; struct incl_file *file; - if (root_src_dir) - { - make->top_src_dir = concat_paths( make->top_obj_dir, root_src_dir ); - make->src_dir = concat_paths( make->top_src_dir, make->base_dir ); - } - strarray_set_value( &make->vars, "top_builddir", top_obj_dir_path( make, "" )); - strarray_set_value( &make->vars, "top_srcdir", top_src_dir_path( make, "" )); + strarray_set_value( &make->vars, "top_srcdir", root_src_dir_path( "" )); strarray_set_value( &make->vars, "srcdir", src_dir_path( make, "" )); make->parent_dir = get_expanded_make_variable( make, "PARENTSRC" ); @@ -4217,7 +4152,7 @@ static void load_sources( struct makefile *make ) strarray_add_uniq( &make->extradllflags, "-mno-cygwin" ); strarray_addall( &make->extradllflags, get_expanded_make_var_array( make, "APPMODE" )); - make->disabled = make->base_dir && strarray_exists( &disabled_dirs, make->base_dir ); + make->disabled = make->obj_dir && strarray_exists( &disabled_dirs, make->obj_dir ); make->use_msvcrt = strarray_exists( &make->extradllflags, "-mno-cygwin" ); make->is_exe = strarray_exists( &make->extradllflags, "-mconsole" ) || strarray_exists( &make->extradllflags, "-mwindows" ); @@ -4247,9 +4182,8 @@ static void load_sources( struct makefile *make ) strarray_add( &make->include_args, strmake( "-I%s", make->src_dir )); if (make->parent_dir) strarray_add( &make->include_args, strmake( "-I%s", src_dir_path( make, make->parent_dir ))); - strarray_add( &make->include_args, strmake( "-I%s", top_obj_dir_path( make, "include" ))); - if (make->top_src_dir) - strarray_add( &make->include_args, strmake( "-I%s", top_src_dir_path( make, "include" ))); + strarray_add( &make->include_args, "-Iinclude" ); + if (root_src_dir) strarray_add( &make->include_args, strmake( "-I%s", root_src_dir_path( "include" ))); list_init( &make->sources ); list_init( &make->includes ); @@ -4440,20 +4374,18 @@ int main( int argc, char *argv[] ) if (!tools_ext) tools_ext = ""; if (!man_ext) man_ext = "3w"; + top_makefile->src_dir = root_src_dir; + subdirs = get_expanded_make_var_array( top_makefile, "SUBDIRS" ); disabled_dirs = get_expanded_make_var_array( top_makefile, "DISABLED_SUBDIRS" ); - top_makefile->subdirs = get_expanded_make_var_array( top_makefile, "SUBDIRS" ); - top_makefile->submakes = xmalloc( top_makefile->subdirs.count * sizeof(*top_makefile->submakes) ); + submakes = xmalloc( subdirs.count * sizeof(*submakes) ); - for (i = 0; i < top_makefile->subdirs.count; i++) - top_makefile->submakes[i] = parse_makefile( top_makefile->subdirs.str[i] ); + for (i = 0; i < subdirs.count; i++) submakes[i] = parse_makefile( subdirs.str[i] ); load_sources( top_makefile ); - for (i = 0; i < top_makefile->subdirs.count; i++) - load_sources( top_makefile->submakes[i] ); + for (i = 0; i < subdirs.count; i++) load_sources( submakes[i] ); output_dependencies( top_makefile ); - for (i = 0; i < top_makefile->subdirs.count; i++) - output_dependencies( top_makefile->submakes[i] ); + for (i = 0; i < subdirs.count; i++) output_dependencies( submakes[i] ); return 0; }