Commits

Anonymous committed 1229945

Now building the man pages properly.

  • Participants
  • Parent commits dcf291b

Comments (0)

Files changed (2)

File pthreads/Common.cmake

+INCLUDE(FindPerl)
+IF (NOT PERL_FOUND)
+    MESSAGE ( FATAL_ERROR "perl must be installed")
+ENDIF(NOT PERL_FOUND)
+
 MACRO(CHOMP VAR)
     STRING(REGEX REPLACE "[\r\n]+$" "" ${VAR} "${${VAR}}")
 ENDMACRO(CHOMP)
+
+MACRO(RUN_POD2MAN SOURCE DEST SECTION CENTER RELEASE)
+    SET(PATH_PERL ${PERL_EXECUTABLE})
+    ADD_CUSTOM_COMMAND(
+        OUTPUT ${DEST}
+        COMMAND ${PATH_PERL}
+        ARGS "-e"
+        "my (\$src, \$dest, \$sect, \$center, \$release) = @ARGV; my \$pod = qq{Hoola.pod}; use File::Copy; copy(\$src, \$pod); system(qq{pod2man --section=\$sect --center=\"\$center\" --release=\"\$release\" \$pod > \$dest}); unlink(\$pod)"
+        ${SOURCE}
+        ${DEST}
+        ${SECTION}
+        "${CENTER}"
+        "${RELEASE}"
+        MAIN_DEPENDENCY ${SOURCE}
+        VERBATIM
+    )
+    ADD_CUSTOM_TARGET(
+        POD_${DEST} ALL
+        DEPENDS ${DEST}
+    )
+ENDMACRO(RUN_POD2MAN)
+
+MACRO(INSTALL_MAN SOURCE SECTION)
+    INSTALL(
+        FILES
+            ${SOURCE}
+        DESTINATION
+            "share/man/man${SECTION}"
+   )
+ENDMACRO(INSTALL_MAN)
+

File pthreads/man/CMakeLists.txt

+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+SET(CMAKE_VERBOSE_MAKEFILE ON)
+
+INCLUDE( "${CMAKE_CURRENT_SOURCE_DIR}/../Common.cmake" )
+
+RUN_POD2MAN(
+    "${CMAKE_CURRENT_SOURCE_DIR}/pthread_rwlock_fcfs.pod"
+    "pthread_rwlock_fcfs.3thr"
+    "3thr"
+    "FCFS RWLock"
+    "FCFS RWLock"
+)
+
+INSTALL_MAN ( "${CMAKE_CURRENT_BINARY_DIR}/freecell-solver-range-parallel-solve.6" 3)
+
+SET (SRC "${CMAKE_CURRENT_SOURCE_DIR}/pthread_rwlock_fcfs.pod")
+SET (DEST "pthread_rwlock_fcfs.html")
+
+ADD_CUSTOM_COMMAND(
+    OUTPUT ${DEST}
+    COMMAND pod2xhtml
+    ARGS "--noindex" "--infile" ${SRC} "--outfile" ${DEST}
+    MAIN_DEPENDENCY ${SRC}
+    VERBATIM
+)
+
+ADD_CUSTOM_TARGET(
+    HTML_${DEST} ALL
+    DEPENDS ${DEST}
+)
+
+SET (man_links "alloc" "timed_gain_read" "timed_gain_write"
+    "try_gain_read" "try_gain_write"
+    "gain_read" "gain_write"
+    "release"
+    "destroy")
+
+SET (prefix "pthread_rwlock_fcfs")
+FOREACH(link ${man_links})
+    SET (full_link "${prefix}_${link}")
+    SET (DEST "${full_link}.3thr")
+    ADD_CUSTOM_COMMAND(
+        OUTPUT ${DEST}
+        COMMAND echo
+        ARGS ".so man3/${prefix}.3thr" > ${DEST}
+        VERBATIM
+    )    
+
+    ADD_CUSTOM_TARGET(
+        MAN_${DEST} ALL
+        DEPENDS ${DEST}
+    )   
+ENDFOREACH(link)
+