Skip to content

Commit

Permalink
Refactor main CMakeLists.txt. Generate manpages when pandoc is presen…
Browse files Browse the repository at this point in the history
…t in Debug builds. Add top level Makefile
  • Loading branch information
Jerry Jacobs committed Sep 15, 2016
1 parent c3f6fd0 commit 1ade678
Show file tree
Hide file tree
Showing 6 changed files with 456 additions and 29 deletions.
20 changes: 2 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@ set(STLINK_SOURCE
src/flash_loader.c
)

set(STLINK_MANPAGES
doc/man/st-util.1
)


if (WIN32 OR MSYS OR MINGW)
set (STLINK_SOURCE "${STLINK_SOURCE};src/mmap.c;src/mingw/mingw.c") # TODO
endif ()
Expand Down Expand Up @@ -218,19 +213,6 @@ install(TARGETS ${PROJECT_NAME} ${STLINK_LIB_STATIC} st-flash st-util st-info
ARCHIVE DESTINATION lib/${CMAKE_LIBRARY_PATH}
LIBRARY DESTINATION lib/${CMAKE_LIBRARY_PATH}
)
# Now, install the development headers
file(GLOB STLINK_HEADERS
"${CMAKE_SOURCE_DIR}/include/stlink/*.h"
)

install(FILES ${CMAKE_SOURCE_DIR}/include/stlink.h
DESTINATION include/${CMAKE_LIBRARY_PATH}/stlink-${STLINK_PACKAGE_VERSION}/)

install(FILES ${STLINK_HEADERS}
DESTINATION include/${CMAKE_LIBRARY_PATH}/stlink-${STLINK_PACKAGE_VERSION}/stlink)

install(FILES ${STLINK_MANPAGES}
DESTINATION share/man/man1)

if (NOT APPLE AND NOT WIN32)
set(PKG_CONFIG_LIBDIR
Expand Down Expand Up @@ -283,6 +265,8 @@ if (NOT APPLE AND gtk_FOUND)
DESTINATION ${INSTALLED_UI_DIR})
endif()

add_subdirectory(include)
add_subdirectory(doc/man)
add_subdirectory(tests)

set (CPACK_PACKAGE_NAME ${PROJECT_NAME})
Expand Down
45 changes: 45 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
##
# This Makefile is used to drive building of Debug and Release
# targets of CMake
##
MAKEFLAGS += -s

all: debug
ci: lint debug release test

help:
@echo " release: Run a release build"
@echo " debug: Run a debug build"
@echo " lint: Lint check all source-code"
@echo " test: Build and run tests"
@echo " clean: Clean all build output"
@echo "rebuild_cache: Rebuild all CMake caches"

rebuild_cache: build/Debug build/Release
@$(MAKE) -C build/Debug rebuild_cache
@$(MAKE) -C build/Release rebuild_cache

debug: build/Debug
@echo "[DEBUG]"
@$(MAKE) -C build/Debug

release: build/Release
@echo "[RELEASE]"
@$(MAKE) -C build/Release

test: build/Debug
@$(MAKE) -C build/Debug test

build/Debug:
@mkdir -p $@
@cd $@ && cmake -DCMAKE_BUILD_TYPE=Debug ../../

build/Release:
@mkdir -p $@
@cd $@ && cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release ../../

clean:
@echo "[CLEAN]"
@rm -Rf build

.PHONY: clean
Loading

0 comments on commit 1ade678

Please sign in to comment.