| 1 |
BUILD_DIR ?= meson-build |
| 2 |
# Can be 'static' or 'shared'. |
| 3 |
LIBRARY_TYPE ?= static |
| 4 |
TEST_DATA_DIR ?= apps/aligner/test_data |
| 5 |
|
| 6 |
YELLOW = \033[33m |
| 7 |
GREEN = \033[32m |
| 8 |
BOLD = \033[1m |
| 9 |
RESET = \033[0m |
| 10 |
|
| 11 |
all: |
| 12 |
@printf "${YELLOW}${BOLD}Configuring build setup via Meson...${RESET}\n" |
| 13 |
${MAKE} configure |
| 14 |
@printf "\n${YELLOW}${BOLD}Building ${LIBRARY_TYPE} library and binaries...${RESET}\n" |
| 15 |
${MAKE} build |
| 16 |
@printf "\n${YELLOW}${BOLD}Running tests...${RESET}\n" |
| 17 |
${MAKE} test |
| 18 |
@printf "\n${GREEN}${BOLD}Edlib successfully built! You can find built binaries and libraries in ${BUILD_DIR}/ directory.${RESET}\n" |
| 19 |
|
| 20 |
configure: |
| 21 |
rm -rf ${BUILD_DIR} |
| 22 |
meson setup ${BUILD_DIR} . \ |
| 23 |
--backend=ninja \ |
| 24 |
-Ddefault_library=${LIBRARY_TYPE} |
| 25 |
|
| 26 |
build: |
| 27 |
meson compile -v -C ${BUILD_DIR} |
| 28 |
|
| 29 |
test: |
| 30 |
meson test -v -C ${BUILD_DIR} |
| 31 |
|
| 32 |
# Valgrind Returns 2 if there was a memory leak/error, |
| 33 |
# otherwise returns runTests exit code, which is 0 if |
| 34 |
# all went fine or 1 if some of the tests failed. |
| 35 |
check-memory-leaks: |
| 36 |
valgrind ${BUILD_DIR}/runTests 2 \ |
| 37 |
--quiet --error-exitcode=2 --tool=memcheck --leak-check=full |
| 38 |
|
| 39 |
install: |
| 40 |
meson install -C ${BUILD_DIR} |
| 41 |
|
| 42 |
clean: |
| 43 |
rm -rf ${BUILD_DIR} |
| 44 |
|
| 45 |
.PHONY: all build configure test install clean check-memory-leaks |