-
Notifications
You must be signed in to change notification settings - Fork 106
/
Makefile
1455 lines (1141 loc) · 56.5 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
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Released under the MIT License. See LICENSE for details.
#
# This Makefile encompasses most high level functionality you should need when
# working with Ballistica. These build rules are also handy as reference or a
# starting point if you need specific funtionality beyond that exposed here.
# Targets in this top level Makefile do not expect -jX to be passed to them
# and generally handle spawning an appropriate number of child jobs
# themselves.
#
# Note: Some of these targets use the lazybuild system to keep things extra
# efficient. This means, for example, that if nothing in asset sources has
# changed since the last successful asset build, we won't even dive into the
# src/assets dir and trigger the Makefile there the next time the 'assets'
# target here gets built. However, if you manually clear out built assets or
# muck around in src/assets yourself you may need to blow away the lazybuild
# states to get things building again. These live in '.cache/lazybuild'. You
# can blow away individual files there or the whole directory to force
# lazybuild to run builds it wouldn't otherwise run.
################################################################################
# #
# General #
# #
################################################################################
# List targets in this Makefile and basic descriptions for them.
help: env
@$(PCOMMAND) makefile_target_list Makefile
# Set env-var BA_ENABLE_COMPILE_COMMANDS_DB=1 to enable creating/updating a
# cmake compile-commands database for use with things like clangd.
ifeq ($(BA_ENABLE_COMPILE_COMMANDS_DB),1)
ENV_COMPILE_COMMANDS_DB = .cache/compile_commands_db/compile_commands.json
endif
# pcommandbatch can be much faster when running hundreds or thousands of
# commands, but has some downsides and limitations compared to regular
# pcommand. See tools/efrotools/pcommandbatch.py for more info on when to use
# which.
PCOMMAND = tools/pcommand
PCOMMANDBATCHBIN = .cache/pcommandbatch/pcommandbatch
ifeq ($(BA_PCOMMANDBATCH_ENABLE),0)
PCOMMANDBATCH = $(PCOMMANDBATCHBIN)
else
PCOMMANDBATCH = $(PCOMMAND)
endif
# Env targets that should be safe to run anytime; even if project-files
# are out of date.
ENV_REQS_SAFE = .cache/checkenv $(PCOMMANDBATCHBIN) .dir-locals.el .rgignore \
.mypy.ini .pyrightconfig.json .pylintrc .clang-format \
ballisticakit-cmake/.clang-format .editorconfig tools/cloudshell \
tools/bacloud tools/pcommand
# Env targets that may break if the project needs updating should go here.
# An example is compile-command-databases; these might try to run cmake and
# fail if the CMakeList files don't match what's on disk. If such a target was
# included in ENV_REQS_SAFE it would try to build *before* project updates
# which would leave us stuck in a broken state.
ENV_REQS_POST_UPDATE_ONLY = $(ENV_COMPILE_COMMANDS_DB)
# Target that should be built before building almost any other target. This
# installs tool config files, sets up the Python virtual environment, etc.
env: $(ENV_REQS_SAFE) $(ENV_REQS_POST_UPDATE_ONLY)
# Set of prereqs safe to run if the project state is dirty.
env-pre-update: $(ENV_REQS_SAFE)
env-clean:
rm -rf $(ENV_REQS_SAFE) $(ENV_REQS_POST_UPDATE_ONLY)
# Build all assets for all platforms.
assets: env meta
@$(PCOMMAND) lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS)
# Build assets required for cmake builds (linux, mac).
assets-cmake: env meta
@$(PCOMMAND) lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS) cmake
# Build only script assets for cmake builds (linux, mac).
assets-cmake-scripts: env meta
@$(PCOMMAND) lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS) scripts-cmake
# Build assets required for server builds.
assets-server: env meta
@$(PCOMMAND) lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS) server
# Build assets required for WINDOWS_PLATFORM windows builds.
assets-windows: env meta
@$(PCOMMAND) lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS) win-$(WINDOWS_PLATFORM)
# Build assets required for Win32 windows builds.
assets-windows-Win32: env meta
@$(PCOMMAND) lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS) win-Win32
# Build assets required for x64 windows builds.
assets-windows-x64: env meta
@$(PCOMMAND) lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS) win-x64
# Build assets required for mac xcode builds
assets-mac: env meta
@$(PCOMMAND) lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS) mac
# Build assets required for ios.
assets-ios: env meta
@$(PCOMMAND) lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS) ios
# Build assets required for android.
assets-android: env meta
@$(PCOMMAND) lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS) android
# Clean all assets.
assets-clean:
@rm -f $(LAZYBUILDDIR)/assets*
cd src/assets && $(MAKE) clean
# Build resources.
resources: env meta
@$(PCOMMAND) lazybuild resources_src $(LAZYBUILDDIR)/$@ \
cd src/resources \&\& $(MAKE) -j$(CPUS)
# Clean resources.
resources-clean:
rm -f $(LAZYBUILDDIR)/resources
cd src/resources && $(MAKE) clean
# Build our generated sources.
#
# Meta builds can affect sources used by asset builds, resource builds, and
# compiles, so it should be listed as a dependency of any of those.
meta: env
@$(PCOMMAND) lazybuild meta_src $(LAZYBUILDDIR)/$@ \
cd src/meta \&\& $(MAKE) -j$(CPUS)
# Clean our generated sources.
meta-clean:
rm -f $(LAZYBUILDDIR)/meta
cd src/meta && $(MAKE) clean
# Remove ALL files and directories that aren't managed by git (except for a
# few things such as localconfig.json).
clean: env
$(CHECK_CLEAN_SAFETY)
rm -rf build # Kill this ourself; can confuse git if contains other repos.
git clean -dfx $(ROOT_CLEAN_IGNORES)
# Show what clean would delete without actually deleting it.
clean-list: env
$(CHECK_CLEAN_SAFETY)
@echo Would remove build # Handle this part ourself; can confuse git.
git clean -dnx $(ROOT_CLEAN_IGNORES)
# Build/update dummy python modules.
#
# IMPORTANT - building this target can kick off full builds/cleans and so it
# should not be built in parallel with other targets. See py_check_prepass
# target for more info.
dummymodules: env meta
@$(PCOMMAND) lazybuild dummymodules_src $(LAZYBUILDDIR)/$@ \
rm -rf build/dummymodules \&\& $(PCOMMAND) gen_dummy_modules
dummymodules-clean: env
rm -f $(LAZYBUILDDIR)/dummymodules
rm -rf build/dummymodules
# Build the project's Python virtual environment. This should happen
# automatically as a dependency of the env target.
venv: .venv/.efro_venv_complete
# Update pip requirements to latest versions.
venv-upgrade: env
$(PCOMMAND) requirements_upgrade config/requirements.txt
venv-clean:
rm -rf .venv
# Generate all docs.
#
# IMPORTANT: Docs generation targets may themselves run builds, so they should
# be run alone serially and never in parallel alongside other builds.
docs: env
$(MAKE) docs-pdoc
docs-pdoc: env
@$(PCOMMAND) gen_docs_pdoc
docs-sphinx: env
$(MAKE) dummymodules
@$(PCOMMAND) gen_docs_sphinx
docs-sphinx-clean:
rm -rf .cache/sphinx
rm -rf build/sphinx
pcommandbatch_speed_test: env
@$(PCOMMAND) pcommandbatch_speed_test $(PCOMMANDBATCHBIN)
# Tell make which of these targets don't represent files.
.PHONY: help env env-pre-update env-clean assets assets-cmake \
assets-cmake-scripts assets-windows assets-windows-Win32 \
assets-windows-x64 assets-mac assets-ios assets-android assets-clean \
resources resources-clean meta meta-clean clean clean-list \
dummymodules venv venv-clean docs docs-pdoc pcommandbatch_speed_test
################################################################################
# #
# Prefab #
# #
################################################################################
# Prebuilt binaries for various platforms.
# WSL is Linux but running under Windows, so it can target either. By default
# we want these top level targets (prefab-gui-debug, etc.) to yield native
# Windows builds from WSL, but this env var can be set to override that.
BA_WSL_TARGETS_WINDOWS ?= 1
# Assemble & run a gui debug build for this platform.
prefab-gui-debug: prefab-gui-debug-build
$($(shell $(WSLU) $(PCOMMAND) prefab_run_var gui-debug))
# Assemble & run a gui release build for this platform.
prefab-gui-release: prefab-gui-release-build
$($(shell $(WSLU) $(PCOMMAND) prefab_run_var gui-release))
# Assemble a debug build for this platform.
prefab-gui-debug-build: env
@$(WSLU) $(PCOMMAND) make_prefab gui-debug
# Assemble a release build for this platform.
prefab-gui-release-build: env
@$(WSLU) $(PCOMMAND) make_prefab gui-release
# Assemble & run a server debug build for this platform.
prefab-server-debug: prefab-server-debug-build
$($(shell $(WSLU) $(PCOMMAND) prefab_run_var server-debug))
# Assemble & run a server release build for this platform.
prefab-server-release: prefab-server-release-build
$($(shell $(WSLU) $(PCOMMAND) prefab_run_var server-release))
# Assemble a server debug build for this platform.
prefab-server-debug-build: env
@$(WSLU) $(PCOMMAND) make_prefab server-debug
# Assemble a server release build for this platform.
prefab-server-release-build: env
@$(WSLU) $(PCOMMAND) make_prefab server-release
# Clean all prefab builds.
prefab-clean:
rm -rf build/prefab
# Specific platform prefab targets:
# (what visual studio calls their x86 (32 bit) target platform)
WINPLAT_X86 = Win32
# Mac gui debug:
RUN_PREFAB_MAC_X86_64_GUI_DEBUG = cd build/prefab/full/mac_x86_64_gui/debug \
&& ./ballisticakit
RUN_PREFAB_MAC_ARM64_GUI_DEBUG = cd build/prefab/full/mac_arm64_gui/debug \
&& ./ballisticakit
prefab-mac-x86-64-gui-debug: prefab-mac-x86-64-gui-debug-build
@$(PCOMMAND) ensure_prefab_platform mac_x86_64
$(RUN_PREFAB_MAC_X86_64_GUI_DEBUG)
prefab-mac-arm64-gui-debug: prefab-mac-arm64-gui-debug-build
@$(PCOMMAND) ensure_prefab_platform mac_arm64
$(RUN_PREFAB_MAC_ARM64_GUI_DEBUG)
prefab-mac-x86-64-gui-debug-build: env assets-cmake \
build/prefab/full/mac_x86_64_gui/debug/ballisticakit
@$(STAGE_BUILD) -cmake -debug build/prefab/full/mac_x86_64_gui/debug
prefab-mac-arm64-gui-debug-build: env assets-cmake \
build/prefab/full/mac_arm64_gui/debug/ballisticakit
@$(STAGE_BUILD) -cmake -debug build/prefab/full/mac_arm64_gui/debug
build/prefab/full/mac_%_gui/debug/ballisticakit: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/mac_%_gui/debug/libballisticaplus.a: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Mac gui release:
RUN_PREFAB_MAC_X86_64_GUI_RELEASE = cd \
build/prefab/full/mac_x86_64_gui/release && ./ballisticakit
RUN_PREFAB_MAC_ARM64_GUI_RELEASE = cd build/prefab/full/mac_arm64_gui/release \
&& ./ballisticakit
prefab-mac-x86-64-gui-release: prefab-mac-x86-64-gui-release-build
@$(PCOMMAND) ensure_prefab_platform mac_x86_64
$(RUN_PREFAB_MAC_X86_64_GUI_RELEASE)
prefab-mac-arm64-gui-release: prefab-mac-arm64-gui_release-build
@$(PCOMMAND) ensure_prefab_platform mac_arm64
$(RUN_PREFAB_MAC_ARM64_GUI_RELEASE)
prefab-mac-x86-64-gui-release-build: env assets-cmake \
build/prefab/full/mac_x86_64_gui/release/ballisticakit
@$(STAGE_BUILD) -cmake -release build/prefab/full/mac_x86_64_gui/release
prefab-mac-arm64-gui-release-build: env assets-cmake \
build/prefab/full/mac_arm64_gui/release/ballisticakit
@$(STAGE_BUILD) -cmake -release build/prefab/full/mac_arm64_gui/release
build/prefab/full/mac_%_gui/release/ballisticakit: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/mac_%_gui/release/libballisticaplus.a: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Mac server debug:
RUN_PREFAB_MAC_X86_64_SERVER_DEBUG = cd \
build/prefab/full/mac_x86_64_server/debug && ./ballisticakit_server
RUN_PREFAB_MAC_ARM64_SERVER_DEBUG = cd \
build/prefab/full/mac_arm64_server/debug && ./ballisticakit_server
prefab-mac-x86-64-server-debug: prefab-mac-x86-64-server-debug-build
@$(PCOMMAND) ensure_prefab_platform mac_x86_64
@$(RUN_PREFAB_MAC_X86_64_SERVER_DEBUG)
prefab-mac-arm64-server-debug: prefab-mac-arm64-server-debug-build
@$(PCOMMAND) ensure_prefab_platform mac_arm64
$(RUN_PREFAB_MAC_ARM64_SERVER_DEBUG)
prefab-mac-x86-64-server-debug-build: env assets-server \
build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless
@$(STAGE_BUILD) -cmakeserver -debug build/prefab/full/mac_x86_64_server/debug
prefab-mac-arm64-server-debug-build: env assets-server \
build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless
@$(STAGE_BUILD) -cmakeserver -debug build/prefab/full/mac_arm64_server/debug
build/prefab/full/mac_%_server/debug/dist/ballisticakit_headless: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/mac_%_server/debug/libballisticaplus.a: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Mac server release:
RUN_PREFAB_MAC_X86_64_SERVER_RELEASE = cd \
build/prefab/full/mac_x86_64_server/release && ./ballisticakit_server
RUN_PREFAB_MAC_ARM64_SERVER_RELEASE = cd \
build/prefab/full/mac_arm64_server/release && ./ballisticakit_server
prefab-mac-x86-64-server-release: prefab-mac-x86-64-server-release-build
@$(PCOMMAND) ensure_prefab_platform mac_x86_64
$(RUN_PREFAB_MAC_X86_64_SERVER_RELEASE)
prefab-mac-arm64-server-release: prefab-mac-arm64-server-release-build
@$(PCOMMAND) ensure_prefab_platform mac_arm64
$(RUN_PREFAB_MAC_ARM64_SERVER_RELEASE)
prefab-mac-x86-64-server-release-build: env assets-server \
build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless
@$(STAGE_BUILD) -cmakeserver -release \
build/prefab/full/mac_x86_64_server/release
prefab-mac-arm64-server-release-build: env assets-server \
build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless
@$(STAGE_BUILD) -cmakeserver -release \
build/prefab/full/mac_arm64_server/release
build/prefab/full/mac_%_server/release/dist/ballisticakit_headless: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/mac_%_server/release/libballisticaplus.a: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Linux gui debug:
RUN_PREFAB_LINUX_X86_64_GUI_DEBUG = cd \
build/prefab/full/linux_x86_64_gui/debug && ./ballisticakit
RUN_PREFAB_LINUX_ARM64_GUI_DEBUG = cd \
build/prefab/full/linux_arm64_gui/debug && ./ballisticakit
prefab-linux-x86-64-gui-debug: prefab-linux-x86-64-gui-debug-build
@$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_x86_64
$(RUN_PREFAB_LINUX_X86_64_GUI_DEBUG)
prefab-linux-arm64-gui-debug: prefab-linux-arm64-gui-debug-build
@$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_arm64
$(RUN_PREFAB_LINUX_ARM64_GUI_DEBUG)
prefab-linux-x86-64-gui-debug-build: env assets-cmake \
build/prefab/full/linux_x86_64_gui/debug/ballisticakit
@$(STAGE_BUILD) -cmake -debug build/prefab/full/linux_x86_64_gui/debug
prefab-linux-arm64-gui-debug-build: env assets-cmake \
build/prefab/full/linux_arm64_gui/debug/ballisticakit
@$(STAGE_BUILD) -cmake -debug build/prefab/full/linux_arm64_gui/debug
build/prefab/full/linux_%_gui/debug/ballisticakit: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/linux_%_gui/debug/libballisticaplus.a: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Linux gui release:
RUN_PREFAB_LINUX_X86_64_GUI_RELEASE = cd \
build/prefab/full/linux_x86_64_gui/release && ./ballisticakit
RUN_PREFAB_LINUX_ARM64_GUI_RELEASE = cd \
build/prefab/full/linux_arm64_gui/release && ./ballisticakit
prefab-linux-x86-64-gui-release: prefab-linux-x86-64-gui-release-build
@$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_x86_64
$(RUN_PREFAB_LINUX_X86_64_GUI_RELEASE)
prefab-linux-arm64-gui-release: prefab-linux-arm64-gui-release-build
@$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_arm64
$(RUN_PREFAB_LINUX_ARM64_GUI_RELEASE)
prefab-linux-x86-64-gui-release-build: env assets-cmake \
build/prefab/full/linux_x86_64_gui/release/ballisticakit
@$(STAGE_BUILD) -cmake -release build/prefab/full/linux_x86_64_gui/release
prefab-linux-arm64-gui-release-build: env assets-cmake \
build/prefab/full/linux_arm64_gui/release/ballisticakit
@$(STAGE_BUILD) -cmake -release build/prefab/full/linux_arm64_gui/release
build/prefab/full/linux_%_gui/release/ballisticakit: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/linux_%_gui/release/libballisticaplus.a: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Linux server debug:
RUN_PREFAB_LINUX_X86_64_SERVER_DEBUG = cd \
build/prefab/full/linux_x86_64_server/debug && ./ballisticakit_server
RUN_PREFAB_LINUX_ARM64_SERVER_DEBUG = cd \
build/prefab/full/linux_arm64_server/debug && ./ballisticakit_server
prefab-linux-x86-64-server-debug: prefab-linux-x86-64-server-debug-build
@$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_x86_64
$(RUN_PREFAB_LINUX_X86_64_SERVER_DEBUG)
prefab-linux-arm64-server-debug: prefab-linux-arm64-server-debug-build
@$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_arm64
$(RUN_PREFAB_LINUX_ARM64_SERVER_DEBUG)
prefab-linux-x86-64-server-debug-build: env assets-server \
build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless
@$(STAGE_BUILD) -cmakeserver -debug \
build/prefab/full/linux_x86_64_server/debug
prefab-linux-arm64-server-debug-build: env assets-server \
build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless
@$(STAGE_BUILD) -cmakeserver -debug \
build/prefab/full/linux_arm64_server/debug
build/prefab/full/linux_%_server/debug/dist/ballisticakit_headless: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/linux_%_server/debug/libballisticaplus.a: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Linux server release:
RUN_PREFAB_LINUX_X86_64_SERVER_RELEASE = cd \
build/prefab/full/linux_x86_64_server/release && ./ballisticakit_server
RUN_PREFAB_LINUX_ARM64_SERVER_RELEASE = cd \
build/prefab/full/linux_arm64_server/release && ./ballisticakit_server
prefab-linux-x86-64-server-release: prefab-linux-x86-64-server-release-build
@$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_x86_64
$(RUN_PREFAB_LINUX_X86_64_SERVER_RELEASE)
prefab-linux-arm64-server-release: prefab-linux-arm64-server-release-build
@$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_arm64
$(RUN_PREFAB_LINUX_ARM64_SERVER_RELEASE)
prefab-linux-x86-64-server-release-build: env assets-server \
build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless
@$(STAGE_BUILD) -cmakeserver -release \
build/prefab/full/linux_x86_64_server/release
prefab-linux-arm64-server-release-build: env assets-server \
build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless
@$(STAGE_BUILD) -cmakeserver -release \
build/prefab/full/linux_arm64_server/release
build/prefab/full/linux_%_server/release/dist/ballisticakit_headless: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/linux_%_server/release/libballisticaplus.a: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Windows gui debug:
RUN_PREFAB_WINDOWS_X86_GUI_DEBUG = cd build/prefab/full/windows_x86_gui/debug \
&& ./BallisticaKit.exe
prefab-windows-x86-gui-debug: prefab-windows-x86-gui-debug-build
@$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86
$(RUN_PREFAB_WINDOWS_X86_GUI_DEBUG)
prefab-windows-x86-gui-debug-build: env assets-windows-$(WINPLAT_X86) \
build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe
@$(STAGE_BUILD) -win-$(WINPLAT_X86) -debug \
build/prefab/full/windows_x86_gui/debug
build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/windows/Debug_%/BallisticaKitGenericPlus.lib: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/windows/Debug_%/BallisticaKitGenericPlus.pdb: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Windows gui release:
RUN_PREFAB_WINDOWS_X86_GUI_RELEASE = cd \
build/prefab/full/windows_x86_gui/release && ./BallisticaKit.exe
prefab-windows-x86-gui-release: prefab-windows-x86-gui-release-build
@$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86
$(RUN_PREFAB_WINDOWS_X86_GUI_RELEASE)
prefab-windows-x86-gui-release-build: env \
assets-windows-$(WINPLAT_X86) \
build/prefab/full/windows_x86_gui/release/BallisticaKit.exe
@$(STAGE_BUILD) -win-$(WINPLAT_X86) -release \
build/prefab/full/windows_x86_gui/release
build/prefab/full/windows_x86_gui/release/BallisticaKit.exe: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/windows/Release_%/BallisticaKitGenericPlus.lib: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/windows/Release_%/BallisticaKitGenericPlus.pdb: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Windows server debug:
RUN_PREFAB_WINDOWS_X86_SERVER_DEBUG = cd \
build/prefab/full/windows_x86_server/debug \
&& dist/python_d.exe ballisticakit_server.py
prefab-windows-x86-server-debug: prefab-windows-x86-server-debug-build
@$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86
$(RUN_PREFAB_WINDOWS_X86_SERVER_DEBUG)
prefab-windows-x86-server-debug-build: env \
assets-windows-$(WINPLAT_X86) \
build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe
@$(STAGE_BUILD) -winserver-$(WINPLAT_X86) -debug \
build/prefab/full/windows_x86_server/debug
build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/windows/Debug_%/BallisticaKitHeadlessPlus.lib: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/windows/Debug_%/BallisticaKitHeadlessPlus.pdb: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Windows server release:
RUN_PREFAB_WINDOWS_X86_SERVER_RELEASE = cd \
build/prefab/full/windows_x86_server/release \
&& dist/python.exe -O ballisticakit_server.py
prefab-windows-x86-server-release: prefab-windows-x86-server-release-build
@$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86
$(RUN_PREFAB_WINDOWS_X86_SERVER_RELEASE)
prefab-windows-x86-server-release-build: env \
assets-windows-$(WINPLAT_X86) \
build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe
@$(STAGE_BUILD) -winserver-$(WINPLAT_X86) -release \
build/prefab/full/windows_x86_server/release
build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/windows/Release_%/BallisticaKitHeadlessPlus.lib: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
build/prefab/lib/windows/Release_%/BallisticaKitHeadlessPlus.pdb: .efrocachemap
@$(PCOMMANDBATCH) efrocache_get $@
# Tell make which of these targets don't represent files.
.PHONY: prefab-gui-debug prefab-gui-release prefab-gui-debug-build \
prefab-gui-release-build prefab-server-debug prefab-server-release \
prefab-server-debug-build prefab-server-release-build prefab-clean \
_cmake_prefab_gui_binary _cmake_prefab_server_binary \
prefab-mac-x86-64-gui-debug prefab-mac-arm64-gui-debug \
prefab-mac-x86-64-gui-debug-build prefab-mac-arm64-gui-debug-build \
prefab-mac-x86-64-gui-release prefab-mac-arm64-gui-release \
prefab-mac-x86-64-gui-release-build \
prefab-mac-arm64-gui-release-build prefab-mac-x86-64-server-debug \
prefab-mac-arm64-server-debug prefab-mac-x86-64-server-debug-build \
prefab-mac-arm64-server-debug-build prefab-mac-x86-64-server-release \
prefab-mac-arm64-server-release \
prefab-mac-x86-64-server-release-build \
prefab-mac-arm64-server-release-build prefab-linux-x86-64-gui-debug \
prefab-linux-arm64-gui-debug prefab-linux-x86-64-gui-debug-build \
prefab-linux-arm64-gui-debug-build prefab-linux-x86-64-gui-release \
prefab-linux-arm64-gui-release prefab-linux-x86-64-gui-release-build \
prefab-linux-arm64-gui-release-build prefab-linux-x86-64-server-debug \
prefab-linux-arm64-server-debug \
prefab-linux-x86-64-server-debug-build \
prefab-linux-arm64-server-debug-build \
prefab-linux-x86-64-server-release prefab-linux-arm64-server-release \
prefab-linux-x86-64-server-release-build \
prefab-linux-arm64-server-release-build prefab-windows-x86-gui-debug \
prefab-windows-x86-gui-debug-build prefab-windows-x86-gui-release \
prefab-windows-x86-gui-release-build prefab-windows-x86-server-debug \
prefab-windows-x86-server-debug-build \
prefab-windows-x86-server-release \
prefab-windows-x86-server-release-build
################################################################################
# #
# Spinoff #
# #
################################################################################
SPINOFF_TEST_TARGET ?= core
# Run a given spinoff test.
spinoff-test: env
$(PCOMMAND) spinoff_test $(SPINOFF_TEST_TARGET) $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check core feature set alone.
spinoff-test-core: env
$(PCOMMAND) spinoff_test core $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check base feature set alone.
spinoff-test-base: env
$(PCOMMAND) spinoff_test base $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check plus feature set alone.
spinoff-test-plus: env
$(PCOMMAND) spinoff_test plus $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check classic feature set alone.
spinoff-test-classic: env
$(PCOMMAND) spinoff_test classic $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check template_fs feature set alone.
spinoff-test-template_fs: env
$(PCOMMAND) spinoff_test template_fs $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check ui_v1 feature set alone.
spinoff-test-ui_v1: env
$(PCOMMAND) spinoff_test ui_v1 $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check ui_v1_lib feature set alone.
spinoff-test-ui_v1_lib: env
$(PCOMMAND) spinoff_test ui_v1_lib $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check scene_v1 feature set alone.
spinoff-test-scene_v1: env
$(PCOMMAND) spinoff_test scene_v1 $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check scene_v1_lib feature set alone.
spinoff-test-scene_v1_lib: env
$(PCOMMAND) spinoff_test scene_v1_lib $(SPINOFF_TEST_EXTRA_ARGS)
# Blow away all spinoff-test builds.
spinoff-test-clean: env
rm -rf build/spinofftest
# Grab the current parent project and sync it into ourself.
spinoff-update: env
@$(PCOMMAND) spinoff_check_submodule_parent
$(MAKE) update
@$(PCOMMANDBATCH) echo BLU Pulling current parent project...
git submodule update
@$(PCOMMANDBATCH) echo BLU Syncing parent into current project...
tools/spinoff update
@$(MAKE) update-check # Make sure spinoff didn't break anything.
@$(PCOMMANDBATCH) echo GRN Spinoff update successful!
# Upgrade to latest parent project and sync it into ourself.
spinoff-upgrade: env
@$(PCOMMAND) spinoff_check_submodule_parent
$(MAKE) update
@$(PCOMMANDBATCH) echo BLU Pulling latest parent project...
cd submodules/ballistica && git checkout main && git pull
@$(PCOMMANDBATCH) echo BLU Syncing parent into current project...
tools/spinoff update
@$(MAKE) update-check # Make sure spinoff didn't break anything.
@$(PCOMMANDBATCH) echo GRN Spinoff upgrade successful!
# Tell make which of these targets don't represent files.
.PHONY: spinoff-test-core spinoff-test-base spinoff-test-plus \
spinoff-test-template_fs spinoff-test-clean spinoff-update \
spinoff-upgrade
################################################################################
# #
# Updating #
# #
################################################################################
# Update any project files that need it (does NOT build projects).
update: env-pre-update
@$(PCOMMAND) update_project
# Though not technically necessary, let's keep things like tool-configs
# immediately updated so our editors/etc. better reflect the current state.
@$(MAKE) -j$(CPUS) env
@$(PCOMMANDBATCH) echo GRN Update-Project: SUCCESS!
# Don't update but fail if anything needs it.
update-check: env-pre-update
@$(PCOMMAND) update_project --check
@$(PCOMMANDBATCH) echo GRN Check-Project: Everything up to date.
# Tell make which of these targets don't represent files.
.PHONY: update update-check
################################################################################
# #
# Formatting #
# #
################################################################################
# Run formatting on all files in the project considered 'dirty'.
format: env
@$(MAKE) -j$(CPUS) format-code format-scripts format-makefile
@$(PCOMMANDBATCH) echo BLD Formatting complete for $(notdir $(CURDIR))!
# Same but always formats; ignores dirty state.
format-full: env
@$(MAKE) -j$(CPUS) format-code-full format-scripts-full format-makefile
@$(PCOMMANDBATCH) echo BLD Formatting complete for $(notdir $(CURDIR))!
# Run formatting for compiled code sources (.cc, .h, etc.).
format-code: env
@$(PCOMMAND) formatcode
# Same but always formats; ignores dirty state.
format-code-full: env
@$(PCOMMAND) formatcode -full
# Runs formatting for scripts (.py, etc).
format-scripts: env
@$(PCOMMAND) formatscripts
# Same but always formats; ignores dirty state.
format-scripts-full: env
@$(PCOMMAND) formatscripts -full
# Runs formatting on the project Makefile.
format-makefile: env
@$(PCOMMAND) formatmakefile
.PHONY: format format-full format-code format-code-full format-scripts \
format-scripts-full
################################################################################
# #
# Checking #
# #
################################################################################
# Run all project checks. (static analysis)
check: py_check_prepass
@$(DMAKE) -j$(CPUS) update-check cpplint pylint mypy
@$(PCOMMANDBATCH) echo SGRN BLD ALL CHECKS PASSED!
# Same as check but no caching (all files are checked).
check-full: py_check_prepass
@$(DMAKE) -j$(CPUS) update-check cpplint-full pylint-full mypy-full
@$(PCOMMANDBATCH) echo SGRN BLD ALL CHECKS PASSED!
# Same as 'check' plus optional/slow extra checks.
check2: py_check_prepass
@$(DMAKE) -j$(CPUS) update-check cpplint pylint mypy
@$(PCOMMANDBATCH) echo SGRN BLD ALL CHECKS PASSED!
# Same as check2 but no caching (all files are checked).
check2-full: py_check_prepass
@$(DMAKE) -j$(CPUS) update-check cpplint-full pylint-full mypy-full
@$(PCOMMANDBATCH) echo SGRN BLD ALL CHECKS PASSED!
# Run Cpplint checks on all C/C++ code.
cpplint: env meta
@$(PCOMMAND) cpplint
# Run Cpplint checks without caching (all files are checked).
cpplint-full: env meta
@$(PCOMMAND) cpplint -full
# Run Pylint checks on all Python Code.
pylint: py_check_prepass
@$(PCOMMAND) pylint
# Run Pylint checks without caching (all files are checked).
pylint-full: py_check_prepass
@$(PCOMMAND) pylint -full
# Run Mypy checks on all Python code.
mypy: py_check_prepass
@$(PCOMMAND) mypy
# Run Mypy checks without caching (all files are checked).
mypy-full: py_check_prepass
@$(PCOMMAND) mypy -full
# Run Mypy checks on all Python code using daemon mode.
dmypy: py_check_prepass
@$(PCOMMAND) dmypy
# Stop the mypy daemon
dmypy-stop: py_check_prepass
@$(PCOMMAND) dmypy -stop
# Run Pyright checks on all Python code.
pyright: py_check_prepass
@$(PCOMMAND) pyright
# Run PyCharm checks on all Python code.
pycharm: py_check_prepass
@$(PCOMMAND) pycharm
# Run PyCharm checks without caching (all files are checked).
pycharm-full: py_check_prepass
@$(PCOMMAND) pycharm -full
# Build prerequisites needed for python checks.
#
# IMPORTANT - this target may kick off new meta/asset/binary builds/cleans as
# part of doing its thing. For this reason, be sure this target gets built
# alone in a make process and not mixed in with others as it would likely
# stomp on them or their dependencies.
#
# Practically, this means any target depending on this should list it as its
# one and only dependency. And when any such target gets built alongside
# others (such as by the 'check-full' target) the parent target should
# explicitly built this beforehand to ensure it does not happen during the
# parallel part.
py_check_prepass: dummymodules
# Tell make which of these targets don't represent files.
.PHONY: check check-full check2 check2-full cpplint cpplint-full pylint \
pylint-full mypy mypy-full dmypy dmypy-stop pycharm pycharm-full \
py_check_prepass
################################################################################
# #
# Testing #
# #
################################################################################
# Set the following from the command line to influence the build:
# Override this to run only particular tests.
# Examples:
# tests/test_efro
# tests/test_efro/test_message.py
TEST_TARGET ?= tests
# Run tests (live execution verification).
test: py_check_prepass
@$(PCOMMANDBATCH) echo BLU Running all tests...
@$(PCOMMAND) tests_warm_start
@$(PCOMMAND) pytest -v $(TEST_TARGET)
# Run tests (live execution verification). Excludes slow ones.
test-fast: py_check_prepass
@$(PCOMMANDBATCH) echo BLU Running all tests \(fast\)...
@$(PCOMMAND) tests_warm_start
@BA_TEST_FAST_MODE=1 $(PCOMMAND) pytest -v $(TEST_TARGET)
test-verbose: py_check_prepass
@$(PCOMMANDBATCH) echo BLU Running all tests...
@$(PCOMMAND) tests_warm_start
@$(PCOMMAND) pytest -o log_cli=true -o log_cli_level=debug \
-s -vv $(TEST_TARGET)
# Run tests with any caching disabled.
test-full: test
# Run fast tests with any caching disabled.
test-fast-full: test-fast
# Shortcut to test efro.message only.
test-message:
@$(PCOMMAND) pytest -o log_cli=true -o log_cli_level=debug -s -vv \
tests/test_efro/test_message.py
# Shortcut to test efro.dataclassio only.
test-dataclassio:
@$(PCOMMAND) pytest -o log_cli=true -o log_cli_level=debug -s -vv \
tests/test_efro/test_dataclassio.py
# Shortcut to test efro.rpc only.
test-rpc:
@$(PCOMMAND) pytest -o log_cli=true -o log_cli_level=debug -s -vv \
tests/test_efro/test_rpc.py
# Shortcut to test efro.threadpool only.
test-threadpool:
@$(PCOMMAND) pytest -o log_cli=true -o log_cli_level=debug -s -vv \
tests/test_efro/test_threadpool.py
# Tell make which of these targets don't represent files.
.PHONY: test test-fast test-verbose test-full test-fast-full \
test-message test-dataclassio test-rpc
################################################################################
# #
# Preflighting #
# #
################################################################################
# Format, update, check, & test the project. Do this before commits.
preflight:
@$(MAKE) format
@$(MAKE) update
@$(MAKE) -j$(CPUS) py_check_prepass # Needs to be done explicitly first.
@$(MAKE) -j$(CPUS) cpplint pylint mypy test-fast
@$(PCOMMANDBATCH) echo SGRN BLD PREFLIGHT SUCCESSFUL!
# Same as 'preflight' without caching (all files are visited).
preflight-full:
@$(MAKE) format-full
@$(MAKE) update
@$(MAKE) -j$(CPUS) py_check_prepass # Needs to be done explicitly first.
@$(MAKE) -j$(CPUS) cpplint-full pylint-full mypy-full test-fast-full
@$(PCOMMANDBATCH) echo SGRN BLD PREFLIGHT SUCCESSFUL!
# Same as 'preflight' plus optional/slow extra checks.
preflight2:
@$(MAKE) format
@$(MAKE) update
@$(MAKE) -j$(CPUS) py_check_prepass # Needs to be done explicitly first.
@$(MAKE) -j$(CPUS) cpplint pylint mypy test-fast
@$(PCOMMANDBATCH) echo SGRN BLD PREFLIGHT SUCCESSFUL!
# Same as 'preflight2' but without caching (all files visited).
preflight2-full:
@$(MAKE) format-full
@$(MAKE) update
@$(MAKE) -j$(CPUS) py_check_prepass # Needs to be done explicitly first.
@$(MAKE) -j$(CPUS) cpplint-full pylint-full mypy-full test-fast-full
@$(PCOMMANDBATCH) echo SGRN BLD PREFLIGHT SUCCESSFUL!
# Tell make which of these targets don't represent files.
.PHONY: preflight preflight-full preflight2 preflight2-full
################################################################################
# #
# Windows #
# #
################################################################################
# Set these env vars from the command line to influence the build:
# Can be Generic, Headless, or Oculus
WINDOWS_PROJECT ?= Generic
# Can be Win32 or x64
WINDOWS_PLATFORM ?= Win32
# Can be Debug or Release
WINDOWS_CONFIGURATION ?= Debug