update/trees: generic cmake handling
it is no longer hardcoded just to be handled for uefiextract. it is now defined as cmakedir in target.cfg, for a single or multi tree project. if multi tree, it is applied to the specific tree, and has to be defined per tree the way it works is: as per cmakelist, a project will define which directory is to be built, and it will then generate a makefile in the main source tree (the build tree in cmake language, where the main CMakeLists.txt file exists) when the makefile has been generated, the project is then treated like any other project. the way cmake works, if a makefile has already been generated by it, in a given directory, running it again will fail and not affect anything; if it fails but the makefile doesn't exist, then something is wrong, but if the makefile does exist, then it's all fine and nothing happens at present, this is only used for uefiextract, which is part of src/uefitool Signed-off-by: Leah Rowe <leah@libreboot.org>9020vga
parent
30337b8fa5
commit
c6a0e4952e
|
@ -0,0 +1 @@
|
||||||
|
cmakedir="UEFIExtract"
|
|
@ -12,7 +12,7 @@ set -u -e
|
||||||
|
|
||||||
eval "$(setvars "" xarch cfgsdir codedir config config_name xlang mode \
|
eval "$(setvars "" xarch cfgsdir codedir config config_name xlang mode \
|
||||||
elfdir listfile project target target_dir targets tree _f target1 \
|
elfdir listfile project target target_dir targets tree _f target1 \
|
||||||
bootstrapargs autoconfargs)"
|
bootstrapargs autoconfargs cmakedir)"
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
@ -54,14 +54,6 @@ build_projects()
|
||||||
codedir="src/${project}"
|
codedir="src/${project}"
|
||||||
[ -d "$codedir" ] || x_ ./update trees -f "$project"
|
[ -d "$codedir" ] || x_ ./update trees -f "$project"
|
||||||
|
|
||||||
if [ "$project" = "uefitool" ]; then
|
|
||||||
(
|
|
||||||
x_ cd src/uefitool
|
|
||||||
cmake UEFIExtract/ || [ -f Makefile ] || \
|
|
||||||
err "build_projects: !cmake UEFIExtract/"
|
|
||||||
) || err "can't build cmake on uefiextract"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ "$mode" = "distclean" ] && mode="clean"
|
[ "$mode" = "distclean" ] && mode="clean"
|
||||||
run_make_command || return 0
|
run_make_command || return 0
|
||||||
}
|
}
|
||||||
|
@ -214,6 +206,7 @@ handle_makefile()
|
||||||
|
|
||||||
run_make_command()
|
run_make_command()
|
||||||
{
|
{
|
||||||
|
check_cmake "$codedir"
|
||||||
[ -z "$mode" ] && check_autoconf "$codedir"
|
[ -z "$mode" ] && check_autoconf "$codedir"
|
||||||
check_makefile "$codedir" || return 1
|
check_makefile "$codedir" || return 1
|
||||||
|
|
||||||
|
@ -228,15 +221,27 @@ run_make_command()
|
||||||
make -C "$codedir" distclean 2>/dev/null || :
|
make -C "$codedir" distclean 2>/dev/null || :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_cmake()
|
||||||
|
{
|
||||||
|
[ -z "${cmakedir}" ] || \
|
||||||
|
check_makefile "${1}" || \
|
||||||
|
cmake -B "${1}" "${1}/${cmakedir}" || \
|
||||||
|
check_makefile "${1}" || \
|
||||||
|
err "check_cmake ${1}: can't cmake ${cmakedir}"
|
||||||
|
[ -z "${cmakedir}" ] || check_makefile "${1}" || \
|
||||||
|
err "check_cmake ${1}: could not generate Makefile"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
check_autoconf()
|
check_autoconf()
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
_cfgopt=""
|
_cfgopt=""
|
||||||
cd "${codedir}" || err "!cd $codedir"
|
cd "${1}" || err "!cd $1"
|
||||||
[ -f "bootstrap" ] && x_ ./bootstrap $bootstrapargs
|
[ -f "bootstrap" ] && x_ ./bootstrap $bootstrapargs
|
||||||
[ -f "autogen.sh" ] && x_ ./autogen.sh
|
[ -f "autogen.sh" ] && x_ ./autogen.sh
|
||||||
[ -f "configure" ] && x_ ./configure $autoconfargs; return 0
|
[ -f "configure" ] && x_ ./configure $autoconfargs; return 0
|
||||||
) || err "can't bootstrap project: $codedir"
|
) || err "can't bootstrap project: $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_makefile()
|
check_makefile()
|
||||||
|
|
Loading…
Reference in New Issue