Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
1041 lines (912 loc) · 34.4 KB
/
Copy pathMakefile
File metadata and controls
1041 lines (912 loc) · 34.4 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
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
#******************************************************************************
# Free implementation of Bullfrog's Dungeon Keeper strategy game.
#******************************************************************************
# @file Makefile
# A script used by GNU Make to recompile the project.
# @par Purpose:
# Allows to invoke "make all" or similar commands to compile all
# source code files and link them into executable file.
# @par Comment:
# Please note that the make must be run from 'sh'; starting if from
# Windows 'cmd.exe' won't work.
# You need mingw32 and coreutils to do the build.
# To prepare a release package, run:
# make standard && make heavylog && make package
# @author Tomasz Lis
# @date 25 Jan 2009 - 02 Jul 2011
# @par Copying and copyrights:
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
#******************************************************************************
# Executable files extension on host environment
ifneq (,$(findstring Windows,$(OS)))
CROSS_EXEEXT = .exe
# linker flags
LINKFLAGS = -static-libgcc -static-libstdc++ -Wl,--enable-auto-import -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive
# The following flags are only here to prevent a dependency on libwinpthread-1.dll when keeperfx is built with MSYS2:
# "-Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive
else
CROSS_EXEEXT =
CROSS_COMPILE = i686-w64-mingw32-
LINKFLAGS = -static-libgcc -static-libstdc++ -Wl,--enable-auto-import
endif
# Executable files extension on target environment
EXEEXT = .exe
# Names of utility commands
CPP = $(CROSS_COMPILE)g++
CC = $(CROSS_COMPILE)gcc
WINDRES = $(CROSS_COMPILE)windres
DLLTOOL = $(CROSS_COMPILE)dlltool
DOXYTOOL = doxygen
BUILD_NUMBER ?= $(VER_BUILD)
PACKAGE_SUFFIX ?= Prototype
PNGTOICO = tools/png2ico/png2ico$(CROSS_EXEEXT)
PNGTORAW = tools/pngpal2raw/bin/pngpal2raw$(CROSS_EXEEXT)
PNGTOBSPAL = tools/png2bestpal/bin/png2bestpal$(CROSS_EXEEXT)
POTONGDAT = tools/po2ngdat/bin/po2ngdat$(CROSS_EXEEXT)
WAVTODAT = tools/sndbanker/bin/sndbanker$(CROSS_EXEEXT)
RNC = tools/rnctools/bin/rnc$(CROSS_EXEEXT)
DERNC = tools/rnctools/bin/dernc$(CROSS_EXEEXT)
DKILLTOLVL = tools/dkillconv/bin/dkillcmpl$(CROSS_EXEEXT)
RM = rm -f
MV = mv -f
CP = cp -f
MKDIR = mkdir -p
ECHO = @echo
# Names of target binary files
BIN = bin/keeperfx$(EXEEXT)
TEST_BIN = bin/tests$(EXEEXT)
HVLOGBIN = bin/keeperfx_hvlog$(EXEEXT)
# Names of intermediate build products
GENSRC = src/ver_defs.h
RES = obj/daimonkeeper_stdres.res
DEPS = \
obj/centitoml/toml_api.o \
deps/luajit/lib/libluajit.a
# functional test debugging flags/objs
FTEST_DEBUG ?= 0
ifeq ($(FTEST_DEBUG), 1)
FTEST_DBGFLAGS = -DFUNCTESTING=1
FTEST_OBJS = obj/ftests/ftest.o \
obj/ftests/ftest_util.o \
obj/ftests/ftest_list.o
FTEST_OBJS += $(patsubst src/ftests/tests/%,obj/ftests/tests/%,$(patsubst %.c,%.o,$(wildcard src/ftests/tests/ftest*.c)))
else
FTEST_DBGFLAGS =
FTEST_OBJS =
endif
OBJS = \
$(DEPS) \
obj/actionpt.o \
obj/api.o \
obj/ariadne.o \
obj/ariadne_edge.o \
obj/ariadne_findcache.o \
obj/ariadne_naviheap.o \
obj/ariadne_navitree.o \
obj/ariadne_points.o \
obj/ariadne_regions.o \
obj/ariadne_tringls.o \
obj/ariadne_update.o \
obj/ariadne_wallhug.o \
obj/kfx_pathfinding_state.o \
obj/bflib_basics.o \
obj/bflib_coroutine.o \
obj/bflib_cpu.o \
obj/bflib_crash.o \
obj/bflib_datetm.o \
obj/bflib_dernc.o \
obj/bflib_enet.o \
obj/net_portforward.o \
obj/net_holepunch.o \
obj/bflib_fileio.o \
obj/bflib_filelst.o \
obj/bflib_fmvids.o \
obj/bflib_guibtns.o \
obj/bflib_input_joyst.o \
obj/bflib_inputctrl.o \
obj/bflib_keybrd.o \
obj/bflib_main.o \
obj/bflib_math.o \
obj/bflib_mouse.o \
obj/bflib_mshandler.o \
obj/bflib_mspointer.o \
obj/bflib_netsession.o \
obj/bflib_netsp.o \
obj/net_exchange_common.o \
obj/net_exchange_gameplay.o \
obj/net_main.o \
obj/net_lobby.o \
obj/net_resync.o \
obj/bflib_planar.o \
obj/kfx/renderer/software/bflib_render.o \
obj/kfx/renderer/software/SwDrawTarget.o \
obj/kfx/renderer/software/bflib_render_gpoly.o \
obj/kfx/renderer/software/bflib_render_trig.o \
obj/bflib_sndlib.o \
obj/bflib_sound.o \
obj/bflib_sprfnt.o \
obj/bflib_string.o \
obj/bflib_text.o \
obj/bflib_video.o \
obj/kfx/renderer/software/bflib_vidraw.o \
obj/kfx/renderer/software/bflib_vidraw_spr_norm.o \
obj/kfx/renderer/software/bflib_vidraw_spr_onec.o \
obj/kfx/renderer/software/bflib_vidraw_spr_remp.o \
obj/bflib_vidsurface.o \
obj/button_snapping.o \
obj/config.o \
obj/config_campaigns.o \
obj/config_creature.o \
obj/config_crtrmodel.o \
obj/config_crtrstates.o \
obj/config_keeperfx.o \
obj/config_lenses.o \
obj/config_magic.o \
obj/config_objects.o \
obj/config_mods.o \
obj/config_players.o \
obj/config_powerhands.o \
obj/config_rules.o \
obj/config_settings.o \
obj/config_slabsets.o \
obj/config_strings.o \
obj/config_terrain.o \
obj/config_cubes.o \
obj/config_textures.o \
obj/config_translation.o \
obj/config_trapdoor.o \
obj/config_spritecolors.o \
obj/config_sounds.o \
obj/script_hooks.o \
obj/sim_feedback.o \
obj/pathfinding_world.o \
obj/render_overlay.o \
obj/net_callbacks.o \
obj/game_callbacks.o \
obj/dungeon_availability.o \
obj/sprite_lookup.o \
obj/console_cmd.o \
obj/custom_sprites.o \
obj/custom_zip.o \
obj/creature_battle.o \
obj/creature_control.o \
obj/creature_graphics.o \
obj/creature_groups.o \
obj/creature_instances.o \
obj/creature_jobs.o \
obj/creature_senses.o \
obj/creature_states.o \
obj/creature_states_barck.o \
obj/creature_states_combt.o \
obj/creature_states_gardn.o \
obj/creature_states_guard.o \
obj/creature_states_hero.o \
obj/creature_states_lair.o \
obj/creature_states_mood.o \
obj/creature_states_pray.o \
obj/creature_states_prisn.o \
obj/creature_states_rsrch.o \
obj/creature_states_scavn.o \
obj/creature_states_spdig.o \
obj/creature_states_tortr.o \
obj/creature_states_train.o \
obj/creature_states_tresr.o \
obj/creature_states_wrshp.o \
obj/cursor_tag.o \
obj/game_lifecycle.o \
obj/dungeon_data.o \
obj/dungeon_stats.o \
obj/engine_arrays.o \
obj/engine_camera.o \
obj/local_camera.o \
obj/engine_lenses.o \
obj/engine_redraw.o \
obj/engine_render.o \
obj/engine_render_data.o \
obj/engine_textures.o \
obj/front_credits.o \
obj/front_easter.o \
obj/front_fmvids.o \
obj/front_highscore.o \
obj/front_input.o \
obj/front_landview.o \
obj/front_landview_multiplayer.o \
obj/front_lvlstats.o \
obj/front_lvlstats_data.o \
obj/front_network.o \
obj/front_simple.o \
obj/front_torture.o \
obj/front_torture_data.o \
obj/frontend.o \
obj/frontmenu_options_data.o \
obj/frontmenu_saves_data.o \
obj/frontmenu_select.o \
obj/frontmenu_select_data.o \
obj/frontmenu_ingame_evnt.o \
obj/frontmenu_ingame_evnt_data.o \
obj/frontmenu_ingame_map.o \
obj/frontmenu_ingame_opts.o \
obj/frontmenu_ingame_opts_data.o \
obj/frontmenu_ingame_tabs.o \
obj/frontmenu_ingame_tabs_data.o \
obj/frontmenu_net.o \
obj/frontmenu_net_data.o \
obj/frontmenu_options.o \
obj/frontmenu_saves.o \
obj/gui_vscroll.o \
obj/frontmenu_specials.o \
obj/game_heap.o \
obj/game_legacy.o \
obj/game_loop.o \
obj/game_merge.o \
obj/game_saves.o \
obj/gui_boxmenu.o \
obj/gui_draw.o \
obj/gui_frontbtns.o \
obj/gui_frontmenu.o \
obj/gui_msgs.o \
obj/gui_parchment.o \
obj/gui_soundmsgs.o \
obj/gui_tooltips.o \
obj/gui_topmsg.o \
obj/highscores.o \
obj/kfx_memory.o \
obj/kfx_sim_state.o \
obj/sim_scratch.o \
obj/kjm_input.o \
obj/lens_api.o \
obj/config_effects.o \
obj/LensEffect.o \
obj/LensManager.o \
obj/MistEffect.o \
obj/FlyeyeEffect.o \
obj/DisplacementEffect.o \
obj/OverlayEffect.o \
obj/PaletteEffect.o \
obj/LuaLensEffect.o \
obj/light_data.o \
obj/lua_api.o \
obj/lua_api_camera.o \
obj/lua_api_lens.o \
obj/lua_api_map.o \
obj/lua_api_player.o \
obj/lua_api_room.o \
obj/lua_api_sound.o \
obj/lua_api_things.o \
obj/lua_api_slabs.o \
obj/lua_base.o \
obj/lua_cfg_funcs.o \
obj/lua_params.o \
obj/lua_triggers.o \
obj/lua_utils.o \
obj/game_session_loop.o \
obj/lvl_filesdk1.o \
obj/lvl_script.o \
obj/lvl_script_commands.o \
obj/lvl_script_commands_old.o \
obj/lvl_script_lib.o \
obj/lvl_script_conditions.o \
obj/lvl_script_value.o \
obj/magic_powers.o \
obj/main_game.o \
obj/map_blocks.o \
obj/map_columns.o \
obj/map_ceiling.o \
obj/map_data.o \
obj/map_events.o \
obj/map_locations.o \
obj/map_utils.o \
obj/moonphase.o \
obj/net_game.o \
obj/net_input_lag.o \
obj/net_checksums.o \
obj/net_matchmaking.o \
obj/net_lan.o \
obj/kfx_net_state.o \
obj/kfx_game_state.o \
obj/kfx_frontend_state.o \
obj/packets.o \
obj/packets_cheats.o \
obj/packets_input.o \
obj/packets_misc.o \
obj/kfx/platform/PlatformManager.o \
obj/kfx/platform/PlatformWindows.o \
obj/kfx/platform/WindowSystemSDL.o \
obj/kfx/renderer/IUIRenderer.o \
obj/kfx/renderer/ITextRenderer.o \
obj/kfx/renderer/RendererManager.o \
obj/kfx/renderer/RendererSoftware.o \
obj/player_compchecks.o \
obj/player_compevents.o \
obj/player_complookup.o \
obj/config_compp.o \
obj/player_compprocs.o \
obj/player_comptask.o \
obj/player_computer.o \
obj/player_computer_data.o \
obj/player_data.o \
obj/player_instances.o \
obj/player_utils.o \
obj/power_hand.o \
obj/power_process.o \
obj/power_specials.o \
obj/room_data.o \
obj/room_entrance.o \
obj/room_garden.o \
obj/room_graveyard.o \
obj/room_jobs.o \
obj/room_lair.o \
obj/room_library.o \
obj/room_list.o \
obj/room_scavenge.o \
obj/room_treasure.o \
obj/room_util.o \
obj/room_workshop.o \
obj/roomspace.o \
obj/roomspace_detection.o \
obj/roomspace_prediction.o \
obj/scrcapt.o \
obj/slab_data.o \
obj/sounds.o \
obj/sound_manager.o \
obj/spdigger_stack.o \
obj/tasks_list.o \
obj/thing_corpses.o \
obj/thing_creature.o \
obj/thing_data.o \
obj/thing_doors.o \
obj/thing_effects.o \
obj/thing_factory.o \
obj/thing_list.o \
obj/thing_navigate.o \
obj/thing_objects.o \
obj/thing_physics.o \
obj/thing_shots.o \
obj/thing_stats.o \
obj/thing_traps.o \
obj/value_util.o \
obj/kfx_config_state.o \
obj/vidfade.o \
obj/vidmode_data.o \
obj/vidmode.o \
obj/kfx_render_state.o \
obj/spritesheet.o \
$(FTEST_OBJS) \
$(RES)
MAIN_OBJ = obj/main.o
TESTS_OBJ = obj/tests/tst_main.o \
obj/tests/001_test.o \
obj/tests/tst_enet_server.o \
obj/tests/tst_enet_client.o
CU_DIR = deps/CUnit-2.1-3/CUnit
CU_INC = -I"$(CU_DIR)/Headers"
CU_OBJS = \
obj/cu/Basic.o \
obj/cu/TestDB.o \
obj/cu/CUError.o \
obj/cu/TestRun.o \
obj/cu/Util.o
# include and library directories
LINKLIB = -mwindows \
-L"sdl/lib" -lSDL3 -lSDL3_mixer -lSDL3_image \
-L"deps/ffmpeg/libavformat" -lavformat \
-L"deps/ffmpeg/libavcodec" -lavcodec \
-L"deps/ffmpeg/libswresample" -lswresample \
-L"deps/ffmpeg/libavutil" -lavutil \
-L"deps/openal" -lOpenAL32 \
-L"deps/astronomy" -lastronomy \
-L"deps/enet6/lib" -lenet6 \
-L"deps/miniupnpc" -lminiupnpc \
-L"deps/libnatpmp" -lnatpmp -liphlpapi \
-L"deps/libcurl/lib" -lcurl -lwldap32 -lcrypt32 -lsecur32 -liphlpapi \
-L"deps/spng" -lspng \
-L"deps/centijson" -ljson \
-L"deps/zlib" -lminizip -lz \
deps/luajit/lib/libluajit.a \
-lwinmm -lmingw32 -limagehlp -lws2_32 -ldbghelp -lbcrypt -lole32 -luuid
INCS = \
-I"src" \
-I"deps/zlib/include" \
-I"deps/spng/include" \
-I"sdl/include" \
-I"deps/enet6/include" \
-I"deps/centijson/include" \
-I"deps/centitoml" \
-I"deps/astronomy/include" \
-I"deps/ffmpeg" \
-I"deps/openal/include" \
-I"deps/luajit/include" \
-I"deps/miniupnpc/include" \
-I"deps/libnatpmp/include" \
-I"deps/libcurl/include"
CXXINCS = $(INCS)
STDOBJS = $(subst obj/,obj/std/,$(OBJS))
HVLOGOBJS = $(subst obj/,obj/hvlog/,$(OBJS))
STD_MAIN_OBJ = $(subst obj/,obj/std/,$(MAIN_OBJ))
HVLOG_MAIN_OBJ = $(subst obj/,obj/hvlog/,$(MAIN_OBJ))
# allow extracting files from archives, replacing pre-existing ones
ENABLE_EXTRACT ?= 1
# flags to generate dependency files
DEPFLAGS = -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -DSPNG_STATIC=1 -DAL_LIBTYPE_STATIC
# other flags to include while compiling
# src/kfx_platform and src/kfx_config (docs/refactor/stage-0{3,4}-*.md)
# physically moved out of src/ into their own include/ dirs; everything
# else still needs to find their headers, and their own src/*.c* files
# still have a handful of acknowledged residual upward includes back into
# src/ (see docs/refactor/stage-02-decouple-bflib.md and
# stage-04-kfx-config.md), hence all three directions here.
INCFLAGS = -I"src/kfx_platform/include" -I"src/kfx_config/include" -I"src/kfx_pathfinding/include" -I"src/kfx_sim/include" -I"src/kfx_render/include" -I"src/kfx_net/include" -I"src/kfx_game/include" -I"src/kfx_frontend/include" -I"src/kfx_script/include" -I"src/kfx_apploop/include" -I"src"
# code optimization and debugging flags
CV2PDB := $(shell PATH=`pwd`:$$PATH command -v cv2pdb.exe 2> /dev/null)
DEBUG ?= 0
ifeq ($(DEBUG), 1)
OPTFLAGS = -march=x86-64 -fno-omit-frame-pointer -O0
DBGFLAGS = -g -DDEBUG
else
# frame pointer is required for ASM code to work
OPTFLAGS = -march=x86-64 -fno-omit-frame-pointer -O3
# if we can create a separate debug info file then do it
ifdef CV2PDB
DBGFLAGS = -g
else
DBGFLAGS =
endif
endif
# logging level flags
STLOGFLAGS = -DBFDEBUG_LEVEL=0
HVLOGFLAGS = -DBFDEBUG_LEVEL=10
# compiler warning generation flags
WARNFLAGS = -Wall -W -Wshadow -Wno-sign-compare -Wno-unused-parameter -Wno-maybe-uninitialized -Wno-sign-compare -Wno-strict-aliasing -Wno-unknown-pragmas -Werror -Wno-format-truncation
# disabled warnings: -Wextra -Wtype-limits
CXXFLAGS = $(CXXINCS) -c -std=gnu++20 -fmessage-length=0 $(WARNFLAGS) $(DEPFLAGS) $(OPTFLAGS) $(DBGFLAGS) $(FTEST_DBGFLAGS) $(INCFLAGS)
CFLAGS = $(INCS) -c -std=gnu11 -fmessage-length=0 $(WARNFLAGS) -Werror=implicit $(DEPFLAGS) $(FTEST_DBGFLAGS) $(OPTFLAGS) $(DBGFLAGS) $(INCFLAGS) -DCURL_STATICLIB
LDFLAGS = $(LINKLIB) $(OPTFLAGS) $(DBGFLAGS) $(FTEST_DBGFLAGS) $(LINKFLAGS) -Wl,-Map,"$(@:%.exe=%.map)"
ifeq ($(USE_PRE_FILE), 1)
CXXFLAGS += -DUSE_PRE_FILE=1
CFLAGS += -DUSE_PRE_FILE=1
endif
CAMPAIGNS = $(patsubst campgns/%.cfg,%,$(wildcard campgns/*.cfg))
MAPPACKS = $(patsubst levels/%.cfg,%,$(filter-out %/personal.cfg,$(wildcard levels/*.cfg)))
LANGS = eng chi cht cze dut fre ger ita jpn kor lat pol rus spa swe
# load program version
include build/make/version.mk
VER_STRING = $(VER_MAJOR).$(VER_MINOR).$(VER_RELEASE).$(BUILD_NUMBER) $(PACKAGE_SUFFIX)
# Enable parallel compilation by default. Users can still override with: make -j8, make -j1, etc.
ifndef MAKEFLAGS
MAKEFLAGS = -j$(shell nproc)
endif
# load depenency packages
include build/make/prebuilds.mk
# name virtual targets
.PHONY: all docs docsdox clean clean-build deep-clean build-before
.PHONY: standard std-before std-after
.PHONY: heavylog hvlog-before hvlog-after
.PHONY: package clean-package deep-clean-package
.PHONY: tools clean-tools deep-clean-tools
.PHONY: clean-libexterns deep-clean-libexterns
.PHONY: tests cppcheck
# dependencies tracking
-include $(filter %.d,$(STDOBJS:%.o=%.d))
-include $(filter %.d,$(HVLOGOBJS:%.o=%.d))
# 'make all' calculates the current checksum of all .h and .hpp files, storing the checksum in a file. Then it decides whether to run 'make clean' or 'make standard' based on whether any .h and .hpp files have been altered
HEADER_CHECKSUM_FILE=.header_checksum
all:
@start_time=$$(date +%s.%N); \
get_header_cksum=$$(find ./src/ -type f \( -name "*.h" -o -name "*.hpp" \) -print0 | xargs -0 cksum | LC_ALL=C sort | cksum | awk '{print $$1}'); \
current_checksum=$$(echo $$get_header_cksum $(DEBUG) | cksum | awk '{print $$1}'); \
if [ ! -f $(HEADER_CHECKSUM_FILE) ] || [ "$$(cat $(HEADER_CHECKSUM_FILE))" != "$$current_checksum" ]; then \
$(MAKE) clean; \
fi; \
$(MAKE) standard || exit 1; \
echo "$$current_checksum" > $(HEADER_CHECKSUM_FILE); \
end_time=$$(date +%s.%N); \
duration=$$(awk "BEGIN {print $$end_time - $$start_time}"); \
printf "\033[97mCompiled in: %0.2f seconds\033[0m\n" $$duration;
standard: CXXFLAGS += $(STLOGFLAGS)
standard: CFLAGS += $(STLOGFLAGS)
standard: std-before $(BIN) std-after
heavylog: CXXFLAGS += $(HVLOGFLAGS)
heavylog: CFLAGS += $(HVLOGFLAGS)
heavylog: hvlog-before $(HVLOGBIN) hvlog-after
# Output directories (bin/, obj/std/**, obj/hvlog/**, obj/cu, obj/tests)
# are created lazily, via an order-only "| $$(@D)/" prerequisite on each
# rule that writes into them, rather than eagerly for the whole tree via
# $(shell $(MKDIR) ...) at Makefile-parse time -- that ran unconditionally
# for every invocation, including targets like pkg-enginegfx/pkg-assemble
# that never touch obj/ or bin/, leaving stray empty directories behind.
# $$(@D) needs .SECONDEXPANSION to see the actual target's directory.
.SECONDEXPANSION:
%/:
$(MKDIR) $@
build-before: libexterns
std-before: build-before
hvlog-before: build-before
docs: docsdox
docsdox: docs/doxygen.conf
VERSION=$(VER_STRING) $(DOXYTOOL) docs/doxygen.conf
deep-clean: deep-clean-tools deep-clean-package
$(MAKE) -f obsolete/libexterns.mk deep-clean-libexterns
clean: submodule clean-build clean-tools clean-libexterns clean-package
submodule:
-git submodule init && git submodule update
clean-build:
-$(RM) $(STDOBJS) $(STD_MAIN_OBJ) $(filter %.d,$(STDOBJS:%.o=%.d)) $(filter %.d,$(STD_MAIN_OBJ:%.o=%.d))
-$(RM) $(HVLOGOBJS) $(HVLOG_MAIN_OBJ) $(filter %.d,$(HVLOGOBJS:%.o=%.d)) $(filter %.d,$(HVLOG_MAIN_OBJ:%.o=%.d))
-$(RM) $(BIN) $(BIN:%.exe=%.map)
-$(RM) $(BIN) $(BIN:%.exe=%.pdb)
-$(RM) $(HVLOGBIN) $(HVLOGBIN:%.exe=%.map)
-$(RM) $(HVLOGBIN) $(HVLOGBIN:%.exe=%.pdb)
-$(RM) bin/keeperfx.dll
-$(RM) $(GENSRC)
-$(RM) obj/keeperfx.*
$(BIN): $(GENSRC) $(STDOBJS) $(STD_MAIN_OBJ) std-before | $$(@D)/
-$(ECHO) 'Building target: $@'
$(CPP) -o "$@" $(STDOBJS) $(STD_MAIN_OBJ) $(LDFLAGS)
ifdef CV2PDB
$(CV2PDB) -C "$@"
endif
-$(ECHO) ' '
$(HVLOGBIN): $(GENSRC) $(HVLOGOBJS) $(HVLOG_MAIN_OBJ) hvlog-before | $$(@D)/
-$(ECHO) 'Building target: $@'
$(CPP) -o "$@" $(HVLOGOBJS) $(HVLOG_MAIN_OBJ) $(LDFLAGS)
ifdef CV2PDB
$(CV2PDB) -C "$@"
endif
-$(ECHO) ' '
$(TEST_BIN): $(GENSRC) $(STDOBJS) $(TESTS_OBJ) $(CU_OBJS) std-before | $$(@D)/
-$(ECHO) 'Building target: $@'
$(CPP) -o "$@" $(TESTS_OBJ) $(STDOBJS) $(CU_OBJS) $(LDFLAGS)
ifdef CV2PDB
$(CV2PDB) -C "$@"
endif
obj/std/centitoml/toml_api.o obj/hvlog/centitoml/toml_api.o: deps/centitoml/toml_api.c | $$(@D)/
-$(ECHO) 'Building file: $<'
$(CC) $(CFLAGS) -o"$@" "$<"
-$(ECHO) ' '
obj/tests/%.o: src/tests/%.cpp $(GENSRC) | $$(@D)/
-$(ECHO) 'Building file: $<'
$(CPP) $(CXXFLAGS) -I"src/" $(CU_INC) -o"$@" "$<"
-$(ECHO) ' '
obj/cu/%.o: $(CU_DIR)/Sources/Framework/%.c | $$(@D)/
$(CPP) $(CXXFLAGS) $(CU_INC) -o"$@" "$<"
obj/cu/%.o: $(CU_DIR)/Sources/Basic/%.c | $$(@D)/
$(CPP) $(CXXFLAGS) $(CU_INC) -o"$@" "$<"
define BUILD_CPP_FILES_CMD
-$(ECHO) 'Building cpp file: $<'
@grep -E "#include \"(\.\./)?(\.\./)?pre_inc.h\"" "$<" >/dev/null || echo "\n\nAll files should have #include \"pre_inc.h\" as first include\n\n" >&2 | false
@grep -E "#include \"(\.\./)?(\.\./)?post_inc.h\"" "$<" >/dev/null || echo "\n\nAll files should have #include \"post_inc.h\" as last include\n\n" >&2 | false
$(CPP) $(CXXFLAGS) -o"$@" "$<"
endef
obj/std/%.o: src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
obj/hvlog/%.o: src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
# src/kfx_platform (stage 3): same rule, second source directory.
obj/std/%.o: src/kfx_platform/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
obj/hvlog/%.o: src/kfx_platform/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
define BUILD_CC_FILES_CMD
-$(ECHO) 'Building cc file: $<'
@grep -E "#include \"(\.\./)?(\.\./)?pre_inc.h\"" "$<" >/dev/null || echo "\n\nAll files should have #include \"pre_inc.h\" as first include\n\n" >&2 | false
@grep -E "#include \"(\.\./)?(\.\./)?post_inc.h\"" "$<" >/dev/null || echo "\n\nAll files should have #include \"post_inc.h\" as last include\n\n" >&2 | false
$(CC) $(CFLAGS) -o"$@" "$<"
endef
obj/std/%.o: src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/%.o: src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
# src/kfx_platform (stage 3): same rule, second source directory.
obj/std/%.o: src/kfx_platform/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/%.o: src/kfx_platform/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
# src/kfx_config (stage 4): same rule, third source directory.
obj/std/%.o: src/kfx_config/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/%.o: src/kfx_config/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
# src/kfx_pathfinding (stage 6a): ariadne pathfinding code extracted out of
# src/kfx_sim, see docs/refactor/stage-06a-ariadne-pathfinding-interface.md.
obj/std/%.o: src/kfx_pathfinding/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/%.o: src/kfx_pathfinding/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
# src/kfx_sim (stage 6): same rule, fourth source directory. Landed
# incrementally cluster-by-cluster, so both .c and .cpp variants are
# needed from the start even though cluster 1 is C-only.
obj/std/%.o: src/kfx_sim/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/%.o: src/kfx_sim/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/std/%.o: src/kfx_sim/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
obj/hvlog/%.o: src/kfx_sim/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
# src/kfx_render (stage 7): same rule, fifth source directory. Landed
# incrementally cluster-by-cluster, so both .c and .cpp variants are
# needed from the start even though cluster 1 is C-only.
obj/std/%.o: src/kfx_render/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/%.o: src/kfx_render/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/std/%.o: src/kfx_render/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
obj/hvlog/%.o: src/kfx_render/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
# custom_sprites.c hits a GNU Make implicit-rule-resolution quirk: with
# five candidate `obj/std/%.o: <root>/src/%.c` pattern rules for the
# same stem, `--debug=implicit` shows make claiming it "successfully
# remade" the nonexistent src/custom_sprites.c via its built-in %.c:%.y
# etc. chain search and locking onto the (wrong, first-tried) src/%.c
# rule instead of falling through to src/kfx_render/src/%.c, where the
# file actually lives. No other stem in this tree reproduces it. An
# explicit (non-pattern) rule always wins over pattern rules, so this
# sidesteps the ambiguity rather than relying on search order.
obj/std/custom_sprites.o: src/kfx_render/src/custom_sprites.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/custom_sprites.o: src/kfx_render/src/custom_sprites.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
# src/kfx_net (stage 8): same rule, sixth source directory. Created
# early (stage 8.3) to give kfx_net_state.h/.c a real home; the
# physical-extraction clusters (stage 8.4) land the rest incrementally,
# same shape as kfx_render above.
obj/std/%.o: src/kfx_net/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/%.o: src/kfx_net/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/std/%.o: src/kfx_net/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
obj/hvlog/%.o: src/kfx_net/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
# src/kfx_game (stage 9): same rule, seventh source directory. Created
# early (stage 9.3) to give kfx_game_state.h/.c a real home; the
# physical-extraction clusters (stage 9.4) land the rest incrementally,
# same shape as kfx_net above.
obj/std/%.o: src/kfx_game/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/%.o: src/kfx_game/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/std/%.o: src/kfx_game/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
obj/hvlog/%.o: src/kfx_game/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
# src/kfx_frontend (stage 10): same rule, eighth source directory.
# Created early (stage 10.1) to give kfx_frontend_state.h/.c a real
# home; the physical-extraction clusters (stage 10.2+) land the rest
# incrementally, same shape as kfx_game above.
obj/std/%.o: src/kfx_frontend/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/%.o: src/kfx_frontend/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/std/%.o: src/kfx_frontend/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
obj/hvlog/%.o: src/kfx_frontend/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
# src/kfx_script (stage 11): same rule, ninth source directory. Moved
# in a single pass (no incremental clusters -- see
# src/kfx_script/CMakeLists.txt's comment for why).
obj/std/%.o: src/kfx_script/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/%.o: src/kfx_script/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/std/%.o: src/kfx_script/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
obj/hvlog/%.o: src/kfx_script/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
# src/kfx_apploop (stage 12.5): top-level game/frontend session loop.
obj/std/%.o: src/kfx_apploop/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/hvlog/%.o: src/kfx_apploop/src/%.c libexterns $(GENSRC) | $$(@D)/
$(BUILD_CC_FILES_CMD)
obj/std/%.o: src/kfx_apploop/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
obj/hvlog/%.o: src/kfx_apploop/src/%.cpp libexterns $(GENSRC) | $$(@D)/
$(BUILD_CPP_FILES_CMD)
# Windows resources compilation
define BUILD_RESOURCE_CMD
-$(ECHO) 'Building resource: $<'
$(WINDRES) -i "$<" --input-format=rc -o "$@" -O coff -I"obj/" $(INCFLAGS)
-$(ECHO) ' '
endef
obj/std/%.res: res/%.rc res/daimonkeeper_icon.ico $(GENSRC) | $$(@D)/
$(BUILD_RESOURCE_CMD)
obj/hvlog/%.res: res/%.rc res/daimonkeeper_icon.ico $(GENSRC) | $$(@D)/
$(BUILD_RESOURCE_CMD)
# res/daimonkeeper_icon.ico is committed: res/branding/make_assets.py writes it (32-bit, which png2ico can't).
src/ver_defs.h: build/make/version.mk Makefile
$(ECHO) \#define VER_MAJOR $(VER_MAJOR) > "$(@D)/tmp"
$(ECHO) \#define VER_MINOR $(VER_MINOR) >> "$(@D)/tmp"
$(ECHO) \#define VER_RELEASE $(VER_RELEASE) >> "$(@D)/tmp"
$(ECHO) \#define VER_BUILD $(BUILD_NUMBER) >> "$(@D)/tmp"
$(ECHO) \#define VER_STRING \"$(VER_STRING)\" >> "$(@D)/tmp"
$(ECHO) \#define VER_SHORT_STRING \"$(VER_MAJOR).$(VER_MINOR).$(VER_RELEASE)\" >> "$(@D)/tmp"
$(ECHO) \#define KFX_COMPAT_MAJOR $(KFX_COMPAT_MAJOR) >> "$(@D)/tmp"
$(ECHO) \#define KFX_COMPAT_MINOR $(KFX_COMPAT_MINOR) >> "$(@D)/tmp"
$(ECHO) \#define KFX_COMPAT_VERSION \"$(KFX_COMPAT_MAJOR).$(KFX_COMPAT_MINOR)\" >> "$(@D)/tmp"
$(ECHO) \#define KFX_COMPAT_STRING \"KFX $(KFX_COMPAT_MAJOR).$(KFX_COMPAT_MINOR)\" >> "$(@D)/tmp"
$(ECHO) \#define PRODUCT_SLUG \"$(PRODUCT_SLUG)\" >> "$(@D)/tmp"
$(ECHO) \#define PRODUCT_EXE_NAME \"$(PRODUCT_SLUG).exe\" >> "$(@D)/tmp"
$(ECHO) \#define PACKAGE_SUFFIX \"$(PACKAGE_SUFFIX)\" >> "$(@D)/tmp"
$(ECHO) \#define GIT_REVISION \"`git describe --always`\" >> "$(@D)/tmp"
$(MV) "$(@D)/tmp" "$@"
tests: std-before $(TEST_BIN)
libexterns: obsolete/libexterns.mk
$(MAKE) -f obsolete/libexterns.mk
clean-libexterns: obsolete/libexterns.mk
-$(MAKE) -f obsolete/libexterns.mk clean-libexterns
-$(RM) -rf deps/enet6 deps/zlib deps/spng deps/astronomy deps/centijson deps/luajit deps/miniupnpc deps/libnatpmp deps/libcurl
-$(RM) libexterns
deps/enet6 deps/zlib deps/spng deps/astronomy deps/centijson deps/ffmpeg deps/openal deps/luajit deps/miniupnpc deps/libnatpmp deps/libcurl:
$(MKDIR) $@
src/kfx_script/src/api.c: deps/centijson/include/json.h
src/kfx_platform/src/bflib_enet.cpp: deps/enet6/include/enet6/enet.h
src/kfx_render/src/custom_sprites.c: deps/zlib/include/zlib.h deps/spng/include/spng.h deps/centijson/include/json.h
src/kfx_platform/src/custom_zip.c: deps/zlib/include/zlib.h deps/centijson/include/json.h
src/kfx_platform/src/moonphase.c: deps/astronomy/include/astronomy.h
deps/centitoml/toml_api.c: deps/centijson/include/json.h
deps/centitoml/toml_conv.c: deps/centijson/include/json.h
src/kfx_platform/src/bflib_fmvids.cpp: deps/ffmpeg/libavformat/avformat.h
src/kfx_platform/src/bflib_sndlib.cpp: deps/openal/include/AL/al.h
src/kfx_net/src/net_exchange_gameplay.c: deps/zlib/include/zlib.h
src/kfx_net/src/net_resync.cpp: deps/zlib/include/zlib.h
src/kfx_game/src/console_cmd.c: deps/luajit/include/lua.h
src/kfx_net/src/net_portforward.cpp: deps/miniupnpc/include/miniupnpc/miniupnpc.h deps/libnatpmp/include/natpmp/natpmp.h
src/kfx_net/src/net_matchmaking.c: deps/libcurl/include/curl/curl.h
deps/enet6-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/20260212/enet6-mingw32.tar.gz"
deps/enet6/include/enet6/enet.h: deps/enet6-mingw32.tar.gz | deps/enet6
tar xzmf $< -C deps/enet6
deps/zlib-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/initial/zlib-mingw32.tar.gz"
deps/zlib/include/zlib.h: deps/zlib-mingw32.tar.gz | deps/zlib
tar xzmf $< -C deps/zlib
deps/spng-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/initial/spng-mingw32.tar.gz"
deps/spng/include/spng.h: deps/spng-mingw32.tar.gz | deps/spng
tar xzmf $< -C deps/spng
deps/astronomy-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/astronomy_fix/astronomy-mingw32.tar.gz"
deps/astronomy/include/astronomy.h: deps/astronomy-mingw32.tar.gz | deps/astronomy
tar xzmf $< -C deps/astronomy
deps/centijson-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/initial/centijson-mingw32.tar.gz"
deps/centijson/include/json.h: deps/centijson-mingw32.tar.gz | deps/centijson
tar xzmf $< -C deps/centijson
deps/ffmpeg-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/initial/ffmpeg-mingw32.tar.gz"
deps/ffmpeg/libavformat/avformat.h: deps/ffmpeg-mingw32.tar.gz | deps/ffmpeg
tar xzmf $< -C deps/ffmpeg
deps/openal-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/2024-11-14/openal-mingw32.tar.gz"
deps/openal/include/AL/al.h: deps/openal-mingw32.tar.gz | deps/openal
tar xzmf $< -C deps/openal
deps/luajit-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/20250418/luajit-mingw32.tar.gz"
deps/luajit/lib/libluajit.a: | deps/luajit/include/lua.h
deps/luajit/include/lua.h: deps/luajit-mingw32.tar.gz | deps/luajit
tar xzmf $< -C deps/luajit
deps/miniupnpc-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/20260102/miniupnpc-mingw32.tar.gz"
deps/miniupnpc/include/miniupnpc/miniupnpc.h: deps/miniupnpc-mingw32.tar.gz | deps/miniupnpc
tar xzmf $< -C deps/miniupnpc
deps/libnatpmp-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/20260102/libnatpmp-mingw32.tar.gz"
deps/libnatpmp/include/natpmp/natpmp.h: deps/libnatpmp-mingw32.tar.gz | deps/libnatpmp
tar xzmf $< -C deps/libnatpmp
deps/libcurl-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/20260310/libcurl-mingw32.tar.gz"
deps/libcurl/include/curl/curl.h: deps/libcurl-mingw32.tar.gz | deps/libcurl
tar xzmf $< -C deps/libcurl
cppcheck: | src/ver_defs.h
cppcheck: | deps/zlib/include/zlib.h
cppcheck: | deps/spng/include/spng.h
cppcheck: | deps/astronomy/include/astronomy.h
cppcheck: | deps/centijson/include/json.h
cppcheck: | deps/enet6/include/enet6/enet.h
cppcheck: | deps/luajit/include/lua.h
cppcheck: | deps/openal/include/AL/al.h
cppcheck: | deps/ffmpeg/libavformat/avformat.h
cppcheck:
$(MKDIR) cppcheck.cache
cppcheck \
--cppcheck-build-dir=cppcheck.cache \
--check-level=exhaustive \
--enable=all \
--platform=win32A \
--std=c++20 \
--inconclusive \
-j $(shell nproc) \
-q \
-I deps/zlib/include \
-I deps/spng/include \
-I sdl/include \
-I deps/enet6/include \
-I deps/centijson/include \
-I deps/centitoml \
-I deps/astronomy/include \
-I deps/ffmpeg \
-I deps/openal/include \
-I deps/luajit/include \
-I obj \
-D__WIN32__ \
-DBFDEBUG_LEVEL=99 \
-DSPNG_STATIC=1 \
-DAL_LIBTYPE_STATIC \
-DDEBUG_NETWORK_PACKETS=1 \
--suppress=missingIncludeSystem \
--suppress=constParameterPointer \
--suppress=constVariablePointer \
--suppress=functionConst \
--suppress=unreadVariable \
--suppress=uninitvar \
--suppress=variableScope \
--suppress=unusedStructMember \
--suppress=funcArgNamesDifferent \
--suppress=funcArgOrderDifferent \
--suppress=cstyleCast \
--suppress=functionStatic \
--suppress=unsignedLessThanZero \
--suppress=constParameterCallback \
--suppress=constParameter \
--suppress=knownConditionTrueFalse \
--suppress=negativeIndex \
--suppress=nullPointerRedundantCheck \
--suppress=nullPointerArithmeticRedundantCheck \
--suppress=invalidscanf \
--suppress=invalidScanfArgType_int \
--suppress=invalidPrintfArgType_uint \
--suppress=invalidPrintfArgType_sint \
--suppress=redundantAssignment \
--suppress=preprocessorErrorDirective \
--suppress=uninitMemberVar \
--suppress=truncLongCastAssignment \
--suppress=shiftNegativeLHS \
--suppress=bitwiseOnBoolean \
--suppress=shiftTooManyBits \
--suppress=shiftTooManyBitsSigned \
--suppress=identicalConditionAfterEarlyExit \
--suppress=useInitializationList \
--suppress=operatorEqVarError \