-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
72 lines (58 loc) · 1.8 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- coding: utf8 -*-
# Copyright (c) 2022 - ∞ blurryroots innovation qanat OÜ
FILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_DIR := $(shell dirname $(FILE_PATH))
PROJECT_NAME := $(notdir $(patsubst %/,%,$(dir $(FILE_PATH))))
WITH_WINDOWS := 0
ifeq ($(OS),Windows_NT)
WITH_WINDOWS = 1
endif
BUILD_DIR ?= $(PROJECT_DIR)/staging
BUILD_MODE ?= Release # Either Debug or Release
BUILD_SHARED_LIBS ?= OFF
TEST_EXE_PATH := $(BUILD_DIR)/CarterTest
ifeq ($(WITH_WINDOWS),1)
TEST_EXE_PATH = $(BUILD_DIR)/$(BUILD_MODE)/CarterTest.exe
endif
BIN_DIR ?= "$(BUILD_DIR)/$(BUILD_MODE)"
WITH_TEST ?= 1
GRIND ?= valgrind
GRIND_OPTS ?= --show-leak-kinds=all --leak-check=full --track-origins=yes -v
TEST_FLAGS := -D JustOnce_WithTest=${WITH_TEST} \
-D ShaOne_WithTest=0 \
-D Testly_WithTest=0
default: all
debug:
@echo "FILE_PATH: $(FILE_PATH)"
@echo "PROJECT_DIR: $(PROJECT_DIR)"
@echo "PROJECT_NAME: $(PROJECT_NAME)"
@echo "OS: $(OS)"
clean:
@rm -rf "$(BUILD_DIR)"
prepare:
@mkdir -p "$(BUILD_DIR)"
@cmake -B $(BUILD_DIR) -D CMAKE_BUILD_TYPE=${BUILD_MODE} \
-D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} ${TEST_FLAGS} \
-D Carter_WithTest=1 \
-D BCRYPT=1 \
-S $(PROJECT_DIR)
build:
@cmake --build $(BUILD_DIR)
run-test:
@(([ ${WITH_TEST} = 1 ] && [ -f "$(TEST_EXE_PATH)" ]) \
&& "$(TEST_EXE_PATH)" ) || echo Skipping test ...
docs: clean-docs icon
doxygen docs/doxygen.cfg > docs/doxygen.log 2> docs/doxygen.err.log
open-docs:
open docs/html/index.html
clean-docs:
rm -rf docs/{html,latex}
rm -f docs/doxygen*.log
build-run: build run-test
all: prepare build-run
icon: prepare
convert -background white -fill black \
-size 128x64 -gravity center label:".:* Carter *:." "$(PROJECT_DIR)/docs/icon.png"
grind:
mkdir -p log
$(GRIND) $(GRIND_OPTS) "$(BUILD_DIR)/./CarterTest" > log/debug 2> log/error