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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
|
{ "defaults":
{ "doc":
[ "A rule to provide defaults."
, "All CC targets take their defaults for CC, CXX, flags, etc from"
, "the target [\"CC\", \"defaults\"]. This is probably the only sensible"
, "use of this rule. As targets form a different root, the defaults"
, "can be provided without changing this directory."
]
, "target_fields": ["base", "toolchain", "deps", "include_scanner"]
, "string_fields":
[ "CC"
, "CXX"
, "CFLAGS"
, "CXXFLAGS"
, "LDFLAGS"
, "ARFLAGS"
, "ADD_COMPILE_FLAGS"
, "ADD_CFLAGS"
, "ADD_CXXFLAGS"
, "ADD_LDFLAGS"
, "AR"
, "PATH"
, "SYSTEM_TOOLS"
]
, "config_vars": ["ARCH", "HOST_ARCH", "TARGET_ARCH", "DEBUG"]
, "field_doc":
{ "base": ["Other targets (using the same rule) to inherit values from."]
, "toolchain":
[ "Optional toolchain directory. A collection of artifacts that provide"
, "the tools CC, CXX, and AR (if needed). Note that only artifacts of"
, "the specified targets are considered (no runfiles etc.). Specifying"
, "this field extends artifacts from \"base\". If the toolchain"
, "supports cross-compilation, it should perform a dispatch on the"
, "configuration variable \"BUILD_ARCH\" to determine for which"
, "architecture to generate code for."
]
, "deps":
[ "Optional CC libraries any CC library and CC binary implicitly depend"
, "on. Those are typically \"libstdc++\" or \"libc++\" for C++ targets."
, "Specifying this field extends dependencies from \"base\"."
]
, "CC": ["The C compiler to use"]
, "CXX": ["The C++ compiler to use"]
, "AR": ["The archiver tool to use"]
, "SYSTEM_TOOLS":
[ "List of tools (\"CC\", \"CXX\", or \"AR\") that should be taken from"
, "the system instead of from \"toolchain\" (if specified)."
]
, "CFLAGS":
[ "Flags for C compilation. Specifying this field overwrites"
, "values from \"base\"."
]
, "CXXFLAGS":
[ "Flags for C++ compilation. Specifying this field overwrites"
, "values from \"base\"."
]
, "LDFLAGS":
[ "Linker flags for linking the final CC library. Specifying this field"
, "overwrites values from \"base\"."
]
, "ARFLAGS":
[ "Arguments to tell the archiver to create an archive with the specified"
, "object files. If the \"ARFLAGS\" specified in the defaults target are"
, "empty, the rules will use [\"cqs\"]."
]
, "ADD_COMPILE_FLAGS":
[ "Additional compilation flags for C and C++. Specifying this field"
, "extends values from \"base\" for both, \"CFLAGS\" and \"CXXFLAGS\"."
]
, "ADD_CFLAGS":
[ "Additional compilation flags specific for C. Specifying this field"
, "extends values from \"base\"."
]
, "ADD_CXXFLAGS":
[ "Additional compilation flags specific for C++. Specifying this field"
, "extends values from \"base\"."
]
, "ADD_LDFLAGS":
[ "Additional linker flags for linking the final CC library. Specifying"
, "this field extends values from \"base\"."
]
, "PATH":
[ "Path for looking up the compilers. Individual paths are joined"
, "with \":\". Specifying this field extends values from \"base\"."
]
, "include_scanner":
[ "Specify an include scanner to be run before each compile action, which"
, "removes unused headers from the include tree. The given target must"
, "contain a single executable artifact, a script or binary. The tool"
, "specified must accept as first argument the <out_dir> path and as"
, "remaining arguments the argv of the preprocessor command (-E -M)."
, "The input headers are located in the local directory \"include\" and"
, "the scanner should copy all used headers to \"<out_dir>/include\"."
, "Specifying this field overwrites values from \"base\"."
]
}
, "config_doc":
{ "ARCH":
[ "The unqualified architecture. Is taken as a default for \"HOST_ARCH\""
, "and \"TARGET_ARCH\" if not set."
]
, "HOST_ARCH":
["The architecture on which the build actions are carried out."]
, "TARGET_ARCH": ["The architecture for which to build."]
, "DEBUG": ["Compute the debug-stage, needed for local debugging."]
}
, "imports":
{ "base-provides": "defaults-base-provides"
, "base-provides-++": "defaults-base-provides-++"
, "base-provides-list": "defaults-base-provides-list"
, "artifacts_list": ["./", "..", "field_artifacts_list"]
, "artifacts": ["./", "..", "field_artifacts"]
, "compile-deps": "compile-deps"
, "compile-args-deps": "compile-args-deps"
, "link-deps": "link-deps"
, "link-args-deps": "link-args-deps"
, "run-libs-deps": "run-libs-deps"
, "run-libs-args-deps": "run-libs-args-deps"
, "cflags-files-deps": "cflags-files-deps"
, "ldflags-files-deps": "ldflags-files-deps"
, "for host": ["transitions", "for host"]
, "debug-deps": "debug-deps"
}
, "config_transitions":
{ "toolchain": [{"type": "CALL_EXPRESSION", "name": "for host"}]
, "include_scanner": [{"type": "CALL_EXPRESSION", "name": "for host"}]
}
, "expression":
{ "type": "let*"
, "bindings":
[ ["CC", {"type": "FIELD", "name": "CC"}]
, ["CXX", {"type": "FIELD", "name": "CXX"}]
, ["CFLAGS", {"type": "FIELD", "name": "CFLAGS"}]
, ["CXXFLAGS", {"type": "FIELD", "name": "CXXFLAGS"}]
, ["LDFLAGS", {"type": "FIELD", "name": "LDFLAGS"}]
, ["ARFLAGS", {"type": "FIELD", "name": "ARFLAGS"}]
, ["AR", {"type": "FIELD", "name": "AR"}]
, ["PATH", {"type": "FIELD", "name": "PATH"}]
, ["provider", "CC"]
, [ "CC"
, { "type": "if"
, "cond": {"type": "var", "name": "CC"}
, "then": {"type": "var", "name": "CC"}
, "else": {"type": "CALL_EXPRESSION", "name": "base-provides"}
}
]
, ["provider", "CXX"]
, [ "CXX"
, { "type": "if"
, "cond": {"type": "var", "name": "CXX"}
, "then": {"type": "var", "name": "CXX"}
, "else": {"type": "CALL_EXPRESSION", "name": "base-provides"}
}
]
, ["provider", "CFLAGS"]
, [ "CFLAGS"
, { "type": "if"
, "cond": {"type": "var", "name": "CFLAGS"}
, "then": {"type": "var", "name": "CFLAGS"}
, "else": {"type": "CALL_EXPRESSION", "name": "base-provides-++"}
}
]
, ["provider", "CXXFLAGS"]
, [ "CXXFLAGS"
, { "type": "if"
, "cond": {"type": "var", "name": "CXXFLAGS"}
, "then": {"type": "var", "name": "CXXFLAGS"}
, "else": {"type": "CALL_EXPRESSION", "name": "base-provides-++"}
}
]
, ["provider", "LDFLAGS"]
, [ "LDFLAGS"
, { "type": "if"
, "cond": {"type": "var", "name": "LDFLAGS"}
, "then": {"type": "var", "name": "LDFLAGS"}
, "else": {"type": "CALL_EXPRESSION", "name": "base-provides-++"}
}
]
, ["provider", "ARFLAGS"]
, [ "ARFLAGS"
, { "type": "if"
, "cond": {"type": "var", "name": "ARFLAGS"}
, "then": {"type": "var", "name": "ARFLAGS"}
, "else": {"type": "CALL_EXPRESSION", "name": "base-provides-++"}
}
]
, ["provider", "AR"]
, [ "AR"
, { "type": "if"
, "cond": {"type": "var", "name": "AR"}
, "then": {"type": "var", "name": "AR"}
, "else": {"type": "CALL_EXPRESSION", "name": "base-provides"}
}
]
, ["provider", "PATH"]
, [ "PATH"
, { "type": "nub_left"
, "$1":
{ "type": "++"
, "$1":
[ {"type": "var", "name": "PATH"}
, {"type": "CALL_EXPRESSION", "name": "base-provides-++"}
]
}
}
]
, ["provider", "ENV"]
, ["default", {"type": "empty_map"}]
, ["ENV", {"type": "CALL_EXPRESSION", "name": "base-provides"}]
, ["provider", "INCLUDE_SCANNER"]
, ["default", {"type": "empty_map"}]
, [ "INCLUDE_SCANNER"
, { "type": "if"
, "cond": {"type": "FIELD", "name": "include_scanner"}
, "then":
{ "type": "let*"
, "bindings":
[ ["fieldname", "include_scanner"]
, ["transition", {"type": "CALL_EXPRESSION", "name": "for host"}]
]
, "body": {"type": "CALL_EXPRESSION", "name": "artifacts"}
}
, "else":
{ "type": "disjoint_map_union"
, "$1": {"type": "CALL_EXPRESSION", "name": "base-provides-list"}
}
}
]
, ["provider", "NON_SYSTEM_TOOLS"]
, ["default", {"type": "empty_map"}]
, [ "NON_SYSTEM_TOOLS"
, { "type": "map_union"
, "$1":
{ "type": "++"
, "$1":
[ [{"type": "CALL_EXPRESSION", "name": "base-provides"}]
, { "type": "if"
, "cond": {"type": "FIELD", "name": "CC"}
, "then":
[ { "type": "singleton_map"
, "key": "CC"
, "value":
{ "type": "if"
, "cond": {"type": "FIELD", "name": "toolchain"}
, "then": true
, "else": false
}
}
]
}
, { "type": "if"
, "cond": {"type": "FIELD", "name": "CXX"}
, "then":
[ { "type": "singleton_map"
, "key": "CXX"
, "value":
{ "type": "if"
, "cond": {"type": "FIELD", "name": "toolchain"}
, "then": true
, "else": false
}
}
]
}
, { "type": "if"
, "cond": {"type": "FIELD", "name": "AR"}
, "then":
[ { "type": "singleton_map"
, "key": "AR"
, "value":
{ "type": "if"
, "cond": {"type": "FIELD", "name": "toolchain"}
, "then": true
, "else": false
}
}
]
}
, { "type": "foreach"
, "range": {"type": "FIELD", "name": "SYSTEM_TOOLS"}
, "var": "tool"
, "body":
{ "type": "singleton_map"
, "key": {"type": "var", "name": "tool"}
, "value": false
}
}
]
}
}
]
, ["provider", "TOOLCHAIN"]
, ["default", {"type": "empty_map"}]
, [ "TOOLCHAIN"
, { "type": "disjoint_map_union"
, "msg": "toolchain artifacts may not overlap"
, "$1":
{ "type": "++"
, "$1":
[ {"type": "CALL_EXPRESSION", "name": "base-provides-list"}
, { "type": "if"
, "cond": {"type": "FIELD", "name": "toolchain"}
, "then":
{ "type": "let*"
, "bindings":
[ ["fieldname", "toolchain"]
, [ "transition"
, {"type": "CALL_EXPRESSION", "name": "for host"}
]
]
, "body":
{"type": "CALL_EXPRESSION", "name": "artifacts_list"}
}
}
]
}
}
]
, [ "CFLAGS"
, { "type": "++"
, "$1":
[ {"type": "var", "name": "CFLAGS"}
, {"type": "FIELD", "name": "ADD_COMPILE_FLAGS"}
, {"type": "FIELD", "name": "ADD_CFLAGS"}
]
}
]
, [ "CXXFLAGS"
, { "type": "++"
, "$1":
[ {"type": "var", "name": "CXXFLAGS"}
, {"type": "FIELD", "name": "ADD_COMPILE_FLAGS"}
, {"type": "FIELD", "name": "ADD_CXXFLAGS"}
]
}
]
, [ "LDFLAGS"
, { "type": "++"
, "$1":
[ {"type": "var", "name": "LDFLAGS"}
, {"type": "FIELD", "name": "ADD_LDFLAGS"}
]
}
]
, ["deps-fieldnames", ["base", "deps"]]
, ["compile-deps", {"type": "CALL_EXPRESSION", "name": "compile-deps"}]
, [ "compile-args"
, {"type": "CALL_EXPRESSION", "name": "compile-args-deps"}
]
, ["link-deps", {"type": "CALL_EXPRESSION", "name": "link-deps"}]
, ["link-args", {"type": "CALL_EXPRESSION", "name": "link-args-deps"}]
, ["run-libs", {"type": "CALL_EXPRESSION", "name": "run-libs-deps"}]
, [ "run-libs-args"
, {"type": "CALL_EXPRESSION", "name": "run-libs-args-deps"}
]
, [ "cflags-files"
, {"type": "CALL_EXPRESSION", "name": "cflags-files-deps"}
]
, [ "ldflags-files"
, {"type": "CALL_EXPRESSION", "name": "ldflags-files-deps"}
]
, ["package", {"type": "env", "vars": ["cflags-files", "ldflags-files"]}]
, [ "debug-srcs"
, { "type": "if"
, "cond": {"type": "var", "name": "DEBUG"}
, "then":
{ "type": "let*"
, "bindings": [["deps-provider", "debug-srcs"]]
, "body": {"type": "CALL_EXPRESSION", "name": "debug-deps"}
}
, "else": {"type": "empty_map"}
}
]
, [ "debug-hdrs"
, { "type": "if"
, "cond": {"type": "var", "name": "DEBUG"}
, "then":
{ "type": "map_union"
, "$1":
[ { "type": "let*"
, "bindings": [["deps-provider", "debug-hdrs"]]
, "body": {"type": "CALL_EXPRESSION", "name": "debug-deps"}
}
, {"type": "var", "name": "compile-deps"}
]
}
, "else": {"type": "empty_map"}
}
]
]
, "body":
{ "type": "RESULT"
, "provides":
{ "type": "env"
, "vars":
[ "CC"
, "CXX"
, "CFLAGS"
, "CXXFLAGS"
, "LDFLAGS"
, "AR"
, "ARFLAGS"
, "PATH"
, "ENV"
, "INCLUDE_SCANNER"
, "TOOLCHAIN"
, "NON_SYSTEM_TOOLS"
, "compile-deps"
, "compile-args"
, "link-deps"
, "link-args"
, "run-libs"
, "run-libs-args"
, "package"
, "debug-srcs"
, "debug-hdrs"
]
}
}
}
}
, "library":
{ "doc": ["A C++ library"]
, "target_fields":
[ "srcs"
, "hdrs"
, "private-hdrs"
, "deps"
, "private-deps"
, "proto"
, "private-proto"
, "components"
]
, "string_fields":
[ "name"
, "stage"
, "pure C"
, "defines"
, "private-defines"
, "cflags"
, "private-cflags"
, "ldflags"
, "private-ldflags"
, "soversion"
, "pkg-name"
]
, "config_fields": ["shared"]
, "config_vars":
[ "CC"
, "CXX"
, "CFLAGS"
, "CXXFLAGS"
, "LDFLAGS"
, "ADD_CFLAGS"
, "ADD_CXXFLAGS"
, "ADD_LDFLAGS"
, "AR"
, "ENV"
, "BUILD_POSITION_INDEPENDENT"
, "BUILD_OBJECT_ONLY"
, "BUILD_OBJECT_ONLY_DROP_OBJECT_LINKING"
, "DEBUG"
, "LINT"
]
, "implicit": {"defaults": ["defaults"]}
, "field_doc":
{ "name":
["The name of the library (without leading \"lib\" or trailing \".a\")."]
, "srcs": ["The source files of the library."]
, "hdrs": ["Any public header files of the library."]
, "private-hdrs":
[ "Any header files that only need to be present when compiling the"
, "source files, but are not needed for any consumer of the library."
]
, "components":
[ "Any other libraries that are considered part of this library;"
, "all object files of those are included unconditionally into this"
, "library."
]
, "stage":
[ "The logical location of all header and source files, as well as the"
, "resulting library file. Individual directory components are joined"
, "with \"/\"."
]
, "pure C":
[ "If non-empty, compile as C sources rather than C++ sources."
, "In particular, CC is used to compile rather than CXX (or their"
, "respective defaults)."
]
, "defines":
[ "List of defines set for this target and its consumers."
, "Each list entry will be prepended by \"-D\"."
]
, "private-defines":
[ "List of defines set for source files local to this target."
, "Each list entry will be prepended by \"-D\"."
]
, "cflags":
["List of compile flags set for this target and its consumers."]
, "private-cflags":
["List of compile flags set for source files local to this target."]
, "ldflags":
[ "Additional linker flags for linking external libraries for this"
, "target and its consumers (not built by this tool, typically system"
, "libraries)."
]
, "private-ldflags":
[ "Additional linker flags for linking external libraries (not built"
, "by this tool, typically system libraries)."
]
, "deps": ["Any other libraries this library depends upon."]
, "private-deps":
[ "Any other libraries this library depends upon but does not include"
, "in its public headers."
]
, "proto":
[ "Any [\"proto\", \"library\"] this target depends upon directly."
, "The creation of C++ bindings for this proto library as well as of"
, "its dependencies will be taken care of (as anonymous targets, so no"
, "duplicate work will be carried out, even if the same proto library"
, "is used at various places)."
]
, "private-proto":
[ "Any [\"proto\", \"library\"] this target depends upon privately."
, "The creation of C++ bindings for this proto library as well as of"
, "its dependencies will be taken care of (as anonymous targets, so no"
, "duplicate work will be carried out, even if the same proto library"
, "is used at various places)."
]
, "shared": ["If non-empty, produce a shared instead of a static library."]
, "soversion":
[ "The SOVERSION for shared libraries. Individual version components are"
, "joined with \".\"."
]
, "pkg-name":
[ "Name to use for pkg-config files. If this field is empty, the field"
, "\"name\" is used instead."
]
, "defaults": ["The C/C++ toolchain to use"]
}
, "config_doc":
{ "CC":
[ "The name of the C compiler to be used (when compiling pure C code)."
, "If None, the respective value from [\"CC\", \"defaults\"] will be taken."
]
, "CXX":
[ "The name of the C++ compiler to be used."
, "If None, the respective value from [\"CC\", \"defaults\"] will be taken."
]
, "CFLAGS":
[ "The flags for CC to be used instead of the default ones."
, "For libraries that should be built in a non-standard way; usually"
, "adapting the default target [\"CC\", \"defaults\"] is the better"
, "choice."
]
, "CXXFLAGS":
[ "The flags for CXX to be used instead of the default ones."
, "For libraries that should be built in a non-standard way; usually"
, "adapting the default target [\"CC\", \"defaults\"] is the better"
, "choice."
]
, "LDFLAGS":
[ "The linker flags to be used instead of the default ones."
, "For libraries that should be built in a non-standard way; usually"
, "adapting the default target [\"CC\", \"defaults\"] is the better"
, "choice."
]
, "ADD_CFLAGS":
[ "The flags to add to the default ones for CC."
, "For libraries that should be built in a non-standard way; usually"
, "adapting the default target [\"CC\", \"defaults\"] is the better"
, "choice."
]
, "ADD_CXXFLAGS":
[ "The flags to add to the default ones for CXX."
, "For libraries that should be built in a non-standard way; usually"
, "adapting the default target [\"CC\", \"defaults\"] is the better"
, "choice."
]
, "ADD_LDFLAGS":
[ "The linker flags to add to the default ones."
, "For libraries that should be built in a non-standard way; usually"
, "adapting the default target [\"CC\", \"defaults\"] is the better"
, "choice."
]
, "AR":
[ "The archive tool to used for creating the library"
, "If None, the respective value from [\"CC\", \"defaults\"] will be taken."
]
, "ENV": ["The environment for any action generated."]
, "BUILD_POSITION_INDEPENDENT": ["Build with -fPIC."]
, "DEBUG": ["Compute the debug-stage, needed for local debugging."]
, "BUILD_OBJECT_ONLY":
[ "If true, produce an object library, resulting in object files"
, "added to the linker line of all depending targets. If this"
, "configuration is set, the \"shared\" option is ignored. This"
, "variable is cleared for all dependencies."
]
, "BUILD_OBJECT_ONLY_DROP_OBJECT_LINKING":
[ "If true, do not include the objects in the provided \"link-args\"."
, "This allows consuming libraries that pick on the objects themselves"
, "to still forward the \"link-args\" of that library, and thus getting"
, "correct linking instructions for the resulting library."
]
, "LINT":
[ "Also provide nodes describing compile actions and header files;"
, "those can be used by lint rules (doing also the config transition)"
, "for additional checks."
]
}
, "artifacts_doc":
["The actual library (libname.a) staged in the specified directory"]
, "runfiles_doc": ["The public headers of this library"]
, "provides_doc":
{ "compile-deps":
[ "Map of artifacts specifying any additional files that, besides the runfiles,"
, "have to be present in compile actions of targets depending on this library"
]
, "link-deps":
[ "Map of artifacts specifying any additional files that, besides the artifacts,"
, "have to be present in a link actions of targets depending on this library"
]
, "link-args":
[ "List of strings that have to be added to the command line for linking actions"
, "in targets depending on this library"
]
, "debug-srcs": ["Map of all sources needed for debugging."]
, "debug-hdrs": ["Map of all additional headers needed for debugging."]
, "run-libs":
[ "Map of artifacts specifying libraries that have to be present at"
, "runtime (as well as during linking)."
]
, "run-libs-args":
[ "Additional arguments for linking that are related to the run-libs."
, "Those are added on the linker command line after the regular link-args."
]
, "package":
[ "Information related to packaging the library. This provider is a map,"
, "specifying \"name\" and \"version\" of the package, as well as"
, "additional stages \"cflags-files\" and \"ldflags-files\" for files"
, "with compile-flags or link-flags, respctively."
]
}
, "anonymous":
{ "proto-deps":
{ "target": "proto"
, "provider": "proto"
, "rule_map":
{ "library": ["./", "proto", "library"]
, "service library": ["./", "proto", "service library"]
}
}
, "private-proto-deps":
{ "target": "private-proto"
, "provider": "proto"
, "rule_map":
{ "library": ["./", "proto", "library"]
, "service library": ["./", "proto", "service library"]
}
}
}
, "imports":
{ "artifacts": ["./", "..", "field_artifacts"]
, "runfiles": ["./", "..", "field_runfiles"]
, "static result": "lib result"
, "shared result": "shared result"
, "object result": "object result"
, "fPIC transition": ["transitions", "with fPIC, not object-only"]
, "component transition": ["transitions", "with fPIC, object-only"]
}
, "config_transitions":
{ "deps": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}]
, "private-deps": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}]
, "proto-deps": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}]
, "private-proto-deps":
[{"type": "CALL_EXPRESSION", "name": "fPIC transition"}]
, "defaults": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}]
, "components":
[{"type": "CALL_EXPRESSION", "name": "component transition"}]
}
, "expression":
{ "type": "let*"
, "bindings":
[ ["name", {"type": "join", "$1": {"type": "FIELD", "name": "name"}}]
, ["pure C", {"type": "FIELD", "name": "pure C"}]
, [ "cflags"
, { "type": "++"
, "$1":
[ {"type": "FIELD", "name": "cflags"}
, { "type": "foreach"
, "var": "def"
, "range": {"type": "FIELD", "name": "defines"}
, "body":
{"type": "join", "$1": ["-D", {"type": "var", "name": "def"}]}
}
]
}
]
, [ "private-cflags"
, { "type": "++"
, "$1":
[ {"type": "FIELD", "name": "private-cflags"}
, { "type": "foreach"
, "var": "def"
, "range": {"type": "FIELD", "name": "private-defines"}
, "body":
{"type": "join", "$1": ["-D", {"type": "var", "name": "def"}]}
}
]
}
]
, [ "stage"
, { "type": "join"
, "separator": "/"
, "$1": {"type": "FIELD", "name": "stage"}
}
]
, [ "srcs"
, { "type": "to_subdir"
, "subdir": {"type": "var", "name": "stage"}
, "$1":
{ "type": "let*"
, "bindings": [["fieldname", "srcs"]]
, "body": {"type": "CALL_EXPRESSION", "name": "artifacts"}
}
}
]
, [ "hdrs"
, { "type": "to_subdir"
, "subdir": {"type": "var", "name": "stage"}
, "$1":
{ "type": "let*"
, "bindings": [["fieldname", "hdrs"]]
, "body": {"type": "CALL_EXPRESSION", "name": "artifacts"}
}
}
]
, [ "component transition"
, {"type": "CALL_EXPRESSION", "name": "component transition"}
]
, [ "component hdrs"
, { "type": "let*"
, "bindings":
[ ["fieldname", "components"]
, ["transition", {"type": "var", "name": "component transition"}]
]
, "body": {"type": "CALL_EXPRESSION", "name": "runfiles"}
}
]
, [ "hdrs"
, { "type": "disjoint_map_union"
, "msg": "Staging conflict between component and own header files"
, "$1":
[ {"type": "var", "name": "hdrs"}
, {"type": "var", "name": "component hdrs"}
]
}
]
, [ "private-hdrs"
, { "type": "to_subdir"
, "subdir": {"type": "var", "name": "stage"}
, "$1":
{ "type": "let*"
, "bindings": [["fieldname", "private-hdrs"]]
, "body": {"type": "CALL_EXPRESSION", "name": "artifacts"}
}
}
]
, ["ldflags", {"type": "FIELD", "name": "ldflags"}]
, ["private-ldflags", {"type": "FIELD", "name": "private-ldflags"}]
, ["soversion", {"type": "FIELD", "name": "soversion"}]
, [ "pkg-name"
, { "type": "if"
, "cond": {"type": "FIELD", "name": "pkg-name"}
, "then":
{"type": "join", "$1": {"type": "FIELD", "name": "pkg-name"}}
, "else": {"type": "var", "name": "name"}
}
]
, [ "defaults-transition"
, {"type": "CALL_EXPRESSION", "name": "fPIC transition"}
]
, [ "deps-transition"
, {"type": "CALL_EXPRESSION", "name": "fPIC transition"}
]
, ["public-fieldnames", ["deps", "proto-deps", "defaults"]]
, [ "private-fieldnames"
, [ "deps"
, "private-deps"
, "proto-deps"
, "private-proto-deps"
, "defaults"
, "components"
]
]
, ["component-fieldnames", ["components"]]
, [ "modified-transitions"
, { "type": "singleton_map"
, "key": "components"
, "value": {"type": "var", "name": "component transition"}
}
]
, [ "shared"
, { "type": "and"
, "$1":
[ {"type": "FIELD", "name": "shared"}
, { "type": "not"
, "$1": {"type": "var", "name": "BUILD_OBJECT_ONLY"}
}
]
}
]
]
, "body":
{ "type": "cond"
, "cond":
[ [ {"type": "var", "name": "shared"}
, {"type": "CALL_EXPRESSION", "name": "shared result"}
]
, [ {"type": "var", "name": "BUILD_OBJECT_ONLY"}
, {"type": "CALL_EXPRESSION", "name": "object result"}
]
]
, "default": {"type": "CALL_EXPRESSION", "name": "static result"}
}
}
}
, "binary":
{ "doc": ["A binary written in C++"]
, "target_fields": ["srcs", "private-hdrs", "private-deps", "private-proto"]
, "string_fields":
[ "name"
, "stage"
, "pure C"
, "private-defines"
, "private-cflags"
, "private-ldflags"
]
, "config_vars":
[ "CC"
, "CXX"
, "CFLAGS"
, "CXXFLAGS"
, "LDFLAGS"
, "ADD_CFLAGS"
, "ADD_CXXFLAGS"
, "ADD_LDFLAGS"
, "ENV"
, "BUILD_POSITION_INDEPENDENT"
, "DEBUG"
, "LINT"
]
, "implicit": {"defaults": ["defaults"]}
, "field_doc":
{ "name": ["The name of the binary"]
, "srcs": ["The source files of the library."]
, "private-hdrs":
[ "Any header files that need to be present when compiling the"
, "source files."
]
, "stage":
[ "The logical location of all header and source files, as well as the"
, "resulting binary file. Individual directory components are joined"
, "with \"/\"."
]
, "pure C":
[ "If non-empty, compile as C sources rathter than C++ sources."
, "In particular, CC is used to compile rather than CXX"
]
, "private-defines":
[ "List of defines set for source files local to this target."
, "Each list entry will be prepended by \"-D\"."
]
, "private-cflags":
["List of compile flags set for source files local to this target."]
, "private-ldflags":
["Additional linker flags for linking external libraries."]
, "private-deps": ["Any other libraries this binary depends upon."]
, "private-proto":
[ "Any [\"proto\", \"library\"] this target depends upon directly."
, "The creation of C++ bindings for this proto library as well as of"
, "is dependencies will be taken care of (as anonymous targets, so no"
, "duplicate work will be carried out, even if the same proto library"
, "is used at various places)."
]
, "defaults": ["The C/C++ toolchain to use"]
}
, "config_doc":
{ "CC":
["The name of the C compiler to be used (when compiling pure C code)"]
, "CXX": ["The name of the C++ compiler to be used."]
, "CFLAGS":
[ "The flags for CXX to be used instead of the default ones"
, "taken from the [\"CC\", \"defaults\"] target"
]
, "CXXFLAGS":
[ "The flags for CXX to be used instead of the default ones"
, "taken from the [\"CC\", \"defaults\"] target"
]
, "LDFLAGS":
[ "The linker flags do be used instead of the default ones"
, "taken from the [\"CC\", \"defaults\"] target"
]
, "ADD_CFLAGS":
[ "The flags to add to the default ones for CC"
, "taken from the [\"CC\", \"defaults\"] target"
]
, "ADD_CXXFLAGS":
[ "The flags to add to the default ones for CXX"
, "taken from the [\"CC\", \"defaults\"] target"
]
, "ADD_LDFLAGS":
[ "The linker flags to add to the default ones"
, "taken from the [\"CC\", \"defaults\"] target"
]
, "ENV": ["The environment for any action generated."]
, "BUILD_POSITION_INDEPENDENT": ["Build with -fPIC."]
, "DEBUG": ["Compute the debug-stage, needed for local debugging."]
, "LINT":
[ "Also provide nodes describing compile actions and header files;"
, "those can be used by lint rules (doing also the config transition)"
, "for additional checks."
]
}
, "artifacts_doc": ["The final binary, staged to the given directory"]
, "runfiles_doc": ["None"]
, "provides_doc":
{ "debug-srcs": ["Map of all sources needed for debugging."]
, "debug-hdrs": ["Map of all additional headers needed for debugging."]
}
, "anonymous":
{ "private-proto-deps":
{ "target": "private-proto"
, "provider": "proto"
, "rule_map":
{ "library": ["./", "proto", "library"]
, "service library": ["./", "proto", "service library"]
}
}
}
, "imports":
{"artifacts": ["./", "..", "field_artifacts"], "bin result": "bin result"}
, "expression":
{ "type": "let*"
, "bindings":
[ [ "name"
, { "type": "assert_non_empty"
, "msg": "A non-empty name has to be provided for binaries"
, "$1": {"type": "join", "$1": {"type": "FIELD", "name": "name"}}
}
]
, ["pure C", {"type": "FIELD", "name": "pure C"}]
, [ "stage"
, { "type": "join"
, "separator": "/"
, "$1": {"type": "FIELD", "name": "stage"}
}
]
, [ "srcs"
, { "type": "to_subdir"
, "subdir": {"type": "var", "name": "stage"}
, "$1":
{ "type": "let*"
, "bindings": [["fieldname", "srcs"]]
, "body": {"type": "CALL_EXPRESSION", "name": "artifacts"}
}
}
]
, [ "private-hdrs"
, { "type": "to_subdir"
, "subdir": {"type": "var", "name": "stage"}
, "$1":
{ "type": "let*"
, "bindings": [["fieldname", "private-hdrs"]]
, "body": {"type": "CALL_EXPRESSION", "name": "artifacts"}
}
}
]
, [ "private-cflags"
, { "type": "++"
, "$1":
[ { "type": "foreach"
, "var": "def"
, "range": {"type": "FIELD", "name": "private-defines"}
, "body":
{"type": "join", "$1": ["-D", {"type": "var", "name": "def"}]}
}
, {"type": "FIELD", "name": "private-cflags"}
]
}
]
, ["private-ldflags", {"type": "FIELD", "name": "private-ldflags"}]
, [ "private-fieldnames"
, ["private-deps", "private-proto-deps", "defaults"]
]
]
, "body": {"type": "CALL_EXPRESSION", "name": "bin result"}
}
}
, "install-with-deps":
{ "doc":
[ "Install target's artifacts with transitive dependencies. Depending on"
, "the target, artifacts and dependencies will be installed to"
, "subdirectories \"bin\", \"include\", and \"lib\". For library targets,"
, "a pkg-config file is generated and provided in \"lib/pkgconfig\"."
, "In debug mode, depending on the target, additional artifacts needed for"
, "local debugging are gathered and installed, depending on target, to"
, "\"work\" and \"include\"."
]
, "config_vars": ["PREFIX"]
, "target_fields": ["targets"]
, "string_fields": ["flat-libs", "prefix", "hdrs-only", "skip-debug-stage"]
, "imports": {"install result": "install-with-deps result"}
, "field_doc":
{ "targets": ["Targets to install artifacts from."]
, "flat-libs":
[ "Install libraries flat to the \"lib\" subdirectory. Be aware that"
, "conflicts may occur if any of the (transitive) libraries happen to"
, "have the same base name."
]
, "prefix":
[ "The prefix used for pkg-config files. The path will be made absolute"
, "and individual directory components are joined with \"/\". If no"
, "prefix is specified, the value from the config variable \"PREFIX\" is"
, "taken, with the default value being \"/\"."
]
, "hdrs-only": ["Only collect headers from deps (without subdirectory)."]
, "skip-debug-stage":
[ "If in debug mode, skip installing additional artifacts gathered if no"
, "local debugging is needed, but debug targets are nonetheless desired."
]
}
, "config_doc":
{ "PREFIX":
[ "The absolute path that is used as prefix inside generated pkg-config"
, "files. The default value for this variable is \"/\". This variable"
, "is ignored if the field \"prefix\" is set."
]
}
, "artifacts_doc":
["Installed artifacts in subdirectories (\"bin\"/\"include\"/\"lib\")."]
, "expression":
{ "type": "let*"
, "bindings":
[ ["pc-install-dir", "lib/pkgconfig"]
, ["targets", {"type": "FIELD", "name": "targets"}]
, [ "prefix"
, { "type": "if"
, "cond": {"type": "FIELD", "name": "prefix"}
, "then":
{ "type": "join"
, "separator": "/"
, "$1":
{"type": "++", "$1": [[""], {"type": "FIELD", "name": "prefix"}]}
}
, "else": {"type": "var", "name": "PREFIX", "default": "/"}
}
]
, ["flat-libs", {"type": "FIELD", "name": "flat-libs"}]
, ["hdrs-only", {"type": "FIELD", "name": "hdrs-only"}]
, ["skip-debug-stage", {"type": "FIELD", "name": "skip-debug-stage"}]
]
, "body": {"type": "CALL_EXPRESSION", "name": "install result"}
}
}
}
|