Hello.

I have some problem with the KBUILD_SRCTREE, and
reading the kbuild-2.5 makefile and the CML2, I
think I'm not alone.

I don't like the actual syntax, so I propose some
improvements, and it is difficult to apply in non
gcc cases.

kbuild-2. should set the internal variable
kbuild_scrtree that is a list of all KBUILD_SRCTREE
(in a format like the PATH), thus easy to use with
other programs.

to do this:
    kbuild_srctree=
    for evar in ${!KBUILD_SOURCETREE_*} ; do
        if [ "x$kbuild_srctree" = "x" ] ; then
            kbuild_srctree="${!evar}"
        else
            kbuild_srctree="${!evar}:$kbuild_srctree"
        fi
    done

To be more POSIX compatible we should substitute
"${!var}" to the "$(echo $var)".


This will simplify the use of multiple source
in applications.
Also the Makefile (instead of hard coded
SCRTREE_000 and CML2 (parsing the 'source' token
should use it.

To extract the right file in shell:
    OPATH="$PATH"
    PATH=$kbuild_srctree
    type -p file_without_dir
    PATH="$OPATH"
or the old method.
    OIFS="$OIFS"
    IFS=:
    for src in $kbuild_srctree ; do
        if [ -e "$kbuild_srctree/FILE_WITH_MAYBE_DIR" ] ; then
            echo "$kbuild_srctree/FILE_WITH_MAYBE_DIR"
            break
        fi
    done
    IFS="$OIFS"
IMHO in python will be a lot simpler.


    giacomo

_______________________________________________
kbuild-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/kbuild-devel

Reply via email to