-
Notifications
You must be signed in to change notification settings - Fork 60
/
GNUmakefile
92 lines (72 loc) · 3.09 KB
/
GNUmakefile
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#
# This file is a part of SORT(Simple Open Ray Tracing), an open-source cross
# platform physically based renderer.
#
# Copyright (c) 2011-2023 by Jiayin Cao - All rights reserved.
#
# SORT is a free software written for educational purpose. Anyone can distribute
# or modify it under the the terms of the GNU General Public License Version 3 as
# published by the Free Software Foundation. However, there is NO warranty that
# all components are functional in a perfect manner. Without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.
#
# SORT root directory
SORT_DIR := $(shell pwd -P)
# detect the current arch, by default it is what the current platform is.
# this can be overwritten like this so that we can do cross compiling
# make release ARCH=arm64
ARCH ?= $(shell uname -m)
# unified command by using python script
UPDATE_DEP_COMMAND = @python3 ./scripts/get_deps.py FALSE "${ARCH}"
FORCE_UPDATE_DEP_COMMAND = @python3 ./scripts/get_deps.py TRUE "${ARCH}"
GENERATE_SRC_COMMAND = @python3 ./scripts/generate_src.py
BUILD_RELEASE_COMMAND = @echo "building release version.";cd $(SORT_DIR); mkdir proj_release; cd proj_release; cmake -DCMAKE_OSX_ARCHITECTURES=${ARCH} -DCMAKE_BUILD_TYPE=Release ..;make -j 4;cd ..;
BUILD_DEBUG_COMMAND = @echo "building debug version.";cd $(SORT_DIR); mkdir proj_debug; cd proj_debug; cmake -DCMAKE_OSX_ARCHITECTURES=${ARCH} -DCMAKE_BUILD_TYPE=Debug ..;make -j 4;cd ..;
BUILD_RELWITHDEBINFO_COMMAND = @echo "building release version with debug information.";cd $(SORT_DIR); mkdir proj_relwithdebinfo; cd proj_relwithdebinfo; cmake -DCMAKE_OSX_ARCHITECTURES=${ARCH} -DCMAKE_BUILD_TYPE=RelWithDebInfo ..;make -j 4;cd ..;
release: .FORCE
$(UPDATE_DEP_COMMAND)
$(GENERATE_SRC_COMMAND)
$(BUILD_RELEASE_COMMAND)
debug: .FORCE
$(UPDATE_DEP_COMMAND)
$(GENERATE_SRC_COMMAND)
$(BUILD_DEBUG_COMMAND)
relwithdebinfo: .FORCE
$(UPDATE_DEP_COMMAND)
$(GENERATE_SRC_COMMAND)
$(BUILD_RELWITHDEBINFO_COMMAND)
update: .FORCE
@echo 'Syncing source code from Github'
@git pull
update_dep: .FORCE
@echo 'Syncing dependencies'
$(UPDATE_DEP_COMMAND)
force_update_dep: .FORCE
@echo 'Syncing dependencies'
$(FORCE_UPDATE_DEP_COMMAND)
setup: .FORCE
@make update_dep
@make generate_src
clean: .FORCE
@echo 'Cleaning all generated files'
@cd $(SORT_DIR); rm -rf bin ; rm -rf proj_release ; rm -rf proj_debug ; rm -rf proj_relwithdebinfo ; rm -rf _out ; rm -rf generated_src ;
clean_dep: .FORCE
@echo 'Cleaning all dependency files'
@cd $(SORT_DIR); rm -rf dependencies
help: .FORCE
@python3 ./scripts/show_help.py
about: .FORCE
@python3 ./scripts/show_about.py
dep_info: .FORCE
@python3 ./scripts/show_dep_info.py
generate_src: .FORCE
@echo 'Generating source code'
$(GENERATE_SRC_COMMAND)
verify_builds: .FORCE
@echo 'Verifying builds'
@python3 ./scripts/verify_builds.py
.FORCE: