-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathMakefile
More file actions
217 lines (172 loc) · 7.7 KB
/
Copy pathMakefile
File metadata and controls
217 lines (172 loc) · 7.7 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
MAKEFLAGS+=--no-print-directory
.PHONY:default
default:
$(error Must specify target)
CMAKE_DEFINES:=
ifdef RELEASE_MODE
ifdef RELEASE_NAME
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DRELEASE_NAME=$(RELEASE_NAME)
endif
endif
BUILD_FOLDER:=build
ifeq ($(OS),Windows_NT)
# Windows
PYTHON3:=py -3
CAT:=cmd /c type
else
# Assume POSIX
PYTHON3:=python3
CAT:=cat
endif
SHELLCMD:=$(PYTHON3) ./submodules/shellcmd.py/shellcmd.py
NPROC:=$(shell $(SHELLCMD) nproc)
ifeq ($(OS),Windows_NT)
# https://github.com/muttleyxd/clang-tools-static-binaries/releases
CLANG_FORMAT:=bin/clang-format-19_windows-amd64.exe
include Makefile.windows.mak
else
UNAME:=$(shell uname -s)
ifeq ($(UNAME),Darwin)
OS:=osx
NPROC:=$(shell sysctl -n hw.ncpu)
INSTALLER:=
# Target the installed macOS version if no explicit versions
# specified. (If left to itself and/or Xcode, CMake can end up picking
# something newer than the installed version, if Xcode has an SDK for
# it. Result: Xcode will refuse to debug it.)
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DCMAKE_OSX_DEPLOYMENT_TARGET=$(if $(OSX_DEPLOYMENT_TARGET),$(OSX_DEPLOYMENT_TARGET),$(shell sw_vers -productVersion))
# new requirement for CMake 4.x.
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DCMAKE_OSX_SYSROOT=macosx
CLANG_FORMAT:=clang-format-mp-19
include Makefile.unix.mak
include Makefile.osx.mak
endif
ifeq ($(UNAME),Linux)
OS:=linux
NPROC:=$(shell nproc)
INSTALLER:=1
CLANG_FORMAT:=clang-format-19
include Makefile.unix.mak
endif
endif
##########################################################################
##########################################################################
.PHONY:rel
rel:
$(PYTHON3) ./etc/release/release.py --make=$(MAKE)
##########################################################################
##########################################################################
.PHONY:rel_tests
rel_tests:
$(PYTHON3) ./etc/b2_tests/rel_tests.py
##########################################################################
##########################################################################
.PHONY: clang-format
clang-format: _PREFIX:=$(if $(QUIET),@,)
clang-format:
$(_PREFIX)$(SHELLCMD) cat experimental/clang-format.header.txt src/.clang-format experimental/clang-format.header.txt > experimental/.clang-format
$(_PREFIX)$(SHELLCMD) mkdir $(BUILD_FOLDER)
$(_PREFIX)$(PYTHON3) ./bin/make_clang-format_makefile.py -o "$(BUILD_FOLDER)/clang-format.mak" -e "$(CLANG_FORMAT)" --ignore "src/beeb/generated/*" src experimental submodules/shared_lib
$(_PREFIX)$(MAKE) -f "$(BUILD_FOLDER)/clang-format.mak" -j $(NPROC) QUIET=$(QUIET)
##########################################################################
##########################################################################
.PHONY: set_submodule_upstreams
set_submodule_upstreams:
@$(MAKE) _set_submodule_upstream SUBMODULE=Remotery UPSTREAM=https://github.com/Celtoys/Remotery
@$(MAKE) _set_submodule_upstream SUBMODULE=SDL_official UPSTREAM=https://github.com/libsdl-org/SDL
@$(MAKE) _set_submodule_upstream SUBMODULE=curl UPSTREAM=https://github.com/curl/curl
@$(MAKE) _set_submodule_upstream SUBMODULE=http-parser UPSTREAM=https://github.com/nodejs/http-parser
@$(MAKE) _set_submodule_upstream SUBMODULE=imgui UPSTREAM=https://github.com/ocornut/imgui
@$(MAKE) _set_submodule_upstream SUBMODULE=imgui_club UPSTREAM=https://github.com/ocornut/imgui_club
@$(MAKE) _set_submodule_upstream SUBMODULE=libuv UPSTREAM=https://github.com/libuv/libuv
@$(MAKE) _set_submodule_upstream SUBMODULE=macdylibbundler UPSTREAM=https://github.com/auriamg/macdylibbundler
@$(MAKE) _set_submodule_upstream SUBMODULE=perfect6502 UPSTREAM=https://github.com/mist64/perfect6502
@$(MAKE) _set_submodule_upstream SUBMODULE=rapidjson UPSTREAM=https://github.com/Tencent/rapidjson
@$(MAKE) _set_submodule_upstream SUBMODULE=relacy UPSTREAM=https://github.com/dvyukov/relacy
@$(MAKE) _set_submodule_upstream SUBMODULE=salieri UPSTREAM=https://github.com/nemequ/salieri
@$(MAKE) _set_submodule_upstream SUBMODULE=visual6502 UPSTREAM=https://github.com/trebonian/visual6502
.PHONY:_set_submodule_upstream
_set_submodule_upstream: SUBMODULE=$(error must supply SUBMODULE)
_set_submodule_upstream: UPSTREAM=$(error must supply UPSTREAM)
_set_submodule_upstream:
-cd "submodules/$(SUBMODULE)" && git remote remove upstream
cd "submodules/$(SUBMODULE)" && git remote add upstream "$(UPSTREAM)"
##########################################################################
##########################################################################
.PHONY: backup_b2_config
backup_b2_config: B2_JSON_FOLDER?=$(error B2_JSON_FOLDER not set!)
backup_b2_config: _TIMESTAMP:=$(shell $(SHELLCMD) strftime --UTC -d _ _Y_m_dT_H_M_SZ)
backup_b2_config: _DEST:=$(BUILD_FOLDER)/configs/$(_TIMESTAMP)$(SUFFIX)
backup_b2_config:
$(SHELLCMD) mkdir "$(_DEST)"
$(SHELLCMD) copy-file "$(B2_JSON_FOLDER)/b2.json" "$(_DEST)/b2.json"
-$(SHELLCMD) copy-file "$(B2_JSON_FOLDER)/imgui.ini" "$(_DEST)/"
-$(SHELLCMD) copy-file "$(B2_JSON_FOLDER)/imgui.1.92+.ini" "$(_DEST)/"
# copy/paste fodder
@$(SHELLCMD) realpath "$(B2_JSON_FOLDER)"
@$(SHELLCMD) realpath "$(_DEST)"
##########################################################################
##########################################################################
ifeq ($(OS),Windows_NT)
MAGICK:=./etc/ImageMagick-7.0.5-4-portable-Q16-x64/magick.exe
else
MAGICK:=magick
endif
ICON_FOLDER:=./etc/icon
ICON_PNG:=$(ICON_FOLDER)/icon.png
ICON_DEST_WINDOWS:=$(ICON_FOLDER)/windows
ICON_DEST_MACOS:=$(ICON_FOLDER)/macos/b2.iconset
.PHONY:icons
icons: _ICON_TEMP:=$(BUILD_FOLDER)/icons
icons:
$(SHELLCMD) rm-tree "$(_ICON_TEMP)"
$(SHELLCMD) mkdir "$(_ICON_TEMP)"
$(SHELLCMD) mkdir "$(ICON_DEST_WINDOWS)"
$(SHELLCMD) mkdir "$(ICON_DEST_MACOS)"
# Windows
"${MAGICK}" "${ICON_PNG}" -resize 256x256 "$(_ICON_TEMP)/icon_256x256_32bpp.png"
"${MAGICK}" "${ICON_PNG}" -resize 16x16 "$(_ICON_TEMP)/icon_16x16_32bpp.png"
"${MAGICK}" "${ICON_PNG}" -resize 24x24 "$(_ICON_TEMP)/icon_24x24_32bpp.png"
"${MAGICK}" "${ICON_PNG}" -resize 32x32 "$(_ICON_TEMP)/icon_32x32_32bpp.png"
"${MAGICK}" "${ICON_PNG}" -resize 48x48 "$(_ICON_TEMP)/icon_48x48_32bpp.png"
"${MAGICK}" "${ICON_PNG}" -resize 64x64 "$(_ICON_TEMP)/icon_64x64_32bpp.png"
"${MAGICK}" \
"$(_ICON_TEMP)/icon_256x256_32bpp.png" \
"$(_ICON_TEMP)/icon_64x64_32bpp.png" \
"$(_ICON_TEMP)/icon_48x48_32bpp.png" \
"$(_ICON_TEMP)/icon_32x32_32bpp.png" \
"$(_ICON_TEMP)/icon_24x24_32bpp.png" \
"$(_ICON_TEMP)/icon_16x16_32bpp.png" \
"$(ICON_DEST_WINDOWS)/b2_icons.ico"
# macOS
#
# If updating this list, update the dependencies in
# src/b2/CMakeLists.txt as well.
$(MAKE) _icon_macos SIZE=16
$(MAKE) _icon_macos SIZE=32
$(MAKE) _icon_macos SIZE=64
$(MAKE) _icon_macos SIZE=128
$(MAKE) _icon_macos SIZE=256
$(MAKE) _icon_macos SIZE=512
$(MAKE) _icon_macos SIZE=1024
$(MAKE) _icon_macos_x2 SRC=32 DEST=16
$(MAKE) _icon_macos_x2 SRC=64 DEST=32
$(MAKE) _icon_macos_x2 SRC=128 DEST=64
$(MAKE) _icon_macos_x2 SRC=256 DEST=128
.PHONY:_icon_macos
_icon_macos: SIZE=$(error Must specify SIZE)
_icon_macos:
"$(MAGICK)" "$(ICON_PNG)" -resize $(SIZE)x$(SIZE) "$(ICON_DEST_MACOS)/icon_$(SIZE)x$(SIZE).png"
.PHONY:_icon_macos_x2
_icon_macos_x2: SRC=$(error Must specify SRC)
_icon_macos_x2: DEST=$(error Must specify DEST)
_icon_macos_x2:
$(SHELLCMD) copy-file "$(ICON_DEST_MACOS)/icon_$(SRC)x$(SRC).png" "$(ICON_DEST_MACOS)/icon_$(DEST)x$(DEST)@2x.png"
##########################################################################
##########################################################################
.PHONY:update_mfns
update_mfns: NUM_GROUPS:=16
update_mfns:
$(PYTHON3) "src/beeb/bin/make_update_fn_stuff.py" -n "$(NUM_GROUPS)" .
##########################################################################
##########################################################################