From 03642414a84a14d9cd0efe143b2de9cf35a693a2 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 20 Mar 2010 15:24:22 +0100 Subject: [PATCH] makefiles: Generate all the top-level make rules inside the corresponding shell function. --- aclocal.m4 | 26 ++++++++--------- configure | 68 ++++++++++++++++---------------------------- configure.ac | 20 ++++++------- tools/make_makefiles | 9 ++---- 4 files changed, 50 insertions(+), 73 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 328a345a601..060767aa28d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -140,7 +140,8 @@ dnl dnl Usage: AC_REQUIRE([WINE_CONFIG_HELPERS]) dnl AC_DEFUN([WINE_CONFIG_HELPERS], -[AC_SUBST(ALL_MAKEFILE_DEPENDS,["# Makefile dependencies"]) +[AC_SUBST(ALL_MAKEFILE_DEPENDS,["# Makefile dependencies +Makefile: Makefile.in Make.rules config.status"]) AC_SUBST(ALL_WINETEST_DEPENDS,["# Test binaries"]) AC_SUBST(ALL_MAKERULES,"") @@ -171,12 +172,16 @@ wine_fn_append_rule () wine_fn_config_makefile () { ac_dir=$[1] - ac_deps=$[2] + ac_enable=$[2] wine_fn_append_file ALL_DIRS $ac_dir wine_fn_append_rule ALL_MAKEFILE_DEPENDS \ "$ac_dir/__clean__ $ac_dir/__install__ $ac_dir/__install-dev__ $ac_dir/__install-lib__ $ac_dir/__uninstall__ $ac_dir: $ac_dir/Makefile -$ac_dir/Makefile $ac_dir/__depend__: $ac_dir/Makefile.in config.status $ac_deps +$ac_dir/Makefile $ac_dir/__depend__: $ac_dir/Makefile.in config.status Make.rules \$(MAKEDEP) @./config.status --file $ac_dir/Makefile && cd $ac_dir && \$(MAKE) depend" + AS_VAR_IF([$ac_enable],[no],,[case $ac_dir in + */*) ;; + *) wine_fn_append_file ALL_TOP_DIRS $ac_dir ;; + esac]) } wine_fn_config_lib () @@ -345,19 +350,12 @@ AC_CONFIG_FILES([$1])]) dnl **** Create a makefile from config.status **** dnl -dnl Usage: WINE_CONFIG_MAKEFILE(file,deps,var,enable) +dnl Usage: WINE_CONFIG_MAKEFILE(file,enable) dnl AC_DEFUN([WINE_CONFIG_MAKEFILE],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl -m4_pushdef([ac_dir],m4_bpatsubst([$1],[^\(\(.*\)/\)?Makefile$],[\2]))dnl -m4_pushdef([ac_name],m4_bpatsubst(ac_dir,[.*/\(.*\)$],[\1]))dnl -m4_if(ac_dir,,WINE_APPEND_RULE(ALL_MAKEFILE_DEPENDS,[$1: $1.in $2 config.status]) -AC_CONFIG_FILES([$1]), -[wine_fn_config_makefile ac_dir m4_if(ac_dir,tools,[$2],["$2 \$(MAKEDEP)"]) -AS_VAR_PUSHDEF([ac_enable],m4_default([$4],[enable_]ac_name))dnl -m4_ifval([$3],[test "x$ac_enable" != xno]m4_foreach([ac_var],[$3],[ && WINE_APPEND_FILE(ac_var,ac_dir)])) -AS_VAR_POPDEF([ac_enable])])dnl -m4_popdef([ac_dir])dnl -m4_popdef([ac_name])]) +AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl +wine_fn_config_makefile [$1] ac_enable[]dnl +AS_VAR_POPDEF([ac_enable])]) dnl **** Create a dll makefile from config.status **** dnl diff --git a/configure b/configure index 346ec70e950..6363a24af1d 100755 --- a/configure +++ b/configure @@ -13782,8 +13782,11 @@ esac ac_config_commands="$ac_config_commands include/stamp-h" +ac_config_files="$ac_config_files Makefile" -ALL_MAKEFILE_DEPENDS="# Makefile dependencies" + +ALL_MAKEFILE_DEPENDS="# Makefile dependencies +Makefile: Makefile.in Make.rules config.status" ALL_WINETEST_DEPENDS="# Test binaries" @@ -13830,12 +13833,21 @@ wine_fn_append_rule () wine_fn_config_makefile () { ac_dir=$1 - ac_deps=$2 + ac_enable=$2 wine_fn_append_file ALL_DIRS $ac_dir wine_fn_append_rule ALL_MAKEFILE_DEPENDS \ "$ac_dir/__clean__ $ac_dir/__install__ $ac_dir/__install-dev__ $ac_dir/__install-lib__ $ac_dir/__uninstall__ $ac_dir: $ac_dir/Makefile -$ac_dir/Makefile $ac_dir/__depend__: $ac_dir/Makefile.in config.status $ac_deps +$ac_dir/Makefile $ac_dir/__depend__: $ac_dir/Makefile.in config.status Make.rules \$(MAKEDEP) @./config.status --file $ac_dir/Makefile && cd $ac_dir && \$(MAKE) depend" + eval as_val=\$$ac_enable + if test "x$as_val" = x""no; then : + +else + case $ac_dir in + */*) ;; + *) wine_fn_append_file ALL_TOP_DIRS $ac_dir ;; + esac +fi } wine_fn_config_lib () @@ -14029,9 +14041,6 @@ MAKE_PROG_RULES=programs/Makeprog.rules ac_config_files="$ac_config_files programs/Makeprog.rules" -wine_fn_append_rule ALL_MAKEFILE_DEPENDS "Makefile: Makefile.in Make.rules config.status" -ac_config_files="$ac_config_files Makefile" - wine_fn_config_dll acledit enable_acledit wine_fn_config_dll aclui enable_aclui aclui wine_fn_config_dll activeds enable_activeds activeds @@ -14505,30 +14514,14 @@ wine_fn_config_test dlls/xinput1_3/tests xinput1_3_test wine_fn_config_dll xinput9_1_0 enable_xinput9_1_0 wine_fn_config_dll xmllite enable_xmllite wine_fn_config_test dlls/xmllite/tests xmllite_test -wine_fn_config_makefile documentation "Make.rules \$(MAKEDEP)" -test "x$enable_documentation" != xno && wine_fn_append_file ALL_TOP_DIRS "documentation" - -wine_fn_config_makefile fonts "Make.rules \$(MAKEDEP)" -test "x$enable_fonts" != xno && wine_fn_append_file ALL_TOP_DIRS "fonts" - -wine_fn_config_makefile include "Make.rules \$(MAKEDEP)" -test "x$enable_include" != xno && wine_fn_append_file ALL_TOP_DIRS "include" - -wine_fn_config_makefile libs/port "Make.rules \$(MAKEDEP)" - - -wine_fn_config_makefile libs/wine "Make.rules \$(MAKEDEP)" - - -wine_fn_config_makefile libs/wpp "Make.rules \$(MAKEDEP)" - - -wine_fn_config_makefile loader "Make.rules \$(MAKEDEP)" -test "x$enable_loader" != xno && wine_fn_append_file ALL_TOP_DIRS "loader" - -wine_fn_config_makefile programs "Make.rules \$(MAKEDEP)" -test "x$enable_programs" != xno && wine_fn_append_file ALL_TOP_DIRS "programs" - +wine_fn_config_makefile documentation enable_documentation +wine_fn_config_makefile fonts enable_fonts +wine_fn_config_makefile include enable_include +wine_fn_config_makefile libs/port enable_libs_port +wine_fn_config_makefile libs/wine enable_libs_wine +wine_fn_config_makefile libs/wpp enable_libs_wpp +wine_fn_config_makefile loader enable_loader +wine_fn_config_makefile programs enable_programs wine_fn_config_program attrib enable_attrib install wine_fn_config_program cacls enable_cacls install wine_fn_config_program clock enable_clock install @@ -14586,9 +14579,7 @@ wine_fn_config_program winver enable_winver install wine_fn_config_program wordpad enable_wordpad install wine_fn_config_program write enable_write install wine_fn_config_program xcopy enable_xcopy install -wine_fn_config_makefile server "Make.rules \$(MAKEDEP)" -test "x$enable_server" != xno && wine_fn_append_file ALL_TOP_DIRS "server" - +wine_fn_config_makefile server enable_server wine_fn_config_tool tools wine_fn_config_tool tools/widl wine_fn_config_tool tools/winebuild @@ -15293,6 +15284,7 @@ do case $ac_config_target in "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; "include/stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/stamp-h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "dlls/wineps.drv/generic.ppd") CONFIG_LINKS="$CONFIG_LINKS dlls/wineps.drv/generic.ppd:dlls/wineps.drv/generic.ppd" ;; "fonts/marlett.ttf") CONFIG_LINKS="$CONFIG_LINKS fonts/marlett.ttf:fonts/marlett.ttf" ;; "fonts/symbol.ttf") CONFIG_LINKS="$CONFIG_LINKS fonts/symbol.ttf:fonts/symbol.ttf" ;; @@ -15310,16 +15302,6 @@ do "dlls/Makedll.rules") CONFIG_FILES="$CONFIG_FILES dlls/Makedll.rules" ;; "dlls/Makeimplib.rules") CONFIG_FILES="$CONFIG_FILES dlls/Makeimplib.rules" ;; "programs/Makeprog.rules") CONFIG_FILES="$CONFIG_FILES programs/Makeprog.rules" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "documentation/Makefile") CONFIG_FILES="$CONFIG_FILES documentation/Makefile" ;; - "fonts/Makefile") CONFIG_FILES="$CONFIG_FILES fonts/Makefile" ;; - "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; - "libs/port/Makefile") CONFIG_FILES="$CONFIG_FILES libs/port/Makefile" ;; - "libs/wine/Makefile") CONFIG_FILES="$CONFIG_FILES libs/wine/Makefile" ;; - "libs/wpp/Makefile") CONFIG_FILES="$CONFIG_FILES libs/wpp/Makefile" ;; - "loader/Makefile") CONFIG_FILES="$CONFIG_FILES loader/Makefile" ;; - "programs/Makefile") CONFIG_FILES="$CONFIG_FILES programs/Makefile" ;; - "server/Makefile") CONFIG_FILES="$CONFIG_FILES server/Makefile" ;; *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/configure.ac b/configure.ac index a22b9845194..5655b512ca1 100644 --- a/configure.ac +++ b/configure.ac @@ -2121,6 +2121,7 @@ dnl **** Generate output files **** AH_TOP([#define __WINE_CONFIG_H]) AC_CONFIG_COMMANDS([include/stamp-h], [echo timestamp > include/stamp-h]) +AC_CONFIG_FILES([Makefile]) WINE_CONFIG_SYMLINK(dlls/wineps.drv/generic.ppd) WINE_CONFIG_SYMLINK(fonts/marlett.ttf) @@ -2142,7 +2143,6 @@ WINE_CONFIG_MAKERULES([dlls/Makedll.rules],[MAKE_DLL_RULES],[Make.rules]) WINE_CONFIG_MAKERULES([dlls/Makeimplib.rules],[MAKE_IMPLIB_RULES],[Make.rules]) WINE_CONFIG_MAKERULES([programs/Makeprog.rules],[MAKE_PROG_RULES],[Make.rules]) -WINE_CONFIG_MAKEFILE([Makefile],[Make.rules]) WINE_CONFIG_DLL(acledit) WINE_CONFIG_DLL(aclui,,[aclui]) WINE_CONFIG_DLL(activeds,,[activeds]) @@ -2616,14 +2616,14 @@ WINE_CONFIG_TEST(dlls/xinput1_3/tests) WINE_CONFIG_DLL(xinput9_1_0) WINE_CONFIG_DLL(xmllite) WINE_CONFIG_TEST(dlls/xmllite/tests) -WINE_CONFIG_MAKEFILE([documentation/Makefile],[Make.rules],[ALL_TOP_DIRS]) -WINE_CONFIG_MAKEFILE([fonts/Makefile],[Make.rules],[ALL_TOP_DIRS]) -WINE_CONFIG_MAKEFILE([include/Makefile],[Make.rules],[ALL_TOP_DIRS]) -WINE_CONFIG_MAKEFILE([libs/port/Makefile],[Make.rules]) -WINE_CONFIG_MAKEFILE([libs/wine/Makefile],[Make.rules]) -WINE_CONFIG_MAKEFILE([libs/wpp/Makefile],[Make.rules]) -WINE_CONFIG_MAKEFILE([loader/Makefile],[Make.rules],[ALL_TOP_DIRS]) -WINE_CONFIG_MAKEFILE([programs/Makefile],[Make.rules],[ALL_TOP_DIRS]) +WINE_CONFIG_MAKEFILE([documentation]) +WINE_CONFIG_MAKEFILE([fonts]) +WINE_CONFIG_MAKEFILE([include]) +WINE_CONFIG_MAKEFILE([libs/port]) +WINE_CONFIG_MAKEFILE([libs/wine]) +WINE_CONFIG_MAKEFILE([libs/wpp]) +WINE_CONFIG_MAKEFILE([loader]) +WINE_CONFIG_MAKEFILE([programs]) WINE_CONFIG_PROGRAM(attrib,install) WINE_CONFIG_PROGRAM(cacls,install) WINE_CONFIG_PROGRAM(clock,install) @@ -2681,7 +2681,7 @@ WINE_CONFIG_PROGRAM(winver,install) WINE_CONFIG_PROGRAM(wordpad,install) WINE_CONFIG_PROGRAM(write,install) WINE_CONFIG_PROGRAM(xcopy,install) -WINE_CONFIG_MAKEFILE([server/Makefile],[Make.rules],[ALL_TOP_DIRS]) +WINE_CONFIG_MAKEFILE([server]) WINE_CONFIG_TOOL(tools) WINE_CONFIG_TOOL(tools/widl) WINE_CONFIG_TOOL(tools/winebuild) diff --git a/tools/make_makefiles b/tools/make_makefiles index 33fcbc0031c..83d7836dc90 100755 --- a/tools/make_makefiles +++ b/tools/make_makefiles @@ -395,13 +395,10 @@ sub update_makefiles(@) (my $name = $file) =~ s/^(.*)\/Makefile/$1/; push @lines, "WINE_CONFIG_TOOL($name)\n"; } - elsif ($file =~ /^[^\/]*\/Makefile$/) + elsif ($file =~ /\/Makefile$/) { - push @lines, "WINE_CONFIG_MAKEFILE([$file],[$rules],[ALL_TOP_DIRS])\n"; - } - else - { - push @lines, "WINE_CONFIG_MAKEFILE([$file],[$rules])\n"; + (my $name = $file) =~ s/^(.*)\/Makefile/$1/; + push @lines, "WINE_CONFIG_MAKEFILE([$name])\n"; } }