Skip to content

Commit

Permalink
Merge pull request #2206 from masatake/revise-autogen
Browse files Browse the repository at this point in the history
Revise autogen.sh
  • Loading branch information
masatake committed Sep 26, 2019
2 parents 9757e4f + 82a3fb1 commit 535d205
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 26 deletions.
30 changes: 18 additions & 12 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,32 @@ if [ -z "${MAKE}" ]; then
elif type bmake > /dev/null; then
MAKE=bmake
else
echo "make command is not found" 1>&1
echo "make command is not found" 1>&2
exit 1
fi
fi

ctags_files=`${MAKE} -s -f makefiles/list-optlib2c-input.mak`
misc/dist-test-cases && \
if autoreconf -vfi; then
if type perl > /dev/null; then
for i in ${ctags_files}; do
o=${i%.ctags}.c
echo "optlib2c: translating $i to $o"
./misc/optlib2c $i > $o
done
if type perl > /dev/null; then
for i in ${ctags_files}; do
o=${i%.ctags}.c
echo "optlib2c: translating $i to $o"
if ! ./misc/optlib2c $i > $o; then
echo "failed in running optlib2c" 1>&2
exit 1
fi
done
else
for i in ${ctags_files}; do
o=${i%.ctags}.c
echo "use pre-translated file: $o"
done
fi
else
for i in ${ctags_files}; do
o=${i%.ctags}.c
echo "use pre-translated file: $o"
done
fi
echo "failed in running autoreconf" 1>&2
exit 1
fi

exit $?
28 changes: 14 additions & 14 deletions misc/dist-test-cases
Original file line number Diff line number Diff line change
Expand Up @@ -23,45 +23,45 @@ print_am_header()

print_m4_header()
{
local top=$1
m4_top=$1

echo "dnl -*- autoconf -*-"
echo "dnl Generated by $0"
echo
echo 'AC_CONFIG_FILES(['"$top"/Makefile'])'
echo 'AC_CONFIG_FILES(['"${m4_top}"/Makefile'])'
}

make_am_sub_with_git ()
{
local d=$1
local f
sub_d=$1
sub_f

print_am_header
echo "EXTRA_DIST ="

for f in $(git ls-files | sed -n -e 's|^'"$d"'/\(.\+\)|\1|p' | uniq); do
echo "EXTRA_DIST +=" "$f"
for sub_f in $(git ls-files | sed -n -e 's|^'"${sub_d}"'/\(.\+\)|\1|p' | uniq); do
echo "EXTRA_DIST +=" "${sub_f}"
done

}

make_am_with_git ()
{
local top=$1
local d
git_top=$1
top_d=

print_am_header
echo "DIST_SUBDIRS ="
echo "EXTRA_DIST ="
echo

for d in $(git ls-files | grep $top | sed -n -e 's|^\(^'$top'/[^/]\+\)\(/.*\)\?|\1|p' | sort | uniq); do
if [ -d "$d" ]; then
echo "DIST_SUBDIRS +=" $(basename "$d")
make_am_sub_with_git $d > $d/Makefile.am
echo 'AC_CONFIG_FILES(['$d'/Makefile])' >> $top/dist.m4
for d in $(git ls-files | grep ${git_top} | sed -n -e 's|^\(^'${git_top}'/[^/]\+\)\(/.*\)\?|\1|p' | sort | uniq); do
if [ -d "${top_d}" ]; then
echo "DIST_SUBDIRS +=" $(basename "${top_d}")
make_am_sub_with_git ${top_d} > ${top_d}/Makefile.am
echo 'AC_CONFIG_FILES(['${top_d}'/Makefile])' >> ${git_top}/dist.m4
else
echo "EXTRA_DIST +=" $(basename "$d")
echo "EXTRA_DIST +=" $(basename "${top_d}")
fi
done
}
Expand Down

0 comments on commit 535d205

Please sign in to comment.