-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
118 lines (94 loc) · 2.9 KB
/
Makefile
File metadata and controls
118 lines (94 loc) · 2.9 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# GNU makefile. Designed for:
# - Linux
# - BSD
# - MinGW
buildProfile ?= opt
CXX?= clang++
CC?= clang
ifeq ($(buildProfile), opt)
CFLAGS = -O3
else ifeq ($(buildProfile), dbg)
CFLAGS = -g
else ifeq ($(buildProfile), asan)
CFLAGS = -g -fsanitize=address
endif
CXXFLAGS := ${CFLAGS}
CFLAGS += -std=gnu99
CXXFLAGS += -std=gnu++20
targetOS= default
ifeq ($(OS), Windows_NT)
targetOS = Windows
else
targetOS = $(shell uname -s)
endif
# == what can be done to obtain libs ==
# 'clone' implies 'build'
# 'build' will run make/cmake/whatever and build the library if needed, according to build profile
# 'systemlib' will try to find systemwide installed library and use it
# 'provided' will try to use prebuilt library by paths provided in module.mk for each dependency
deps_ACT ?= provided,systemlib,build,clone
lua_BIN ?= lua
# usually on Linux you'll find 'lua' available from everywhere in shell,
# or specific version like 'lua5.1' or 'lua5.4'
# on FreeBSD, it's 'lua54', 'lua51' and so on, probably without 'lua'
# if it's not overridden, try different variants:
ifeq ($(lua_BIN), lua)
ifeq (, $(shell command -v lua))
ifneq (, $(shell command -v lua5.1))
lua_BIN = lua5.1
else ifneq (, $(shell command -v lua51))
lua_BIN = lua51
else ifneq (, $(shell command -v lua5.2))
lua_BIN = lua5.2
else ifneq (, $(shell command -v lua52))
lua_BIN = lua52
else ifneq (, $(shell command -v lua5.3))
lua_BIN = lua5.3
else ifneq (, $(shell command -v lua53))
lua_BIN = lua53
else ifneq (, $(shell command -v lua5.4))
lua_BIN = lua5.4
else ifneq (, $(shell command -v lua54))
lua_BIN = lua54
endif
endif
endif
# do this for setting no action for all dependencies
# deps_ACT = 0
include gmake/assimp.mk
include gmake/glfw.mk
include gmake/luarjit.mk
INC_cm3d = -Iinclude -Iexternal/bitsery/include -Iexternal/glad/include -Iexternal/glfw/include -Iexternal/glm -Iexternal/imgui -Iexternal/stb -Iexternal/luarjit2/src
.PHONY: default
default: all
.PHONY: prepareAssimp
prepareAssimp:
@echo [Assimp is being prepared]
$(call assimp_Prepare)
.PHONY: prepareGLFW
prepareGLFW:
@echo [GLFW is being prepared]
$(call glfw_Prepare)
.PHONY: prepareLuarJIT
prepareLuarJIT:
@echo [LuarJIT is being prepared]
$(call luarjit_Prepare)
# call this before making each dependent target to ensure that
# the libs' generated data is available on all gmake threads that make them
define loadCache
$(eval $(file < $(assimp_CACHEDIR)/assimp.cache))
$(eval $(file < $(glfw_CACHEDIR)/glfw.cache))
$(eval $(file < $(luarjit_CACHEDIR)/luarjit.cache))
endef
.PHONY: prepareLibs
prepareLibs: prepareAssimp prepareGLFW prepareLuarJIT
# =========
include source/module.mk
include examples/module.mk
include external/module.mk
# =========
all: $(OUT_source) $(OUT_examples)
clean:
rm -rf obj/$(targetOS)/$(buildProfile) build/$(targetOS)/$(buildProfile)
cleanall:
rm -rf obj build