author | Olivier Brunel
<jjk@jjacky.com> 2023-01-25 22:19:57 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-01-25 23:03:17 UTC |
parent | 4ca50bca26cb0d455adde7d24361f9dd663bd107 |
configure | +41 | -18 |
project.mk.tpl | +2 | -2 |
diff --git a/configure b/configure index f18de16..a486f81 100755 --- a/configure +++ b/configure @@ -447,31 +447,54 @@ echo $VPATHS setdep() { local depname="$1" - local rep=$(eval "echo \$lib$depname") - rep="$(echo "$rep" | sed "s/\//\\\\\//g")" - line="$(echo "$line" | sed "s/$depname/$rep/")" + if test "$line" != "$depname"; then return; fi + line="$(eval "echo \$lib$depname")" } echo "# dependencies" -if test -f "meta/deps-lib"; then - exec 4<"meta/deps-lib" - echo "# dependencies" - while IFS= read -r line <&4; do - foreach "dep" $nbdeps setdep - echo "lib$(echo "$line" | cut -d: -f1).a: $(echo "$line" | cut -d: -f2-)" - line="$(echo "$line" | sed "s/\.o/\.lo/g")" - echo "lib$(echo "$line" | cut -d: -f1).so: $(echo "$line" | cut -d: -f2-)" +if test -d meta/libs; then + for file in meta/libs/*; do + exec 4<"$file" + depsA= + depsSO= + while IFS= read -r line <&4; do + if test "${line:0:1}" == "#"; then continue; fi + foreach "dep" $nbdeps setdep + if test "${line:${#line}-2}" == ".o"; then + lineso="${line:0:${#line}-2}.lo" + else + lineso= + fi + if test "${line:${#line}-2}" == ".O"; then + line="${line:0:${#line}-2}.o" + fi + if test -z "$lineso"; then + lineso="$line" + fi + depsA="$depsA $line" + depsSO="$depsSO $lineso" + done + exec 4<&- + echo lib${file##*/}.a: $depsA + echo lib${file##*/}.so: $depsSO done - exec 4<&- fi -if test -f "meta/deps-bin"; then - exec 4<"meta/deps-bin" - while IFS= read -r line <&4; do - foreach "dep" $nbdeps setdep - echo $line +if test -d meta/bins; then + for file in meta/bins/*; do + exec 4<"$file" + deps= + while IFS= read -r line <&4; do + if test "${line:0:1}" == "#"; then continue; fi + foreach "dep" $nbdeps setdep + if test "${line:${#line}-2}" == ".O"; then + line="${line:0:${#line}-2}.o" + fi + deps="$deps $line" + done + exec 4<&- + echo ${file##*/}: $deps done - exec 4<&- fi cat <<EOF diff --git a/project.mk.tpl b/project.mk.tpl index 0892fd9..cd9bd93 100644 --- a/project.mk.tpl +++ b/project.mk.tpl @@ -1,7 +1,7 @@ $(error You need to edit project.mk) -# binaries: -- don't forget to set meta/deps-bin with all deps & .o files +# binaries: -- don't forget to set meta/bins/{bin1,bin2,...} with all deps & .o files BINS = -# librairies -- don't forget to set meta/deps-lib with all deps & .o files +# librairies -- don't forget to set meta/libs{lib1,lib2,...} with all deps & .o files LIBS =