Skip to content

Commit

Permalink
Merge pull request #572 from analogdevicesinc/rgetz-fix-building-man-…
Browse files Browse the repository at this point in the history
…pages

man: allow man pages to be built when not in a ./build dir
  • Loading branch information
dNechita authored Jul 23, 2020
2 parents 753e285 + ebe67a8 commit 9b4b492
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion man/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ if (WITH_MAN)
execute_process(
COMMAND ${DATE_EXECUTABLE} "+%d %B %Y"
OUTPUT_VARIABLE CMAKE_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/make_man.sh.in
${CMAKE_CURRENT_BINARY_DIR}/make_man.sh @ONLY)
execute_process(
COMMAND ${BASH_EXECUTABLE} "-c" "${CMAKE_CURRENT_SOURCE_DIR}/make_man.sh > ${CMAKE_BINARY_DIR}/libiio.3.in"
COMMAND ${BASH_EXECUTABLE} "-c" "${CMAKE_CURRENT_BINARY_DIR}/make_man.sh > ${CMAKE_BINARY_DIR}/libiio.3.in"
)
configure_file(
${CMAKE_BINARY_DIR}/libiio.3.in
Expand Down
11 changes: 6 additions & 5 deletions man/make_man.sh → man/make_man.sh.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash -e

if [ -z "$TRAVIS_BUILD_DIR" ] ; then
header="../iio.h"
else
header="$TRAVIS_BUILD_DIR/iio.h"
header="@CMAKE_SOURCE_DIR@/iio.h"

if [ ! -f "${header}" ] ; then
echo "Can not find iio.h at ${header}"
exit
fi

cat <<EOF
Expand Down Expand Up @@ -90,7 +91,7 @@ EOF
tmp=$(grep @struct "${header}" | sed 's:^[[:space:]]*\*[[:space:]]*@::g' | awk '{print length($0)}' | sort -n | tail -1)
echo .TP $((tmp - 5))

grep @struct ../iio.h -A 1 | \
grep @struct ${header} -A 1 | \
sed -e 's:^[[:space:]]*\*[[:space:]]*@::g' \
-e 's:struct[[:space:]]*:.TP\n.B :' \
-e 's:brief[[:space:]]*::' \
Expand Down

0 comments on commit 9b4b492

Please sign in to comment.