forked from ut-amrl/cs378_starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (28 loc) · 965 Bytes
/
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
# Clang is a good compiler to use during development due to its faster compile
# times and more readable output.
# C_compiler=/usr/bin/clang
# CXX_compiler=/usr/bin/clang++
# GCC is better for release mode due to the speed of its output, and its support
# for OpenMP.
C_compiler=/usr/bin/gcc
CXX_compiler=/usr/bin/g++
#acceptable build_types: Release/Debug/Profile
build_type=Release
# build_type=Debug
.SILENT:
all: build/CMakeLists.txt.copy
$(info Build_type is [${build_type}])
$(MAKE) --no-print-directory -C build
# Sets the build type to Debug.
set_debug:
$(eval build_type=Debug)
# Ensures that the build type is debug before running all target.
debug_all: | set_debug all
clean:
rm -rf build bin lib
build/CMakeLists.txt.copy: CMakeLists.txt Makefile
mkdir -p build
cd build && cmake -DCMAKE_BUILD_TYPE=$(build_type) \
-DCMAKE_CXX_COMPILER=$(CXX_compiler) \
-DCMAKE_C_COMPILER=$(C_compiler) ..
cp CMakeLists.txt build/CMakeLists.txt.copy