-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile_mini.mk
1625 lines (1456 loc) · 65.6 KB
/
makefile_mini.mk
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
MAKEFILE_MINI_VERSION:=0.1.2
# usage..
# make #< default target makes all not ignored binaries
# make test #< make all test(s) if any and run them
# make release
# # ^
# # 1. make all not ignored binaries + make test(s) if any
# # 2. run test(s) if any and only continue if all test(s) passed
# # 3. make any releasetype(s) specified
# make clean #< clean all binaryparts and binaries
#
# rules..
# .. for paths use / only never \, if required (only if required)..
# .. makefile-mini will automatically replace / with \
#
# terminology..
# .. project <- this Makefile
# .. resource <- e.g. for mm_add_library a library is a resource
# .. binarypartsource <- e.g. .c for .o
# .. binarypart <- e.g. .o for .lib/.a/.exe/<no extension>
# .. binarysource <- e.g. .glsl for .spv
# .. binary <- e.g. for $(call mm_add_library,staticlibrarytest,<..>)..
# .. libstaticlibrarytest.<lib/a> is a binary
# .. library <- static|shared
# .. executable <- <no extension>/.exe, optionally.. portable (.AppImage/.exe)
# .. installer <- <.deb/.snap>/.msi
#
# projectname.. e.g. for myproject/makefile_mini.mk included by..
# .. myproject/Makefile.. myproject
#
# resourcename..
# .. may not contain . (see "external project address")
# .. may contain / (\ will be replaced by / for consistency)*
# .. per resourcetype every resourcename must be unique**
# ^
# * e.g. test/test.spv.h..
# char $(notdir $(<.name>))_spv_h[] = { <...> };
# v
# char test_spv_h[] = { <...> };
# OR
# char $(subst /,_,$(dir $(<.name>)))$(notdir $(<.name>))_spv_h[] = {..
# .. <...> };
# v
# char test_test_spv_h[] = { <...> };
# ^
# .makefile-mini/test/test.spv.h would still result in the above output as..
# .. .makefile-mini is ignored here
# ** resourcename is always specified by type (e.g...
# .. <mm_add_library_parameters_t>.libraries)
# ^
# <mm_start_parameters_t>.ignoredbinaries and..
# .. <mm_stop_parameters>.ifRelease.<ignoredbinaries/if*.ignoredbinaries>..
# .. are specified as regular expression, resourcename is not allowed here
# ^
# exceptions..
# .. shader and shaderlibrary as both use .spv and .spv.h
#
# external project address..
# .. <projectname>:<resourcename> <- resourcename may not contain .
# .. <projectname>:<filepath> <- filepath must contain .
# ^
# if * contains a . in <projectname>:*.. * is considered a filepath
# otherwise.. * is considered a resourcename
# both resourcename and filepath may contain one or more / (e.g...
# .. test:test/test)
# if both external project address and binarypartsource is allowed..
# .. <binarypartsource> <- may not contain :
# .. <projectname>:* <- must contain :
# leave <projectname> empty for current project (e.g. :test for resource test)
# ^
# only files that don't use . ever are..
# .. Makefile (shouldn't be included as .mk is for inclusion only)
# .. linux executable (shouldn't be included as is platform specific thus..
# .. use resourcename)
# # NOTE: $(1) == * (non cli) #< make may parse argument (e.g. for use in..
# # .. $(subst <..>))
# # $(2) == * (cli) #< make does not parse argument (e.g. $@)
# mm_cli_*
#MM_SAFETY:=
#******************************************************************************
# NOTE: https://stackoverflow.com/a/47927343/4825512
MM_EMPTY:=
define MM_NEWLINE:=
$(MM_EMPTY)
endef
MM_COMMA:=,
MM_SPACE:=$(MM_EMPTY) $(MM_EMPTY)
MM_PERCENT:=%
ifndef OS #< linux
MM_OS:=linux
MM_FOLDER_SEPARATOR:=/
MM_STATICLIBRARY_EXTENSION:=.a
MM_SHAREDLIBRARY_EXTENSION:=.so
MM_EXECUTABLE_EXTENSION:=
MM_SCRIPT_EXTENSION:=
MM_PORTABLEEXECUTABLE_EXTENSION:=.AppImage
MM_RELEASEINSTALLER_EXTENSIONS:=.deb .snap
MM_CLI_DEV_NULL:=/dev/null
else ifeq ($(OS), Windows_NT) #< windows
MM_OS:=windows
MM_FOLDER_SEPARATOR:=\$(MM_EMPTY)
MM_STATICLIBRARY_EXTENSION:=.lib
MM_SHAREDLIBRARY_EXTENSION:=.dll
MM_EXECUTABLE_EXTENSION:=.exe
MM_SCRIPT_EXTENSION:=.bat
MM_PORTABLEEXECUTABLE_EXTENSION:=.exe
MM_RELEASEINSTALLER_EXTENSIONS:=.msi
MM_CLI_DEV_NULL:=NUL
else
$(error os not supported)
endif
MM_EXECUTABLE_EXTENSION_OR_DOT:=$(if $(MM_EXECUTABLE_EXTENSION),$(MM_EXECUTABLE_EXTENSION),.)
ifndef OS #< linux
# NOTE: $(1) = non cli (see windows version of mm_cli_mkdir)
mm_cli_mkdir=mkdir -p $(1)
# TODO: not tested
# NOTE: $(1) == non cli (see windows version of mm_cli_rmdir)
mm_cli_rmdir=rm -d -f $(1)
# NOTE: ^
# not using rmdir because that will error if folder doesn't exist
mm_cli_rm=rm -f $(1)
# NOTE: $(2) == non cli (see windows version of mm_cli_zip)
mm_cli_zip=zip -r9 $(1) $(2)
# NOTE: $(1) == one or element(s) of format <pattern>/<replacement>
define mm_cli_not_sed=
$(eval mm_cli_not_sed_a:=$(subst ",\",$(1)))
$(eval mm_cli_not_sed_b:=$(firstword $(mm_cli_not_sed_a)))
$(eval mm_cli_not_sed_c:=$(wordlist 2,$(words $(mm_cli_not_sed_a))))
"s/$(mm_cli_not_sed_b)/g$(patsubst %,;s/%/g,$(mm_cli_not_sed_c))"
endef
# NOTE: $(1) == one or element(s) of format <pattern>/<replacement>
# $(2) == input
define mm_cli_sed=
$(2) | sed -e $(call mm_cli_not_sed,$(1))
endef
# NOTE: ^
# sed "s/<..>/g;s/<..>/g" <..> > <..>
# NOTE: ^
# " in <pattern>/<replacement> is replaced with \"
# NOTE: $(1) == one or element(s) of format <pattern>/<replacement>
# $(2) == input filename
mm_cli_sed2=sed $(call mm_cli_not_sed,$(1)) $(2)
# NOTE: $(1) == one or element(s) of format <pattern>/<replacement>
# $(2) == input filename
# $(3) == output filename
mm_cli_sed3=$(call mm_cli_sed2,$(1),$(2)) > $(3)
else #< windows
# NOTE: $(1) == non cli
# NOTE: mkdir outputs "The syntax of the command is incorrect." if any /..
# .. (only \ allowed)
mm_cli_mkdir=if not exist $(1) mkdir $(subst /,\,$(1))
# NOTE: $(1) == non cli
# NOTE: rmdir outputs "Invalid switch - \"<...>\"" if any / (only \ allowed)
mm_cli_rmdir=if exist $(1) rmdir /S /Q $(subst /,\,$(1))
# NOTE: del outputs "Invalid switch" if any forward / is used"
mm_cli_rm=if exist $(1) del $(subst /,\,$(1))
# NOTE: $(2) == non cli
mm_cli_zip=powershell "Compress-Archive $(subst $(MM_SPACE),$(MM_COMMA),$(strip $(2))) $(1)"
# NOTE: ^
# cannot find documentation on omitting -Command for powershell but..
# .. seems to work
# ^
# https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_powershell_exe?view=powershell-5.1#-command
# NOTE: ^
# "use commas to separate the paths",..
# .. https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/compress-archive?view=powershell-7.3#-path
# NOTE: ^
# strip in $(strip $(2)) to avoid multiple consecutive commas
# NOTE: $(1) == one or more element(s) of format <pattern>/<replacement>
define mm_cli_not_sed=
$(eval mm_cli_not_sed_a:=$(subst ",`\",$(1)))
$(subst /,\"$(MM_COMMA)\",$(patsubst %,-Replace \"%\",$(mm_cli_not_sed_a)))
endef
# NOTE: $(1) == one or more element(s) of format <pattern>/<replacement>
# $(2) == input
mm_cli_sed=powershell "\"$(2)\" $(call mm_cli_not_sed,$(1))"
# NOTE: ^
# powershell "Get-Content <..> -Replace \"<..>\",\"<..>\" -Replace..
# .. \"<..>\",\"<..>\" | Set-Content <..>"
# NOTE: ^
# " in <pattern>/<replacement> is replaced with `"
# NOTE: $(1) == one or more element(s) of format <pattern>/<replacement>
# $(2) == input filename
mm_cli_sed2=powershell "Get-Content $(2) $(call mm_cli_not_sed,$(1))"
# NOTE: $(1) == one or more element(s) of format <pattern>/<replacement>
# $(2) == input filename
# $(3) == output filename
mm_cli_sed3=powershell "Get-Content $(2) $(call mm_cli_not_sed,$(1)) | Set-Content $(3)"
endif
ifndef OS #< linux
# NOTE: $(1) == filename except extension (non cli)
# $(2) == inputfile (cli)
# $(3) == outputfile (cli)
define mm_cli_hfile_from_file=
$(strip\
$(eval $(0)_a:=$(shell echo -n $(1) | tr -c a-zA-Z0-9 _))\
$(eval $(0)_b:=$(shell echo -n $($(0)_a) | tr a-z A-Z))\
echo "#ifndef $($(0)_b)_H" > $(3);\
echo "#define $($(0)_b)_H" >> $(3);\
echo >> $(3); echo >> $(3);\
echo -n "char $($(0)_a)_h[] = { " >> $(3);\
od -An -v -td1 $(2) | tr -s " " | tr -d "\n" | sed -z -e "s/ /, /g;s/^, //;s/, $$$$//" >> $(3);\
echo " };" >> $(3);\
echo >> $(3);\
echo "#endif" >> $(3)\
)
endef
# NOTE: ^
# https://unix.stackexchange.com/a/758531
else #< windows
# NOTE: $(1) == filename except extension (non cli)
# $(2) == inputfile (cli)
# $(3) == outputfile (cli)
define mm_cli_hfile_from_file=
$(strip\
$(eval $(0)_a:=$(shell powershell.exe "\"$(1)\" -Replace \"[^a-zA-Z0-9]\",\"_\""))\
$(eval $(0)_b:=$(shell powershell.exe ""\"$($(0)_a)\".ToUpper()"))\
powershell.exe "$$$$a=(Get-Content -Encoding Byte -Raw $(2) | Out-String).Replace(\"`r`n\",\", \").TrimEnd(\", \"); Set-Content -NoNewline \"#ifndef $($(0)_b)_H`n#define $($(0)_b)_H`n`n`nchar $($(0)_a)_h[] = { $$$$a };`n`n#endif`n\"" $(3)\
)
endef
endif
# NOTE: $(1) == a
# $(2) == b
# NOTE: if a == b.. returns 1
# otherwise.. returns 0
# NOTE: not the same as $(if $(filter $(1),$(2),,) as mm_equals also..
# .. returns 1 if both $(1) and $(2) are both empty
define mm_equals=
$(eval $(0)_a:=$(strip $(1)))
$(eval $(0)_b:=$(strip $(2)))
$(eval $(0)_bAreBothEmpty:=0)
$(if $($(0)_a),,$(if $($(0)_b),,$(eval $(0)_bAreBothEmpty:=1)))
$(if $(filter 1,$($(0)_bAreBothEmpty)),\
1,\
$(if $(filter $($(0)_a),$($(0)_b)),1,0)\
)
endef
# NOTE: switch(<$1>)
# {
# case <$(word 1,$(2))>:
# <$(word 1,$(3))>
# break;
# case <$(word 2,$(2)>:
# <$(word 2,$(3))>
# break;
# //...
# };
define mm_switch=
$(if $(filter 1,$(call mm_equals,$(1),$(firstword $(2)))),\
$(firstword $(3)),\
$(eval $(0)_a:=$(words $(2)))\
$(if $(filter 1,$($(0)_a)),,\
$(eval $(0)_b:=$(wordlist 2,$($(0)_a),$(2)))\
$(eval $(0)_c:=$(wordlist 2,$($(0)_a),$(3)))\
$(call mm_switch,$(1),$($(0)_b),$($(0)_c))\
)\
)
endef
# NOTE: $(1) == elements variablename
mm_add_or_append_one_element=$(eval $(1)+=$(1).$(words $($(1))))
# NOTE: $(1) == pattern(s)
# $(2) == text
# NOTE: like $(filter <..>) but using regular expression pattern
define mm_filter_using_patterns=
$(strip\
$(eval $(0)_a:=$(firstword $(2)))\
$(eval $(0)_b:=$(wordlist 2,$(words $(2)),$(2)))\
$(eval $(0)_c:=$(firstword $(1)))\
$(eval $(0)_d:=$(wordlist 2,$(words $(1)),$(1)))\
$(if $(OS),\
$(shell powershell "\"$($(0)_a)\"$(patsubst %,$(MM_COMMA)\"%\",$($(0)_b)) | Select-String -Pattern \"$($(0)_c)\"$(patsubst %,$(MM_COMMA)\"%\",$($(0)_d))"),\
$(shell (echo "$($(0)_a)"$(patsubst %,; echo "%",$($(0)_b))) | grep -i -E "$($(0)_c)$(addprefix |,$($(0)_d))")\
)\
)
endef
# NOTE: powershell "\"<..>\",\"<..>\" | Select-String -Pattern \"<..>\",\"<..>\""
# ^
# no ^ required as surrounding with "" seems to escape all characters..
# .. between ""
# cmd.exe escaping would be powershell """"<..>""","""<...>""" |..
# .. Select-String -Pattern """<..>""","""<..>""""
# ^
# https://stackoverflow.com/a/15262019
# ^
# powershell seems to also escape quotes if preceeded by \
# NOTE: (echo "<..>"; echo "<..>") | grep -i -E "<..>|<..>"
# ^
# -i for consistency between windows and linux?
# NOTE: $(1) == pattern(s)
# $(2) == text
# NOTE: like $(filter-out <..>) but using regular expression pattern
mm_filter_out_using_patterns=$(filter-out $(call mm_filter_using_patterns,$(1),$(2)),$(2))
ifndef OS #< linux
# NOTE: list files in current folder and deeper folder(s) if any recursively
mm_get_path_to_file_per_file:=$(shell find -type f)
else #< windows
# NOTE: list files in current folder and deeper folder(s) if any recursively
mm_get_path_to_file_per_file:=$(subst ",,$(shell forfiles /s /c "cmd /c if @ISDIR==FALSE echo @RELPATH"))
# NOTE: ^
# dir /S /B /A-D
# ^
# outputs absolute paths
endif
#******************************************************************************
# checks
#******************************************************************************
# NOTE: $(1) == functionname
# $(2) == variablename
mm_check_if_defined=$(if $(filter undefined,$(origin $(2))),$(error $(2) is not defined in $(1)),)
# NOTE: $(1) == functionname
# $(2) == value pattern
# $(3) == values variablename
define mm_check_if_valid_values=
$(eval $(0)_a:=$(filter-out $(2),$($(3))))
$(if $($(0)_a),$(error $(3) contains invalid element(s) $($(0)_a) in $(1)),)
endef
# NOTE: $(1) == functionname
# $(2) == value pattern
# $(3) == value variablename
define mm_check_if_valid_value=
$(eval $(0)_a:=$(filter-out $(2),$($(3))))
$(if $($(0)_a),$(error $(3) contains invalid value $($(0)_a) in $(1)),)
endef
#******************************************************************************
# start
#******************************************************************************
$(shell $(call mm_cli_mkdir,.makefile-mini))
MM_PROJECTNAME:=$(lastword $(subst /, ,$(abspath .)))
# NOTE: .makefile-mini/<binarypart>
MM_BINARYPARTS:=
# NOTE: .makefile-mini/<binarypathfolderpathpart>$(notdir <binarypart>)
# ^
# thus $(dir <binarypath>)
MM_FOLDERPATHPART_PER_BINARYPART:=
# NOTE: can contain both..
# .. .makefile-mini/<ignoredbinary>
# .. <notignoredbinary>
# NOTE: filepath not "path to file" as binary is not always there before..
# .. this variable is used
MM_FILEPATH_PER_BINARY:=
# NOTE: MM_IGNOREDBINARIES_PATTERNS == <mm_start_parameters_t>.ignoredbinaries
MM_IGNOREDBINARIES_PATTERNS:=
# NOTE: .makefile-mini/<ignoredbinary>
MM_IGNOREDBINARIES:=
# NOTE: <notignoredbinary>
MM_NOTIGNOREDBINARIES:=
# NOTE: for sanity pattern will be surrounded by ^ and $
MM_SHAREDSHADER_PATTERN:=.*.spv
MM_STATICSHADER_PATTERN:=.*.spv.h
MM_SHADER_PATTERNS:=$(MM_SHAREDSHADER_PATTERN) $(MM_STATICSHADER_PATTERN)
MM_STATICLIBRARY_PATTERNS:=.*lib.*$(MM_STATICLIBRARY_EXTENSION)
MM_SHAREDLIBRARY_PATTERNS:=.*lib.*$(MM_SHAREDLIBRARY_EXTENSION)
ifndef OS #< linux
# NOTE: [^/\\\.\n] not required as filepath cannot contain newline
MM_EXECUTABLE_PATTERNS:=.*[/\\][^/\\\.]+ [^/\\\.]+
else
MM_EXECUTABLE_PATTERNS:=.*.exe
endif
# NOTE: $(1) == variablename
define mm_start_parameters_t=
$(eval $(1).ignoredbinaries:=)
endef
# NOTE: ^
# .ignoredbinaries == empty or pattern(s), each pattern is a regular..
# .. expression without any space(s) allowed)
#*********************************** checks ***********************************
# NOTE: $(1) == functionname
# $(2) == <mm_start_parameters_t>
define mm_check_start_parameters_t=
$(call mm_check_if_defined,$(1),$(2).ignoredbinaries)
endef
#******************************************************************************
# NOTE: $(1) == <mm_start_parameters_t>
define mm_start=
$(if $(filter undefined,$(origin MM_SAFETY)),,\
$(call mm_check_start_parameters_t,$(0),$(1))\
)
$(eval MM_IGNOREDBINARIES_PATTERNS:=$$($(1).ignoredbinaries))
endef
# NOTE: ^
# $$ in $(eval MM_IGNOREDBINARIES_PATTERN:=$$<..>) because patterns..
# .. may contain $ which should not be directly supplied to eval
# NOTE: $(1) == binary
# NOTE: assumes $(1) does not start with .makefile-mini/
mm_is_binary_ignored=$(if $(MM_IGNOREDBINARIES_PATTERNS),$(if $(call mm_filter_using_patterns,$(MM_IGNOREDBINARIES_PATTERNS),$(1)),1,0),0)
# NOTE: $(1) == binary
mm_get_binaryfilepath_from_binary=$(if $(filter 1,$(call mm_is_binary_ignored,$(1))),.makefile-mini/$(1),$(1))
# NOTE: $(1) == binary
# $(2) == filepath variablename
# NOTE: assumes $(1) does not start with .makefile-mini/
define mm_add_binary=
$(eval $(0)_filepath:=)
$(if $(filter 1,$(call mm_is_binary_ignored,$(1))),\
$(eval $(0)_filepath:=.makefile-mini/$(1))\
$(eval MM_IGNOREDBINARIES+=$(1)),\
$(eval $(0)_filepath:=$(1))\
$(eval MM_NOTIGNOREDBINARIES+=$(1))\
)
$(eval MM_FILEPATH_PER_BINARY+=$($(0)_filepath))
$(eval $(2):=$($(0)_filepath))
endef
# NOTE: $(1) == binarypart
define mm_get_binarypartfolderpathpart_from_binarypart=
$(strip \
$(eval $(0)_a:=$(dir $(1)))\
$(if $(filter ./,$($(0)_a)),,\
$($(0)_a)\
)\
)
endef
# NOTE: $(1) == binarypart
define mm_get_binarypartfolderpath_from_binarypart=
$(strip \
$(eval $(0)_binarypartfolderpathpart:=$(call mm_get_binarypartfolderpathpart_from_binarypart,$(1)))\
$(if $($(0)_binarypartfolderpathpart),\
.makefile-mini/$($(0)_binarypartfolderpathpart)\
,)\
)
endef
# NOTE: $(1) == binarypart
# NOTE: assumes $(1) does not start with .makefile-mini/
define mm_add_binarypart=
$(eval MM_BINARYPARTS+=$(1))
$(eval $(0)_binarypartfolderpathpart:=$(call mm_get_binarypartfolderpathpart_from_binarypart,$(1)))
$(if $(filter $($(0)_binarypartfolderpathpart),$(MM_FOLDERPATHPART_PER_BINARYPART)),,\
$(eval MM_FOLDERPATHPART_PER_BINARYPART+=$($(0)_binarypartfolderpathpart))\
)
endef
#******************************************************************************
# resources
#******************************************************************************
#define mm_info_about_resource_t=
#$(eval .name:=)
#endef
#*********************************** checks ***********************************
# NOTE: $(1) == functionname
# $(2) == resourcetype plural
# $(3) == RESOURCETYPE plural
# $(4) == resources variablename
define mm_check_resources=
$(eval $(0)_a:=$(filter-out $(MM_$(3)),$($(4))))
$(if $($(0)_a),$(error $(3) contains element(s) that aren't $(2) in $(1)),)
endef
#******************************************************************************
# NOTE: $(1) == RESOURCETYPE
# $(2) == resourcename
# NOTE: if there is a resource for which <mm_info_about_resource_t>.name ==..
# .. $(2).. returns 1
# otherwise.. returns 0
define mm_is_resource=
$(eval $(0)_bIsResource:=0)
$(foreach $(0)_infoAboutResource,$(MM_INFO_PER_$(1)),\
$(if $(filter $($($(0)_infoAboutResource).name),$(2)),\
$(eval $(0)_bIsResource:=1)\
,)\
)
$(if $(filter 1,$($(0)_bIsResource)),1,0)
endef
# NOTE: $(1) == RESOURCETYPE
# $(2) == variablename(s)
# $(3) == resources
define mm_get_variables_from_resources=
$(foreach $(0)_resource,$(3),\
$(foreach $(0)_infoAboutResource,$(MM_INFO_PER_$(1)),\
$(if $(filter $($($(0)_infoAboutResource).name),$($(0)_resource)),\
$(foreach $(0)_a,$(2),\
$($($(0)_infoAboutResource).$($(0)_a))\
)\
,)\
)\
)
endef
#******************************************************************************
# glsl
#******************************************************************************
# NOTE: $(1) == variablename
define mm_info_about_spvasm_from_glsl_t=
$(eval $(1).type:=)
$(eval $(1).spvasm:=)
$(eval $(1).glslangValidator:=)
endef
# NOTE: ^
# .type == one of EMMShadertype
# NOTE: "It's a convention to name SPIR-V assembly and binary files with..
# .. suffix .spvasm and .spv, respectively",
# https://github.com/KhronosGroup/SPIRV-Tools#command-line-tools
MM_INFO_PER_SPVASM_FROM_GLSL:=
# NOTE: both .spvasm2 from .spvasm and .spv2 from .spvasm2 are temporary..
# .. until possible to rename entrypoints using spirv-link,..
# .. https://github.com/KhronosGroup/glslang/issues/605
define mm_info_about_spvasm2_and_spv2_from_spvasm_t=
$(eval $(1).a:=)
endef
# NOTE: ^
# <a>.spvasm2
# <a>.spv2
MM_INFO_PER_SPVASM2_AND_SPV2_FROM_SPVASM:=
#*********************************** shader ***********************************
EMMShadertype:=EMMShadertype_Vertex EMMShadertype_Pixel
# NOTE: for consistency with libraries a shader/shaderlibary is..
# .. shared if it is loaded at runtime
# .. static if it is for compiling into a library/executable
EMMShaderfiletype:=EMMShaderfiletype_Shared EMMShaderfiletype_Static
EMMShaderfiletype_All:=$(EMMShaderfiletype)
# NOTE: $(1) == variablename
define mm_add_shader_parameters_t=
$(eval $(1).filetypes:=$(EMMShaderfiletype_All))
$(eval $(1).type:=)
$(eval $(1).glsl:=)
$(eval $(1).glslangValidator:=)
endef
# NOTE: ^
# .filetypes == one or more of EMMShaderfiletype, may not be empty
# .glsl == <filepath><filename>.glsl, must contain one element
# .glslangValidator == i.e. glslangValidator <.glslangValidator>, may..
# .. be empty
# NOTE: $(1) == variablename
define mm_info_about_shader_t=
$(eval $(1).name:=)
$(eval $(1).type:=)
$(eval $(1).filetypes:=)
$(eval $(1).spvasm:=)
$(eval $(1).spv:=)
$(eval $(1).spvFilepath:=)
$(eval $(1).spvHFilepath:=)
endef
# NOTE: .name == output files are..
# .. <.name>.spv
# .. <.name>.spv.h -> char <$(1).spv>_spv = { <...> };
# .spv == is for mm_get_binarypartfolderpath_from_binarypart
MM_INFO_PER_SHADER:=
#********************************** checks ***********************************
# NOTE: $(1) == functionname
# $(2) == <mm_add_shader_parameters_t>
define mm_check_add_shader_parameters_t=
$(call mm_check_if_defined,$(1),$(2).filetypes)
$(call mm_check_if_defined,$(1),$(2).type)
$(call mm_check_if_defined,$(1),$(2).glsl)
$(call mm_check_if_defined,$(1),$(2).glslangValidator)
$(if $($(2).filetypes),,$(error $(2).filetypes may not be empty in $(1)))
$(call mm_check_if_valid_values,$(1),$(EMMShaderfiletype_All),$(2).filetypes)
$(if $($(2).type),,$(error $(2).type may not be empty in $(1)))
$(call mm_check_if_valid_value,$(1),$(EMMShadertype),,$(2).type)
$(if $(filter-out 1,$(words $($(2).glsl))),$(error $(2).glsl must contain one element in $(1)),)
$(call mm_check_if_valid_value,$(1),%.glsl,$(2).glsl)
endef
#******************************************************************************
# NOTE: $(1) == shadername
mm_is_shader=$(call mm_is_resource,SHADER,$(1))
# NOTE: $(1) == shadername
# $(2) == <mm_add_shader_parameters_t>
# NOTE: binary is $(1).spvasm for every shadertype thus shadername is shared..
# .. between shadertypes
define mm_add_shader=
$(if $(filter undefined,$(origin MM_SAFETY)),,\
$(if $(filter 1,$(call mm_is_shader,$(1))),$(error attempted to add shader $(1) more than once in $(0)),)\
$(call mm_check_add_shader_parameters_t,$(0),$(2))\
)
$(call mm_add_or_append_one_element,MM_INFO_PER_SHADER)
$(eval $(0)_infoAboutShader:=$(lastword $(MM_INFO_PER_SHADER)))
$(call mm_info_about_shader_t,$($(0)_infoAboutShader))
$(eval $($(0)_infoAboutShader).name:=$(1))
$(eval $($(0)_infoAboutShader).type:=$($(2).type))
$(eval $($(0)_infoAboutShader).filetypes:=$($(2).filetypes))
$(eval $($(0)_infoAboutShader).spvasm:=$(patsubst %.glsl,%.spvasm,$($(2).glsl)))
$(eval $($(0)_infoAboutShader).spv:=$($(1).spv))
$(eval $(0)_bIsSpvasmFromGlsl:=0)
$(foreach $(0)_infoAboutSpvasmFromGlsl,$(MM_INFO_PER_SPVASM_FROM_GLSL),\
$(if $(filter $($($(0)_infoAboutSpvasmFromGlsl).spvasm),$($(2).spvasm)),\
$(if $(filter $($($(0)_infoAboutSpvasmFromGlsl).type),$($(2).type)),,\
$(error $($(2).spvasm) required more than once but with different type value in $(0))\
)\
$(if $(filter 0,$(call mm_equals,$($($(0)_infoAboutSpvasmFromGlsl).glslangValidator).$($(2).glslangValidator)))\
$(error $($(2).spvasm) required more than once but with different glslangValidator value in $(0))\
,)\
$(eval $(0)_bIsSpvasmFromGlsl:=1)\
,)\
)
$(if $(filter 0,$($(0)_bIsSpvasmFromGlsl)),\
$(call mm_add_or_append_one_element,MM_INFO_PER_SPVASM_FROM_GLSL)\
$(eval $(0)_infoAboutSpvasmFromGlsl:=$(lastword $(MM_INFO_PER_SPVASM_FROM_GLSL)))\
$(eval $($(0)_infoAboutSpvasmFromGlsl).type:=$($(2).type))\
$(eval $($(0)_infoAboutSpvasmFromGlsl).spvasm:=$($($(0)_infoAboutShader).spvasm))\
$(eval $($(0)_infoAboutSpvasmFromGlsl).glslangValidator:=$($(2).glslangValidator))\
$(call mm_add_binarypart,$($($(0)_infoAboutShader).spvasm))\
,)
$(if $(filter EMMShaderfiletype_Shared,$($(2).filetypes)),\
$(call mm_add_binary,$(1).spv,$($(0)_infoAboutShader).spvFilepath),\
$(call mm_add_binarypart,$(1).spv)\
$(eval $($(0)_infoAboutShader).spvFilepath:=.makefile-mini/$(1).spv)\
)
$(if $(filter EMMShaderfiletype_Static,$($(2).filetypes)),\
$(call mm_add_binary,$(1).spv.h,$($(0)_infoAboutShader).spvHFilepath)\
,)
endef
# TODO: ^
# if not EMMShaderfiletype_Shared.. .makefile-mini/$(1).spv
# otherwise.. $(1).spv
#******************************************************************************
# c/c++
#******************************************************************************
# NOTE: $(1) == variablename
define mm_info_about_o_from_c_t=
$(eval $(1).c:=)
$(eval $(1).hFolders:=)
$(eval $(1).gcc:=)
$(eval $(1).o:=)
endef
# NOTE: ^
# .o == if windows.. <.c>.o
# if linux..
# .. if sharedlibrary.. <.c>.shared.o
# .. otherwise.. <.c>.static.o
MM_INFO_PER_O_FROM_C:=
# NOTE: $(1) == variablename
define mm_info_about_o_from_cpp_t=
$(eval $(1).cpp:=)
$(eval $(1).hppFolders:=)
$(eval $(1).g++:=)
$(eval $(1).o:=)
endef
# NOTE: ^
# .o == if windows.. <.cpp>.o
# if linux..
# .. if sharedlibrary.. <.cpp>.shared.o
# .. otherwise.. <.cpp>.static.o
MM_INFO_PER_O_FROM_CPP:=
#********************************** checks ***********************************
# NOTE: $(1) == functionname
# $(2) == lib
define mm_check_lib=
$(eval $(0)_invalidLib:=)
$(foreach $(0)_lib,$($(2)),\
$(if $(findstring .,$($(0)_lib)),\
$(eval $(0)_invalidLib+=$($(0)_lib))\
)\
)
$(if $($(0)_invalidLib),\
$(error $(2) contains invalid value(s) $($(0)_invalidLib) in $(1))\
,)
endef
#******************************************************************************
# NOTE: $(1) == functionname
# $(2) == C/CPP
# $(3) == c/cpp
# $(4) == h/hpp
# $(5) == gcc/g++
# $(6) == .hFolders/.hppFolders
# $(7) == .gcc/.g++
# $(8) == .o
define mm_add_o_from_c_or_cpp=
$(foreach $(0)_o,$(8),\
$(if $(OS),\
$(eval $(0)_cOrCpp:=$(basename $($(0)_o))),\
$(eval $(0)_cOrCpp:=$(basename $(basename $($(0)_o))))\
)\
$(eval $(0)_gccOrG++:=$(7))\
$(if $(OS),,\
$(if $(filter %.shared.o,$($(0)_o)),\
$(eval $(0)_gccOrG++ +=-fpic -fvisibility=hidden)\
,)\
)\
$(eval $(0)_bIsOFromCOrCpp:=0)\
$(foreach $(0)_infoAboutOFromCOrCpp,$(MM_INFO_PER_O_FROM_$(2)),\
$(if $(filter $($($(0)_infoAboutOFromCOrCpp).o),$($(0)_o)),\
$(if $(filter 0,$(call mm_equals,$($($(0)_infoAboutOFromCOrCpp).$(4)Folders),$(6))),\
$(error $($(0)_o) required more than once but with different $(4)Folders value in $(1))\
,)\
$(if $(filter 0,$(call mm_equals,$($($(0)_infoAboutOFromCOrCpp).$(5)),$($(0)_gccOrG++))),\
$(error $($(0)_o) required more than once but with different $(5) value in $(1))\
,)\
$(eval $(0)_bIsOFromCOrCpp:=1)\
,)\
)\
$(if $(filter 0,$($(0)_bIsOFromCOrCpp)),\
$(call mm_add_or_append_one_element,MM_INFO_PER_O_FROM_$(2))\
$(eval $(0)_infoAboutOFromCOrCpp:=$(lastword $(MM_INFO_PER_O_FROM_$(2))))\
$(call mm_info_about_o_from_c_or_cpp_t,$($(0)_infoAboutOFromCOrCpp))\
$(eval $($(0)_infoAboutOFromCOrCpp).$(3):=$($(0)_cOrCpp))\
$(eval $($(0)_infoAboutOFromCOrCpp).$(4)Folders:=$(6))\
$(eval $($(0)_infoAboutOFromCOrCpp).$(5):=$($(0)_gccOrG++))\
$(eval $($(0)_infoAboutOFromCOrCpp).o:=$($(0)_o))\
$(call mm_add_binarypart,$($(0)_o))\
,)\
)
endef
# NOTE: ^
# though not possible that "-fpic -fvisibilty=hidden" for .shared.o is..
# .. ever an issue, adding it here before checking for sanity
# NOTE: $(1) == functionname
# $(2) == .hFolders
# $(3) == .gcc
# $(4) == .o
mm_add_o_from_c=$(call mm_add_o_from_c_or_cpp,$(1),C,c,h,gcc,$(2),$(3),$(4))
# NOTE: $(1) == functionname
# $(2) == .hppFolders
# $(3) == .g++
# $(4) == .o
mm_add_o_from_cpp=$(call mm_add_o_from_c_or_cpp,$(1),CPP,cpp,hpp,g++,$(2),$(3),$(4))
#********************************** library ***********************************
# NOTE: library and shaderlibrary are separate as every library can be built..
# .. from the same files and every shaderlibrary can be built from the..
# .. same files
EMMLibraryfiletype:=EMMLibraryfiletype_Static EMMLibraryfiletype_Shared
EMMLibraryfiletype_All:=$(EMMLibraryfiletype)
# NOTE: $(1) == <mm_add_library_parameters_t>
# NOTE: if .filetypes is empty.. .c and .gcc must be empty
define mm_add_library_parameters_t=
$(eval $(1).filetypes:=)
$(eval $(1).c:=)
$(eval $(1).localC:=)
$(eval $(1).cpp:=)
$(eval $(1).localCpp:=)
$(eval $(1).h:=)
$(eval $(1).hpp:=)
$(eval $(1).hFolders:=)
$(eval $(1).hppFolders:=)
$(eval $(1).hAndHppFolders:=)
$(eval $(1).lib:=)
$(eval $(1).libFolders:=)
$(eval $(1).cGcc:=)
$(eval $(1).cppG++:=)
$(eval $(1).gccOrG++:=)
$(eval $(1).libraries:=)
$(eval $(1).staticlibraries:=)
$(eval $(1).sharedlibraries:=)
endef
# NOTE: ^
# .filetypes == empty (i.e. .h only) or one or multiple of..
# .. EMMLibraryfiletype
# .localC == .c file(s) for which objdump would report l on the..
# .. corresponding .o for every extern symbol
# .localCpp == .cpp file(s) for which objdump would report l on the..
# .. corresponding .o for every extern symbol
# .hFolders == folders only for c, equivalent to -I for gcc
# .hppFolders == folders only for c++, equivalent to -I for g++
# .hAndHppFolders == folders for both c and c++
# .libraries == libraryname(s) and/or external project address(es)..
# .. each to a library (i.e. <projectname>:<libraryname>)
# .lib == lib as in the first lib in lib<...>.<lib/dll/a/so>,..
# .. equivalent to -l for gcc
# .libFolders == folders, equivalent to -L for gcc
# .gccOrG++ == if .cpp is empty.. gcc <.gcc> <...>
# otherwise.. g++ <.g++> <....
# NOTE: header only library (empty .filetypes) is such that external project..
# .. address (<projectname>:<libraryname>) to header only library is..
# .. possible
# NOTE: ^
# current limitation of .local<C/Cpp> is that static variables and..
# .. functions can only occur once across all local files because..
# .. every local .o is merged into one .o
# TODO: ^
# option would be to mangle static symbols per file, but don't know..
# .. how to do that using windows+mingw/linux a.t.m.
# NOTE: $(1) == variablename
define mm_info_about_library_t=
$(eval $(1).name:=)
$(eval $(1).filetypes:=)
$(eval $(1).o:=)
$(eval $(1).staticO:=)
$(eval $(1).sharedO:=)
$(eval $(1).localStaticO:=)
$(eval $(1).h:=)
$(eval $(1).hpp:=)
$(eval $(1).lib:=)
$(eval $(1).libFolders:=)
$(eval $(1).cc:=)
$(eval $(1).gccOrG++:=)
$(eval $(1).otherLibraries:=)
$(eval $(1).otherStaticlibraries:=)
$(eval $(1).otherSharedlibraries:=)
$(if $(OS),\
$(eval $(1).windows.libfilepath:=)\
$(eval $(1).windows.dllfilepath:=),\
$(eval $(1).linux.afilepath:=)\
$(eval $(1).linux.sofilepath:=)\
)
$(eval $(1).hAndHppFilepathPerOtherLibrary:=)
$(eval $(1).binaryfilepathPerOtherStaticlibrary:=)
$(eval $(1).binaryfilepathPerOtherSharedlibrary:=)
endef
# NOTE: ^
# .o == if windows.. .o from .c
# if linux.. <.staticO> <.sharedO>
# .staticO == if windows.. <.o>
# if linux.. compiled w.o. -fpic -fvisibility=hidden
# .sharedO == if windows.. <.o>
# if linux.. == compiled w. -fpic -fvisibility=hidden
# .localStaticO == .o, .staticO and .sharedO already include every..
# .. local static .o, .localStaticO contains only..
# .. those .o file(s) if any in .staticO that are local
# .cc == gcc/g++
# .windows.<lib/dll>filepath == filepath to <.lib/.dll> binary
# .linux.<a/so>filepath == filepath to <.a/.so> binary
MM_INFO_PER_LIBRARY:=
MM_LIBRARIES:=
#*********************************** checks ***********************************
# NOTE: $(1) == functionname
# $(2) == libraries variablename
mm_check_libraries=$(call mm_check_resources,$(1),libraries,LIBRARIES,$(2))
# NOTE: $(1) == functionname
# $(2) == <mm_add_*_parameters_t>
define mm_check_libraries_and_staticlibraries_and_sharedlibraries=
$(call mm_check_libraries,$(1),$(2).libraries)
$(call mm_check_libraries,$(1).$(2).staticlibraries)
$(call mm_check_libraries,$(1).$(2).sharedlibraries)
$(eval $(0)_a:=$(filter $($(2).staticlibraries),$($(2).libraries)))
$(if $($(0)_a),$(error $($(0)_a) specified both in $(2).libraries and $(2).staticlibraries) in $(1),)
$(eval $(0)_b:=$(filter $($(2).sharedlibraries),$($(2).libraries)))
$(if $($(0)_b),$(error $($(0)_b) specified both in $(2).libraries and $(2).sharedlibaries) in $(1),)
endef
# NOTE: $(1) == functionname
# $(2) == <mm_add_library_parameters_t>
define mm_check_add_library_parameters_t=
$(call mm_check_if_defined,$(1),$(2).filetypes)
$(call mm_check_if_defined,$(1),$(2).c)
$(call mm_check_if_defined,$(1),$(2).localC)
$(call mm_check_if_defined,$(1),$(2).cpp)
$(call mm_check_if_defined,$(1),$(2).localCpp)
$(call mm_check_if_defined,$(1),$(2).h)
$(call mm_check_if_defined,$(1),$(2).hpp)
$(call mm_check_if_defined,$(1),$(2).hFolders)
$(call mm_check_if_defined,$(1),$(2).hppFolders)
$(call mm_check_if_defined,$(1),$(2).hAndHppFolders)
$(call mm_check_if_defined,$(1),$(2).lib)
$(call mm_check_if_defined,$(1),$(2).libFolders)
$(call mm_check_if_defined,$(1),$(2).cGcc)
$(call mm_check_if_defined,$(1),$(2).cppG++)
$(call mm_check_if_defined,$(1),$(2).gccOrG++)
$(call mm_check_if_defined,$(1),$(2).libraries)
$(call mm_check_if_defined,$(1),$(2).staticlibraries)
$(call mm_check_if_defined,$(1),$(2).sharedlibraries)
$(if $($(2).filetypes),\
$(call mm_check_if_valid_values,$(1),$(EMMLibraryfiletype_All),$(2).filetypes)\
$(if $($(2).c) $($(2).cpp),,$(error if $(2).filetypes is not empty.. $(2).c and $(2).cpp may not both be empty in $(1)))\
$(call mm_check_if_valid_values,$(1),%.c,$(2).c)\
$(call mm_check_if_valid_values,$(1),%.cpp,$(2).cpp),\
$(if $($(2).c),$(error if $(2).filetypes is empty.. $(2).c must be empty in $(1)),)\
$(if $($(2).cpp),$(error if $(2).filetypes is empty.. $(2).cpp must be empty in $(1)),)\
$(if $($(2).h) $($(2).hpp),,$(error if $(2).filetypes is empty.. $(2).h and $(2).hpp may not both be empty in $(1)))\
$(if $($(2).cGcc),$(error if $(2).filetypes is empty.. $(2).cGcc must be empty in $(1)),)\
$(if $($(2).cppG++),$(error if $(2).filetypes is empty.. $(2).cppG++ must be empty in $(1)),)\
$(if $($(2).gccOrG++),$(error if $(2).filetypes is empty.. $(2).gccOrG++ must be empty in $(1)),)\
)
$(call mm_check_if_valid_values,$(1),%.h,$(2).h)
$(call mm_check_if_valid_values,$(1),%.hpp,$(2).hpp)
$(call mm_check_lib,$(1),$(2).lib)
$(call mm_check_libraries_and_staticlibraries_and_sharedlibraries,$(1),$(2))
endef
# TODO: ^
# implement .h, .lib, .libFolders, .windows.*, .linux.*
#******************************************************************************
# NOTE: $(1) == libraryname
mm_is_library=$(call mm_is_resource,LIBRARY,$(1))
# NOTE: $(1) == libraries
mm_get_filepath_per_h_and_hpp_from_libraries=$(call mm_get_variables_from_resources,LIBRARY,h hpp,$(1))
# NOTE: $(1) == staticlibraries
mm_get_filepath_per_binary_from_staticlibraries=$(call mm_get_variables_from_resources,LIBRARY,$(MM_OS)$(MM_STATICLIBRARY_EXTENSION)filepath,$(1))
# NOTE: $(1) == sharedlibraries
mm_get_filepath_per_binary_from_sharedlibraries=$(call mm_get_variables_from_resources,LIBRARY,$(MM_OS)$(MM_SHAREDLIBRARY_EXTENSION)filepath,$(1))
# NOTE: $(1) == libraryname
# $(2) == <mm_add_library_parameters_t>
define mm_add_library=
$(if $(filter undefined,$(origin MM_SAFETY)),,\
$(if $(filter 1,$(call mm_is_library,$(1))),$(error attempted to add library $(1) more than once in $(0)),)\
$(call mm_check_add_library_parameters_t,$(0),$(2))\
)
$(eval MM_INFO_PER_LIBRARY+=MM_INFO_PER_LIBRARY.$(words $(MM_INFO_PER_LIBRARY)))
$(eval $(0)_infoAboutLibrary:=$(lastword $(MM_INFO_PER_LIBRARY)))
$(call mm_info_about_library_t,$($(0)_infoAboutLibrary))
$(eval $($(0)_infoAboutLibrary).name:=$(1))
$(eval $($(0)_infoAboutLibrary).filetypes:=$($(2).filetypes))
$(eval $(0)_oFromC:=)
$(eval $(0)_oFromLocalC:=)
$(eval $(0)_oFromCpp:=)
$(eval $(0)_oFromLocalCpp:=)
$(if $(OS),\
$(eval $(0)_oFromC:=$(addsuffix .o,$($(2).c)))\
$(eval $(0)_oFromLocalC:=$(addsuffix .o,$($(2).localC)))\
$(eval $(0)_oFromCpp:=$(addsuffix .o,$($(2).cpp)))\
$(eval $(0)_oFromLocalCpp:=$(addsuffix .o,$($(2).localCpp)))\
$(eval $($(0)_infoAboutLibrary).o:=$($(0)_oFromC) $($(0)_oFromLocalC) $($(0)_oFromCpp) $($(0)_oFromLocalCpp))\
$(eval $($(0)_infoAboutLibrary).staticO:=$($($(0)_infoAboutLibrary).o))\
$(eval $($(0)_infoAboutLibrary).sharedO:=$($($(0)_infoAboutLibrary).o)),\
$(if $(filter EMMLibraryfiletype_Static,$($($(0)_infoAboutLibrary).filetypes)),\
$(eval $(0)_staticOFromC:=$(addsuffix .static.o,$($(2).c)))\
$(eval $(0)_staticOFromLocalC:=$(addsuffix .static.o,$($(2).localC)))\
$(eval $(0)_staticOFromCpp:=$(addsuffix .static.o,$($(2).cpp)))\
$(eval $(0)_staticOFromLocalCpp:=$(addsuffix .static.o,$($(2).localCpp)))\
$(eval $($(0)_infoAboutLibrary).staticO:=$($(0)_staticOFromC) $($(0)_staticOFromLocalC) $($(0)_staticOFromCpp) $($(0)_staticOFromLocalCpp))\
$(eval $($(0)_infoAboutLibrary).o+=$($($(0)_infoAboutLibrary).staticO))\
$(eval $(0)_oFromC+=$($(0)_staticOFromC))\
$(eval $(0)_oFromLocalC+=$($(0)_staticOFromLocalC))\
$(eval $(0)_oFromCpp+=$($(0)_staticOFromCpp))\
$(eval $(0)_oFromLocalCpp+=$($(0)_staticOFromLocalCpp))\
,)\
$(if $(filter EMMLibraryfiletype_Shared,$($($(0)_infoAboutLibrary).filetypes)),\
$(eval $(0)_sharedOFromC:=$(addsuffix .shared.o,$($(2).c)))\
$(eval $(0)_sharedOFromLocalC:=$(addsuffix .shared.o,$($(2).localC)))\