mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
makefiles: Add helper functions to build the various make lists more efficiently.
This commit is contained in:
parent
a1c253e056
commit
2de10c4a42
2 changed files with 2572 additions and 5131 deletions
89
aclocal.m4
vendored
89
aclocal.m4
vendored
|
@ -135,6 +135,32 @@ esac
|
|||
AC_CHECK_PROGS([$1],[$ac_prefix_list],[$3],[$4])])
|
||||
|
||||
|
||||
dnl **** Define helper functions for creating config.status files ****
|
||||
dnl
|
||||
dnl Usage: AC_REQUIRE([WINE_CONFIG_HELPERS])
|
||||
dnl
|
||||
AC_DEFUN([WINE_CONFIG_HELPERS],
|
||||
[wine_fn_append_file ()
|
||||
{
|
||||
AS_VAR_APPEND($[1]," \\$as_nl $[2]")
|
||||
}
|
||||
wine_fn_append_rule ()
|
||||
{
|
||||
AS_VAR_APPEND($[1],"$as_nl$[2]")
|
||||
}])
|
||||
|
||||
dnl **** Define helper function to append a file to a makefile file list ****
|
||||
dnl
|
||||
dnl Usage: WINE_APPEND_FILE(var,file)
|
||||
dnl
|
||||
AC_DEFUN([WINE_APPEND_FILE],[AC_REQUIRE([WINE_CONFIG_HELPERS])wine_fn_append_file $1 "$2"])
|
||||
|
||||
dnl **** Define helper function to append a rule to a makefile command list ****
|
||||
dnl
|
||||
dnl Usage: WINE_APPEND_RULE(var,rule)
|
||||
dnl
|
||||
AC_DEFUN([WINE_APPEND_RULE],[AC_REQUIRE([WINE_CONFIG_HELPERS])wine_fn_append_rule $1 "$2"])
|
||||
|
||||
dnl **** Create nonexistent directories from config.status ****
|
||||
dnl
|
||||
dnl Usage: WINE_CONFIG_EXTRA_DIR(dirname)
|
||||
|
@ -146,19 +172,17 @@ dnl **** Create symlinks from config.status ****
|
|||
dnl
|
||||
dnl Usage: WINE_CONFIG_SYMLINK(name,target)
|
||||
dnl
|
||||
AC_DEFUN([WINE_CONFIG_SYMLINK],[AC_CONFIG_LINKS([$1:]m4_default([$2],[$1]))dnl
|
||||
m4_if([$2],,[test "$srcdir" = "." || ])ALL_SYMLINKS="$ALL_SYMLINKS \\
|
||||
$1"])
|
||||
AC_DEFUN([WINE_CONFIG_SYMLINK],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
|
||||
AC_CONFIG_LINKS([$1:]m4_default([$2],[$1]))dnl
|
||||
m4_if([$2],,[test "$srcdir" = "." || ])WINE_APPEND_FILE(ALL_SYMLINKS,[$1])])
|
||||
|
||||
dnl **** Create a make rules file from config.status ****
|
||||
dnl
|
||||
dnl Usage: WINE_CONFIG_MAKERULES(file,var,deps)
|
||||
dnl
|
||||
AC_DEFUN([WINE_CONFIG_MAKERULES],
|
||||
[ALL_MAKERULES="$ALL_MAKERULES \\
|
||||
$1"
|
||||
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
|
||||
$1: m4_ifval([$3],[$1.in $3],[$1.in]) config.status"
|
||||
[WINE_APPEND_FILE(ALL_MAKERULES,[$1])
|
||||
WINE_APPEND_RULE(ALL_MAKEFILE_DEPENDS,[$1: m4_ifval([$3],[$1.in $3],[$1.in]) config.status])
|
||||
$2=$1
|
||||
AC_SUBST_FILE([$2])dnl
|
||||
AC_CONFIG_FILES([$1])])
|
||||
|
@ -170,15 +194,12 @@ dnl
|
|||
AC_DEFUN([WINE_CONFIG_MAKEFILE],
|
||||
[m4_pushdef([ac_dir],m4_bpatsubst([$1],[^\(\(.*\)/\)?Makefile$],[\2]))dnl
|
||||
m4_pushdef([ac_name],m4_bpatsubst(ac_dir,[.*/\(.*\)$],[\1]))dnl
|
||||
m4_ifval(ac_dir,[ALL_DIRS="$ALL_DIRS \\
|
||||
ac_dir"])
|
||||
m4_ifval(ac_dir,WINE_APPEND_FILE(ALL_DIRS,ac_dir))
|
||||
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],[ && ac_var="$ac_var \\
|
||||
ac_dir"]))
|
||||
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
|
||||
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
|
||||
m4_ifval(ac_dir,[\$(RECURSE_TARGETS:%=ac_dir/%) ac_dir: $1 \$(MAKEDEP)
|
||||
])[$1: ]m4_ifval([$2],[$1.in $2],[$1.in]) config.status"
|
||||
WINE_APPEND_RULE(ALL_MAKEFILE_DEPENDS,[m4_ifval(ac_dir,[\$(RECURSE_TARGETS:%=ac_dir/%) ac_dir: $1 \$(MAKEDEP)
|
||||
])[$1: ]m4_ifval([$2],[$1.in $2],[$1.in]) config.status])
|
||||
AC_CONFIG_FILES([$1])dnl
|
||||
m4_popdef([ac_dir])dnl
|
||||
m4_popdef([ac_name])])
|
||||
|
@ -192,14 +213,11 @@ AC_DEFUN([WINE_CONFIG_DLL],
|
|||
m4_pushdef([ac_crosslib],m4_ifval([$3],[dlls/$1/lib$3.cross.a]))dnl
|
||||
m4_pushdef([ac_staticlib],m4_ifval([$4],[dlls/$1/lib$3.$STATIC_IMPLIBEXT]))dnl
|
||||
m4_pushdef([ac_symlink],m4_if([$1],[$3],,[dlls/lib$3.$IMPLIBEXT]))dnl
|
||||
m4_ifval(ac_implib,[m4_ifval([$2],[test "x$[$2]" = xno || ])ALL_IMPORT_LIBS="$ALL_IMPORT_LIBS \\
|
||||
ac_implib[]dnl
|
||||
m4_ifval(ac_symlink,[ \\
|
||||
ac_symlink])[]dnl
|
||||
m4_ifval(ac_staticlib,[ \\
|
||||
ac_staticlib])"
|
||||
])ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
|
||||
m4_ifval(ac_implib,[ac_implib m4_ifval(ac_staticlib,[ac_staticlib ])ac_crosslib: tools/widl tools/winebuild tools/winegcc include
|
||||
m4_ifval(ac_implib,[m4_ifval([$2],[test "x$[$2]" != xno && ])WINE_APPEND_FILE(ALL_IMPORT_LIBS,ac_implib)dnl
|
||||
m4_ifval(ac_symlink,[ && WINE_APPEND_FILE(ALL_IMPORT_LIBS,ac_symlink)])dnl
|
||||
m4_ifval(ac_staticlib,[ && WINE_APPEND_FILE(ALL_IMPORT_LIBS,ac_staticlib)])
|
||||
])WINE_APPEND_RULE(ALL_MAKEFILE_DEPENDS,
|
||||
[m4_ifval(ac_implib,[ac_implib m4_ifval(ac_staticlib,[ac_staticlib ])ac_crosslib: tools/widl tools/winebuild tools/winegcc include
|
||||
m4_ifval(ac_symlink,[ac_symlink: ac_implib
|
||||
\$(RM) \$[@] && \$(LN_S) $1/lib$3.$IMPLIBEXT \$[@]
|
||||
dlls/lib$3.cross.a: ac_crosslib
|
||||
|
@ -212,7 +230,7 @@ ac_staticlib ac_crosslib: dlls/$1/Makefile dummy
|
|||
@cd dlls/$1 && \$(MAKE) \`basename \$[@]\`],
|
||||
[ac_implib ac_crosslib: dlls/$1/$1.spec dlls/$1/Makefile
|
||||
@cd dlls/$1 && \$(MAKE) \`basename \$[@]\`])
|
||||
])dlls/$1 dlls/$1/__install__ dlls/$1/__install-lib__ dlls/$1/__install-dev__: __builddeps__"
|
||||
])dlls/$1 dlls/$1/__install__ dlls/$1/__install-lib__ dlls/$1/__install-dev__: __builddeps__])
|
||||
WINE_CONFIG_MAKEFILE([dlls/$1/Makefile],[dlls/Makedll.rules],[ALL_DLL_DIRS],[$2])dnl
|
||||
m4_popdef([ac_implib])dnl
|
||||
m4_popdef([ac_crosslib])dnl
|
||||
|
@ -224,8 +242,7 @@ dnl
|
|||
dnl Usage: WINE_CONFIG_PROGRAM(name,var,enable)
|
||||
dnl
|
||||
AC_DEFUN([WINE_CONFIG_PROGRAM],
|
||||
[ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
|
||||
programs/$1 programs/$1/__install__ programs/$1/__install-lib__: __builddeps__"
|
||||
[WINE_APPEND_RULE(ALL_MAKEFILE_DEPENDS,[programs/$1 programs/$1/__install__ programs/$1/__install-lib__: __builddeps__])
|
||||
WINE_CONFIG_MAKEFILE([programs/$1/Makefile],[programs/Makeprog.rules],[$2],[$3])])
|
||||
|
||||
dnl **** Create a test makefile from config.status ****
|
||||
|
@ -235,17 +252,15 @@ dnl
|
|||
AC_DEFUN([WINE_CONFIG_TEST],
|
||||
[m4_pushdef([ac_suffix],m4_if(m4_substr([$1],0,9),[programs/],[.exe_test],[_test]))dnl
|
||||
m4_pushdef([ac_name],[m4_bpatsubst([$1],[.*/\(.*\)/tests$],[\1])]ac_suffix)dnl
|
||||
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
|
||||
$1: __builddeps__
|
||||
$1/__crosstest__: __buildcrossdeps__"
|
||||
ALL_TEST_BINARIES="$ALL_TEST_BINARIES \\
|
||||
ac_name.exe"
|
||||
ALL_WINETEST_DEPENDS="$ALL_WINETEST_DEPENDS
|
||||
ac_name.exe: \$(TOPOBJDIR)/$1/ac_name.exe$DLLEXT
|
||||
WINE_APPEND_RULE(ALL_MAKEFILE_DEPENDS,[$1: __builddeps__
|
||||
$1/__crosstest__: __buildcrossdeps__])
|
||||
WINE_APPEND_FILE(ALL_TEST_BINARIES,[ac_name.exe])
|
||||
WINE_APPEND_RULE(ALL_WINETEST_DEPENDS,
|
||||
[ac_name.exe: \$(TOPOBJDIR)/$1/ac_name.exe$DLLEXT
|
||||
cp \$(TOPOBJDIR)/$1/ac_name.exe$DLLEXT \$[@] && \$(STRIP) \$[@]
|
||||
ac_name.rc:
|
||||
echo \"ac_name.exe TESTRES \\\"ac_name.exe\\\"\" >\$[@] || (\$(RM) \$[@] && false)
|
||||
ac_name.res: ac_name.rc ac_name.exe"
|
||||
ac_name.res: ac_name.rc ac_name.exe])
|
||||
WINE_CONFIG_MAKEFILE([$1/Makefile],[Maketest.rules],[ALL_TEST_DIRS],[enable_tests])dnl
|
||||
m4_popdef([ac_suffix])dnl
|
||||
m4_popdef([ac_name])])
|
||||
|
@ -255,13 +270,11 @@ dnl
|
|||
dnl Usage: WINE_CONFIG_LIB(name)
|
||||
dnl
|
||||
AC_DEFUN([WINE_CONFIG_LIB],
|
||||
[ALL_STATIC_LIBS="$ALL_STATIC_LIBS \\
|
||||
dlls/$1/lib$1.a"
|
||||
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
|
||||
dlls/$1: tools/widl tools/winebuild tools/winegcc include
|
||||
[WINE_APPEND_FILE(ALL_STATIC_LIBS,[dlls/$1/lib$1.a])
|
||||
WINE_APPEND_RULE(ALL_MAKEFILE_DEPENDS,[dlls/$1: tools/widl tools/winebuild tools/winegcc include
|
||||
dlls/$1/__install__ dlls/$1/__install-dev__: dlls/$1
|
||||
dlls/$1/lib$1.cross.a: dlls/$1/Makefile tools/widl tools/winebuild tools/winegcc include dummy
|
||||
@cd dlls/$1 && \$(MAKE) \`basename \$[@]\`"
|
||||
@cd dlls/$1 && \$(MAKE) \`basename \$[@]\`])
|
||||
WINE_CONFIG_MAKEFILE([dlls/$1/Makefile],[dlls/Makeimplib.rules],[ALL_STATICLIB_DIRS])])
|
||||
|
||||
dnl **** Add a message to the list displayed at the end ****
|
||||
|
|
Loading…
Reference in a new issue