Commit fa07ef15 authored by Matheus Marchini's avatar Matheus Marchini

add make install target

Destination can be set through the CMAKE_INSTALL_PREFIX variable when
running cmake (for example, `-DCMAKE_INSTALL_PREFIX=/usr/local`).

Files are installed as described below:
  - `build/src/bpftrace` -> `${CMAKE_INSTALL_PREFIX}/sbin`
  - `tools/*` -> `${CMAKE_INSTALL_PREFIX}/share/bpftrace/tools`
  - `man/*` -> `${CMAKE_INSTALL_PREFIX}/man`
parent 64f706ce
......@@ -72,3 +72,5 @@ add_subdirectory(src/ast)
add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(resources)
add_subdirectory(tools)
add_subdirectory(man)
add_subdirectory(man8)
find_program(GZIP gzip)
file(GLOB FILES *.8)
set(GZFILES "")
foreach(FIL ${FILES})
get_filename_component(NAME ${FIL} NAME)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
COMMAND ${GZIP} -c ${FIL} > ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
DEPENDS ${FIL})
list(APPEND GZFILES "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz")
endforeach()
add_custom_target(man ALL DEPENDS ${GZFILES})
install(FILES ${GZFILES} DESTINATION man/man8)
......@@ -21,3 +21,5 @@ target_link_libraries(bpftrace ${binary_dir}/src/cc/libbpf.a)
target_link_libraries(bpftrace ${binary_dir}/src/cc/libbcc-loader-static.a)
target_link_libraries(bpftrace ${binary_dir}/src/cc/libbcc.a)
target_link_libraries(bpftrace ${LIBELF_LIBRARIES})
install(TARGETS bpftrace DESTINATION bin)
file(GLOB BT_FILES *.bt)
install(FILES ${BT_FILES} DESTINATION share/bpftrace/tools)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment