File scons-user.html of Package scons
x
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2
<HTML
3
><HEAD
4
><TITLE
5
>SCons User Guide 1.0.1</TITLE
6
><META
7
NAME="GENERATOR"
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD
9
><BODY
10
CLASS="book"
11
BGCOLOR="#FFFFFF"
12
TEXT="#000000"
13
LINK="#0000FF"
14
VLINK="#840084"
15
ALINK="#0000FF"
16
><DIV
17
CLASS="BOOK"
18
><A
19
NAME="AEN1"
20
></A
21
><DIV
22
CLASS="TITLEPAGE"
23
><H1
24
CLASS="title"
25
><A
26
NAME="AEN2"
27
>SCons User Guide 1.0.1</A
28
></H1
29
><H3
30
CLASS="author"
31
><A
32
NAME="AEN4"
33
></A
34
>Steven Knight</H3
35
><P
36
CLASS="copyright"
37
>Copyright © 2004, 2005, 2006, 2007, 2008 Steven Knight</P
38
><DIV
39
CLASS="legalnotice"
40
><P
41
></P
42
><A
43
NAME="AEN12"
44
></A
45
><A
46
NAME="AEN13"
47
></A
48
><BLOCKQUOTE
49
CLASS="BLOCKQUOTE"
50
><P
51
>
52
SCons User's Guide Copyright (c) 2004, 2005, 2006, 2007 Steven Knight
53
54
</P
55
></BLOCKQUOTE
56
><P
57
></P
58
></DIV
59
><HR></DIV
60
><DIV
61
CLASS="TOC"
62
><DL
63
><DT
64
><B
65
>Table of Contents</B
66
></DT
67
><DT
68
><A
69
HREF="#chap-preface"
70
>Preface</A
71
></DT
72
><DD
73
><DL
74
><DT
75
>1. <A
76
HREF="#AEN29"
77
><SPAN
78
CLASS="application"
79
>SCons</SPAN
80
> Principles</A
81
></DT
82
><DT
83
>2. <A
84
HREF="#AEN54"
85
>A Caveat About This Guide's Completeness</A
86
></DT
87
><DT
88
>3. <A
89
HREF="#AEN62"
90
>Acknowledgements</A
91
></DT
92
><DT
93
>4. <A
94
HREF="#AEN83"
95
>Contact</A
96
></DT
97
></DL
98
></DD
99
><DT
100
>1. <A
101
HREF="#chap-build-install"
102
>Building and Installing <SPAN
103
CLASS="application"
104
>SCons</SPAN
105
></A
106
></DT
107
><DD
108
><DL
109
><DT
110
>1.1. <A
111
HREF="#AEN102"
112
>Installing Python</A
113
></DT
114
><DT
115
>1.2. <A
116
HREF="#AEN124"
117
>Installing <SPAN
118
CLASS="application"
119
>SCons</SPAN
120
> From Pre-Built Packages</A
121
></DT
122
><DD
123
><DL
124
><DT
125
>1.2.1. <A
126
HREF="#AEN129"
127
>Installing <SPAN
128
CLASS="application"
129
>SCons</SPAN
130
> on Red Hat (and Other RPM-based) Linux Systems</A
131
></DT
132
><DT
133
>1.2.2. <A
134
HREF="#AEN149"
135
>Installing <SPAN
136
CLASS="application"
137
>SCons</SPAN
138
> on Debian Linux Systems</A
139
></DT
140
><DT
141
>1.2.3. <A
142
HREF="#AEN157"
143
>Installing <SPAN
144
CLASS="application"
145
>SCons</SPAN
146
> on Windows Systems</A
147
></DT
148
></DL
149
></DD
150
><DT
151
>1.3. <A
152
HREF="#AEN166"
153
>Building and Installing <SPAN
154
CLASS="application"
155
>SCons</SPAN
156
> on Any System</A
157
></DT
158
><DD
159
><DL
160
><DT
161
>1.3.1. <A
162
HREF="#AEN194"
163
>Building and Installing Multiple Versions of <SPAN
164
CLASS="application"
165
>SCons</SPAN
166
> Side-by-Side</A
167
></DT
168
><DT
169
>1.3.2. <A
170
HREF="#AEN218"
171
>Installing <SPAN
172
CLASS="application"
173
>SCons</SPAN
174
> in Other Locations</A
175
></DT
176
><DT
177
>1.3.3. <A
178
HREF="#AEN236"
179
>Building and Installing <SPAN
180
CLASS="application"
181
>SCons</SPAN
182
> Without Administrative Privileges</A
183
></DT
184
></DL
185
></DD
186
></DL
187
></DD
188
><DT
189
>2. <A
190
HREF="#chap-simple"
191
>Simple Builds</A
192
></DT
193
><DD
194
><DL
195
><DT
196
>2.1. <A
197
HREF="#AEN256"
198
>Building Simple C / C++ Programs</A
199
></DT
200
><DT
201
>2.2. <A
202
HREF="#AEN288"
203
>Building Object Files</A
204
></DT
205
><DT
206
>2.3. <A
207
HREF="#AEN307"
208
>Simple Java Builds</A
209
></DT
210
><DT
211
>2.4. <A
212
HREF="#AEN328"
213
>Cleaning Up After a Build</A
214
></DT
215
><DT
216
>2.5. <A
217
HREF="#AEN348"
218
>The <TT
219
CLASS="filename"
220
>SConstruct</TT
221
> File</A
222
></DT
223
><DD
224
><DL
225
><DT
226
>2.5.1. <A
227
HREF="#AEN358"
228
><TT
229
CLASS="filename"
230
>SConstruct</TT
231
> Files Are Python Scripts</A
232
></DT
233
><DT
234
>2.5.2. <A
235
HREF="#AEN370"
236
><SPAN
237
CLASS="application"
238
>SCons</SPAN
239
> Functions Are Order-Independent</A
240
></DT
241
></DL
242
></DD
243
><DT
244
>2.6. <A
245
HREF="#AEN420"
246
>Making the <SPAN
247
CLASS="application"
248
>SCons</SPAN
249
> Output Less Verbose</A
250
></DT
251
></DL
252
></DD
253
><DT
254
>3. <A
255
HREF="#chap-less-simple"
256
>Less Simple Things to Do With Builds</A
257
></DT
258
><DD
259
><DL
260
><DT
261
>3.1. <A
262
HREF="#AEN443"
263
>Specifying the Name of the Target (Output) File</A
264
></DT
265
><DT
266
>3.2. <A
267
HREF="#AEN467"
268
>Compiling Multiple Source Files</A
269
></DT
270
><DT
271
>3.3. <A
272
HREF="#AEN489"
273
>Making a list of files with <CODE
274
CLASS="function"
275
>Glob</CODE
276
></A
277
></DT
278
><DT
279
>3.4. <A
280
HREF="#AEN508"
281
>Specifying Single Files Vs. Lists of Files</A
282
></DT
283
><DT
284
>3.5. <A
285
HREF="#AEN526"
286
>Making Lists of Files Easier to Read</A
287
></DT
288
><DT
289
>3.6. <A
290
HREF="#AEN552"
291
>Keyword Arguments</A
292
></DT
293
><DT
294
>3.7. <A
295
HREF="#AEN563"
296
>Compiling Multiple Programs</A
297
></DT
298
><DT
299
>3.8. <A
300
HREF="#AEN577"
301
>Sharing Source Files Between Multiple Programs</A
302
></DT
303
></DL
304
></DD
305
><DT
306
>4. <A
307
HREF="#chap-libraries"
308
>Building and Linking with Libraries</A
309
></DT
310
><DD
311
><DL
312
><DT
313
>4.1. <A
314
HREF="#AEN597"
315
>Building Libraries</A
316
></DT
317
><DD
318
><DL
319
><DT
320
>4.1.1. <A
321
HREF="#AEN616"
322
>Building Libraries From Source Code or Object Files</A
323
></DT
324
><DT
325
>4.1.2. <A
326
HREF="#AEN627"
327
>Building Static Libraries Explicitly: the <CODE
328
CLASS="function"
329
>StaticLibrary</CODE
330
> Builder</A
331
></DT
332
><DT
333
>4.1.3. <A
334
HREF="#AEN641"
335
>Building Shared (DLL) Libraries: the <CODE
336
CLASS="function"
337
>SharedLibrary</CODE
338
> Builder</A
339
></DT
340
></DL
341
></DD
342
><DT
343
>4.2. <A
344
HREF="#AEN658"
345
>Linking with Libraries</A
346
></DT
347
><DT
348
>4.3. <A
349
HREF="#AEN685"
350
>Finding Libraries: the <CODE
351
CLASS="envar"
352
>$LIBPATH</CODE
353
> Construction Variable</A
354
></DT
355
></DL
356
></DD
357
><DT
358
>5. <A
359
HREF="#chap-nodes"
360
>Node Objects</A
361
></DT
362
><DD
363
><DL
364
><DT
365
>5.1. <A
366
HREF="#AEN716"
367
>Builder Methods Return Lists of Target Nodes</A
368
></DT
369
><DT
370
>5.2. <A
371
HREF="#AEN747"
372
>Explicitly Creating File and Directory Nodes</A
373
></DT
374
><DT
375
>5.3. <A
376
HREF="#AEN767"
377
>Printing <CODE
378
CLASS="classname"
379
>Node</CODE
380
> File Names</A
381
></DT
382
><DT
383
>5.4. <A
384
HREF="#AEN779"
385
>Using a <CODE
386
CLASS="classname"
387
>Node</CODE
388
>'s File Name as a String</A
389
></DT
390
></DL
391
></DD
392
><DT
393
>6. <A
394
HREF="#chap-depends"
395
>Dependencies</A
396
></DT
397
><DD
398
><DL
399
><DT
400
>6.1. <A
401
HREF="#AEN815"
402
>Deciding When an Input File Has Changed: the <CODE
403
CLASS="function"
404
>Decider</CODE
405
> Function</A
406
></DT
407
><DD
408
><DL
409
><DT
410
>6.1.1. <A
411
HREF="#AEN823"
412
>Using MD5 Signatures to Decide if a File Has Changed</A
413
></DT
414
><DT
415
>6.1.2. <A
416
HREF="#AEN866"
417
>Using Time Stamps to Decide If a File Has Changed</A
418
></DT
419
><DT
420
>6.1.3. <A
421
HREF="#AEN912"
422
>Deciding If a File Has Changed Using Both MD Signatures and Time Stamps</A
423
></DT
424
><DT
425
>6.1.4. <A
426
HREF="#AEN937"
427
>Writing Your Own Custom <CODE
428
CLASS="function"
429
>Decider</CODE
430
> Function</A
431
></DT
432
><DT
433
>6.1.5. <A
434
HREF="#AEN977"
435
>Mixing Different Ways of Deciding If a File Has Changed</A
436
></DT
437
></DL
438
></DD
439
><DT
440
>6.2. <A
441
HREF="#AEN994"
442
>Older Functions for Deciding When an Input File Has Changed</A
443
></DT
444
><DD
445
><DL
446
><DT
447
>6.2.1. <A
448
HREF="#AEN999"
449
>The <CODE
450
CLASS="function"
451
>SourceSignatures</CODE
452
> Function</A
453
></DT
454
><DT
455
>6.2.2. <A
456
HREF="#AEN1011"
457
>The <CODE
458
CLASS="function"
459
>TargetSignatures</CODE
460
> Function</A
461
></DT
462
></DL
463
></DD
464
><DT
465
>6.3. <A
466
HREF="#AEN1056"
467
>Implicit Dependencies: The <CODE
468
CLASS="envar"
469
>$CPPPATH</CODE
470
> Construction Variable</A
471
></DT
472
><DT
473
>6.4. <A
474
HREF="#AEN1115"
475
>Caching Implicit Dependencies</A
476
></DT
477
><DD
478
><DL
479
><DT
480
>6.4.1. <A
481
HREF="#AEN1154"
482
>The <TT
483
CLASS="literal"
484
>--implicit-deps-changed</TT
485
> Option</A
486
></DT
487
><DT
488
>6.4.2. <A
489
HREF="#AEN1166"
490
>The <TT
491
CLASS="literal"
492
>--implicit-deps-unchanged</TT
493
> Option</A
494
></DT
495
></DL
496
></DD
497
><DT
498
>6.5. <A
499
HREF="#AEN1179"
500
>Explicit Dependencies: the <CODE
501
CLASS="function"
502
>Depends</CODE
503
> Function</A
504
></DT
505
><DT
506
>6.6. <A
507
HREF="#AEN1198"
508
>Dependencies From External Files: the <CODE
509
CLASS="function"
510
>ParseDepends</CODE
511
>
512
Function</A
513
></DT
514
><DT
515
>6.7. <A
516
HREF="#AEN1234"
517
>Ignoring Dependencies: the <CODE
518
CLASS="function"
519
>Ignore</CODE
520
> Function</A
521
></DT
522
><DT
523
>6.8. <A
524
HREF="#AEN1261"
525
>Order-Only Dependencies: the <CODE
526
CLASS="function"
527
>Requires</CODE
528
> Function</A
529
></DT
530
><DT
531
>6.9. <A
532
HREF="#AEN1312"
533
>The <CODE
534
CLASS="function"
535
>AlwaysBuild</CODE
536
> Function</A
537
></DT
538
></DL
539
></DD
540
><DT
541
>7. <A
542
HREF="#chap-environments"
543
>Environments</A
544
></DT
545
><DD
546
><DL
547
><DT
548
>7.1. <A
549
HREF="#sect-external-environments"
550
>Using Values From the External Environment</A
551
></DT
552
><DT
553
>7.2. <A
554
HREF="#sect-construction-environments"
555
>Construction Environments</A
556
></DT
557
><DD
558
><DL
559
><DT
560
>7.2.1. <A
561
HREF="#AEN1400"
562
>Creating a <TT
563
CLASS="literal"
564
>Construction Environment</TT
565
>: the <CODE
566
CLASS="function"
567
>Environment</CODE
568
> Function</A
569
></DT
570
><DT
571
>7.2.2. <A
572
HREF="#AEN1423"
573
>Fetching Values From a <TT
574
CLASS="literal"
575
>Construction Environment</TT
576
></A
577
></DT
578
><DT
579
>7.2.3. <A
580
HREF="#AEN1446"
581
>Expanding Values From a <TT
582
CLASS="literal"
583
>Construction Environment</TT
584
>: the <CODE
585
CLASS="function"
586
>subst</CODE
587
> Method</A
588
></DT
589
><DT
590
>7.2.4. <A
591
HREF="#AEN1479"
592
>Controlling the Default <TT
593
CLASS="literal"
594
>Construction Environment</TT
595
>: the <CODE
596
CLASS="function"
597
>DefaultEnvironment</CODE
598
> Function</A
599
></DT
600
><DT
601
>7.2.5. <A
602
HREF="#AEN1510"
603
>Multiple <TT
604
CLASS="literal"
605
>Construction Environments</TT
606
></A
607
></DT
608
><DT
609
>7.2.6. <A
610
HREF="#AEN1550"
611
>Making Copies of <TT
612
CLASS="literal"
613
>Construction Environments</TT
614
>: the <CODE
615
CLASS="function"
616
>Clone</CODE
617
> Method</A
618
></DT
619
><DT
620
>7.2.7. <A
621
HREF="#AEN1571"
622
>Replacing Values: the <CODE
623
CLASS="function"
624
>Replace</CODE
625
> Method</A
626
></DT
627
><DT
628
>7.2.8. <A
629
HREF="#AEN1603"
630
>Setting Values Only If They're Not Already Defined: the <CODE
631
CLASS="function"
632
>SetDefault</CODE
633
> Method</A
634
></DT
635
><DT
636
>7.2.9. <A
637
HREF="#AEN1612"
638
>Appending to the End of Values: the <CODE
639
CLASS="function"
640
>Append</CODE
641
> Method</A
642
></DT
643
><DT
644
>7.2.10. <A
645
HREF="#AEN1632"
646
>Appending Unique Values: the <CODE
647
CLASS="function"
648
>AppendUnique</CODE
649
> Method</A
650
></DT
651
><DT
652
>7.2.11. <A
653
HREF="#AEN1642"
654
>Appending to the Beginning of Values: the <CODE
655
CLASS="function"
656
>Prepend</CODE
657
> Method</A
658
></DT
659
><DT
660
>7.2.12. <A
661
HREF="#AEN1663"
662
>Prepending Unique Values: the <CODE
663
CLASS="function"
664
>PrependUnique</CODE
665
> Method</A
666
></DT
667
></DL
668
></DD
669
><DT
670
>7.3. <A
671
HREF="#sect-execution-environments"
672
>Controlling the Execution Environment for Issued Commands</A
673
></DT
674
><DD
675
><DL
676
><DT
677
>7.3.1. <A
678
HREF="#AEN1704"
679
>Propagating <CODE
680
CLASS="varname"
681
>PATH</CODE
682
> From the External Environment</A
683
></DT
684
><DT
685
>7.3.2. <A
686
HREF="#AEN1723"
687
>Adding to <CODE
688
CLASS="varname"
689
>PATH</CODE
690
> Values in the Execution Environment</A
691
></DT
692
></DL
693
></DD
694
></DL
695
></DD
696
><DT
697
>8. <A
698
HREF="#chap-mergeflags"
699
>Merging Options into the Environment: the <CODE
700
CLASS="function"
701
>MergeFlags</CODE
702
> Function</A
703
></DT
704
><DT
705
>9. <A
706
HREF="#chap-parseflags"
707
>Separating Compile Arguments into their Variables: the <CODE
708
CLASS="function"
709
>ParseFlags</CODE
710
> Function</A
711
></DT
712
><DT
713
>10. <A
714
HREF="#chap-parseconfig"
715
>Finding Installed Library Information: the <CODE
716
CLASS="function"
717
>ParseConfig</CODE
718
> Function</A
719
></DT
720
><DT
721
>11. <A
722
HREF="#chap-output"
723
>Controlling Build Output</A
724
></DT
725
><DD
726
><DL
727
><DT
728
>11.1. <A
729
HREF="#AEN1846"
730
>Providing Build Help: the <CODE
731
CLASS="function"
732
>Help</CODE
733
> Function</A
734
></DT
735
><DT
736
>11.2. <A
737
HREF="#AEN1884"
738
>Controlling How <SPAN
739
CLASS="application"
740
>SCons</SPAN
741
> Prints Build Commands: the <CODE
742
CLASS="envar"
743
>$*COMSTR</CODE
744
> Variables</A
745
></DT
746
><DT
747
>11.3. <A
748
HREF="#AEN1921"
749
>Providing Build Progress Output: the <CODE
750
CLASS="function"
751
>Progress</CODE
752
> Function</A
753
></DT
754
><DT
755
>11.4. <A
756
HREF="#AEN1977"
757
>Printing Detailed Build Status: the <CODE
758
CLASS="function"
759
>GetBuildFailures</CODE
760
> Function</A
761
></DT
762
></DL
763
></DD
764
><DT
765
>12. <A
766
HREF="#chap-command-line"
767
>Controlling a Build From the Command Line</A
768
></DT
769
><DD
770
><DL
771
><DT
772
>12.1. <A
773
HREF="#sect-command-line-options"
774
>Command-Line Options</A
775
></DT
776
><DD
777
><DL
778
><DT
779
>12.1.1. <A
780
HREF="#AEN2048"
781
>Not Having to Specify Command-Line Options Each Time: the <CODE
782
CLASS="varname"
783
>SCONSFLAGS</CODE
784
> Environment Variable</A
785
></DT
786
><DT
787
>12.1.2. <A
788
HREF="#AEN2074"
789
>Getting Values Set by Command-Line Options: the <CODE
790
CLASS="function"
791
>GetOption</CODE
792
> Function</A
793
></DT
794
><DT
795
>12.1.3. <A
796
HREF="#AEN2099"
797
>Setting Values of Command-Line Options: the <CODE
798
CLASS="function"
799
>SetOption</CODE
800
> Function</A
801
></DT
802
><DT
803
>12.1.4. <A
804
HREF="#sect-command-line-option-strings"
805
>Strings for Getting or Setting Values of <SPAN
806
CLASS="application"
807
>SCons</SPAN
808
> Command-Line Options</A
809
></DT
810
><DT
811
>12.1.5. <A
812
HREF="#AEN2327"
813
>Adding Custom Command-Line Options: the <CODE
814
CLASS="function"
815
>AddOption</CODE
816
> Function</A
817
></DT
818
></DL
819
></DD
820
><DT
821
>12.2. <A
822
HREF="#sect-command-line-variables"
823
>Command-Line <CODE
824
CLASS="varname"
825
>variable</CODE
826
>=<CODE
827
CLASS="varname"
828
>value</CODE
829
> Build Variables</A
830
></DT
831
><DD
832
><DL
833
><DT
834
>12.2.1. <A
835
HREF="#AEN2420"
836
>Controlling Command-Line Build Variables</A
837
></DT
838
><DT
839
>12.2.2. <A
840
HREF="#AEN2456"
841
>Providing Help for Command-Line Build Variables</A
842
></DT
843
><DT
844
>12.2.3. <A
845
HREF="#AEN2471"
846
>Reading Build Variables From a File</A
847
></DT
848
><DT
849
>12.2.4. <A
850
HREF="#AEN2491"
851
>Pre-Defined Build Variable Functions</A
852
></DT
853
><DT
854
>12.2.5. <A
855
HREF="#AEN2677"
856
>Adding Multiple Command-Line Build Variables at Once</A
857
></DT
858
><DT
859
>12.2.6. <A
860
HREF="#AEN2687"
861
>Handling Unknown Command-Line Build Variables: the <CODE
862
CLASS="function"
863
>UnknownVariables</CODE
864
> Function</A
865
></DT
866
></DL
867
></DD
868
><DT
869
>12.3. <A
870
HREF="#sect-command-line-targets"
871
>Command-Line Targets</A
872
></DT
873
><DD
874
><DL
875
><DT
876
>12.3.1. <A
877
HREF="#AEN2722"
878
>Fetching Command-Line Targets: the <CODE
879
CLASS="varname"
880
>COMMAND_LINE_TARGETS</CODE
881
> Variable</A
882
></DT
883
><DT
884
>12.3.2. <A
885
HREF="#AEN2739"
886
>Controlling the Default Targets: the <CODE
887
CLASS="function"
888
>Default</CODE
889
> Function</A
890
></DT
891
><DT
892
>12.3.3. <A
893
HREF="#AEN2822"
894
>Fetching the List of Build Targets, Regardless of Origin: the <CODE
895
CLASS="varname"
896
>BUILD_TARGETS</CODE
897
> Variable</A
898
></DT
899
></DL
900
></DD
901
></DL
902
></DD
903
><DT
904
>13. <A
905
HREF="#chap-install"
906
>Installing Files in Other Directories: the <CODE
907
CLASS="function"
908
>Install</CODE
909
> Builder</A
910
></DT
911
><DD
912
><DL
913
><DT
914
>13.1. <A
915
HREF="#AEN2869"
916
>Installing Multiple Files in a Directory</A
917
></DT
918
><DT
919
>13.2. <A
920
HREF="#AEN2879"
921
>Installing a File Under a Different Name</A
922
></DT
923
><DT
924
>13.3. <A
925
HREF="#AEN2890"
926
>Installing Multiple Files Under Different Names</A
927
></DT
928
></DL
929
></DD
930
><DT
931
>14. <A
932
HREF="#chap-factories"
933
>Platform-Independent File System Manipulation</A
934
></DT
935
><DD
936
><DL
937
><DT
938
>14.1. <A
939
HREF="#AEN2906"
940
>Copying Files or Directories: The <CODE
941
CLASS="function"
942
>Copy</CODE
943
> Factory</A
944
></DT
945
><DT
946
>14.2. <A
947
HREF="#AEN2940"
948
>Deleting Files or Directories: The <CODE
949
CLASS="function"
950
>Delete</CODE
951
> Factory</A
952
></DT
953
><DT
954
>14.3. <A
955
HREF="#AEN2969"
956
>Moving (Renaming) Files or Directories: The <CODE
957
CLASS="function"
958
>Move</CODE
959
> Factory</A
960
></DT
961
><DT
962
>14.4. <A
963
HREF="#AEN2978"
964
>Updating the Modification Time of a File: The <CODE
965
CLASS="function"
966
>Touch</CODE
967
> Factory</A
968
></DT
969
><DT
970
>14.5. <A
971
HREF="#AEN2987"
972
>Creating a Directory: The <CODE
973
CLASS="function"
974
>Mkdir</CODE
975
> Factory</A
976
></DT
977
><DT
978
>14.6. <A
979
HREF="#AEN2996"
980
>Changing File or Directory Permissions: The <CODE
981
CLASS="function"
982
>Chmod</CODE
983
> Factory</A
984
></DT
985
><DT
986
>14.7. <A
987
HREF="#AEN3005"
988
>Executing an action immediately: the <CODE
989
CLASS="function"
990
>Execute</CODE
991
> Function</A
992
></DT
993
></DL
994
></DD
995
><DT
996
>15. <A
997
HREF="#chap-file-removal"
998
>Controlling Removal of Targets</A
999
></DT
1000
><DD
1001
><DL
1002
><DT
1003
>15.1. <A
1004
HREF="#AEN3044"
1005
>Preventing target removal during build: the <CODE
1006
CLASS="function"
1007
>Precious</CODE
1008
> Function</A
1009
></DT
1010
><DT
1011
>15.2. <A
1012
HREF="#AEN3060"
1013
>Preventing target removal during clean: the <CODE
1014
CLASS="function"
1015
>NoClean</CODE
1016
> Function</A
1017
></DT
1018
><DT
1019
>15.3. <A
1020
HREF="#AEN3074"
1021
>Removing additional files during clean: the <CODE
1022
CLASS="function"
1023
>Clean</CODE
1024
> Function</A
1025
></DT
1026
></DL
1027
></DD
1028
><DT
1029
>16. <A
1030
HREF="#chap-hierarchical"
1031
>Hierarchical Builds</A
1032
></DT
1033
><DD
1034
><DL
1035
><DT
1036
>16.1. <A
1037
HREF="#AEN3101"
1038
><TT
1039
CLASS="filename"
1040
>SConscript</TT
1041
> Files</A
1042
></DT
1043
><DT
1044
>16.2. <A
1045
HREF="#AEN3129"
1046
>Path Names Are Relative to the <TT
1047
CLASS="filename"
1048
>SConscript</TT
1049
> Directory</A
1050
></DT
1051
><DT
1052
>16.3. <A
1053
HREF="#AEN3155"
1054
>Top-Level Path Names in Subsidiary <TT
1055
CLASS="filename"
1056
>SConscript</TT
1057
> Files</A
1058
></DT
1059
><DT
1060
>16.4. <A
1061
HREF="#AEN3176"
1062
>Absolute Path Names</A
1063
></DT
1064
><DT
1065
>16.5. <A
1066
HREF="#AEN3186"
1067
>Sharing Environments (and Other Variables) Between <TT
1068
CLASS="filename"
1069
>SConscript</TT
1070
> Files</A
1071
></DT
1072
><DD
1073
><DL
1074
><DT
1075
>16.5.1. <A
1076
HREF="#AEN3198"
1077
>Exporting Variables</A
1078
></DT
1079
><DT
1080
>16.5.2. <A
1081
HREF="#AEN3226"
1082
>Importing Variables</A
1083
></DT
1084
><DT
1085
>16.5.3. <A
1086
HREF="#AEN3249"
1087
>Returning Values From an <TT
1088
CLASS="filename"
1089
>SConscript</TT
1090
> File</A
1091
></DT
1092
></DL
1093
></DD
1094
></DL
1095
></DD
1096
><DT
1097
>17. <A
1098
HREF="#chap-separate"
1099
>Separating Source and Build Directories</A
1100
></DT
1101
><DD
1102
><DL
1103
><DT
1104
>17.1. <A
1105
HREF="#AEN3283"
1106
>Specifying a Variant Directory Tree as Part of an <TT
1107
CLASS="filename"
1108
>SConscript</TT
1109
> Call</A
1110
></DT
1111
><DT
1112
>17.2. <A
1113
HREF="#AEN3313"
1114
>Why <SPAN
1115
CLASS="application"
1116
>SCons</SPAN
1117
> Duplicates Source Files in a Variant Directory Tree</A
1118
></DT
1119
><DT
1120
>17.3. <A
1121
HREF="#AEN3330"
1122
>Telling <SPAN
1123
CLASS="application"
1124
>SCons</SPAN
1125
> to Not Duplicate Source Files in the Variant Directory Tree</A
1126
></DT
1127
><DT
1128
>17.4. <A
1129
HREF="#AEN3346"
1130
>The <CODE
1131
CLASS="function"
1132
>VariantDir</CODE
1133
> Function</A
1134
></DT
1135
><DT
1136
>17.5. <A
1137
HREF="#AEN3375"
1138
>Using <CODE
1139
CLASS="function"
1140
>VariantDir</CODE
1141
> With an <TT
1142
CLASS="filename"
1143
>SConscript</TT
1144
> File</A
1145
></DT
1146
><DT
1147
>17.6. <A
1148
HREF="#AEN3394"
1149
>Using <CODE
1150
CLASS="function"
1151
>Glob</CODE
1152
> with <CODE
1153
CLASS="function"
1154
>VariantDir</CODE
1155
></A
1156
></DT
1157
></DL
1158
></DD
1159
><DT
1160
>18. <A
1161
HREF="#chap-variants"
1162
>Variant Builds</A
1163
></DT
1164
><DT
1165
>19. <A
1166
HREF="#chap-builders-writing"
1167
>Writing Your Own Builders</A
1168
></DT
1169
><DD
1170
><DL
1171
><DT
1172
>19.1. <A
1173
HREF="#AEN3438"
1174
>Writing Builders That Execute External Commands</A
1175
></DT
1176
><DT
1177
>19.2. <A
1178
HREF="#AEN3447"
1179
>Attaching a Builder to a <TT
1180
CLASS="literal"
1181
>Construction Environment</TT
1182
></A
1183
></DT
1184
><DT
1185
>19.3. <A
1186
HREF="#AEN3503"
1187
>Letting <SPAN
1188
CLASS="application"
1189
>SCons</SPAN
1190
> Handle The File Suffixes</A
1191
></DT
1192
><DT
1193
>19.4. <A
1194
HREF="#AEN3524"
1195
>Builders That Execute Python Functions</A
1196
></DT
1197
><DT
1198
>19.5. <A
1199
HREF="#AEN3560"
1200
>Builders That Create Actions Using a <TT
1201
CLASS="literal"
1202
>Generator</TT
1203
></A
1204
></DT
1205
><DT
1206
>19.6. <A
1207
HREF="#AEN3603"
1208
>Builders That Modify the Target or Source Lists Using an <TT
1209
CLASS="literal"
1210
>Emitter</TT
1211
></A
1212
></DT
1213
><DT
1214
>19.7. <A
1215
HREF="#AEN3627"
1216
>Where To Put Your Custom Builders and Tools</A
1217
></DT
1218
></DL
1219
></DD
1220
><DT
1221
>20. <A
1222
HREF="#chap-builders-commands"
1223
>Not Writing a Builder: the <CODE
1224
CLASS="function"
1225
>Command</CODE
1226
> Builder</A
1227
></DT
1228
><DT
1229
>21. <A
1230
HREF="#chap-add-method"
1231
>Pseudo-Builders: the AddMethod function</A
1232
></DT
1233
><DT
1234
>22. <A
1235
HREF="#chap-scanners"
1236
>Writing Scanners</A
1237
></DT
1238
><DD
1239
><DL
1240
><DT
1241
>22.1. <A
1242
HREF="#AEN3743"
1243
>A Simple Scanner Example</A
1244
></DT
1245
></DL
1246
></DD
1247
><DT
1248
>23. <A
1249
HREF="#chap-repositories"
1250
>Building From Code Repositories</A
1251
></DT
1252
><DD
1253
><DL
1254
><DT
1255
>23.1. <A
1256
HREF="#AEN3794"
1257
>The <CODE
1258
CLASS="function"
1259
>Repository</CODE
1260
> Method</A
1261
></DT
1262
><DT
1263
>23.2. <A
1264
HREF="#AEN3805"
1265
>Finding source files in repositories</A
1266
></DT
1267
><DT
1268
>23.3. <A
1269
HREF="#AEN3837"
1270
>Finding <TT
1271
CLASS="literal"
1272
>#include</TT
1273
> files in repositories</A
1274
></DT
1275
><DD
1276
><DL
1277
><DT
1278
>23.3.1. <A
1279
HREF="#AEN3878"
1280
>Limitations on <TT
1281
CLASS="literal"
1282
>#include</TT
1283
> files in repositories</A
1284
></DT
1285
></DL
1286
></DD
1287
><DT
1288
>23.4. <A
1289
HREF="#AEN3919"
1290
>Finding the <TT
1291
CLASS="filename"
1292
>SConstruct</TT
1293
> file in repositories</A
1294
></DT
1295
><DT
1296
>23.5. <A
1297
HREF="#AEN3937"
1298
>Finding derived files in repositories</A
1299
></DT
1300
><DT
1301
>23.6. <A
1302
HREF="#AEN3966"
1303
>Guaranteeing local copies of files</A
1304
></DT
1305
></DL
1306
></DD
1307
><DT
1308
>24. <A
1309
HREF="#chap-sconf"
1310
>Multi-Platform Configuration (<SPAN
1311
CLASS="application"
1312
>Autoconf</SPAN
1313
> Functionality)</A
1314
></DT
1315
><DD
1316
><DL
1317
><DT
1318
>24.1. <A
1319
HREF="#AEN4000"
1320
><TT
1321
CLASS="literal"
1322
>Configure Contexts</TT
1323
></A
1324
></DT
1325
><DT
1326
>24.2. <A
1327
HREF="#AEN4016"
1328
>Checking for the Existence of Header Files</A
1329
></DT
1330
><DT
1331
>24.3. <A
1332
HREF="#AEN4025"
1333
>Checking for the Availability of a Function</A
1334
></DT
1335
><DT
1336
>24.4. <A
1337
HREF="#AEN4030"
1338
>Checking for the Availability of a Library</A
1339
></DT
1340
><DT
1341
>24.5. <A
1342
HREF="#AEN4045"
1343
>Checking for the Availability of a <TT
1344
CLASS="literal"
1345
>typedef</TT
1346
></A
1347
></DT
1348
><DT
1349
>24.6. <A
1350
HREF="#AEN4056"
1351
>Adding Your Own Custom Checks</A
1352
></DT
1353
><DT
1354
>24.7. <A
1355
HREF="#AEN4085"
1356
>Not Configuring When Cleaning Targets</A
1357
></DT
1358
></DL
1359
></DD
1360
><DT
1361
>25. <A
1362
HREF="#chap-caching"
1363
>Caching Built Files</A
1364
></DT
1365
><DD
1366
><DL
1367
><DT
1368
>25.1. <A
1369
HREF="#AEN4101"
1370
>Specifying the Shared Cache Directory</A
1371
></DT
1372
><DT
1373
>25.2. <A
1374
HREF="#AEN4123"
1375
>Keeping Build Output Consistent</A
1376
></DT
1377
><DT
1378
>25.3. <A
1379
HREF="#AEN4137"
1380
>Not Using the Shared Cache for Specific Files</A
1381
></DT
1382
><DT
1383
>25.4. <A
1384
HREF="#AEN4148"
1385
>Disabling the Shared Cache</A
1386
></DT
1387
><DT
1388
>25.5. <A
1389
HREF="#AEN4160"
1390
>Populating a Shared Cache With Already-Built Files</A
1391
></DT
1392
><DT
1393
>25.6. <A
1394
HREF="#AEN4177"
1395
>Minimizing Cache Contention: the <TT
1396
CLASS="literal"
1397
>--random</TT
1398
> Option</A
1399
></DT
1400
></DL
1401
></DD
1402
><DT
1403
>26. <A
1404
HREF="#chap-alias"
1405
>Alias Targets</A
1406
></DT
1407
><DT
1408
>27. <A
1409
HREF="#chap-java"
1410
>Java Builds</A
1411
></DT
1412
><DD
1413
><DL
1414
><DT
1415
>27.1. <A
1416
HREF="#AEN4237"
1417
>Building Java Class Files: the <CODE
1418
CLASS="function"
1419
>Java</CODE
1420
> Builder</A
1421
></DT
1422
><DT
1423
>27.2. <A
1424
HREF="#AEN4261"
1425
>How <SPAN
1426
CLASS="application"
1427
>SCons</SPAN
1428
> Handles Java Dependencies</A
1429
></DT
1430
><DT
1431
>27.3. <A
1432
HREF="#AEN4288"
1433
>Building Java Archive (<TT
1434
CLASS="filename"
1435
>.jar</TT
1436
>) Files: the <CODE
1437
CLASS="function"
1438
>Jar</CODE
1439
> Builder</A
1440
></DT
1441
><DT
1442
>27.4. <A
1443
HREF="#AEN4319"
1444
>Building C Header and Stub Files: the <CODE
1445
CLASS="function"
1446
>JavaH</CODE
1447
> Builder</A
1448
></DT
1449
><DT
1450
>27.5. <A
1451
HREF="#AEN4373"
1452
>Building RMI Stub and Skeleton Class Files: the <CODE
1453
CLASS="function"
1454
>RMIC</CODE
1455
> Builder</A
1456
></DT
1457
></DL
1458
></DD
1459
><DT
1460
>28. <A
1461
HREF="#chap-misc"
1462
>Miscellaneous Functionality</A
1463
></DT
1464
><DD
1465
><DL
1466
><DT
1467
>28.1. <A
1468
HREF="#AEN4401"
1469
>Verifying the Python Version: the <CODE
1470
CLASS="function"
1471
>EnsurePythonVersion</CODE
1472
> Function</A
1473
></DT
1474
><DT
1475
>28.2. <A
1476
HREF="#AEN4417"
1477
>Verifying the SCons Version: the <CODE
1478
CLASS="function"
1479
>EnsureSConsVersion</CODE
1480
> Function</A
1481
></DT
1482
><DT
1483
>28.3. <A
1484
HREF="#AEN4437"
1485
>Explicitly Terminating <SPAN
1486
CLASS="application"
1487
>SCons</SPAN
1488
> While Reading <TT
1489
CLASS="filename"
1490
>SConscript</TT
1491
> Files: the <CODE
1492
CLASS="function"
1493
>Exit</CODE
1494
> Function</A
1495
></DT
1496
><DT
1497
>28.4. <A
1498
HREF="#AEN4461"
1499
>Searching for Files: the <CODE
1500
CLASS="function"
1501
>FindFile</CODE
1502
> Function</A
1503
></DT
1504
><DT
1505
>28.5. <A
1506
HREF="#AEN4490"
1507
>Handling Nested Lists: the <CODE
1508
CLASS="function"
1509
>Flatten</CODE
1510
> Function</A
1511
></DT
1512
><DT
1513
>28.6. <A
1514
HREF="#AEN4517"
1515
>Finding the Invocation Directory: the <CODE
1516
CLASS="function"
1517
>GetLaunchDir</CODE
1518
> Function</A
1519
></DT
1520
></DL
1521
></DD
1522
><DT
1523
>29. <A
1524
HREF="#chap-troubleshooting"
1525
>Troubleshooting</A
1526
></DT
1527
><DD
1528
><DL
1529
><DT
1530
>29.1. <A
1531
HREF="#AEN4543"
1532
>Why is That Target Being Rebuilt? the <TT
1533
CLASS="literal"
1534
>--debug=explain</TT
1535
> Option</A
1536
></DT
1537
><DT
1538
>29.2. <A
1539
HREF="#AEN4593"
1540
>What's in That Construction Environment? the <CODE
1541
CLASS="function"
1542
>Dump</CODE
1543
> Method</A
1544
></DT
1545
><DT
1546
>29.3. <A
1547
HREF="#AEN4619"
1548
>What Dependencies Does <SPAN
1549
CLASS="application"
1550
>SCons</SPAN
1551
> Know About? the <TT
1552
CLASS="literal"
1553
>--tree</TT
1554
> Option</A
1555
></DT
1556
><DT
1557
>29.4. <A
1558
HREF="#AEN4689"
1559
>How is <SPAN
1560
CLASS="application"
1561
>SCons</SPAN
1562
> Constructing the Command Lines It Executes? the <TT
1563
CLASS="literal"
1564
>--debug=presub</TT
1565
> Option</A
1566
></DT
1567
><DT
1568
>29.5. <A
1569
HREF="#AEN4698"
1570
>Where is <SPAN
1571
CLASS="application"
1572
>SCons</SPAN
1573
> Searching for Libraries? the <TT
1574
CLASS="literal"
1575
>--debug=findlibs</TT
1576
> Option</A
1577
></DT
1578
><DT
1579
>29.6. <A
1580
HREF="#AEN4715"
1581
>Where is <SPAN
1582
CLASS="application"
1583
>SCons</SPAN
1584
> Blowing Up? the <TT
1585
CLASS="literal"
1586
>--debug=stacktrace</TT
1587
> Option</A
1588
></DT
1589
><DT
1590
>29.7. <A
1591
HREF="#AEN4736"
1592
>How is <SPAN
1593
CLASS="application"
1594
>SCons</SPAN
1595
> Making Its Decisions? the <TT
1596
CLASS="literal"
1597
>--taskmastertrace</TT
1598
> Option</A
1599
></DT
1600
></DL
1601
></DD
1602
><DT
1603
>A. <A
1604
HREF="#app-variables"
1605
>Construction Variables</A
1606
></DT
1607
><DT
1608
>B. <A
1609
HREF="#app-builders"
1610
>Builders</A
1611
></DT
1612
><DT
1613
>C. <A
1614
HREF="#app-tools"
1615
>Tools</A
1616
></DT
1617
><DT
1618
>D. <A
1619
HREF="#app-tasks"
1620
>Handling Common Tasks</A
1621
></DT
1622
></DL
1623
></DIV
1624
><DIV
1625
CLASS="LOT"
1626
><DL
1627
CLASS="LOT"
1628
><DT
1629
><B
1630
>List of Examples</B
1631
></DT
1632
><DT
1633
>D-1. <A
1634
HREF="#AEN10745"
1635
>Wildcard globbing to create a list of filenames</A
1636
></DT
1637
><DT
1638
>D-2. <A
1639
HREF="#AEN10748"
1640
>Filename extension substitution</A
1641
></DT
1642
><DT
1643
>D-3. <A
1644
HREF="#AEN10751"
1645
>Appending a path prefix to a list of filenames</A
1646
></DT
1647
><DT
1648
>D-4. <A
1649
HREF="#AEN10756"
1650
>Substituting a path prefix with another one</A
1651
></DT
1652
><DT
1653
>D-5. <A
1654
HREF="#AEN10761"
1655
>Filtering a filename list to exclude/retain only a specific set
1656
of extensions</A
1657
></DT
1658
><DT
1659
>D-6. <A
1660
HREF="#AEN10766"
1661
>The "backtick function": run a shell command and capture the
1662
output</A
1663
></DT
1664
></DL
1665
></DIV
1666
><DIV
1667
CLASS="preface"
1668
><HR><H1
1669
><A
1670
NAME="chap-preface"
1671
></A
1672
>Preface</H1
1673
><P
1674
>
1675
Thank you for taking the time to read about <SPAN
1676
CLASS="application"
1677
>SCons</SPAN
1678
>.
1679
<SPAN
1680
CLASS="application"
1681
>SCons</SPAN
1682
> is a next-generation
1683
software construction tool,
1684
or make tool--that is, a software utility
1685
for building software (or other files)
1686
and keeping built software up-to-date
1687
whenever the underlying input files change.
1688
1689
</P
1690
><P
1691
>
1692
The most distinctive thing about <SPAN
1693
CLASS="application"
1694
>SCons</SPAN
1695
>
1696
is that its configuration files are
1697
actually <SPAN
1698
CLASS="emphasis"
1699
><I
1700
CLASS="emphasis"
1701
>scripts</I
1702
></SPAN
1703
>,
1704
written in the <SPAN
1705
CLASS="application"
1706
>Python</SPAN
1707
> programming language.
1708
This is in contrast to most alternative build tools,
1709
which typically invent a new language to
1710
configure the build.
1711
<SPAN
1712
CLASS="application"
1713
>SCons</SPAN
1714
> still has a learning curve, of course,
1715
because you have to know what functions to call
1716
to set up your build properly,
1717
but the underlying syntax used should be familiar
1718
to anyone who has ever looked at a Python script.
1719
1720
</P
1721
><P
1722
>
1723
Paradoxically,
1724
using Python as the configuration file format
1725
makes <SPAN
1726
CLASS="application"
1727
>SCons</SPAN
1728
>
1729
<SPAN
1730
CLASS="emphasis"
1731
><I
1732
CLASS="emphasis"
1733
>easier</I
1734
></SPAN
1735
>
1736
for non-programmers to learn
1737
than the cryptic languages of other build tools,
1738
which are usually invented by programmers for other programmers.
1739
This is in no small part due to the
1740
consistency and readability that are built in to Python.
1741
It just so happens that making a real, live
1742
scripting language the basis for the
1743
configuration files
1744
makes it a snap for more accomplished programmers
1745
to do more complicated things with builds,
1746
as necessary.
1747
1748
</P
1749
><DIV
1750
CLASS="section"
1751
><HR><H2
1752
CLASS="section"
1753
><A
1754
NAME="AEN29"
1755
>1. <SPAN
1756
CLASS="application"
1757
>SCons</SPAN
1758
> Principles</A
1759
></H2
1760
><P
1761
>
1762
There are a few overriding principles
1763
we try to live up to in designing and implementing <SPAN
1764
CLASS="application"
1765
>SCons</SPAN
1766
>:
1767
1768
</P
1769
><P
1770
></P
1771
><DIV
1772
CLASS="variablelist"
1773
><DL
1774
><DT
1775
>Correctness</DT
1776
><DD
1777
><P
1778
>
1779
First and foremost,
1780
by default, <SPAN
1781
CLASS="application"
1782
>SCons</SPAN
1783
> guarantees a correct build
1784
even if it means sacrificing performance a little.
1785
We strive to guarantee the build is correct
1786
regardless of how the software being built is structured,
1787
how it may have been written,
1788
or how unusual the tools are that build it.
1789
1790
</P
1791
></DD
1792
><DT
1793
>Performance</DT
1794
><DD
1795
><P
1796
>
1797
Given that the build is correct,
1798
we try to make <SPAN
1799
CLASS="application"
1800
>SCons</SPAN
1801
> build software
1802
as quickly as possible.
1803
In particular, wherever we may have needed to slow
1804
down the default <SPAN
1805
CLASS="application"
1806
>SCons</SPAN
1807
> behavior to guarantee a correct build,
1808
we also try to make it easy to speed up <SPAN
1809
CLASS="application"
1810
>SCons</SPAN
1811
>
1812
through optimization options that let you trade off
1813
guaranteed correctness in all end cases for
1814
a speedier build in the usual cases.
1815
1816
</P
1817
></DD
1818
><DT
1819
>Convenience</DT
1820
><DD
1821
><P
1822
>
1823
<SPAN
1824
CLASS="application"
1825
>SCons</SPAN
1826
> tries to do as much for you out of the box as reasonable,
1827
including detecting the right tools on your system
1828
and using them correctly to build the software.
1829
1830
</P
1831
></DD
1832
></DL
1833
></DIV
1834
><P
1835
>
1836
In a nutshell, we try hard to make <SPAN
1837
CLASS="application"
1838
>SCons</SPAN
1839
> just
1840
"do the right thing" and build software correctly,
1841
with a minimum of hassles.
1842
1843
</P
1844
></DIV
1845
><DIV
1846
CLASS="section"
1847
><HR><H2
1848
CLASS="section"
1849
><A
1850
NAME="AEN54"
1851
>2. A Caveat About This Guide's Completeness</A
1852
></H2
1853
><P
1854
>
1855
One word of warning as you read through this Guide:
1856
Like too much Open Source software out there,
1857
the <SPAN
1858
CLASS="application"
1859
>SCons</SPAN
1860
> documentation isn't always
1861
kept up-to-date with the available features.
1862
In other words,
1863
there's a lot that <SPAN
1864
CLASS="application"
1865
>SCons</SPAN
1866
> can do that
1867
isn't yet covered in this User's Guide.
1868
(Come to think of it,
1869
that also describes a lot of proprietary software, doesn't it?)
1870
1871
</P
1872
><P
1873
>
1874
Although this User's Guide isn't as complete as we'd like it to be,
1875
our development process does emphasize
1876
making sure that the <SPAN
1877
CLASS="application"
1878
>SCons</SPAN
1879
> man page is kept up-to-date
1880
with new features.
1881
So if you're trying to figure out how to do something
1882
that <SPAN
1883
CLASS="application"
1884
>SCons</SPAN
1885
> supports
1886
but can't find enough (or any) information here,
1887
it would be worth your while to look
1888
at the man page to see if the information is covered there.
1889
And if you do,
1890
maybe you'd even consider contributing
1891
a section to the User's Guide
1892
so the next person looking for
1893
that information won't have to
1894
go through the same thing...?
1895
1896
</P
1897
></DIV
1898
><DIV
1899
CLASS="section"
1900
><HR><H2
1901
CLASS="section"
1902
><A
1903
NAME="AEN62"
1904
>3. Acknowledgements</A
1905
></H2
1906
><P
1907
>
1908
<SPAN
1909
CLASS="application"
1910
>SCons</SPAN
1911
> would not exist without a lot of help
1912
from a lot of people,
1913
many of whom may not even be aware
1914
that they helped or served as inspiration.
1915
So in no particular order,
1916
and at the risk of leaving out someone:
1917
1918
</P
1919
><P
1920
>
1921
First and foremost,
1922
<SPAN
1923
CLASS="application"
1924
>SCons</SPAN
1925
> owes a tremendous debt to Bob Sidebotham,
1926
the original author of the classic Perl-based <SPAN
1927
CLASS="application"
1928
>Cons</SPAN
1929
> tool
1930
which Bob first released to the world back around 1996.
1931
Bob's work on Cons classic provided the underlying architecture
1932
and model of specifying a build configuration
1933
using a real scripting language.
1934
My real-world experience working on Cons
1935
informed many of the design decisions in SCons,
1936
including the improved parallel build support,
1937
making Builder objects easily definable by users,
1938
and separating the build engine from the wrapping interface.
1939
1940
</P
1941
><P
1942
>
1943
Greg Wilson was instrumental in getting
1944
<SPAN
1945
CLASS="application"
1946
>SCons</SPAN
1947
> started as a real project
1948
when he initiated the Software Carpentry design
1949
competition in February 2000.
1950
Without that nudge,
1951
marrying the advantages of the Cons classic
1952
architecture with the readability of Python
1953
might have just stayed no more than a nice idea.
1954
1955
</P
1956
><P
1957
>
1958
The entire <SPAN
1959
CLASS="application"
1960
>SCons</SPAN
1961
> team have been
1962
absolutely wonderful to work with,
1963
and <SPAN
1964
CLASS="application"
1965
>SCons</SPAN
1966
> would be nowhere near as useful a
1967
tool without the energy, enthusiasm
1968
and time people have contributed over the past few years.
1969
The "core team"
1970
of Chad Austin, Anthony Roach,
1971
Bill Deegan, Charles Crain, Steve Leblanc, Greg Noel,
1972
Gary Oberbrunner, Greg Spencer and Christoph Wiedemann
1973
have been great about reviewing my (and other) changes
1974
and catching problems before they get in the code base.
1975
Of particular technical note:
1976
Anthony's outstanding and innovative work on the tasking engine
1977
has given <SPAN
1978
CLASS="application"
1979
>SCons</SPAN
1980
> a vastly superior parallel build model;
1981
Charles has been the master of the crucial Node infrastructure;
1982
Christoph's work on the Configure infrastructure
1983
has added crucial Autoconf-like functionality;
1984
and Greg has provided excellent support
1985
for Microsoft Visual Studio.
1986
1987
</P
1988
><P
1989
>
1990
Special thanks to David Snopek for contributing
1991
his underlying "Autoscons" code that formed
1992
the basis of Christoph's work with the Configure functionality.
1993
David was extremely generous in making
1994
this code available to <SPAN
1995
CLASS="application"
1996
>SCons</SPAN
1997
>,
1998
given that he initially released it under the GPL
1999
and <SPAN
2000
CLASS="application"
2001
>SCons</SPAN
2002
> is released under a less-restrictive MIT-style license.
2003
2004
</P
2005
><P
2006
>
2007
Thanks to Peter Miller
2008
for his splendid change management system, <SPAN
2009
CLASS="application"
2010
>Aegis</SPAN
2011
>,
2012
which has provided the <SPAN
2013
CLASS="application"
2014
>SCons</SPAN
2015
> project
2016
with a robust development methodology from day one,
2017
and which showed me how you could
2018
integrate incremental regression tests into
2019
a practical development cycle
2020
(years before eXtreme Programming arrived on the scene).
2021
2022
</P
2023
><P
2024
>
2025
And last, thanks to Guido van Rossum
2026
for his elegant scripting language,
2027
which is the basis not only for the <SPAN
2028
CLASS="application"
2029
>SCons</SPAN
2030
> implementation,
2031
but for the interface itself.
2032
2033
</P
2034
></DIV
2035
><DIV
2036
CLASS="section"
2037
><HR><H2
2038
CLASS="section"
2039
><A
2040
NAME="AEN83"
2041
>4. Contact</A
2042
></H2
2043
><P
2044
>
2045
The best way to contact people involved with SCons,
2046
including the author,
2047
is through the SCons mailing lists.
2048
2049
</P
2050
><P
2051
>
2052
If you want to ask general questions about how to use <SPAN
2053
CLASS="application"
2054
>SCons</SPAN
2055
>
2056
send email to <TT
2057
CLASS="literal"
2058
>users@scons.tigris.org</TT
2059
>.
2060
2061
</P
2062
><P
2063
>
2064
If you want to contact the <SPAN
2065
CLASS="application"
2066
>SCons</SPAN
2067
> development community directly,
2068
send email to <TT
2069
CLASS="literal"
2070
>dev@scons.tigris.org</TT
2071
>.
2072
2073
</P
2074
><P
2075
>
2076
If you want to receive announcements about <SPAN
2077
CLASS="application"
2078
>SCons</SPAN
2079
>,
2080
join the low-volume <TT
2081
CLASS="literal"
2082
>announce@scons.tigris.org</TT
2083
> mailing list.
2084
2085
</P
2086
></DIV
2087
></DIV
2088
><DIV
2089
CLASS="chapter"
2090
><HR><H1
2091
><A
2092
NAME="chap-build-install"
2093
></A
2094
>Chapter 1. Building and Installing <SPAN
2095
CLASS="application"
2096
>SCons</SPAN
2097
></H1
2098
><P
2099
>
2100
This chapter will take you through the basic steps
2101
of installing <SPAN
2102
CLASS="application"
2103
>SCons</SPAN
2104
> on your system,
2105
and building <SPAN
2106
CLASS="application"
2107
>SCons</SPAN
2108
> if you don't have a
2109
pre-built package available
2110
(or simply prefer the flexibility of building it yourself).
2111
Before that, however, this chapter will also describe the basic steps
2112
involved in installing Python on your system,
2113
in case that is necessary.
2114
Fortunately, both <SPAN
2115
CLASS="application"
2116
>SCons</SPAN
2117
> and Python
2118
are very easy to install on almost any system,
2119
and Python already comes installed on many systems.
2120
2121
</P
2122
><DIV
2123
CLASS="section"
2124
><HR><H2
2125
CLASS="section"
2126
><A
2127
NAME="AEN102"
2128
>1.1. Installing Python</A
2129
></H2
2130
><P
2131
>
2132
Because <SPAN
2133
CLASS="application"
2134
>SCons</SPAN
2135
> is written in Python,
2136
you must obviously have Python installed on your system
2137
to use <SPAN
2138
CLASS="application"
2139
>SCons</SPAN
2140
>.
2141
Before you try to install Python,
2142
you should check to see if Python is already
2143
available on your system by typing
2144
<KBD
2145
CLASS="userinput"
2146
>python -V</KBD
2147
>
2148
(capital 'V')
2149
or
2150
<KBD
2151
CLASS="userinput"
2152
>python --version</KBD
2153
>
2154
at your system's command-line prompt.
2155
2156
</P
2157
><PRE
2158
CLASS="screen"
2159
> $ <KBD
2160
CLASS="userinput"
2161
>python -V</KBD
2162
>
2163
Python 2.5.1
2164
</PRE
2165
><P
2166
>
2167
And on a Windows system with Python installed:
2168
2169
</P
2170
><PRE
2171
CLASS="screen"
2172
> C:\><KBD
2173
CLASS="userinput"
2174
>python -V</KBD
2175
>
2176
Python 2.5.1
2177
</PRE
2178
><P
2179
>
2180
If Python is not installed on your system,
2181
you will see an error message
2182
stating something like "command not found"
2183
(on UNIX or Linux)
2184
or "'python' is not recognized
2185
as an internal or external command, operable progam or batch file"
2186
(on Windows).
2187
In that case, you need to install Python
2188
before you can install <SPAN
2189
CLASS="application"
2190
>SCons</SPAN
2191
>.
2192
2193
</P
2194
><P
2195
>
2196
(Note that the <CODE
2197
CLASS="option"
2198
>-V</CODE
2199
> option
2200
was added to Python version 2.0,
2201
so if your system only has an earlier version available
2202
you may see an
2203
<TT
2204
CLASS="literal"
2205
>"Unknown option: -V"</TT
2206
>
2207
error message.)
2208
2209
</P
2210
><P
2211
>
2212
The standard location for information
2213
about downloading and installing Python is
2214
<A
2215
HREF="http://www.python.org/download/"
2216
TARGET="_top"
2217
>http://www.python.org/download/</A
2218
>.
2219
See that page for information about
2220
how to download and install Python on your system.
2221
2222
</P
2223
><P
2224
>
2225
<SPAN
2226
CLASS="application"
2227
>SCons</SPAN
2228
> will work with any version of Python from 1.5.2 or later.
2229
If you need to install Python and have a choice,
2230
we recommend using the most recent Python 2.5 version available.
2231
Python 2.5 has significant improvements
2232
the help speed up the performance of <SPAN
2233
CLASS="application"
2234
>SCons</SPAN
2235
>'.
2236
2237
</P
2238
></DIV
2239
><DIV
2240
CLASS="section"
2241
><HR><H2
2242
CLASS="section"
2243
><A
2244
NAME="AEN124"
2245
>1.2. Installing <SPAN
2246
CLASS="application"
2247
>SCons</SPAN
2248
> From Pre-Built Packages</A
2249
></H2
2250
><P
2251
>
2252
<SPAN
2253
CLASS="application"
2254
>SCons</SPAN
2255
> comes pre-packaged for installation on a number of systems,
2256
including Linux and Windows systems.
2257
You do not need to read this entire section,
2258
you should only need to read the section
2259
appropriate to the type of system you're running on.
2260
2261
</P
2262
><DIV
2263
CLASS="section"
2264
><HR><H3
2265
CLASS="section"
2266
><A
2267
NAME="AEN129"
2268
>1.2.1. Installing <SPAN
2269
CLASS="application"
2270
>SCons</SPAN
2271
> on Red Hat (and Other RPM-based) Linux Systems</A
2272
></H3
2273
><P
2274
>
2275
<SPAN
2276
CLASS="application"
2277
>SCons</SPAN
2278
> comes in RPM (Red Hat Package Manager) format,
2279
pre-built and ready to install on Red Hat Linux,
2280
Fedora Core,
2281
or any other Linux distribution that uses RPM.
2282
Your distribution may
2283
already have an <SPAN
2284
CLASS="application"
2285
>SCons</SPAN
2286
> RPM built specifically for it;
2287
many do, including SuSe, Mandrake and Fedora.
2288
You can check for the availability of an <SPAN
2289
CLASS="application"
2290
>SCons</SPAN
2291
> RPM
2292
on your distribution's download servers,
2293
or by consulting an RPM search site like
2294
<A
2295
HREF="http://www.rpmfind.net/"
2296
TARGET="_top"
2297
>http://www.rpmfind.net/</A
2298
> or
2299
<A
2300
HREF="http://rpm.pbone.net/"
2301
TARGET="_top"
2302
>http://rpm.pbone.net/</A
2303
>.
2304
2305
</P
2306
><P
2307
>
2308
If your Linux distribution does not already have
2309
a specific <SPAN
2310
CLASS="application"
2311
>SCons</SPAN
2312
> RPM file,
2313
you can download and install from the
2314
generic RPM provided by the <SPAN
2315
CLASS="application"
2316
>SCons</SPAN
2317
> project.
2318
This will install the
2319
SCons script(s) in <TT
2320
CLASS="filename"
2321
>/usr/bin</TT
2322
>,
2323
and the SCons library modules in
2324
<TT
2325
CLASS="filename"
2326
>/usr/lib/scons</TT
2327
>.
2328
2329
</P
2330
><P
2331
>
2332
To install from the command line, simply download the
2333
appropriate <TT
2334
CLASS="filename"
2335
>.rpm</TT
2336
> file,
2337
and then run:
2338
2339
</P
2340
><PRE
2341
CLASS="screen"
2342
> # <KBD
2343
CLASS="userinput"
2344
>rpm -Uvh scons-0.96-1.noarch.rpm</KBD
2345
>
2346
</PRE
2347
><P
2348
>
2349
Or, you can use a graphical RPM package manager
2350
like <SPAN
2351
CLASS="application"
2352
>gnorpm</SPAN
2353
>.
2354
See your package manager application's documention
2355
for specific instructions about
2356
how to use it to install a downloaded RPM.
2357
2358
</P
2359
></DIV
2360
><DIV
2361
CLASS="section"
2362
><HR><H3
2363
CLASS="section"
2364
><A
2365
NAME="AEN149"
2366
>1.2.2. Installing <SPAN
2367
CLASS="application"
2368
>SCons</SPAN
2369
> on Debian Linux Systems</A
2370
></H3
2371
><P
2372
>
2373
Debian Linux systems use a different package management
2374
format that also makes it very easy to install <SPAN
2375
CLASS="application"
2376
>SCons</SPAN
2377
>.
2378
2379
</P
2380
><P
2381
>
2382
If your system is connected to the Internet,
2383
you can install the latest official Debian package
2384
by running:
2385
2386
</P
2387
><PRE
2388
CLASS="screen"
2389
> # <KBD
2390
CLASS="userinput"
2391
>apt-get install scons</KBD
2392
>
2393
</PRE
2394
></DIV
2395
><DIV
2396
CLASS="section"
2397
><HR><H3
2398
CLASS="section"
2399
><A
2400
NAME="AEN157"
2401
>1.2.3. Installing <SPAN
2402
CLASS="application"
2403
>SCons</SPAN
2404
> on Windows Systems</A
2405
></H3
2406
><P
2407
>
2408
<SPAN
2409
CLASS="application"
2410
>SCons</SPAN
2411
> provides a Windows installer
2412
that makes installation extremely easy.
2413
Download the <TT
2414
CLASS="filename"
2415
>scons-0.95.win32.exe</TT
2416
>
2417
file from the <SPAN
2418
CLASS="application"
2419
>SCons</SPAN
2420
> download page at
2421
<A
2422
HREF="http://www.scons.org/download.html"
2423
TARGET="_top"
2424
>http://www.scons.org/download.html</A
2425
>.
2426
Then all you need to do is execute the file
2427
(usually by clicking on its icon in Windows Explorer).
2428
These will take you through a small
2429
sequence of windows that will install
2430
<SPAN
2431
CLASS="application"
2432
>SCons</SPAN
2433
> on your system.
2434
2435
2436
2437
</P
2438
></DIV
2439
></DIV
2440
><DIV
2441
CLASS="section"
2442
><HR><H2
2443
CLASS="section"
2444
><A
2445
NAME="AEN166"
2446
>1.3. Building and Installing <SPAN
2447
CLASS="application"
2448
>SCons</SPAN
2449
> on Any System</A
2450
></H2
2451
><P
2452
>
2453
If a pre-built <SPAN
2454
CLASS="application"
2455
>SCons</SPAN
2456
> package is not available for your system,
2457
then you can still easily build and install <SPAN
2458
CLASS="application"
2459
>SCons</SPAN
2460
> using the native
2461
Python <TT
2462
CLASS="filename"
2463
>distutils</TT
2464
> package.
2465
2466
</P
2467
><P
2468
>
2469
The first step is to download either the
2470
<TT
2471
CLASS="filename"
2472
>scons-1.0.1.tar.gz</TT
2473
>
2474
or <TT
2475
CLASS="filename"
2476
>scons-1.0.1.zip</TT
2477
>,
2478
which are available from the SCons download page at
2479
<A
2480
HREF="http://www.scons.org/download.html"
2481
TARGET="_top"
2482
>http://www.scons.org/download.html</A
2483
>.
2484
2485
</P
2486
><P
2487
>
2488
Unpack the archive you downloaded,
2489
using a utility like <SPAN
2490
CLASS="application"
2491
>tar</SPAN
2492
>
2493
on Linux or UNIX,
2494
or <SPAN
2495
CLASS="application"
2496
>WinZip</SPAN
2497
> on Windows.
2498
This will create a directory called
2499
<TT
2500
CLASS="filename"
2501
>scons-1.0.1</TT
2502
>,
2503
usually in your local directory.
2504
Then change your working directory to that directory
2505
and install <SPAN
2506
CLASS="application"
2507
>SCons</SPAN
2508
> by executing the following commands:
2509
2510
</P
2511
><PRE
2512
CLASS="screen"
2513
> # <KBD
2514
CLASS="userinput"
2515
>cd scons-1.0.1</KBD
2516
>
2517
# <KBD
2518
CLASS="userinput"
2519
>python setup.py install</KBD
2520
>
2521
</PRE
2522
><P
2523
>
2524
This will build <SPAN
2525
CLASS="application"
2526
>SCons</SPAN
2527
>,
2528
install the <SPAN
2529
CLASS="application"
2530
>scons</SPAN
2531
> script
2532
in the default system scripts directory
2533
(<TT
2534
CLASS="filename"
2535
>/usr/local/bin</TT
2536
> or
2537
<TT
2538
CLASS="filename"
2539
>C:\Python25\Scripts</TT
2540
>),
2541
and will install the <SPAN
2542
CLASS="application"
2543
>SCons</SPAN
2544
> build engine
2545
in an appropriate stand-alone library directory
2546
(<TT
2547
CLASS="filename"
2548
>/usr/local/lib/scons</TT
2549
> or
2550
<TT
2551
CLASS="filename"
2552
>C:\Python25\scons</TT
2553
>).
2554
Because these are system directories,
2555
you may need root (on Linux or UNIX) or Administrator (on Windows)
2556
privileges to install <SPAN
2557
CLASS="application"
2558
>SCons</SPAN
2559
> like this.
2560
2561
</P
2562
><DIV
2563
CLASS="section"
2564
><HR><H3
2565
CLASS="section"
2566
><A
2567
NAME="AEN194"
2568
>1.3.1. Building and Installing Multiple Versions of <SPAN
2569
CLASS="application"
2570
>SCons</SPAN
2571
> Side-by-Side</A
2572
></H3
2573
><P
2574
>
2575
The <SPAN
2576
CLASS="application"
2577
>SCons</SPAN
2578
> <TT
2579
CLASS="filename"
2580
>setup.py</TT
2581
> script
2582
has some extensions that support
2583
easy installation of multiple versions of <SPAN
2584
CLASS="application"
2585
>SCons</SPAN
2586
>
2587
in side-by-side locations.
2588
This makes it easier to download and
2589
experiment with different versions of <SPAN
2590
CLASS="application"
2591
>SCons</SPAN
2592
>
2593
before moving your official build process to a new version,
2594
for example.
2595
2596
</P
2597
><P
2598
>
2599
To install <SPAN
2600
CLASS="application"
2601
>SCons</SPAN
2602
> in a version-specific location,
2603
add the <CODE
2604
CLASS="option"
2605
>--version-lib</CODE
2606
> option
2607
when you call <TT
2608
CLASS="filename"
2609
>setup.py</TT
2610
>:
2611
2612
</P
2613
><PRE
2614
CLASS="screen"
2615
> # <KBD
2616
CLASS="userinput"
2617
>python setup.py install --version-lib</KBD
2618
>
2619
</PRE
2620
><P
2621
>
2622
This will install the <SPAN
2623
CLASS="application"
2624
>SCons</SPAN
2625
> build engine
2626
in the
2627
<TT
2628
CLASS="filename"
2629
>/usr/lib/scons-1.0.1</TT
2630
>
2631
or
2632
<TT
2633
CLASS="filename"
2634
>C:\Python25\scons-1.0.1</TT
2635
>
2636
directory, for example.
2637
2638
</P
2639
><P
2640
>
2641
If you use the <CODE
2642
CLASS="option"
2643
>--version-lib</CODE
2644
> option
2645
the first time you install <SPAN
2646
CLASS="application"
2647
>SCons</SPAN
2648
>,
2649
you do not need to specify it each time you install
2650
a new version.
2651
The <SPAN
2652
CLASS="application"
2653
>SCons</SPAN
2654
> <TT
2655
CLASS="filename"
2656
>setup.py</TT
2657
> script
2658
will detect the version-specific directory name(s)
2659
and assume you want to install all versions
2660
in version-specific directories.
2661
You can override that assumption in the future
2662
by explicitly specifying the <CODE
2663
CLASS="option"
2664
>--standalone-lib</CODE
2665
> option.
2666
2667
</P
2668
></DIV
2669
><DIV
2670
CLASS="section"
2671
><HR><H3
2672
CLASS="section"
2673
><A
2674
NAME="AEN218"
2675
>1.3.2. Installing <SPAN
2676
CLASS="application"
2677
>SCons</SPAN
2678
> in Other Locations</A
2679
></H3
2680
><P
2681
>
2682
You can install <SPAN
2683
CLASS="application"
2684
>SCons</SPAN
2685
> in locations other than
2686
the default by specifying the <CODE
2687
CLASS="option"
2688
>--prefix=</CODE
2689
> option:
2690
2691
</P
2692
><PRE
2693
CLASS="screen"
2694
> # <KBD
2695
CLASS="userinput"
2696
>python setup.py install --prefix=/opt/scons</KBD
2697
>
2698
</PRE
2699
><P
2700
>
2701
This would
2702
install the <SPAN
2703
CLASS="application"
2704
>scons</SPAN
2705
> script in
2706
<TT
2707
CLASS="filename"
2708
>/opt/scons/bin</TT
2709
>
2710
and the build engine in
2711
<TT
2712
CLASS="filename"
2713
>/opt/scons/lib/scons</TT
2714
>,
2715
2716
</P
2717
><P
2718
>
2719
Note that you can specify both the <CODE
2720
CLASS="option"
2721
>--prefix=</CODE
2722
>
2723
and the <CODE
2724
CLASS="option"
2725
>--version-lib</CODE
2726
> options
2727
at the same type,
2728
in which case <TT
2729
CLASS="filename"
2730
>setup.py</TT
2731
>
2732
will install the build engine
2733
in a version-specific directory
2734
relative to the specified prefix.
2735
Adding <CODE
2736
CLASS="option"
2737
>--version-lib</CODE
2738
> to the
2739
above example would install the build engine in
2740
<TT
2741
CLASS="filename"
2742
>/opt/scons/lib/scons-1.0.1</TT
2743
>.
2744
2745
</P
2746
></DIV
2747
><DIV
2748
CLASS="section"
2749
><HR><H3
2750
CLASS="section"
2751
><A
2752
NAME="AEN236"
2753
>1.3.3. Building and Installing <SPAN
2754
CLASS="application"
2755
>SCons</SPAN
2756
> Without Administrative Privileges</A
2757
></H3
2758
><P
2759
>
2760
If you don't have the right privileges to install <SPAN
2761
CLASS="application"
2762
>SCons</SPAN
2763
>
2764
in a system location,
2765
simply use the <TT
2766
CLASS="literal"
2767
>--prefix=</TT
2768
> option
2769
to install it in a location of your choosing.
2770
For example,
2771
to install <SPAN
2772
CLASS="application"
2773
>SCons</SPAN
2774
> in appropriate locations
2775
relative to the user's <TT
2776
CLASS="literal"
2777
>$HOME</TT
2778
> directory,
2779
the <SPAN
2780
CLASS="application"
2781
>scons</SPAN
2782
> script in
2783
<TT
2784
CLASS="filename"
2785
>$HOME/bin</TT
2786
>
2787
and the build engine in
2788
<TT
2789
CLASS="filename"
2790
>$HOME/lib/scons</TT
2791
>,
2792
simply type:
2793
2794
</P
2795
><PRE
2796
CLASS="screen"
2797
> $ <KBD
2798
CLASS="userinput"
2799
>python setup.py install --prefix=$HOME</KBD
2800
>
2801
</PRE
2802
><P
2803
>
2804
You may, of course, specify any other location you prefer,
2805
and may use the <CODE
2806
CLASS="option"
2807
>--version-lib</CODE
2808
> option
2809
if you would like to install version-specific directories
2810
relative to the specified prefix.
2811
2812
</P
2813
></DIV
2814
></DIV
2815
></DIV
2816
><DIV
2817
CLASS="chapter"
2818
><HR><H1
2819
><A
2820
NAME="chap-simple"
2821
></A
2822
>Chapter 2. Simple Builds</H1
2823
><P
2824
>
2825
In this chapter,
2826
you will see several examples of
2827
very simple build configurations using <SPAN
2828
CLASS="application"
2829
>SCons</SPAN
2830
>,
2831
which will demonstrate how easy
2832
it is to use <SPAN
2833
CLASS="application"
2834
>SCons</SPAN
2835
> to
2836
build programs from several different programming languages
2837
on different types of systems.
2838
2839
</P
2840
><DIV
2841
CLASS="section"
2842
><HR><H2
2843
CLASS="section"
2844
><A
2845
NAME="AEN256"
2846
>2.1. Building Simple C / C++ Programs</A
2847
></H2
2848
><P
2849
>
2850
Here's the famous "Hello, World!" program in C:
2851
2852
</P
2853
><PRE
2854
CLASS="programlisting"
2855
> int
2856
main()
2857
{
2858
printf("Hello, world!\n");
2859
}
2860
</PRE
2861
><P
2862
>
2863
And here's how to build it using <SPAN
2864
CLASS="application"
2865
>SCons</SPAN
2866
>.
2867
Enter the following into a file named <TT
2868
CLASS="filename"
2869
>SConstruct</TT
2870
>:
2871
2872
</P
2873
><PRE
2874
CLASS="programlisting"
2875
> Program('hello.c')
2876
</PRE
2877
><P
2878
>
2879
This minimal configuration file gives
2880
<SPAN
2881
CLASS="application"
2882
>SCons</SPAN
2883
> two pieces of information:
2884
what you want to build
2885
(an executable program),
2886
and the input file from
2887
which you want it built
2888
(the <TT
2889
CLASS="filename"
2890
>hello.c</TT
2891
> file).
2892
<A
2893
HREF="#b-Program"
2894
><CODE
2895
CLASS="function"
2896
>Program</CODE
2897
></A
2898
> is a <I
2899
CLASS="firstterm"
2900
>builder_method</I
2901
>,
2902
a Python call that tells <SPAN
2903
CLASS="application"
2904
>SCons</SPAN
2905
> that you want to build an
2906
executable program.
2907
2908
</P
2909
><P
2910
>
2911
That's it. Now run the <SPAN
2912
CLASS="application"
2913
>scons</SPAN
2914
> command to build the program.
2915
On a POSIX-compliant system like Linux or UNIX,
2916
you'll see something like:
2917
2918
</P
2919
><PRE
2920
CLASS="screen"
2921
> % <KBD
2922
CLASS="userinput"
2923
>scons</KBD
2924
>
2925
scons: Reading SConscript files ...
2926
scons: done reading SConscript files.
2927
scons: Building targets ...
2928
cc -o hello.o -c hello.c
2929
cc -o hello hello.o
2930
scons: done building targets.
2931
</PRE
2932
><P
2933
>
2934
On a Windows system with the Microsoft Visual C++ compiler,
2935
you'll see something like:
2936
2937
</P
2938
><PRE
2939
CLASS="screen"
2940
> C:\><KBD
2941
CLASS="userinput"
2942
>scons</KBD
2943
>
2944
scons: Reading SConscript files ...
2945
scons: done reading SConscript files.
2946
scons: Building targets ...
2947
cl /nologo /c hello.c /Fohello.obj
2948
link /nologo /OUT:hello.exe hello.obj
2949
scons: done building targets.
2950
</PRE
2951
><P
2952
>
2953
First, notice that you only need
2954
to specify the name of the source file,
2955
and that <SPAN
2956
CLASS="application"
2957
>SCons</SPAN
2958
> correctly deduces the names of
2959
the object and executable files to be built
2960
from the base of the source file name.
2961
2962
</P
2963
><P
2964
>
2965
Second, notice that the same input <TT
2966
CLASS="filename"
2967
>SConstruct</TT
2968
> file,
2969
without any changes,
2970
generates the correct output file names on both systems:
2971
<TT
2972
CLASS="filename"
2973
>hello.o</TT
2974
> and <TT
2975
CLASS="filename"
2976
>hello</TT
2977
>
2978
on POSIX systems,
2979
<TT
2980
CLASS="filename"
2981
>hello.obj</TT
2982
> and <TT
2983
CLASS="filename"
2984
>hello.exe</TT
2985
>
2986
on Windows systems.
2987
This is a simple example of how <SPAN
2988
CLASS="application"
2989
>SCons</SPAN
2990
>
2991
makes it extremely easy to
2992
write portable software builds.
2993
2994
</P
2995
><P
2996
>
2997
(Note that we won't provide duplicate side-by-side
2998
POSIX and Windows output for all of the examples in this guide;
2999
just keep in mind that, unless otherwise specified,
3000
any of the examples should work equally well on both types of systems.)
3001
3002
</P
3003
></DIV
3004
><DIV
3005
CLASS="section"
3006
><HR><H2
3007
CLASS="section"
3008
><A
3009
NAME="AEN288"
3010
>2.2. Building Object Files</A
3011
></H2
3012
><P
3013
>
3014
The <A
3015
HREF="#b-Program"
3016
><CODE
3017
CLASS="function"
3018
>Program</CODE
3019
></A
3020
> builder method is only one of
3021
many builder methods that <SPAN
3022
CLASS="application"
3023
>SCons</SPAN
3024
> provides
3025
to build different types of files.
3026
Another is the <A
3027
HREF="#b-Object"
3028
><CODE
3029
CLASS="function"
3030
>Object</CODE
3031
></A
3032
> builder method,
3033
which tells <SPAN
3034
CLASS="application"
3035
>SCons</SPAN
3036
> to build an object file
3037
from the specified source file:
3038
3039
</P
3040
><PRE
3041
CLASS="programlisting"
3042
> Object('hello.c')
3043
</PRE
3044
><P
3045
>
3046
Now when you run the <SPAN
3047
CLASS="application"
3048
>scons</SPAN
3049
> command to build the program,
3050
it will build just the <TT
3051
CLASS="filename"
3052
>hello.o</TT
3053
> object file on a POSIX system:
3054
3055
</P
3056
><PRE
3057
CLASS="screen"
3058
> % <KBD
3059
CLASS="userinput"
3060
>scons</KBD
3061
>
3062
scons: Reading SConscript files ...
3063
scons: done reading SConscript files.
3064
scons: Building targets ...
3065
cc -o hello.o -c hello.c
3066
scons: done building targets.
3067
</PRE
3068
><P
3069
>
3070
And just the <TT
3071
CLASS="filename"
3072
>hello.obj</TT
3073
> object file
3074
on a Windows system (with the Microsoft Visual C++ compiler):
3075
3076
</P
3077
><PRE
3078
CLASS="screen"
3079
> C:\><KBD
3080
CLASS="userinput"
3081
>scons</KBD
3082
>
3083
scons: Reading SConscript files ...
3084
scons: done reading SConscript files.
3085
scons: Building targets ...
3086
cl /nologo /c hello.c /Fohello.obj
3087
scons: done building targets.
3088
</PRE
3089
></DIV
3090
><DIV
3091
CLASS="section"
3092
><HR><H2
3093
CLASS="section"
3094
><A
3095
NAME="AEN307"
3096
>2.3. Simple Java Builds</A
3097
></H2
3098
><P
3099
>
3100
<SPAN
3101
CLASS="application"
3102
>SCons</SPAN
3103
> also makes building with Java extremely easy.
3104
Unlike the <A
3105
HREF="#b-Program"
3106
><CODE
3107
CLASS="function"
3108
>Program</CODE
3109
></A
3110
> and <A
3111
HREF="#b-Object"
3112
><CODE
3113
CLASS="function"
3114
>Object</CODE
3115
></A
3116
> builder methods,
3117
however, the <A
3118
HREF="#b-Java"
3119
><CODE
3120
CLASS="function"
3121
>Java</CODE
3122
></A
3123
> builder method
3124
requires that you specify
3125
the name of a destination directory in which
3126
you want the class files placed,
3127
followed by the source directory
3128
in which the <TT
3129
CLASS="filename"
3130
>.java</TT
3131
> files live:
3132
3133
</P
3134
><PRE
3135
CLASS="programlisting"
3136
> Java('classes', 'src')
3137
</PRE
3138
><P
3139
>
3140
If the <TT
3141
CLASS="filename"
3142
>src</TT
3143
> directory
3144
contains a single <TT
3145
CLASS="filename"
3146
>hello.java</TT
3147
> file,
3148
then the output from running the <SPAN
3149
CLASS="application"
3150
>scons</SPAN
3151
> command
3152
would look something like this
3153
(on a POSIX system):
3154
3155
</P
3156
><PRE
3157
CLASS="screen"
3158
> % <KBD
3159
CLASS="userinput"
3160
>scons</KBD
3161
>
3162
scons: Reading SConscript files ...
3163
scons: done reading SConscript files.
3164
scons: Building targets ...
3165
javac -d classes -sourcepath src src/hello.java
3166
scons: done building targets.
3167
</PRE
3168
><P
3169
>
3170
We'll cover Java builds in more detail,
3171
including building Java archive (<TT
3172
CLASS="filename"
3173
>.jar</TT
3174
>)
3175
and other types of file,
3176
in <A
3177
HREF="#chap-java"
3178
>Chapter 27</A
3179
>.
3180
3181
</P
3182
></DIV
3183
><DIV
3184
CLASS="section"
3185
><HR><H2
3186
CLASS="section"
3187
><A
3188
NAME="AEN328"
3189
>2.4. Cleaning Up After a Build</A
3190
></H2
3191
><P
3192
>
3193
When using <SPAN
3194
CLASS="application"
3195
>SCons</SPAN
3196
>, it is unnecessary to add special
3197
commands or target names to clean up after a build.
3198
Instead, you simply use the
3199
<TT
3200
CLASS="literal"
3201
>-c</TT
3202
> or <TT
3203
CLASS="literal"
3204
>--clean</TT
3205
>
3206
option when you invoke <SPAN
3207
CLASS="application"
3208
>SCons</SPAN
3209
>,
3210
and <SPAN
3211
CLASS="application"
3212
>SCons</SPAN
3213
> removes the appropriate built files.
3214
So if we build our example above
3215
and then invoke <TT
3216
CLASS="literal"
3217
>scons -c</TT
3218
>
3219
afterwards, the output on POSIX looks like:
3220
3221
</P
3222
><PRE
3223
CLASS="screen"
3224
> % <KBD
3225
CLASS="userinput"
3226
>scons</KBD
3227
>
3228
scons: Reading SConscript files ...
3229
scons: done reading SConscript files.
3230
scons: Building targets ...
3231
cc -o hello.o -c hello.c
3232
cc -o hello hello.o
3233
scons: done building targets.
3234
% <KBD
3235
CLASS="userinput"
3236
>scons -c</KBD
3237
>
3238
scons: Reading SConscript files ...
3239
scons: done reading SConscript files.
3240
scons: Cleaning targets ...
3241
Removed hello.o
3242
Removed hello
3243
scons: done cleaning targets.
3244
</PRE
3245
><P
3246
>
3247
And the output on Windows looks like:
3248
3249
</P
3250
><PRE
3251
CLASS="screen"
3252
> C:\><KBD
3253
CLASS="userinput"
3254
>scons</KBD
3255
>
3256
scons: Reading SConscript files ...
3257
scons: done reading SConscript files.
3258
scons: Building targets ...
3259
cl /nologo /c hello.c /Fohello.obj
3260
link /nologo /OUT:hello.exe hello.obj
3261
scons: done building targets.
3262
C:\><KBD
3263
CLASS="userinput"
3264
>scons -c</KBD
3265
>
3266
scons: Reading SConscript files ...
3267
scons: done reading SConscript files.
3268
scons: Cleaning targets ...
3269
Removed hello.obj
3270
Removed hello.exe
3271
scons: done cleaning targets.
3272
</PRE
3273
><P
3274
>
3275
Notice that <SPAN
3276
CLASS="application"
3277
>SCons</SPAN
3278
> changes its output to tell you that it
3279
is <TT
3280
CLASS="literal"
3281
>Cleaning targets ...</TT
3282
> and
3283
<TT
3284
CLASS="literal"
3285
>done cleaning targets.</TT
3286
>
3287
3288
</P
3289
></DIV
3290
><DIV
3291
CLASS="section"
3292
><HR><H2
3293
CLASS="section"
3294
><A
3295
NAME="AEN348"
3296
>2.5. The <TT
3297
CLASS="filename"
3298
>SConstruct</TT
3299
> File</A
3300
></H2
3301
><P
3302
>
3303
If you're used to build systems like <SPAN
3304
CLASS="application"
3305
>Make</SPAN
3306
>
3307
you've already figured out that the <TT
3308
CLASS="filename"
3309
>SConstruct</TT
3310
> file
3311
is the <SPAN
3312
CLASS="application"
3313
>SCons</SPAN
3314
> equivalent of a <TT
3315
CLASS="filename"
3316
>Makefile</TT
3317
>.
3318
That is, the <TT
3319
CLASS="filename"
3320
>SConstruct</TT
3321
> file is the input file
3322
that <SPAN
3323
CLASS="application"
3324
>SCons</SPAN
3325
> reads to control the build.
3326
3327
</P
3328
><DIV
3329
CLASS="section"
3330
><HR><H3
3331
CLASS="section"
3332
><A
3333
NAME="AEN358"
3334
>2.5.1. <TT
3335
CLASS="filename"
3336
>SConstruct</TT
3337
> Files Are Python Scripts</A
3338
></H3
3339
><P
3340
>
3341
There is, however, an important difference between
3342
an <TT
3343
CLASS="filename"
3344
>SConstruct</TT
3345
> file and a <TT
3346
CLASS="filename"
3347
>Makefile</TT
3348
>:
3349
the <TT
3350
CLASS="filename"
3351
>SConstruct</TT
3352
> file is actually a Python script.
3353
If you're not already familiar with Python, don't worry.
3354
This User's Guide will introduce you step-by-step
3355
to the relatively small amount of Python you'll
3356
need to know to be able to use <SPAN
3357
CLASS="application"
3358
>SCons</SPAN
3359
> effectively.
3360
And Python is very easy to learn.
3361
3362
</P
3363
><P
3364
>
3365
One aspect of using Python as the
3366
scripting language is that you can put comments
3367
in your <TT
3368
CLASS="filename"
3369
>SConstruct</TT
3370
> file using Python's commenting convention;
3371
that is, everything between a '#' and the end of the line
3372
will be ignored:
3373
3374
</P
3375
><PRE
3376
CLASS="programlisting"
3377
> # Arrange to build the "hello" program.
3378
Program('hello.c') # "hello.c" is the source file.
3379
</PRE
3380
><P
3381
>
3382
You'll see throughout the remainder of this Guide
3383
that being able to use the power of a
3384
real scripting language
3385
can greatly simplify the solutions
3386
to complex requirements of real-world builds.
3387
3388
</P
3389
></DIV
3390
><DIV
3391
CLASS="section"
3392
><HR><H3
3393
CLASS="section"
3394
><A
3395
NAME="AEN370"
3396
>2.5.2. <SPAN
3397
CLASS="application"
3398
>SCons</SPAN
3399
> Functions Are Order-Independent</A
3400
></H3
3401
><P
3402
>
3403
One important way in which the <TT
3404
CLASS="filename"
3405
>SConstruct</TT
3406
>
3407
file is not exactly like a normal Python script,
3408
and is more like a <TT
3409
CLASS="filename"
3410
>Makefile</TT
3411
>,
3412
is that the order in which
3413
the <SPAN
3414
CLASS="application"
3415
>SCons</SPAN
3416
> functions are called in
3417
the <TT
3418
CLASS="filename"
3419
>SConstruct</TT
3420
> file
3421
does <SPAN
3422
CLASS="emphasis"
3423
><I
3424
CLASS="emphasis"
3425
>not</I
3426
></SPAN
3427
>
3428
affect the order in which <SPAN
3429
CLASS="application"
3430
>SCons</SPAN
3431
>
3432
actually builds the programs and object files
3433
you want it to build.<A
3434
NAME="AEN380"
3435
HREF="#FTN.AEN380"
3436
><SPAN
3437
CLASS="footnote"
3438
>[1]</SPAN
3439
></A
3440
>
3441
In other words, when you call the <A
3442
HREF="#b-Program"
3443
><CODE
3444
CLASS="function"
3445
>Program</CODE
3446
></A
3447
> builder
3448
(or any other builder method),
3449
you're not telling <SPAN
3450
CLASS="application"
3451
>SCons</SPAN
3452
> to build
3453
the program at the instant the builder method is called.
3454
Instead, you're telling <SPAN
3455
CLASS="application"
3456
>SCons</SPAN
3457
> to build the program
3458
that you want, for example,
3459
a program built from a file named <TT
3460
CLASS="filename"
3461
>hello.c</TT
3462
>,
3463
and it's up to <SPAN
3464
CLASS="application"
3465
>SCons</SPAN
3466
> to build that program
3467
(and any other files) whenever it's necessary.
3468
(We'll learn more about how
3469
<SPAN
3470
CLASS="application"
3471
>SCons</SPAN
3472
> decides when building or rebuilding a file
3473
is necessary in <A
3474
HREF="#chap-depends"
3475
>Chapter 6</A
3476
>, below.)
3477
3478
</P
3479
><P
3480
>
3481
<SPAN
3482
CLASS="application"
3483
>SCons</SPAN
3484
> reflects this distinction between
3485
<SPAN
3486
CLASS="emphasis"
3487
><I
3488
CLASS="emphasis"
3489
>calling a builder method like</I
3490
></SPAN
3491
> <CODE
3492
CLASS="function"
3493
>Program</CODE
3494
>>
3495
and <SPAN
3496
CLASS="emphasis"
3497
><I
3498
CLASS="emphasis"
3499
>actually building the program</I
3500
></SPAN
3501
>
3502
by printing the status messages that indicate
3503
when it's "just reading" the <TT
3504
CLASS="filename"
3505
>SConstruct</TT
3506
> file,
3507
and when it's actually building the target files.
3508
This is to make it clear when <SPAN
3509
CLASS="application"
3510
>SCons</SPAN
3511
> is
3512
executing the Python statements that make up the <TT
3513
CLASS="filename"
3514
>SConstruct</TT
3515
> file,
3516
and when <SPAN
3517
CLASS="application"
3518
>SCons</SPAN
3519
> is actually executing the
3520
commands or other actions to
3521
build the necessary files.
3522
3523
</P
3524
><P
3525
>
3526
Let's clarify this with an example.
3527
Python has a <TT
3528
CLASS="literal"
3529
>print</TT
3530
> statement that
3531
prints a string of characters to the screen.
3532
If we put <TT
3533
CLASS="literal"
3534
>print</TT
3535
> statements around
3536
our calls to the <CODE
3537
CLASS="function"
3538
>Program</CODE
3539
> builder method:
3540
3541
</P
3542
><PRE
3543
CLASS="programlisting"
3544
> print "Calling Program('hello.c')"
3545
Program('hello.c')
3546
print "Calling Program('goodbye.c')"
3547
Program('goodbye.c')
3548
print "Finished calling Program()"
3549
</PRE
3550
><P
3551
>
3552
Then when we execute <SPAN
3553
CLASS="application"
3554
>SCons</SPAN
3555
>,
3556
we see the output from the <TT
3557
CLASS="literal"
3558
>print</TT
3559
>
3560
statements in between the messages about
3561
reading the <TT
3562
CLASS="filename"
3563
>SConscript</TT
3564
> files,
3565
indicating that that is when the
3566
Python statements are being executed:
3567
3568
</P
3569
><PRE
3570
CLASS="screen"
3571
> % <KBD
3572
CLASS="userinput"
3573
>scons</KBD
3574
>
3575
scons: Reading SConscript files ...
3576
Calling Program('hello.c')
3577
Calling Program('goodbye.c')
3578
Finished calling Program()
3579
scons: done reading SConscript files.
3580
scons: Building targets ...
3581
cc -o goodbye.o -c goodbye.c
3582
cc -o goodbye goodbye.o
3583
cc -o hello.o -c hello.c
3584
cc -o hello hello.o
3585
scons: done building targets.
3586
</PRE
3587
><P
3588
>
3589
Notice also that <SPAN
3590
CLASS="application"
3591
>SCons</SPAN
3592
> built the <SPAN
3593
CLASS="application"
3594
>goodbye</SPAN
3595
> program first,
3596
even though the "reading <TT
3597
CLASS="filename"
3598
>SConscript</TT
3599
>" output
3600
shows that we called <TT
3601
CLASS="literal"
3602
>Program('hello.c')</TT
3603
>
3604
first in the <TT
3605
CLASS="filename"
3606
>SConstruct</TT
3607
> file.
3608
3609
</P
3610
></DIV
3611
></DIV
3612
><DIV
3613
CLASS="section"
3614
><HR><H2
3615
CLASS="section"
3616
><A
3617
NAME="AEN420"
3618
>2.6. Making the <SPAN
3619
CLASS="application"
3620
>SCons</SPAN
3621
> Output Less Verbose</A
3622
></H2
3623
><P
3624
>
3625
You've already seen how <SPAN
3626
CLASS="application"
3627
>SCons</SPAN
3628
> prints
3629
some messages about what it's doing,
3630
surrounding the actual commands used to build the software:
3631
3632
</P
3633
><PRE
3634
CLASS="screen"
3635
> C:\><KBD
3636
CLASS="userinput"
3637
>scons</KBD
3638
>
3639
scons: Reading SConscript files ...
3640
scons: done reading SConscript files.
3641
scons: Building targets ...
3642
cl /nologo /c hello.c /Fohello.obj
3643
link /nologo /OUT:hello.exe hello.obj
3644
scons: done building targets.
3645
</PRE
3646
><P
3647
>
3648
These messages emphasize the
3649
order in which <SPAN
3650
CLASS="application"
3651
>SCons</SPAN
3652
> does its work:
3653
all of the configuration files
3654
(generically referred to as <TT
3655
CLASS="filename"
3656
>SConscript</TT
3657
> files)
3658
are read and executed first,
3659
and only then are the target files built.
3660
Among other benefits, these messages help to distinguish between
3661
errors that occur while the configuration files are read,
3662
and errors that occur while targets are being built.
3663
3664
</P
3665
><P
3666
>
3667
One drawback, of course, is that these messages clutter the output.
3668
Fortunately, they're easily disabled by using
3669
the <TT
3670
CLASS="literal"
3671
>-Q</TT
3672
> option when invoking <SPAN
3673
CLASS="application"
3674
>SCons</SPAN
3675
>:
3676
3677
</P
3678
><PRE
3679
CLASS="screen"
3680
> C:\><KBD
3681
CLASS="userinput"
3682
>scons -Q</KBD
3683
>
3684
cl /nologo /c hello.c /Fohello.obj
3685
link /nologo /OUT:hello.exe hello.obj
3686
</PRE
3687
><P
3688
>
3689
Because we want this User's Guide to focus
3690
on what <SPAN
3691
CLASS="application"
3692
>SCons</SPAN
3693
> is actually doing,
3694
we're going to use the <TT
3695
CLASS="literal"
3696
>-Q</TT
3697
> option
3698
to remove these messages from the
3699
output of all the remaining examples in this Guide.
3700
3701
</P
3702
></DIV
3703
></DIV
3704
><DIV
3705
CLASS="chapter"
3706
><HR><H1
3707
><A
3708
NAME="chap-less-simple"
3709
></A
3710
>Chapter 3. Less Simple Things to Do With Builds</H1
3711
><P
3712
>
3713
In this chapter,
3714
you will see several examples of
3715
very simple build configurations using <SPAN
3716
CLASS="application"
3717
>SCons</SPAN
3718
>,
3719
which will demonstrate how easy
3720
it is to use <SPAN
3721
CLASS="application"
3722
>SCons</SPAN
3723
> to
3724
build programs from several different programming languages
3725
on different types of systems.
3726
3727
</P
3728
><DIV
3729
CLASS="section"
3730
><HR><H2
3731
CLASS="section"
3732
><A
3733
NAME="AEN443"
3734
>3.1. Specifying the Name of the Target (Output) File</A
3735
></H2
3736
><P
3737
>
3738
You've seen that when you call the <A
3739
HREF="#b-Program"
3740
><CODE
3741
CLASS="function"
3742
>Program</CODE
3743
></A
3744
> builder method,
3745
it builds the resulting program with the same
3746
base name as the source file.
3747
That is, the following call to build an
3748
executable program from the <TT
3749
CLASS="filename"
3750
>hello.c</TT
3751
> source file
3752
will build an executable program named <SPAN
3753
CLASS="application"
3754
>hello</SPAN
3755
> on POSIX systems,
3756
and an executable program named <TT
3757
CLASS="filename"
3758
>hello.exe</TT
3759
> on Windows systems:
3760
3761
</P
3762
><PRE
3763
CLASS="programlisting"
3764
> Program('hello.c')
3765
</PRE
3766
><P
3767
>
3768
If you want to build a program with
3769
a different name than the base of the source file name,
3770
you simply put the target file name
3771
to the left of the source file name:
3772
3773
</P
3774
><PRE
3775
CLASS="programlisting"
3776
> Program('new_hello', 'hello.c')
3777
</PRE
3778
><P
3779
>
3780
(<SPAN
3781
CLASS="application"
3782
>SCons</SPAN
3783
> requires the target file name first,
3784
followed by the source file name,
3785
so that the order mimics that of an
3786
assignment statement in most programming languages,
3787
including Python:
3788
<TT
3789
CLASS="literal"
3790
>"program = source files"</TT
3791
>.)
3792
3793
</P
3794
><P
3795
>
3796
Now <SPAN
3797
CLASS="application"
3798
>SCons</SPAN
3799
> will build an executable program
3800
named <SPAN
3801
CLASS="application"
3802
>new_hello</SPAN
3803
> when run on a POSIX system:
3804
3805
</P
3806
><PRE
3807
CLASS="screen"
3808
> % <KBD
3809
CLASS="userinput"
3810
>scons -Q</KBD
3811
>
3812
cc -o hello.o -c hello.c
3813
cc -o new_hello hello.o
3814
</PRE
3815
><P
3816
>
3817
And <SPAN
3818
CLASS="application"
3819
>SCons</SPAN
3820
> will build an executable program
3821
named <SPAN
3822
CLASS="application"
3823
>new_hello.exe</SPAN
3824
> when run on a Windows system:
3825
3826
</P
3827
><PRE
3828
CLASS="screen"
3829
> C:\><KBD
3830
CLASS="userinput"
3831
>scons -Q</KBD
3832
>
3833
cl /nologo /c hello.c /Fohello.obj
3834
link /nologo /OUT:new_hello.exe hello.obj
3835
</PRE
3836
></DIV
3837
><DIV
3838
CLASS="section"
3839
><HR><H2
3840
CLASS="section"
3841
><A
3842
NAME="AEN467"
3843
>3.2. Compiling Multiple Source Files</A
3844
></H2
3845
><P
3846
>
3847
You've just seen how to configure <SPAN
3848
CLASS="application"
3849
>SCons</SPAN
3850
>
3851
to compile a program from a single source file.
3852
It's more common, of course,
3853
that you'll need to build a program from
3854
many input source files, not just one.
3855
To do this, you need to put the
3856
source files in a Python list
3857
(enclosed in square brackets),
3858
like so:
3859
3860
</P
3861
><PRE
3862
CLASS="programlisting"
3863
> Program(['prog.c', 'file1.c', 'file2.c'])
3864
</PRE
3865
><P
3866
>
3867
A build of the above example would look like:
3868
3869
</P
3870
><PRE
3871
CLASS="screen"
3872
> % <KBD
3873
CLASS="userinput"
3874
>scons -Q</KBD
3875
>
3876
cc -o file1.o -c file1.c
3877
cc -o file2.o -c file2.c
3878
cc -o prog.o -c prog.c
3879
cc -o prog prog.o file1.o file2.o
3880
</PRE
3881
><P
3882
>
3883
Notice that <SPAN
3884
CLASS="application"
3885
>SCons</SPAN
3886
>
3887
deduces the output program name
3888
from the first source file specified
3889
in the list--that is,
3890
because the first source file was <TT
3891
CLASS="filename"
3892
>prog.c</TT
3893
>,
3894
<SPAN
3895
CLASS="application"
3896
>SCons</SPAN
3897
> will name the resulting program <TT
3898
CLASS="filename"
3899
>prog</TT
3900
>
3901
(or <TT
3902
CLASS="filename"
3903
>prog.exe</TT
3904
> on a Windows system).
3905
If you want to specify a different program name,
3906
then (as we've seen in the previous section)
3907
you slide the list of source files
3908
over to the right
3909
to make room for the output program file name.
3910
(<SPAN
3911
CLASS="application"
3912
>SCons</SPAN
3913
> puts the output file name to the left
3914
of the source file names
3915
so that the order mimics that of an
3916
assignment statement: "program = source files".)
3917
This makes our example:
3918
3919
</P
3920
><PRE
3921
CLASS="programlisting"
3922
> Program('program', ['prog.c', 'file1.c', 'file2.c'])
3923
</PRE
3924
><P
3925
>
3926
On Linux, a build of this example would look like:
3927
3928
</P
3929
><PRE
3930
CLASS="screen"
3931
> % <KBD
3932
CLASS="userinput"
3933
>scons -Q</KBD
3934
>
3935
cc -o file1.o -c file1.c
3936
cc -o file2.o -c file2.c
3937
cc -o prog.o -c prog.c
3938
cc -o program prog.o file1.o file2.o
3939
</PRE
3940
><P
3941
>
3942
Or on Windows:
3943
3944
</P
3945
><PRE
3946
CLASS="screen"
3947
> C:\><KBD
3948
CLASS="userinput"
3949
>scons -Q</KBD
3950
>
3951
cl /nologo /c file1.c /Fofile1.obj
3952
cl /nologo /c file2.c /Fofile2.obj
3953
cl /nologo /c prog.c /Foprog.obj
3954
link /nologo /OUT:program.exe prog.obj file1.obj file2.obj
3955
</PRE
3956
></DIV
3957
><DIV
3958
CLASS="section"
3959
><HR><H2
3960
CLASS="section"
3961
><A
3962
NAME="AEN489"
3963
>3.3. Making a list of files with <CODE
3964
CLASS="function"
3965
>Glob</CODE
3966
></A
3967
></H2
3968
><P
3969
>
3970
You can also use the <CODE
3971
CLASS="function"
3972
>Glob</CODE
3973
> function to find all files matching a
3974
certain template, using the standard shell pattern matching
3975
characters <TT
3976
CLASS="literal"
3977
>*</TT
3978
>, <TT
3979
CLASS="literal"
3980
>?</TT
3981
>
3982
and <TT
3983
CLASS="literal"
3984
>[abc]</TT
3985
> to match any of
3986
<TT
3987
CLASS="literal"
3988
>a</TT
3989
>, <TT
3990
CLASS="literal"
3991
>b</TT
3992
> or <TT
3993
CLASS="literal"
3994
>c</TT
3995
>.
3996
<TT
3997
CLASS="literal"
3998
>[!abc]</TT
3999
> is also supported,
4000
to match any character <SPAN
4001
CLASS="emphasis"
4002
><I
4003
CLASS="emphasis"
4004
>except</I
4005
></SPAN
4006
>
4007
<TT
4008
CLASS="literal"
4009
>a</TT
4010
>, <TT
4011
CLASS="literal"
4012
>b</TT
4013
> or <TT
4014
CLASS="literal"
4015
>c</TT
4016
>.
4017
This makes many multi-source-file builds quite easy:
4018
4019
</P
4020
><PRE
4021
CLASS="programlisting"
4022
> Program('program', Glob('*.c'))
4023
</PRE
4024
><P
4025
>
4026
The SCons man page has more details on using <CODE
4027
CLASS="function"
4028
>Glob</CODE
4029
> with Variant
4030
directories and Repositories, and returning strings rather than Nodes.
4031
4032
</P
4033
></DIV
4034
><DIV
4035
CLASS="section"
4036
><HR><H2
4037
CLASS="section"
4038
><A
4039
NAME="AEN508"
4040
>3.4. Specifying Single Files Vs. Lists of Files</A
4041
></H2
4042
><P
4043
>
4044
We've now shown you two ways to specify
4045
the source for a program,
4046
one with a list of files:
4047
4048
</P
4049
><PRE
4050
CLASS="programlisting"
4051
> Program('hello', ['file1.c', 'file2.c'])
4052
</PRE
4053
><P
4054
>
4055
And one with a single file:
4056
4057
</P
4058
><PRE
4059
CLASS="programlisting"
4060
> Program('hello', 'hello.c')
4061
</PRE
4062
><P
4063
>
4064
You could actually put a single file name in a list, too,
4065
which you might prefer just for the sake of consistency:
4066
4067
</P
4068
><PRE
4069
CLASS="programlisting"
4070
> Program('hello', ['hello.c'])
4071
</PRE
4072
><P
4073
>
4074
<SPAN
4075
CLASS="application"
4076
>SCons</SPAN
4077
> functions will accept a single file name in either form.
4078
In fact, internally, <SPAN
4079
CLASS="application"
4080
>SCons</SPAN
4081
> treats all input as lists of files,
4082
but allows you to omit the square brackets
4083
to cut down a little on the typing
4084
when there's only a single file name.
4085
4086
</P
4087
><DIV
4088
CLASS="important"
4089
><P
4090
></P
4091
><TABLE
4092
CLASS="important"
4093
WIDTH="100%"
4094
BORDER="0"
4095
><TR
4096
><TD
4097
WIDTH="25"
4098
ALIGN="CENTER"
4099
VALIGN="TOP"
4100
><IMG
4101
SRC="../images/important.gif"
4102
HSPACE="5"
4103
ALT="Important"></TD
4104
><TD
4105
ALIGN="LEFT"
4106
VALIGN="TOP"
4107
><P
4108
>
4109
Although <SPAN
4110
CLASS="application"
4111
>SCons</SPAN
4112
> functions
4113
are forgiving about whether or not you
4114
use a string vs. a list for a single file name,
4115
Python itself is more strict about
4116
treating lists and strings differently.
4117
So where <SPAN
4118
CLASS="application"
4119
>SCons</SPAN
4120
> allows either
4121
a string or list:
4122
4123
</P
4124
><PRE
4125
CLASS="programlisting"
4126
> # The following two calls both work correctly:
4127
Program('program1', 'program1.c')
4128
Program('program2', ['program2.c'])
4129
</PRE
4130
><P
4131
>
4132
Trying to do "Python things" that mix strings and
4133
lists will cause errors or lead to incorrect results:
4134
4135
</P
4136
><PRE
4137
CLASS="programlisting"
4138
> common_sources = ['file1.c', 'file2.c']
4139
4140
# THE FOLLOWING IS INCORRECT AND GENERATES A PYTHON ERROR
4141
# BECAUSE IT TRIES TO ADD A STRING TO A LIST:
4142
Program('program1', common_sources + 'program1.c')
4143
4144
# The following works correctly, because it's adding two
4145
# lists together to make another list.
4146
Program('program2', common_sources + ['program2.c'])
4147
</PRE
4148
></TD
4149
></TR
4150
></TABLE
4151
></DIV
4152
></DIV
4153
><DIV
4154
CLASS="section"
4155
><HR><H2
4156
CLASS="section"
4157
><A
4158
NAME="AEN526"
4159
>3.5. Making Lists of Files Easier to Read</A
4160
></H2
4161
><P
4162
>
4163
One drawback to the use of a Python list
4164
for source files is that
4165
each file name must be enclosed in quotes
4166
(either single quotes or double quotes).
4167
This can get cumbersome and difficult to read
4168
when the list of file names is long.
4169
Fortunately, <SPAN
4170
CLASS="application"
4171
>SCons</SPAN
4172
> and Python provide a number of ways
4173
to make sure that
4174
the <TT
4175
CLASS="filename"
4176
>SConstruct</TT
4177
> file stays easy to read.
4178
4179
</P
4180
><P
4181
>
4182
To make long lists of file names
4183
easier to deal with, <SPAN
4184
CLASS="application"
4185
>SCons</SPAN
4186
> provides a
4187
<CODE
4188
CLASS="function"
4189
>Split</CODE
4190
> function
4191
that takes a quoted list of file names,
4192
with the names separated by spaces or other white-space characters,
4193
and turns it into a list of separate file names.
4194
Using the <CODE
4195
CLASS="function"
4196
>Split</CODE
4197
> function turns the
4198
previous example into:
4199
4200
</P
4201
><PRE
4202
CLASS="programlisting"
4203
> Program('program', Split('main.c file1.c file2.c'))
4204
</PRE
4205
><P
4206
>
4207
(If you're already familiar with Python,
4208
you'll have realized that this is similar to the
4209
<CODE
4210
CLASS="function"
4211
>split()</CODE
4212
> method
4213
in the Python standard <CODE
4214
CLASS="function"
4215
>string</CODE
4216
> module.
4217
Unlike the <CODE
4218
CLASS="function"
4219
>string.split()</CODE
4220
> method,
4221
however, the <CODE
4222
CLASS="function"
4223
>Split</CODE
4224
> function
4225
does not require a string as input
4226
and will wrap up a single non-string object in a list,
4227
or return its argument untouched if it's already a list.
4228
This comes in handy as a way to make sure
4229
arbitrary values can be passed to <SPAN
4230
CLASS="application"
4231
>SCons</SPAN
4232
> functions
4233
without having to check the type of the variable by hand.)
4234
4235
</P
4236
><P
4237
>
4238
Putting the call to the <CODE
4239
CLASS="function"
4240
>Split</CODE
4241
> function
4242
inside the <CODE
4243
CLASS="function"
4244
>Program</CODE
4245
> call
4246
can also be a little unwieldy.
4247
A more readable alternative is to
4248
assign the output from the <CODE
4249
CLASS="function"
4250
>Split</CODE
4251
> call
4252
to a variable name,
4253
and then use the variable when calling the
4254
<CODE
4255
CLASS="function"
4256
>Program</CODE
4257
> function:
4258
4259
</P
4260
><PRE
4261
CLASS="programlisting"
4262
> src_files = Split('main.c file1.c file2.c')
4263
Program('program', src_files)
4264
</PRE
4265
><P
4266
>
4267
Lastly, the <CODE
4268
CLASS="function"
4269
>Split</CODE
4270
> function
4271
doesn't care how much white space separates
4272
the file names in the quoted string.
4273
This allows you to create lists of file
4274
names that span multiple lines,
4275
which often makes for easier editing:
4276
4277
</P
4278
><PRE
4279
CLASS="programlisting"
4280
> src_files = Split("""main.c
4281
file1.c
4282
file2.c""")
4283
Program('program', src_files)
4284
</PRE
4285
><P
4286
>
4287
(Note in this example that we used
4288
the Python "triple-quote" syntax,
4289
which allows a string to contain
4290
multiple lines.
4291
The three quotes can be either
4292
single or double quotes.)
4293
4294
</P
4295
></DIV
4296
><DIV
4297
CLASS="section"
4298
><HR><H2
4299
CLASS="section"
4300
><A
4301
NAME="AEN552"
4302
>3.6. Keyword Arguments</A
4303
></H2
4304
><P
4305
>
4306
<SPAN
4307
CLASS="application"
4308
>SCons</SPAN
4309
> also allows you to identify
4310
the output file and input source files
4311
using Python keyword arguments.
4312
The output file is known as the
4313
<SPAN
4314
CLASS="emphasis"
4315
><I
4316
CLASS="emphasis"
4317
>target</I
4318
></SPAN
4319
>,
4320
and the source file(s) are known (logically enough) as the
4321
<SPAN
4322
CLASS="emphasis"
4323
><I
4324
CLASS="emphasis"
4325
>source</I
4326
></SPAN
4327
>.
4328
The Python syntax for this is:
4329
4330
</P
4331
><PRE
4332
CLASS="programlisting"
4333
> src_files = Split('main.c file1.c file2.c')
4334
Program(target = 'program', source = src_files)
4335
</PRE
4336
><P
4337
>
4338
Because the keywords explicitly identify
4339
what each argument is,
4340
you can actually reverse the order if you prefer:
4341
4342
</P
4343
><PRE
4344
CLASS="programlisting"
4345
> src_files = Split('main.c file1.c file2.c')
4346
Program(source = src_files, target = 'program')
4347
</PRE
4348
><P
4349
>
4350
Whether or not you choose to use keyword arguments
4351
to identify the target and source files,
4352
and the order in which you specify them
4353
when using keywords,
4354
are purely personal choices;
4355
<SPAN
4356
CLASS="application"
4357
>SCons</SPAN
4358
> functions the same regardless.
4359
4360
</P
4361
></DIV
4362
><DIV
4363
CLASS="section"
4364
><HR><H2
4365
CLASS="section"
4366
><A
4367
NAME="AEN563"
4368
>3.7. Compiling Multiple Programs</A
4369
></H2
4370
><P
4371
>
4372
In order to compile multiple programs
4373
within the same <TT
4374
CLASS="filename"
4375
>SConstruct</TT
4376
> file,
4377
simply call the <CODE
4378
CLASS="function"
4379
>Program</CODE
4380
> method
4381
multiple times,
4382
once for each program you need to build:
4383
4384
</P
4385
><PRE
4386
CLASS="programlisting"
4387
> Program('foo.c')
4388
Program('bar', ['bar1.c', 'bar2.c'])
4389
</PRE
4390
><P
4391
>
4392
<SPAN
4393
CLASS="application"
4394
>SCons</SPAN
4395
> would then build the programs as follows:
4396
4397
</P
4398
><PRE
4399
CLASS="screen"
4400
> % <KBD
4401
CLASS="userinput"
4402
>scons -Q</KBD
4403
>
4404
cc -o bar1.o -c bar1.c
4405
cc -o bar2.o -c bar2.c
4406
cc -o bar bar1.o bar2.o
4407
cc -o foo.o -c foo.c
4408
cc -o foo foo.o
4409
</PRE
4410
><P
4411
>
4412
Notice that <SPAN
4413
CLASS="application"
4414
>SCons</SPAN
4415
> does not necessarily build the
4416
programs in the same order in which you specify
4417
them in the <TT
4418
CLASS="filename"
4419
>SConstruct</TT
4420
> file.
4421
<SPAN
4422
CLASS="application"
4423
>SCons</SPAN
4424
> does, however, recognize that
4425
the individual object files must be built
4426
before the resulting program can be built.
4427
We'll discuss this in greater detail in
4428
the "Dependencies" section, below.
4429
4430
</P
4431
></DIV
4432
><DIV
4433
CLASS="section"
4434
><HR><H2
4435
CLASS="section"
4436
><A
4437
NAME="AEN577"
4438
>3.8. Sharing Source Files Between Multiple Programs</A
4439
></H2
4440
><P
4441
>
4442
It's common to re-use code by sharing source files
4443
between multiple programs.
4444
One way to do this is to create a library
4445
from the common source files,
4446
which can then be linked into resulting programs.
4447
(Creating libraries is discussed in
4448
<A
4449
HREF="#chap-libraries"
4450
>Chapter 4</A
4451
>, below.)
4452
4453
</P
4454
><P
4455
>
4456
A more straightforward, but perhaps less convenient,
4457
way to share source files between multiple programs
4458
is simply to include the common files
4459
in the lists of source files for each program:
4460
4461
</P
4462
><PRE
4463
CLASS="programlisting"
4464
> Program(Split('foo.c common1.c common2.c'))
4465
Program('bar', Split('bar1.c bar2.c common1.c common2.c'))
4466
</PRE
4467
><P
4468
>
4469
<SPAN
4470
CLASS="application"
4471
>SCons</SPAN
4472
> recognizes that the object files for
4473
the <TT
4474
CLASS="filename"
4475
>common1.c</TT
4476
> and <TT
4477
CLASS="filename"
4478
>common2.c</TT
4479
> source files
4480
each only need to be built once,
4481
even though the resulting object files are
4482
each linked in to both of the resulting executable programs:
4483
4484
</P
4485
><PRE
4486
CLASS="screen"
4487
> % <KBD
4488
CLASS="userinput"
4489
>scons -Q</KBD
4490
>
4491
cc -o bar1.o -c bar1.c
4492
cc -o bar2.o -c bar2.c
4493
cc -o common1.o -c common1.c
4494
cc -o common2.o -c common2.c
4495
cc -o bar bar1.o bar2.o common1.o common2.o
4496
cc -o foo.o -c foo.c
4497
cc -o foo foo.o common1.o common2.o
4498
</PRE
4499
><P
4500
>
4501
If two or more programs
4502
share a lot of common source files,
4503
repeating the common files in the list for each program
4504
can be a maintenance problem when you need to change the
4505
list of common files.
4506
You can simplify this by creating a separate Python list
4507
to hold the common file names,
4508
and concatenating it with other lists
4509
using the Python <TT
4510
CLASS="literal"
4511
>+</TT
4512
> operator:
4513
4514
</P
4515
><PRE
4516
CLASS="programlisting"
4517
> common = ['common1.c', 'common2.c']
4518
foo_files = ['foo.c'] + common
4519
bar_files = ['bar1.c', 'bar2.c'] + common
4520
Program('foo', foo_files)
4521
Program('bar', bar_files)
4522
</PRE
4523
><P
4524
>
4525
This is functionally equivalent to the previous example.
4526
4527
</P
4528
></DIV
4529
></DIV
4530
><DIV
4531
CLASS="chapter"
4532
><HR><H1
4533
><A
4534
NAME="chap-libraries"
4535
></A
4536
>Chapter 4. Building and Linking with Libraries</H1
4537
><P
4538
>
4539
It's often useful to organize large software projects
4540
by collecting parts of the software into one or more libraries.
4541
<SPAN
4542
CLASS="application"
4543
>SCons</SPAN
4544
> makes it easy to create libraries
4545
and to use them in the programs.
4546
4547
</P
4548
><DIV
4549
CLASS="section"
4550
><HR><H2
4551
CLASS="section"
4552
><A
4553
NAME="AEN597"
4554
>4.1. Building Libraries</A
4555
></H2
4556
><P
4557
>
4558
You build your own libraries by specifying <A
4559
HREF="#b-Library"
4560
><CODE
4561
CLASS="function"
4562
>Library</CODE
4563
></A
4564
>
4565
instead of <A
4566
HREF="#b-Program"
4567
><CODE
4568
CLASS="function"
4569
>Program</CODE
4570
></A
4571
>:
4572
4573
</P
4574
><PRE
4575
CLASS="programlisting"
4576
> Library('foo', ['f1.c', 'f2.c', 'f3.c'])
4577
</PRE
4578
><P
4579
>
4580
<SPAN
4581
CLASS="application"
4582
>SCons</SPAN
4583
> uses the appropriate library prefix and suffix for your system.
4584
So on POSIX or Linux systems,
4585
the above example would build as follows
4586
(although <SPAN
4587
CLASS="application"
4588
>ranlib</SPAN
4589
> may not be called on all systems):
4590
4591
</P
4592
><PRE
4593
CLASS="screen"
4594
> % <KBD
4595
CLASS="userinput"
4596
>scons -Q</KBD
4597
>
4598
cc -o f1.o -c f1.c
4599
cc -o f2.o -c f2.c
4600
cc -o f3.o -c f3.c
4601
ar rc libfoo.a f1.o f2.o f3.o
4602
ranlib libfoo.a
4603
</PRE
4604
><P
4605
>
4606
On a Windows system,
4607
a build of the above example would look like:
4608
4609
</P
4610
><PRE
4611
CLASS="screen"
4612
> C:\><KBD
4613
CLASS="userinput"
4614
>scons -Q</KBD
4615
>
4616
cl /nologo /c f1.c /Fof1.obj
4617
cl /nologo /c f2.c /Fof2.obj
4618
cl /nologo /c f3.c /Fof3.obj
4619
lib /nologo /OUT:foo.lib f1.obj f2.obj f3.obj
4620
</PRE
4621
><P
4622
>
4623
The rules for the target name of the library
4624
are similar to those for programs:
4625
if you don't explicitly specify a target library name,
4626
<SPAN
4627
CLASS="application"
4628
>SCons</SPAN
4629
> will deduce one from the
4630
name of the first source file specified,
4631
and <SPAN
4632
CLASS="application"
4633
>SCons</SPAN
4634
> will add an appropriate
4635
file prefix and suffix if you leave them off.
4636
4637
</P
4638
><DIV
4639
CLASS="section"
4640
><HR><H3
4641
CLASS="section"
4642
><A
4643
NAME="AEN616"
4644
>4.1.1. Building Libraries From Source Code or Object Files</A
4645
></H3
4646
><P
4647
>
4648
The previous example shows building a library from a
4649
list of source files.
4650
You can, however, also give the <A
4651
HREF="#b-Library"
4652
><CODE
4653
CLASS="function"
4654
>Library</CODE
4655
></A
4656
> call
4657
object files,
4658
and it will correctly realize
4659
In fact, you can arbitrarily mix source code files
4660
and object files in the source list:
4661
4662
</P
4663
><PRE
4664
CLASS="programlisting"
4665
> Library('foo', ['f1.c', 'f2.o', 'f3.c', 'f4.o'])
4666
</PRE
4667
><P
4668
>
4669
And SCons realizes that only the source code files
4670
must be compiled into object files
4671
before creating the final library:
4672
4673
</P
4674
><PRE
4675
CLASS="screen"
4676
> % <KBD
4677
CLASS="userinput"
4678
>scons -Q</KBD
4679
>
4680
cc -o f1.o -c f1.c
4681
cc -o f3.o -c f3.c
4682
ar rc libfoo.a f1.o f2.o f3.o f4.o
4683
ranlib libfoo.a
4684
</PRE
4685
><P
4686
>
4687
Of course, in this example, the object files
4688
must already exist for the build to succeed.
4689
See <A
4690
HREF="#chap-nodes"
4691
>Chapter 5</A
4692
>, below,
4693
for information about how you can
4694
build object files explicitly
4695
and include the built files in a library.
4696
4697
</P
4698
></DIV
4699
><DIV
4700
CLASS="section"
4701
><HR><H3
4702
CLASS="section"
4703
><A
4704
NAME="AEN627"
4705
>4.1.2. Building Static Libraries Explicitly: the <CODE
4706
CLASS="function"
4707
>StaticLibrary</CODE
4708
> Builder</A
4709
></H3
4710
><P
4711
>
4712
The <A
4713
HREF="#b-Library"
4714
><CODE
4715
CLASS="function"
4716
>Library</CODE
4717
></A
4718
> function builds a traditional static library.
4719
If you want to be explicit about the type of library being built,
4720
you can use the synonym <A
4721
HREF="#b-StaticLibrary"
4722
><CODE
4723
CLASS="function"
4724
>StaticLibrary</CODE
4725
></A
4726
> function
4727
instead of <CODE
4728
CLASS="function"
4729
>Library</CODE
4730
>:
4731
4732
</P
4733
><PRE
4734
CLASS="programlisting"
4735
> StaticLibrary('foo', ['f1.c', 'f2.c', 'f3.c'])
4736
</PRE
4737
><P
4738
>
4739
There is no functional difference between the
4740
<A
4741
HREF="#b-StaticLibrary"
4742
><CODE
4743
CLASS="function"
4744
>StaticLibrary</CODE
4745
></A
4746
> and <CODE
4747
CLASS="function"
4748
>Library</CODE
4749
> functions.
4750
4751
</P
4752
></DIV
4753
><DIV
4754
CLASS="section"
4755
><HR><H3
4756
CLASS="section"
4757
><A
4758
NAME="AEN641"
4759
>4.1.3. Building Shared (DLL) Libraries: the <CODE
4760
CLASS="function"
4761
>SharedLibrary</CODE
4762
> Builder</A
4763
></H3
4764
><P
4765
>
4766
If you want to build a shared library (on POSIX systems)
4767
or a DLL file (on Windows systems),
4768
you use the <A
4769
HREF="#b-SharedLibrary"
4770
><CODE
4771
CLASS="function"
4772
>SharedLibrary</CODE
4773
></A
4774
> function:
4775
4776
</P
4777
><PRE
4778
CLASS="programlisting"
4779
> SharedLibrary('foo', ['f1.c', 'f2.c', 'f3.c'])
4780
</PRE
4781
><P
4782
>
4783
The output on POSIX:
4784
4785
</P
4786
><PRE
4787
CLASS="screen"
4788
> % <KBD
4789
CLASS="userinput"
4790
>scons -Q</KBD
4791
>
4792
cc -o f1.os -c f1.c
4793
cc -o f2.os -c f2.c
4794
cc -o f3.os -c f3.c
4795
cc -o libfoo.so -shared f1.os f2.os f3.os
4796
</PRE
4797
><P
4798
>
4799
And the output on Windows:
4800
4801
</P
4802
><PRE
4803
CLASS="screen"
4804
> C:\><KBD
4805
CLASS="userinput"
4806
>scons -Q</KBD
4807
>
4808
cl /nologo /c f1.c /Fof1.obj
4809
cl /nologo /c f2.c /Fof2.obj
4810
cl /nologo /c f3.c /Fof3.obj
4811
link /nologo /dll /out:foo.dll /implib:foo.lib f1.obj f2.obj f3.obj
4812
RegServerFunc(target, source, env)
4813
</PRE
4814
><P
4815
>
4816
Notice again that <SPAN
4817
CLASS="application"
4818
>SCons</SPAN
4819
> takes care of
4820
building the output file correctly,
4821
adding the <TT
4822
CLASS="literal"
4823
>-shared</TT
4824
> option
4825
for a POSIX compilation,
4826
and the <TT
4827
CLASS="literal"
4828
>/dll</TT
4829
> option on Windows.
4830
4831
</P
4832
></DIV
4833
></DIV
4834
><DIV
4835
CLASS="section"
4836
><HR><H2
4837
CLASS="section"
4838
><A
4839
NAME="AEN658"
4840
>4.2. Linking with Libraries</A
4841
></H2
4842
><P
4843
>
4844
Usually, you build a library
4845
because you want to link it with one or more programs.
4846
You link libraries with a program by specifying
4847
the libraries in the <A
4848
HREF="#cv-LIBS"
4849
><CODE
4850
CLASS="envar"
4851
>$LIBS</CODE
4852
></A
4853
> construction variable,
4854
and by specifying the directory in which
4855
the library will be found in the
4856
<A
4857
HREF="#cv-LIBPATH"
4858
><CODE
4859
CLASS="envar"
4860
>$LIBPATH</CODE
4861
></A
4862
> construction variable:
4863
4864
4865
4866
</P
4867
><PRE
4868
CLASS="programlisting"
4869
> Library('foo', ['f1.c', 'f2.c', 'f3.c'])
4870
Program('prog.c', LIBS=['foo', 'bar'], LIBPATH='.')
4871
</PRE
4872
><P
4873
>
4874
Notice, of course, that you don't need to specify a library
4875
prefix (like <TT
4876
CLASS="literal"
4877
>lib</TT
4878
>)
4879
or suffix (like <TT
4880
CLASS="literal"
4881
>.a</TT
4882
> or <TT
4883
CLASS="literal"
4884
>.lib</TT
4885
>).
4886
<SPAN
4887
CLASS="application"
4888
>SCons</SPAN
4889
> uses the correct prefix or suffix for the current system.
4890
4891
</P
4892
><P
4893
>
4894
On a POSIX or Linux system,
4895
a build of the above example would look like:
4896
4897
</P
4898
><PRE
4899
CLASS="screen"
4900
> % <KBD
4901
CLASS="userinput"
4902
>scons -Q</KBD
4903
>
4904
cc -o f1.o -c f1.c
4905
cc -o f2.o -c f2.c
4906
cc -o f3.o -c f3.c
4907
ar rc libfoo.a f1.o f2.o f3.o
4908
ranlib libfoo.a
4909
cc -o prog.o -c prog.c
4910
cc -o prog prog.o -L. -lfoo -lbar
4911
</PRE
4912
><P
4913
>
4914
On a Windows system,
4915
a build of the above example would look like:
4916
4917
</P
4918
><PRE
4919
CLASS="screen"
4920
> C:\><KBD
4921
CLASS="userinput"
4922
>scons -Q</KBD
4923
>
4924
cl /nologo /c f1.c /Fof1.obj
4925
cl /nologo /c f2.c /Fof2.obj
4926
cl /nologo /c f3.c /Fof3.obj
4927
lib /nologo /OUT:foo.lib f1.obj f2.obj f3.obj
4928
cl /nologo /c prog.c /Foprog.obj
4929
link /nologo /OUT:prog.exe /LIBPATH:. foo.lib bar.lib prog.obj
4930
</PRE
4931
><P
4932
>
4933
As usual, notice that <SPAN
4934
CLASS="application"
4935
>SCons</SPAN
4936
> has taken care
4937
of constructing the correct command lines
4938
to link with the specified library on each system.
4939
4940
</P
4941
><P
4942
>
4943
Note also that,
4944
if you only have a single library to link with,
4945
you can specify the library name in single string,
4946
instead of a Python list,
4947
so that:
4948
4949
</P
4950
><PRE
4951
CLASS="programlisting"
4952
> Program('prog.c', LIBS='foo', LIBPATH='.')
4953
</PRE
4954
><P
4955
>
4956
is equivalent to:
4957
4958
</P
4959
><PRE
4960
CLASS="programlisting"
4961
> Program('prog.c', LIBS=['foo'], LIBPATH='.')
4962
</PRE
4963
><P
4964
>
4965
This is similar to the way that <SPAN
4966
CLASS="application"
4967
>SCons</SPAN
4968
>
4969
handles either a string or a list to
4970
specify a single source file.
4971
4972
</P
4973
></DIV
4974
><DIV
4975
CLASS="section"
4976
><HR><H2
4977
CLASS="section"
4978
><A
4979
NAME="AEN685"
4980
>4.3. Finding Libraries: the <CODE
4981
CLASS="envar"
4982
>$LIBPATH</CODE
4983
> Construction Variable</A
4984
></H2
4985
><P
4986
>
4987
By default, the linker will only look in
4988
certain system-defined directories for libraries.
4989
<SPAN
4990
CLASS="application"
4991
>SCons</SPAN
4992
> knows how to look for libraries
4993
in directories that you specify with the
4994
<A
4995
HREF="#cv-LIBPATH"
4996
><CODE
4997
CLASS="envar"
4998
>$LIBPATH</CODE
4999
></A
5000
> construction variable.
5001
<CODE
5002
CLASS="envar"
5003
>$LIBPATH</CODE
5004
> consists of a list of
5005
directory names, like so:
5006
5007
</P
5008
><PRE
5009
CLASS="programlisting"
5010
> Program('prog.c', LIBS = 'm',
5011
LIBPATH = ['/usr/lib', '/usr/local/lib'])
5012
</PRE
5013
><P
5014
>
5015
Using a Python list is preferred because it's portable
5016
across systems. Alternatively, you could put all of
5017
the directory names in a single string, separated by the
5018
system-specific path separator character:
5019
a colon on POSIX systems:
5020
5021
</P
5022
><PRE
5023
CLASS="programlisting"
5024
> LIBPATH = '/usr/lib:/usr/local/lib'
5025
</PRE
5026
><P
5027
>
5028
or a semi-colon on Windows systems:
5029
5030
</P
5031
><PRE
5032
CLASS="programlisting"
5033
> LIBPATH = 'C:\\lib;D:\\lib'
5034
</PRE
5035
><P
5036
>
5037
(Note that Python requires that the backslash
5038
separators in a Windows path name
5039
be escaped within strings.)
5040
5041
</P
5042
><P
5043
>
5044
When the linker is executed,
5045
<SPAN
5046
CLASS="application"
5047
>SCons</SPAN
5048
> will create appropriate flags
5049
so that the linker will look for
5050
libraries in the same directories as <SPAN
5051
CLASS="application"
5052
>SCons</SPAN
5053
>.
5054
So on a POSIX or Linux system,
5055
a build of the above example would look like:
5056
5057
</P
5058
><PRE
5059
CLASS="screen"
5060
> % <KBD
5061
CLASS="userinput"
5062
>scons -Q</KBD
5063
>
5064
cc -o prog.o -c prog.c
5065
cc -o prog prog.o -L/usr/lib -L/usr/local/lib -lm
5066
</PRE
5067
><P
5068
>
5069
On a Windows system,
5070
a build of the above example would look like:
5071
5072
</P
5073
><PRE
5074
CLASS="screen"
5075
> C:\><KBD
5076
CLASS="userinput"
5077
>scons -Q</KBD
5078
>
5079
cl /nologo /c prog.c /Foprog.obj
5080
link /nologo /OUT:prog.exe /LIBPATH:\usr\lib /LIBPATH:\usr\local\lib m.lib prog.obj
5081
</PRE
5082
><P
5083
>
5084
Note again that <SPAN
5085
CLASS="application"
5086
>SCons</SPAN
5087
> has taken care of
5088
the system-specific details of creating
5089
the right command-line options.
5090
5091
</P
5092
></DIV
5093
></DIV
5094
><DIV
5095
CLASS="chapter"
5096
><HR><H1
5097
><A
5098
NAME="chap-nodes"
5099
></A
5100
>Chapter 5. Node Objects</H1
5101
><P
5102
>
5103
Internally, <SPAN
5104
CLASS="application"
5105
>SCons</SPAN
5106
> represents all of the files
5107
and directories it knows about as <TT
5108
CLASS="literal"
5109
>Nodes</TT
5110
>.
5111
These internal objects
5112
(not object <SPAN
5113
CLASS="emphasis"
5114
><I
5115
CLASS="emphasis"
5116
>files</I
5117
></SPAN
5118
>)
5119
can be used in a variety of ways
5120
to make your <TT
5121
CLASS="filename"
5122
>SConscript</TT
5123
>
5124
files portable and easy to read.
5125
5126
</P
5127
><DIV
5128
CLASS="section"
5129
><HR><H2
5130
CLASS="section"
5131
><A
5132
NAME="AEN716"
5133
>5.1. Builder Methods Return Lists of Target Nodes</A
5134
></H2
5135
><P
5136
>
5137
All builder methods return a list of
5138
<CODE
5139
CLASS="classname"
5140
>Node</CODE
5141
> objects that identify the
5142
target file or files that will be built.
5143
These returned <TT
5144
CLASS="literal"
5145
>Nodes</TT
5146
> can be passed
5147
as source files to other builder methods,
5148
5149
</P
5150
><P
5151
>
5152
For example, suppose that we want to build
5153
the two object files that make up a program with different options.
5154
This would mean calling the <A
5155
HREF="#b-Object"
5156
><CODE
5157
CLASS="function"
5158
>Object</CODE
5159
></A
5160
>
5161
builder once for each object file,
5162
specifying the desired options:
5163
5164
</P
5165
><PRE
5166
CLASS="programlisting"
5167
> Object('hello.c', CCFLAGS='-DHELLO')
5168
Object('goodbye.c', CCFLAGS='-DGOODBYE')
5169
</PRE
5170
><P
5171
>
5172
One way to combine these object files
5173
into the resulting program
5174
would be to call the <A
5175
HREF="#b-Program"
5176
><CODE
5177
CLASS="function"
5178
>Program</CODE
5179
></A
5180
>
5181
builder with the names of the object files
5182
listed as sources:
5183
5184
</P
5185
><PRE
5186
CLASS="programlisting"
5187
> Object('hello.c', CCFLAGS='-DHELLO')
5188
Object('goodbye.c', CCFLAGS='-DGOODBYE')
5189
Program(['hello.o', 'goodbye.o'])
5190
</PRE
5191
><P
5192
>
5193
The problem with listing the names as strings
5194
is that our <TT
5195
CLASS="filename"
5196
>SConstruct</TT
5197
> file is no longer portable
5198
across operating systems.
5199
It won't, for example, work on Windows
5200
because the object files there would be
5201
named <TT
5202
CLASS="filename"
5203
>hello.obj</TT
5204
> and <TT
5205
CLASS="filename"
5206
>goodbye.obj</TT
5207
>,
5208
not <TT
5209
CLASS="filename"
5210
>hello.o</TT
5211
> and <TT
5212
CLASS="filename"
5213
>goodbye.o</TT
5214
>.
5215
5216
</P
5217
><P
5218
>
5219
A better solution is to assign the lists of targets
5220
returned by the calls to the <CODE
5221
CLASS="function"
5222
>Object</CODE
5223
> builder to variables,
5224
which we can then concatenate in our
5225
call to the <CODE
5226
CLASS="function"
5227
>Program</CODE
5228
> builder:
5229
5230
</P
5231
><PRE
5232
CLASS="programlisting"
5233
> hello_list = Object('hello.c', CCFLAGS='-DHELLO')
5234
goodbye_list = Object('goodbye.c', CCFLAGS='-DGOODBYE')
5235
Program(hello_list + goodbye_list)
5236
</PRE
5237
><P
5238
>
5239
This makes our <TT
5240
CLASS="filename"
5241
>SConstruct</TT
5242
> file portable again,
5243
the build output on Linux looking like:
5244
5245
</P
5246
><PRE
5247
CLASS="screen"
5248
> % <KBD
5249
CLASS="userinput"
5250
>scons -Q</KBD
5251
>
5252
cc -o goodbye.o -c -DGOODBYE goodbye.c
5253
cc -o hello.o -c -DHELLO hello.c
5254
cc -o hello hello.o goodbye.o
5255
</PRE
5256
><P
5257
>
5258
And on Windows:
5259
5260
</P
5261
><PRE
5262
CLASS="screen"
5263
> C:\><KBD
5264
CLASS="userinput"
5265
>scons -Q</KBD
5266
>
5267
cl -DGOODBYE /c goodbye.c /Fogoodbye.obj
5268
cl -DHELLO /c hello.c /Fohello.obj
5269
link /nologo /OUT:hello.exe hello.obj goodbye.obj
5270
</PRE
5271
><P
5272
>
5273
We'll see examples of using the list of nodes
5274
returned by builder methods throughout
5275
the rest of this guide.
5276
5277
</P
5278
></DIV
5279
><DIV
5280
CLASS="section"
5281
><HR><H2
5282
CLASS="section"
5283
><A
5284
NAME="AEN747"
5285
>5.2. Explicitly Creating File and Directory Nodes</A
5286
></H2
5287
><P
5288
>
5289
It's worth mentioning here that
5290
<SPAN
5291
CLASS="application"
5292
>SCons</SPAN
5293
> maintains a clear distinction
5294
between Nodes that represent files
5295
and Nodes that represent directories.
5296
<SPAN
5297
CLASS="application"
5298
>SCons</SPAN
5299
> supports <CODE
5300
CLASS="function"
5301
>File</CODE
5302
> and <CODE
5303
CLASS="function"
5304
>Dir</CODE
5305
>
5306
functions that, repectively,
5307
return a file or directory Node:
5308
5309
</P
5310
><PRE
5311
CLASS="programlisting"
5312
> hello_c = File('hello.c')
5313
Program(hello_c)
5314
5315
classes = Dir('classes')
5316
Java(classes, 'src')
5317
</PRE
5318
><P
5319
>
5320
Normally, you don't need to call
5321
<CODE
5322
CLASS="function"
5323
>File</CODE
5324
> or <CODE
5325
CLASS="function"
5326
>Dir</CODE
5327
> directly,
5328
because calling a builder method automatically
5329
treats strings as the names of files or directories,
5330
and translates them into
5331
the Node objects for you.
5332
The <CODE
5333
CLASS="function"
5334
>File</CODE
5335
> and <CODE
5336
CLASS="function"
5337
>Dir</CODE
5338
> functions can come in handy
5339
in situations where you need to explicitly
5340
instruct <SPAN
5341
CLASS="application"
5342
>SCons</SPAN
5343
> about the type of Node being
5344
passed to a builder or other function,
5345
or unambiguously refer to a specific
5346
file in a directory tree.
5347
5348
5349
</P
5350
><P
5351
>
5352
There are also times when you may need to
5353
refer to an entry in a file system
5354
without knowing in advance
5355
whether it's a file or a directory.
5356
For those situations,
5357
<SPAN
5358
CLASS="application"
5359
>SCons</SPAN
5360
> also supports an <CODE
5361
CLASS="function"
5362
>Entry</CODE
5363
> function,
5364
which returns a Node
5365
that can represent either a file or a directory.
5366
5367
</P
5368
><PRE
5369
CLASS="programlisting"
5370
> xyzzy = Entry('xyzzy')
5371
</PRE
5372
><P
5373
>
5374
The returned <TT
5375
CLASS="literal"
5376
>xyzzy</TT
5377
> Node
5378
will be turned into a file or directory Node
5379
the first time it is used by a builder method
5380
or other function that
5381
requires one vs. the other.
5382
5383
</P
5384
></DIV
5385
><DIV
5386
CLASS="section"
5387
><HR><H2
5388
CLASS="section"
5389
><A
5390
NAME="AEN767"
5391
>5.3. Printing <CODE
5392
CLASS="classname"
5393
>Node</CODE
5394
> File Names</A
5395
></H2
5396
><P
5397
>
5398
One of the most common things you can do
5399
with a Node is use it to print the
5400
file name that the node represents.
5401
For example, the following <TT
5402
CLASS="filename"
5403
>SConstruct</TT
5404
> file:
5405
5406
</P
5407
><PRE
5408
CLASS="programlisting"
5409
> hello_c = File('hello.c')
5410
Program(hello_c)
5411
5412
classes = Dir('classes')
5413
Java(classes, 'src')
5414
5415
object_list = Object('hello.c')
5416
program_list = Program(object_list)
5417
print "The object file is:", object_list[0]
5418
print "The program file is:", program_list[0]
5419
</PRE
5420
><P
5421
>
5422
Would print the following file names on a POSIX system:
5423
5424
</P
5425
><PRE
5426
CLASS="screen"
5427
> % <KBD
5428
CLASS="userinput"
5429
>scons -Q</KBD
5430
>
5431
The object file is: hello.o
5432
The program file is: hello
5433
cc -o hello.o -c hello.c
5434
cc -o hello hello.o
5435
</PRE
5436
><P
5437
>
5438
And the following file names on a Windows system:
5439
5440
</P
5441
><PRE
5442
CLASS="screen"
5443
> C:\><KBD
5444
CLASS="userinput"
5445
>scons -Q</KBD
5446
>
5447
The object file is: hello.obj
5448
The program file is: hello.exe
5449
cl /nologo /c hello.c /Fohello.obj
5450
link /nologo /OUT:hello.exe hello.obj
5451
</PRE
5452
></DIV
5453
><DIV
5454
CLASS="section"
5455
><HR><H2
5456
CLASS="section"
5457
><A
5458
NAME="AEN779"
5459
>5.4. Using a <CODE
5460
CLASS="classname"
5461
>Node</CODE
5462
>'s File Name as a String</A
5463
></H2
5464
><P
5465
>
5466
Printing a <CODE
5467
CLASS="classname"
5468
>Node</CODE
5469
>'s name
5470
as described in the previous section
5471
works because the string representation of a <CODE
5472
CLASS="classname"
5473
>Node</CODE
5474
>
5475
is the name of the file.
5476
If you want to do something other than
5477
print the name of the file,
5478
you can fetch it by using the builtin Python
5479
<CODE
5480
CLASS="function"
5481
>str</CODE
5482
> function.
5483
For example, if you want to use the Python
5484
<CODE
5485
CLASS="function"
5486
>os.path.exists</CODE
5487
>
5488
to figure out whether a file
5489
exists while the <TT
5490
CLASS="filename"
5491
>SConstruct</TT
5492
> file
5493
is being read and executed,
5494
you can fetch the string as follows:
5495
5496
</P
5497
><PRE
5498
CLASS="programlisting"
5499
> import os.path
5500
program_list = Program('hello.c')
5501
program_name = str(program_list[0])
5502
if not os.path.exists(program_name):
5503
print program_name, "does not exist!"
5504
</PRE
5505
><P
5506
>
5507
Which executes as follows on a POSIX system:
5508
5509
</P
5510
><PRE
5511
CLASS="screen"
5512
> % <KBD
5513
CLASS="userinput"
5514
>scons -Q</KBD
5515
>
5516
hello does not exist!
5517
cc -o hello.o -c hello.c
5518
cc -o hello hello.o
5519
</PRE
5520
></DIV
5521
></DIV
5522
><DIV
5523
CLASS="chapter"
5524
><HR><H1
5525
><A
5526
NAME="chap-depends"
5527
></A
5528
>Chapter 6. Dependencies</H1
5529
><P
5530
>
5531
So far we've seen how <SPAN
5532
CLASS="application"
5533
>SCons</SPAN
5534
> handles one-time builds.
5535
But one of the main functions of a build tool like <SPAN
5536
CLASS="application"
5537
>SCons</SPAN
5538
>
5539
is to rebuild only the necessary things
5540
when source files change--or, put another way,
5541
<SPAN
5542
CLASS="application"
5543
>SCons</SPAN
5544
> should <SPAN
5545
CLASS="emphasis"
5546
><I
5547
CLASS="emphasis"
5548
>not</I
5549
></SPAN
5550
>
5551
waste time rebuilding things that have already been built.
5552
You can see this at work simply by re-invoking <SPAN
5553
CLASS="application"
5554
>SCons</SPAN
5555
>
5556
after building our simple <SPAN
5557
CLASS="application"
5558
>hello</SPAN
5559
> example:
5560
5561
</P
5562
><PRE
5563
CLASS="screen"
5564
> % <KBD
5565
CLASS="userinput"
5566
>scons -Q</KBD
5567
>
5568
cc -o hello.o -c hello.c
5569
cc -o hello hello.o
5570
% <KBD
5571
CLASS="userinput"
5572
>scons -Q</KBD
5573
>
5574
scons: `.' is up to date.
5575
</PRE
5576
><P
5577
>
5578
The second time it is executed,
5579
<SPAN
5580
CLASS="application"
5581
>SCons</SPAN
5582
> realizes that the <SPAN
5583
CLASS="application"
5584
>hello</SPAN
5585
> program
5586
is up-to-date with respect to the current <TT
5587
CLASS="filename"
5588
>hello.c</TT
5589
> source file,
5590
and avoids rebuilding it.
5591
You can see this more clearly by naming
5592
the <SPAN
5593
CLASS="application"
5594
>hello</SPAN
5595
> program explicitly on the command line:
5596
5597
</P
5598
><PRE
5599
CLASS="screen"
5600
> % <KBD
5601
CLASS="userinput"
5602
>scons -Q hello</KBD
5603
>
5604
cc -o hello.o -c hello.c
5605
cc -o hello hello.o
5606
% <KBD
5607
CLASS="userinput"
5608
>scons -Q hello</KBD
5609
>
5610
scons: `hello' is up to date.
5611
</PRE
5612
><P
5613
>
5614
Note that <SPAN
5615
CLASS="application"
5616
>SCons</SPAN
5617
> reports <TT
5618
CLASS="literal"
5619
>"...is up to date"</TT
5620
>
5621
only for target files named explicitly on the command line,
5622
to avoid cluttering the output.
5623
5624
</P
5625
><DIV
5626
CLASS="section"
5627
><HR><H2
5628
CLASS="section"
5629
><A
5630
NAME="AEN815"
5631
>6.1. Deciding When an Input File Has Changed: the <CODE
5632
CLASS="function"
5633
>Decider</CODE
5634
> Function</A
5635
></H2
5636
><P
5637
>
5638
Another aspect of avoiding unnecessary rebuilds
5639
is the fundamental build tool behavior
5640
of <SPAN
5641
CLASS="emphasis"
5642
><I
5643
CLASS="emphasis"
5644
>rebuilding</I
5645
></SPAN
5646
>
5647
things when an input file changes,
5648
so that the built software is up to date.
5649
By default,
5650
<SPAN
5651
CLASS="application"
5652
>SCons</SPAN
5653
> keeps track of this through an
5654
MD5 <TT
5655
CLASS="literal"
5656
>signature</TT
5657
>, or checksum, of the contents of each file,
5658
although you can easily configure
5659
<SPAN
5660
CLASS="application"
5661
>SCons</SPAN
5662
> to use the
5663
modification times (or time stamps)
5664
instead.
5665
You can even specify your own Python function
5666
for deciding if an input file has changed.
5667
5668
</P
5669
><DIV
5670
CLASS="section"
5671
><HR><H3
5672
CLASS="section"
5673
><A
5674
NAME="AEN823"
5675
>6.1.1. Using MD5 Signatures to Decide if a File Has Changed</A
5676
></H3
5677
><P
5678
>
5679
By default,
5680
<SPAN
5681
CLASS="application"
5682
>SCons</SPAN
5683
> keeps track of whether a file has changed
5684
based on an MD5 checksum of the file's contents,
5685
not the file's modification time.
5686
This means that you may be surprised by the
5687
default <SPAN
5688
CLASS="application"
5689
>SCons</SPAN
5690
> behavior if you are used to the
5691
<SPAN
5692
CLASS="application"
5693
>Make</SPAN
5694
> convention of forcing
5695
a rebuild by updating the file's modification time
5696
(using the <SPAN
5697
CLASS="application"
5698
>touch</SPAN
5699
> command, for example):
5700
5701
</P
5702
><PRE
5703
CLASS="screen"
5704
> % <KBD
5705
CLASS="userinput"
5706
>scons -Q hello</KBD
5707
>
5708
cc -o hello.o -c hello.c
5709
cc -o hello hello.o
5710
% <KBD
5711
CLASS="userinput"
5712
>touch hello.c</KBD
5713
>
5714
% <KBD
5715
CLASS="userinput"
5716
>scons -Q hello</KBD
5717
>
5718
scons: `hello' is up to date.
5719
</PRE
5720
><P
5721
>
5722
Even though the file's modification time has changed,
5723
<SPAN
5724
CLASS="application"
5725
>SCons</SPAN
5726
> realizes that the contents of the
5727
<TT
5728
CLASS="filename"
5729
>hello.c</TT
5730
> file have <SPAN
5731
CLASS="emphasis"
5732
><I
5733
CLASS="emphasis"
5734
>not</I
5735
></SPAN
5736
> changed,
5737
and therefore that the <SPAN
5738
CLASS="application"
5739
>hello</SPAN
5740
> program
5741
need not be rebuilt.
5742
This avoids unnecessary rebuilds when,
5743
for example, someone rewrites the
5744
contents of a file without making a change.
5745
But if the contents of the file really do change,
5746
then <SPAN
5747
CLASS="application"
5748
>SCons</SPAN
5749
> detects the change
5750
and rebuilds the program as required:
5751
5752
</P
5753
><PRE
5754
CLASS="screen"
5755
> % <KBD
5756
CLASS="userinput"
5757
>scons -Q hello</KBD
5758
>
5759
cc -o hello.o -c hello.c
5760
cc -o hello hello.o
5761
% <KBD
5762
CLASS="userinput"
5763
>edit hello.c</KBD
5764
>
5765
[CHANGE THE CONTENTS OF hello.c]
5766
% <KBD
5767
CLASS="userinput"
5768
>scons -Q hello</KBD
5769
>
5770
cc -o hello.o -c hello.c
5771
cc -o hello hello.o
5772
</PRE
5773
><P
5774
>
5775
Note that you can, if you wish,
5776
specify this default behavior
5777
(MD5 signatures) explicitly
5778
using the <CODE
5779
CLASS="function"
5780
>Decider</CODE
5781
> function as follows:
5782
5783
</P
5784
><PRE
5785
CLASS="programlisting"
5786
> Program('hello.c')
5787
Decider('MD5')
5788
</PRE
5789
><P
5790
>
5791
You can also use the string <TT
5792
CLASS="literal"
5793
>'content'</TT
5794
>
5795
as a synonym for <TT
5796
CLASS="literal"
5797
>'MD5'</TT
5798
>
5799
when calling the <CODE
5800
CLASS="function"
5801
>Decider</CODE
5802
> function.
5803
5804
</P
5805
><DIV
5806
CLASS="section"
5807
><HR><H4
5808
CLASS="section"
5809
><A
5810
NAME="AEN851"
5811
>6.1.1.1. Ramifications of Using MD5 Signatures</A
5812
></H4
5813
><P
5814
>
5815
Using MD5 Signatures to decide if an input file has changed
5816
has one surprising benefit:
5817
if a source file has been changed
5818
in such a way that the contents of the
5819
rebuilt target file(s)
5820
will be exactly the same as the last time
5821
the file was built,
5822
then any "downstream" target files
5823
that depend on the rebuilt-but-not-changed target
5824
file actually need not be rebuilt.
5825
5826
</P
5827
><P
5828
>
5829
So if, for example,
5830
a user were to only change a comment in a <TT
5831
CLASS="filename"
5832
>hello.c</TT
5833
> file,
5834
then the rebuilt <TT
5835
CLASS="filename"
5836
>hello.o</TT
5837
> file
5838
would be exactly the same as the one previously built
5839
(assuming the compiler doesn't put any build-specific
5840
information in the object file).
5841
<SPAN
5842
CLASS="application"
5843
>SCons</SPAN
5844
> would then realize that it would not
5845
need to rebuild the <SPAN
5846
CLASS="application"
5847
>hello</SPAN
5848
> program as follows:
5849
5850
</P
5851
><PRE
5852
CLASS="screen"
5853
> % <KBD
5854
CLASS="userinput"
5855
>scons -Q hello</KBD
5856
>
5857
cc -o hello.o -c hello.c
5858
cc -o hello hello.o
5859
% <KBD
5860
CLASS="userinput"
5861
>edit hello.c</KBD
5862
>
5863
[CHANGE A COMMENT IN hello.c]
5864
% <KBD
5865
CLASS="userinput"
5866
>scons -Q hello</KBD
5867
>
5868
cc -o hello.o -c hello.c
5869
scons: `hello' is up to date.
5870
</PRE
5871
><P
5872
>
5873
In essence, <SPAN
5874
CLASS="application"
5875
>SCons</SPAN
5876
>
5877
"short-circuits" any dependent builds
5878
when it realizes that a target file
5879
has been rebuilt to exactly the same file as the last build.
5880
This does take some extra processing time
5881
to read the contents of the target (<TT
5882
CLASS="filename"
5883
>hello.o</TT
5884
>) file,
5885
but often saves time when the rebuild that was avoided
5886
would have been time-consuming and expensive.
5887
5888
</P
5889
></DIV
5890
></DIV
5891
><DIV
5892
CLASS="section"
5893
><HR><H3
5894
CLASS="section"
5895
><A
5896
NAME="AEN866"
5897
>6.1.2. Using Time Stamps to Decide If a File Has Changed</A
5898
></H3
5899
><P
5900
>
5901
If you prefer, you can
5902
configure <SPAN
5903
CLASS="application"
5904
>SCons</SPAN
5905
> to use the modification time
5906
of a file, not the file contents,
5907
when deciding if a target needs to be rebuilt.
5908
<SPAN
5909
CLASS="application"
5910
>SCons</SPAN
5911
> gives you two ways to use time stamps
5912
to decide if an input file has changed
5913
since the last time a target has been built.
5914
5915
</P
5916
><P
5917
>
5918
The most familiar way to use time stamps
5919
is the way <SPAN
5920
CLASS="application"
5921
>Make</SPAN
5922
> does:
5923
that is, have <SPAN
5924
CLASS="application"
5925
>SCons</SPAN
5926
> decide
5927
and target must be rebuilt if
5928
if a source file's modification time is
5929
<SPAN
5930
CLASS="emphasis"
5931
><I
5932
CLASS="emphasis"
5933
>newer</I
5934
></SPAN
5935
>
5936
than the target file.
5937
To do this, call the <CODE
5938
CLASS="function"
5939
>Decider</CODE
5940
>
5941
function as follows:
5942
5943
</P
5944
><PRE
5945
CLASS="programlisting"
5946
> Program('hello.c')
5947
Decider('timestamp-newer')
5948
</PRE
5949
><P
5950
>
5951
This makes <SPAN
5952
CLASS="application"
5953
>SCons</SPAN
5954
> act like <SPAN
5955
CLASS="application"
5956
>Make</SPAN
5957
>
5958
when a file's modification time is updated
5959
(using the <SPAN
5960
CLASS="application"
5961
>touch</SPAN
5962
> command, for example):
5963
5964
</P
5965
><PRE
5966
CLASS="screen"
5967
> % <KBD
5968
CLASS="userinput"
5969
>scons -Q hello</KBD
5970
>
5971
cc -o hello.o -c hello.c
5972
cc -o hello hello.o
5973
% <KBD
5974
CLASS="userinput"
5975
>touch hello.c</KBD
5976
>
5977
% <KBD
5978
CLASS="userinput"
5979
>scons -Q hello</KBD
5980
>
5981
cc -o hello.o -c hello.c
5982
cc -o hello hello.o
5983
</PRE
5984
><P
5985
>
5986
And, in fact, because this behavior is the same
5987
as the behavior of <SPAN
5988
CLASS="application"
5989
>Make</SPAN
5990
>,
5991
you can also use the string <TT
5992
CLASS="literal"
5993
>'make'</TT
5994
>
5995
as a synonym for <TT
5996
CLASS="literal"
5997
>'timestamp-newer'</TT
5998
>
5999
when calling the <CODE
6000
CLASS="function"
6001
>Decider</CODE
6002
> function:
6003
6004
</P
6005
><PRE
6006
CLASS="programlisting"
6007
> Program('hello.c')
6008
Decider('make')
6009
</PRE
6010
><P
6011
>
6012
One drawback to using times stamps exactly like <SPAN
6013
CLASS="application"
6014
>Make</SPAN
6015
>
6016
is that if an input file's modification time suddenly
6017
becomes <SPAN
6018
CLASS="emphasis"
6019
><I
6020
CLASS="emphasis"
6021
>older</I
6022
></SPAN
6023
> than a target file,
6024
the target file will not be rebuilt.
6025
This can happen if an old copy of a source file is restored
6026
from a backup archive, for example.
6027
The contents of the restored file will likely be different
6028
than they were the last time a dependent target was built,
6029
but the target won't be rebuilt
6030
because the modification time of the source file
6031
is not newer than the target.
6032
6033
</P
6034
><P
6035
>
6036
Because <SPAN
6037
CLASS="application"
6038
>SCons</SPAN
6039
> actually stores information
6040
about the source files' time stamps whenever a target is built,
6041
it can handle this situation by checking for
6042
an exact match of the source file time stamp,
6043
instead of just whether or not the source file
6044
is newer than the target file.
6045
To do this, specify the argument
6046
<TT
6047
CLASS="literal"
6048
>'timestamp-match'</TT
6049
>
6050
when calling the <CODE
6051
CLASS="function"
6052
>Decider</CODE
6053
> function:
6054
6055
</P
6056
><PRE
6057
CLASS="programlisting"
6058
> Program('hello.c')
6059
Decider('timestamp-match')
6060
</PRE
6061
><P
6062
>
6063
When configured this way,
6064
<SPAN
6065
CLASS="application"
6066
>SCons</SPAN
6067
> will rebuild a target whenever
6068
a source file's modification time has changed.
6069
So if we use the <TT
6070
CLASS="literal"
6071
>touch -t</TT
6072
>
6073
option to change the modification time of
6074
<TT
6075
CLASS="filename"
6076
>hello.c</TT
6077
> to an old date (January 1, 1989),
6078
<SPAN
6079
CLASS="application"
6080
>SCons</SPAN
6081
> will still rebuild the target file:
6082
6083
</P
6084
><PRE
6085
CLASS="screen"
6086
> % <KBD
6087
CLASS="userinput"
6088
>scons -Q hello</KBD
6089
>
6090
cc -o hello.o -c hello.c
6091
cc -o hello hello.o
6092
% <KBD
6093
CLASS="userinput"
6094
>touch -t 198901010000 hello.c</KBD
6095
>
6096
% <KBD
6097
CLASS="userinput"
6098
>scons -Q hello</KBD
6099
>
6100
cc -o hello.o -c hello.c
6101
scons: `hello' is up to date.
6102
</PRE
6103
><P
6104
>
6105
In general, the only reason to prefer
6106
<TT
6107
CLASS="literal"
6108
>timestamp-newer</TT
6109
>
6110
instead of
6111
<TT
6112
CLASS="literal"
6113
>timestamp-match</TT
6114
>,
6115
would be if you have some specific reason
6116
to require this <SPAN
6117
CLASS="application"
6118
>Make</SPAN
6119
>-like behavior of
6120
not rebuilding a target when an otherwise-modified
6121
source file is older.
6122
6123
</P
6124
></DIV
6125
><DIV
6126
CLASS="section"
6127
><HR><H3
6128
CLASS="section"
6129
><A
6130
NAME="AEN912"
6131
>6.1.3. Deciding If a File Has Changed Using Both MD Signatures and Time Stamps</A
6132
></H3
6133
><P
6134
>
6135
As a performance enhancement,
6136
<SPAN
6137
CLASS="application"
6138
>SCons</SPAN
6139
> provides a way to use
6140
MD5 checksums of file contents
6141
but to only read the contents
6142
whenever the file's timestamp has changed.
6143
To do this, call the <CODE
6144
CLASS="function"
6145
>Decider</CODE
6146
>
6147
function with <TT
6148
CLASS="literal"
6149
>'MD5-timestamp'</TT
6150
>
6151
argument as follows:
6152
6153
</P
6154
><PRE
6155
CLASS="programlisting"
6156
> Program('hello.c')
6157
Decider('MD5-timestamp')
6158
</PRE
6159
><P
6160
>
6161
So configured, <SPAN
6162
CLASS="application"
6163
>SCons</SPAN
6164
> will still behave like
6165
it does when using <TT
6166
CLASS="literal"
6167
>Decider('MD5')</TT
6168
>:
6169
6170
</P
6171
><PRE
6172
CLASS="screen"
6173
> % <KBD
6174
CLASS="userinput"
6175
>scons -Q hello</KBD
6176
>
6177
cc -o hello.o -c hello.c
6178
cc -o hello hello.o
6179
% <KBD
6180
CLASS="userinput"
6181
>touch hello.c</KBD
6182
>
6183
% <KBD
6184
CLASS="userinput"
6185
>scons -Q hello</KBD
6186
>
6187
scons: `hello' is up to date.
6188
% <KBD
6189
CLASS="userinput"
6190
>edit hello.c</KBD
6191
>
6192
[CHANGE THE CONTENTS OF hello.c]
6193
% <KBD
6194
CLASS="userinput"
6195
>scons -Q hello</KBD
6196
>
6197
cc -o hello.o -c hello.c
6198
cc -o hello hello.o
6199
</PRE
6200
><P
6201
>
6202
However, the second call to <SPAN
6203
CLASS="application"
6204
>SCons</SPAN
6205
> in the above output,
6206
when the build is up-to-date,
6207
will have been performed by simply looking at the
6208
modification time of the <TT
6209
CLASS="filename"
6210
>hello.c</TT
6211
> file,
6212
not by opening it and performing
6213
an MD5 checksum calcuation on its contents.
6214
This can significantly speed up many up-to-date builds.
6215
6216
</P
6217
><P
6218
>
6219
The only drawback to using
6220
<TT
6221
CLASS="literal"
6222
>Decider('MD5-timestamp')</TT
6223
>
6224
is that <SPAN
6225
CLASS="application"
6226
>SCons</SPAN
6227
> will <SPAN
6228
CLASS="emphasis"
6229
><I
6230
CLASS="emphasis"
6231
>not</I
6232
></SPAN
6233
>
6234
rebuild a target file if a source file was modified
6235
within one second of the last time <SPAN
6236
CLASS="application"
6237
>SCons</SPAN
6238
> built the file.
6239
While most developers are programming,
6240
this isn't a problem in practice,
6241
since it's unlikely that someone will have built
6242
and then thought quickly enought to make a substantive
6243
change to a source file within one second.
6244
Certain build scripts or
6245
continuous integration tools may, however,
6246
rely on the ability to applying changes to files
6247
automatically and then rebuild as quickly as possible,
6248
in which case use of
6249
<TT
6250
CLASS="literal"
6251
>Decider('MD5-timestamp')</TT
6252
>
6253
may not be appropriate.
6254
6255
</P
6256
></DIV
6257
><DIV
6258
CLASS="section"
6259
><HR><H3
6260
CLASS="section"
6261
><A
6262
NAME="AEN937"
6263
>6.1.4. Writing Your Own Custom <CODE
6264
CLASS="function"
6265
>Decider</CODE
6266
> Function</A
6267
></H3
6268
><P
6269
>
6270
The different string values that we've passed to
6271
the <CODE
6272
CLASS="function"
6273
>Decider</CODE
6274
> function are essentially used by <SPAN
6275
CLASS="application"
6276
>SCons</SPAN
6277
>
6278
to pick one of several specific internal functions
6279
that implement various ways of deciding if a dependency
6280
(usually a source file)
6281
has changed since a target file has been built.
6282
As it turns out,
6283
you can also supply your own function
6284
to decide if a dependency has changed.
6285
6286
</P
6287
><P
6288
>
6289
For example, suppose we have an input file
6290
that contains a lot of data,
6291
in some specific regular format,
6292
that is used to rebuild a lot of different target files,
6293
but each target file really only depends on
6294
one particular section of the input file.
6295
We'd like to have each target file depend on
6296
only its section of the input file.
6297
However, since the input file may contain a lot of data,
6298
we only want to open the input file if its timestamp has changed.
6299
This could done with a custom
6300
<CODE
6301
CLASS="function"
6302
>Decider</CODE
6303
> function that might look something like this:
6304
6305
</P
6306
><PRE
6307
CLASS="programlisting"
6308
> Program('hello.c')
6309
def decide_if_changed(dependency, target, prev_ni):
6310
if self.get_timestamp() != prev_ni.timestamp:
6311
dep = str(dependency)
6312
tgt = str(target)
6313
if specific_part_of_file_has_changed(dep, tgt):
6314
return True
6315
return False
6316
Decider(decide_if_changed)
6317
</PRE
6318
><P
6319
>
6320
Note that in the function definition,
6321
the <CODE
6322
CLASS="varname"
6323
>dependency</CODE
6324
>
6325
(input file) is the first argument,
6326
and then the <CODE
6327
CLASS="varname"
6328
>target</CODE
6329
>.
6330
Both of these are passed to the functions as
6331
SCons <CODE
6332
CLASS="classname"
6333
>Node</CODE
6334
> objects,
6335
which we convert to strings using the Python
6336
<CODE
6337
CLASS="function"
6338
>str()</CODE
6339
>.
6340
6341
</P
6342
><P
6343
>
6344
The third argument, <CODE
6345
CLASS="varname"
6346
>prev_ni</CODE
6347
>,
6348
is an object that holds the
6349
signature or timestamp information
6350
that was recorded about the dependency
6351
the last time the target was built.
6352
A <CODE
6353
CLASS="varname"
6354
>prev_ni</CODE
6355
> object can hold
6356
different information,
6357
depending on the type of thing that the
6358
<CODE
6359
CLASS="varname"
6360
>dependency</CODE
6361
> argument represents.
6362
For normal files,
6363
the <CODE
6364
CLASS="varname"
6365
>prev_ni</CODE
6366
> object
6367
has the following attributes:
6368
6369
</P
6370
><P
6371
></P
6372
><DIV
6373
CLASS="variablelist"
6374
><DL
6375
><DT
6376
>.csig</DT
6377
><DD
6378
><P
6379
> The <SPAN
6380
CLASS="emphasis"
6381
><I
6382
CLASS="emphasis"
6383
>content signature</I
6384
></SPAN
6385
>,
6386
or MD5 checksum, of the contents of the
6387
<CODE
6388
CLASS="varname"
6389
>dependency</CODE
6390
>
6391
file the list time the <CODE
6392
CLASS="varname"
6393
>target</CODE
6394
> was built.
6395
</P
6396
></DD
6397
><DT
6398
>.size</DT
6399
><DD
6400
><P
6401
> The size in bytes of the <CODE
6402
CLASS="varname"
6403
>dependency</CODE
6404
>
6405
file the list time the target was built.
6406
</P
6407
></DD
6408
><DT
6409
>.timestamp</DT
6410
><DD
6411
><P
6412
> The modification time of the <CODE
6413
CLASS="varname"
6414
>dependency</CODE
6415
>
6416
file the list time the <CODE
6417
CLASS="varname"
6418
>target</CODE
6419
> was built.
6420
</P
6421
></DD
6422
></DL
6423
></DIV
6424
><P
6425
>
6426
Note that ignoring some of the arguments
6427
in your custom <CODE
6428
CLASS="function"
6429
>Decider</CODE
6430
> function
6431
is a perfectly normal thing to do,
6432
if they don't impact the way you want to
6433
decide if the dependency file has changed.
6434
6435
</P
6436
></DIV
6437
><DIV
6438
CLASS="section"
6439
><HR><H3
6440
CLASS="section"
6441
><A
6442
NAME="AEN977"
6443
>6.1.5. Mixing Different Ways of Deciding If a File Has Changed</A
6444
></H3
6445
><P
6446
>
6447
The previous examples have all demonstrated calling
6448
the global <CODE
6449
CLASS="function"
6450
>Decider</CODE
6451
> function
6452
to configure all dependency decisions that <SPAN
6453
CLASS="application"
6454
>SCons</SPAN
6455
> makes.
6456
Sometimes, however, you want to be able to configure
6457
different decision-making for different targets.
6458
When that's necessary, you can use the
6459
<CODE
6460
CLASS="function"
6461
>env.Decider</CODE
6462
>
6463
method to affect only the configuration
6464
decisions for targets built with a
6465
specific construction environment.
6466
6467
</P
6468
><P
6469
>
6470
For example, if we arbitrarily want to build
6471
one program using MD5 checkums
6472
and another use file modification times
6473
from the same source
6474
we might configure it this way:
6475
6476
</P
6477
><PRE
6478
CLASS="programlisting"
6479
> env1 = Environment(CPPPATH = ['.'])
6480
env2 = env1.Clone()
6481
env2.Decider('timestamp-match')
6482
env1.Program('prog-MD5', 'program1.c')
6483
env2.Program('prog-timestamp', 'program2.c')
6484
</PRE
6485
><P
6486
>
6487
If both of the programs include the same
6488
<TT
6489
CLASS="filename"
6490
>inc.h</TT
6491
> file,
6492
then updating the modification time of
6493
<TT
6494
CLASS="filename"
6495
>inc.h</TT
6496
>
6497
(using the <SPAN
6498
CLASS="application"
6499
>touch</SPAN
6500
> command)
6501
will cause only <TT
6502
CLASS="filename"
6503
>prog-timestamp</TT
6504
>
6505
to be rebuilt:
6506
6507
</P
6508
><PRE
6509
CLASS="screen"
6510
> % <KBD
6511
CLASS="userinput"
6512
>scons -Q</KBD
6513
>
6514
cc -o program1.o -c -I. program1.c
6515
cc -o prog-MD5 program1.o
6516
cc -o program2.o -c -I. program2.c
6517
cc -o prog-timestamp program2.o
6518
% <KBD
6519
CLASS="userinput"
6520
>touch inc.h</KBD
6521
>
6522
% <KBD
6523
CLASS="userinput"
6524
>scons -Q</KBD
6525
>
6526
cc -o program2.o -c -I. program2.c
6527
cc -o prog-timestamp program2.o
6528
</PRE
6529
></DIV
6530
></DIV
6531
><DIV
6532
CLASS="section"
6533
><HR><H2
6534
CLASS="section"
6535
><A
6536
NAME="AEN994"
6537
>6.2. Older Functions for Deciding When an Input File Has Changed</A
6538
></H2
6539
><P
6540
>
6541
<SPAN
6542
CLASS="application"
6543
>SCons</SPAN
6544
> still supports two functions that used to be the
6545
primary methods for configuring the
6546
decision about whether or not an input file has changed.
6547
Although they're not officially deprecated yet,
6548
their use is discouraged,
6549
mainly because they rely on a somewhat
6550
confusing distinction between how
6551
source files and target files are handled.
6552
These functions are documented here mainly in case you
6553
encounter them in existing <TT
6554
CLASS="filename"
6555
>SConscript</TT
6556
> files.
6557
6558
</P
6559
><DIV
6560
CLASS="section"
6561
><HR><H3
6562
CLASS="section"
6563
><A
6564
NAME="AEN999"
6565
>6.2.1. The <CODE
6566
CLASS="function"
6567
>SourceSignatures</CODE
6568
> Function</A
6569
></H3
6570
><P
6571
>
6572
The <CODE
6573
CLASS="function"
6574
>SourceSignatures</CODE
6575
> function is fairly straightforward,
6576
and supports two different argument values
6577
to configure whether source file changes should be decided
6578
using MD5 signatures:
6579
6580
</P
6581
><PRE
6582
CLASS="programlisting"
6583
> Program('hello.c')
6584
SourceSignatures('MD5')
6585
</PRE
6586
><P
6587
>
6588
Or using time stamps:
6589
6590
</P
6591
><PRE
6592
CLASS="programlisting"
6593
> Program('hello.c')
6594
SourceSignatures('timestamp')
6595
</PRE
6596
><P
6597
>
6598
These are roughly equivalent to specifying
6599
<CODE
6600
CLASS="function"
6601
>Decider('MD5')</CODE
6602
>
6603
or
6604
<CODE
6605
CLASS="function"
6606
>Decider('timestamp-match')</CODE
6607
>,
6608
respectively,
6609
although it only affects how SCons makes
6610
decisions about dependencies on
6611
<SPAN
6612
CLASS="emphasis"
6613
><I
6614
CLASS="emphasis"
6615
>source</I
6616
></SPAN
6617
> files--that is,
6618
files that are not built from any other files.
6619
6620
</P
6621
></DIV
6622
><DIV
6623
CLASS="section"
6624
><HR><H3
6625
CLASS="section"
6626
><A
6627
NAME="AEN1011"
6628
>6.2.2. The <CODE
6629
CLASS="function"
6630
>TargetSignatures</CODE
6631
> Function</A
6632
></H3
6633
><P
6634
>
6635
The <CODE
6636
CLASS="function"
6637
>TargetSignatures</CODE
6638
> function
6639
specifies how <SPAN
6640
CLASS="application"
6641
>SCons</SPAN
6642
> decides
6643
when a target file has changed
6644
<SPAN
6645
CLASS="emphasis"
6646
><I
6647
CLASS="emphasis"
6648
>when it is used as a
6649
dependency of (input to) another target</I
6650
></SPAN
6651
>--that is,
6652
the <CODE
6653
CLASS="function"
6654
>TargetSignatures</CODE
6655
> function configures
6656
how the signatures of "intermediate" target files
6657
are used when deciding if a "downstream" target file
6658
must be rebuilt.
6659
<A
6660
NAME="AEN1019"
6661
HREF="#FTN.AEN1019"
6662
><SPAN
6663
CLASS="footnote"
6664
>[2]</SPAN
6665
></A
6666
>
6667
6668
</P
6669
><P
6670
>
6671
The <CODE
6672
CLASS="function"
6673
>TargetSignatures</CODE
6674
> function supports the same
6675
<TT
6676
CLASS="literal"
6677
>'MD5'</TT
6678
> and <TT
6679
CLASS="literal"
6680
>'timestamp'</TT
6681
>
6682
argument values that are supported by the <CODE
6683
CLASS="function"
6684
>SourceSignatures</CODE
6685
>,
6686
with the same meanings, but applied to target files.
6687
That is, in the example:
6688
6689
</P
6690
><PRE
6691
CLASS="programlisting"
6692
> Program('hello.c')
6693
TargetSignatures('MD5')
6694
</PRE
6695
><P
6696
>
6697
The MD5 checksum of the <TT
6698
CLASS="filename"
6699
>hello.o</TT
6700
> target file
6701
will be used to decide if it has changed since the last
6702
time the "downstream" <SPAN
6703
CLASS="application"
6704
>hello</SPAN
6705
> target file was built.
6706
And in the example:
6707
6708
</P
6709
><PRE
6710
CLASS="programlisting"
6711
> Program('hello.c')
6712
TargetSignatures('timestamp')
6713
</PRE
6714
><P
6715
>
6716
The modification time of the <TT
6717
CLASS="filename"
6718
>hello.o</TT
6719
> target file
6720
will be used to decide if it has changed since the last
6721
time the "downstream" <SPAN
6722
CLASS="application"
6723
>hello</SPAN
6724
> target file was built.
6725
6726
</P
6727
><P
6728
>
6729
The <CODE
6730
CLASS="function"
6731
>TargetSignatures</CODE
6732
> function supports
6733
two additional argument values:
6734
<TT
6735
CLASS="literal"
6736
>'source'</TT
6737
> and <TT
6738
CLASS="literal"
6739
>'build'</TT
6740
>.
6741
The <TT
6742
CLASS="literal"
6743
>'source'</TT
6744
> argument
6745
specifies that decisions involving
6746
whether target files have changed
6747
since a previous build
6748
should use the same behavior
6749
for the decisions configured for source files
6750
(using the <CODE
6751
CLASS="function"
6752
>SourceSignatures</CODE
6753
> function).
6754
So in the example:
6755
6756
</P
6757
><PRE
6758
CLASS="programlisting"
6759
> Program('hello.c')
6760
TargetSignatures('source')
6761
SourceSignatures('timestamp')
6762
</PRE
6763
><P
6764
>
6765
All files, both targets and sources,
6766
will use modification times
6767
when deciding if an input file
6768
has changed since the last
6769
time a target was built.
6770
6771
</P
6772
><P
6773
>
6774
Lastly, the <TT
6775
CLASS="literal"
6776
>'build'</TT
6777
> argument
6778
specifies that <SPAN
6779
CLASS="application"
6780
>SCons</SPAN
6781
> should examine
6782
the build status of a target file
6783
and always rebuild a "downstream" target
6784
if the target file was itself rebuilt,
6785
without re-examining the contents or timestamp
6786
of the newly-built target file.
6787
If the target file was not rebuilt during
6788
this <SPAN
6789
CLASS="application"
6790
>scons</SPAN
6791
> invocation,
6792
then the target file will be examined
6793
the same way as configured by
6794
the <CODE
6795
CLASS="function"
6796
>SourceSignature</CODE
6797
> call
6798
to decide if it has changed.
6799
6800
</P
6801
><P
6802
>
6803
This mimics the behavior of
6804
<TT
6805
CLASS="literal"
6806
>build signatures</TT
6807
>
6808
in earlier versions of <SPAN
6809
CLASS="application"
6810
>SCons</SPAN
6811
>.
6812
A <TT
6813
CLASS="literal"
6814
>build signature</TT
6815
> re-combined
6816
signatures of all the input files
6817
that went into making the target file,
6818
so that the target file itself
6819
did not need to have its contents read
6820
to compute an MD5 signature.
6821
This can improve performance for some configurations,
6822
but is generally not as effective as using
6823
<TT
6824
CLASS="literal"
6825
>Decider('MD5-timestamp')</TT
6826
>.
6827
6828
</P
6829
></DIV
6830
></DIV
6831
><DIV
6832
CLASS="section"
6833
><HR><H2
6834
CLASS="section"
6835
><A
6836
NAME="AEN1056"
6837
>6.3. Implicit Dependencies: The <CODE
6838
CLASS="envar"
6839
>$CPPPATH</CODE
6840
> Construction Variable</A
6841
></H2
6842
><P
6843
>
6844
Now suppose that our "Hello, World!" program
6845
actually has an <TT
6846
CLASS="literal"
6847
>#include</TT
6848
> line
6849
to include the <TT
6850
CLASS="filename"
6851
>hello.h</TT
6852
> file in the compilation:
6853
6854
</P
6855
><PRE
6856
CLASS="programlisting"
6857
> #include <hello.h>
6858
int
6859
main()
6860
{
6861
printf("Hello, %s!\n", string);
6862
}
6863
</PRE
6864
><P
6865
>
6866
And, for completeness, the <TT
6867
CLASS="filename"
6868
>hello.h</TT
6869
> file looks like this:
6870
6871
</P
6872
><PRE
6873
CLASS="programlisting"
6874
> #define string "world"
6875
</PRE
6876
><P
6877
>
6878
In this case, we want <SPAN
6879
CLASS="application"
6880
>SCons</SPAN
6881
> to recognize that,
6882
if the contents of the <TT
6883
CLASS="filename"
6884
>hello.h</TT
6885
> file change,
6886
the <SPAN
6887
CLASS="application"
6888
>hello</SPAN
6889
> program must be recompiled.
6890
To do this, we need to modify the
6891
<TT
6892
CLASS="filename"
6893
>SConstruct</TT
6894
> file like so:
6895
6896
</P
6897
><PRE
6898
CLASS="programlisting"
6899
> Program('hello.c', CPPPATH = '.')
6900
</PRE
6901
><P
6902
>
6903
The <A
6904
HREF="#cv-CPPPATH"
6905
><CODE
6906
CLASS="envar"
6907
>$CPPPATH</CODE
6908
></A
6909
> value
6910
tells <SPAN
6911
CLASS="application"
6912
>SCons</SPAN
6913
> to look in the current directory
6914
(<TT
6915
CLASS="literal"
6916
>'.'</TT
6917
>)
6918
for any files included by C source files
6919
(<TT
6920
CLASS="filename"
6921
>.c</TT
6922
> or <TT
6923
CLASS="filename"
6924
>.h</TT
6925
> files).
6926
With this assignment in the <TT
6927
CLASS="filename"
6928
>SConstruct</TT
6929
> file:
6930
6931
</P
6932
><PRE
6933
CLASS="screen"
6934
> % <KBD
6935
CLASS="userinput"
6936
>scons -Q hello</KBD
6937
>
6938
cc -o hello.o -c -I. hello.c
6939
cc -o hello hello.o
6940
% <KBD
6941
CLASS="userinput"
6942
>scons -Q hello</KBD
6943
>
6944
scons: `hello' is up to date.
6945
% <KBD
6946
CLASS="userinput"
6947
>edit hello.h</KBD
6948
>
6949
[CHANGE THE CONTENTS OF hello.h]
6950
% <KBD
6951
CLASS="userinput"
6952
>scons -Q hello</KBD
6953
>
6954
cc -o hello.o -c -I. hello.c
6955
cc -o hello hello.o
6956
</PRE
6957
><P
6958
>
6959
First, notice that <SPAN
6960
CLASS="application"
6961
>SCons</SPAN
6962
>
6963
added the <TT
6964
CLASS="literal"
6965
>-I.</TT
6966
> argument
6967
from the <CODE
6968
CLASS="envar"
6969
>$CPPPATH</CODE
6970
> variable
6971
so that the compilation would find the
6972
<TT
6973
CLASS="filename"
6974
>hello.h</TT
6975
> file in the local directory.
6976
6977
</P
6978
><P
6979
>
6980
Second, realize that <SPAN
6981
CLASS="application"
6982
>SCons</SPAN
6983
> knows that the <SPAN
6984
CLASS="application"
6985
>hello</SPAN
6986
>
6987
program must be rebuilt
6988
because it scans the contents of
6989
the <TT
6990
CLASS="filename"
6991
>hello.c</TT
6992
> file
6993
for the <TT
6994
CLASS="literal"
6995
>#include</TT
6996
> lines that indicate
6997
another file is being included in the compilation.
6998
<SPAN
6999
CLASS="application"
7000
>SCons</SPAN
7001
> records these as
7002
<SPAN
7003
CLASS="emphasis"
7004
><I
7005
CLASS="emphasis"
7006
>implicit dependencies</I
7007
></SPAN
7008
>
7009
of the target file,
7010
Consequently,
7011
when the <TT
7012
CLASS="filename"
7013
>hello.h</TT
7014
> file changes,
7015
<SPAN
7016
CLASS="application"
7017
>SCons</SPAN
7018
> realizes that the <TT
7019
CLASS="filename"
7020
>hello.c</TT
7021
> file includes it,
7022
and rebuilds the resulting <SPAN
7023
CLASS="application"
7024
>hello</SPAN
7025
> program
7026
that depends on both the <TT
7027
CLASS="filename"
7028
>hello.c</TT
7029
> and <TT
7030
CLASS="filename"
7031
>hello.h</TT
7032
> files.
7033
7034
</P
7035
><P
7036
>
7037
Like the <A
7038
HREF="#cv-LIBPATH"
7039
><CODE
7040
CLASS="envar"
7041
>$LIBPATH</CODE
7042
></A
7043
> variable,
7044
the <CODE
7045
CLASS="envar"
7046
>$CPPPATH</CODE
7047
> variable
7048
may be a list of directories,
7049
or a string separated by
7050
the system-specific path separation character
7051
(':' on POSIX/Linux, ';' on Windows).
7052
Either way, <SPAN
7053
CLASS="application"
7054
>SCons</SPAN
7055
> creates the
7056
right command-line options
7057
so that the following example:
7058
7059
</P
7060
><PRE
7061
CLASS="programlisting"
7062
> Program('hello.c', CPPPATH = ['include', '/home/project/inc'])
7063
</PRE
7064
><P
7065
>
7066
Will look like this on POSIX or Linux:
7067
7068
</P
7069
><PRE
7070
CLASS="screen"
7071
> % <KBD
7072
CLASS="userinput"
7073
>scons -Q hello</KBD
7074
>
7075
cc -o hello.o -c -Iinclude -I/home/project/inc hello.c
7076
cc -o hello hello.o
7077
</PRE
7078
><P
7079
>
7080
And like this on Windows:
7081
7082
</P
7083
><PRE
7084
CLASS="screen"
7085
> C:\><KBD
7086
CLASS="userinput"
7087
>scons -Q hello.exe</KBD
7088
>
7089
cl /nologo /Iinclude /I\home\project\inc /c hello.c /Fohello.obj
7090
link /nologo /OUT:hello.exe hello.obj
7091
</PRE
7092
></DIV
7093
><DIV
7094
CLASS="section"
7095
><HR><H2
7096
CLASS="section"
7097
><A
7098
NAME="AEN1115"
7099
>6.4. Caching Implicit Dependencies</A
7100
></H2
7101
><P
7102
>
7103
Scanning each file for <TT
7104
CLASS="literal"
7105
>#include</TT
7106
> lines
7107
does take some extra processing time.
7108
When you're doing a full build of a large system,
7109
the scanning time is usually a very small percentage
7110
of the overall time spent on the build.
7111
You're most likely to notice the scanning time,
7112
however, when you <SPAN
7113
CLASS="emphasis"
7114
><I
7115
CLASS="emphasis"
7116
>rebuild</I
7117
></SPAN
7118
>
7119
all or part of a large system:
7120
<SPAN
7121
CLASS="application"
7122
>SCons</SPAN
7123
> will likely take some extra time to "think about"
7124
what must be built before it issues the
7125
first build command
7126
(or decides that everything is up to date
7127
and nothing must be rebuilt).
7128
7129
7130
7131
</P
7132
><P
7133
>
7134
In practice, having <SPAN
7135
CLASS="application"
7136
>SCons</SPAN
7137
> scan files saves time
7138
relative to the amount of potential time
7139
lost to tracking down subtle problems
7140
introduced by incorrect dependencies.
7141
Nevertheless, the "waiting time"
7142
while <SPAN
7143
CLASS="application"
7144
>SCons</SPAN
7145
> scans files can annoy
7146
individual developers waiting for their builds to finish.
7147
Consequently, <SPAN
7148
CLASS="application"
7149
>SCons</SPAN
7150
> lets you cache
7151
the implicit dependencies
7152
that its scanners find,
7153
for use by later builds.
7154
You can do this by specifying the
7155
<TT
7156
CLASS="literal"
7157
>--implicit-cache</TT
7158
> option on the command line:
7159
7160
</P
7161
><PRE
7162
CLASS="screen"
7163
> % <KBD
7164
CLASS="userinput"
7165
>scons -Q --implicit-cache hello</KBD
7166
>
7167
cc -o hello.o -c hello.c
7168
cc -o hello hello.o
7169
% <KBD
7170
CLASS="userinput"
7171
>scons -Q hello</KBD
7172
>
7173
scons: `hello' is up to date.
7174
</PRE
7175
><P
7176
>
7177
If you don't want to specify <TT
7178
CLASS="literal"
7179
>--implicit-cache</TT
7180
>
7181
on the command line each time,
7182
you can make it the default behavior for your build
7183
by setting the <TT
7184
CLASS="literal"
7185
>implicit_cache</TT
7186
> option
7187
in an <TT
7188
CLASS="filename"
7189
>SConscript</TT
7190
> file:
7191
7192
</P
7193
><PRE
7194
CLASS="programlisting"
7195
> SetOption('implicit_cache', 1)
7196
</PRE
7197
><P
7198
>
7199
<SPAN
7200
CLASS="application"
7201
>SCons</SPAN
7202
> does not cache implicit dependencies like this by default
7203
because the <TT
7204
CLASS="literal"
7205
>--implicit-cache</TT
7206
> causes <SPAN
7207
CLASS="application"
7208
>SCons</SPAN
7209
> to simply use the implicit
7210
dependencies stored during the last run, without any checking
7211
for whether or not those dependencies are still correct.
7212
Specifically, this means <TT
7213
CLASS="literal"
7214
>--implicit-cache</TT
7215
> instructs <SPAN
7216
CLASS="application"
7217
>SCons</SPAN
7218
>
7219
to <SPAN
7220
CLASS="emphasis"
7221
><I
7222
CLASS="emphasis"
7223
>not</I
7224
></SPAN
7225
> rebuild "correctly" in the
7226
following cases:
7227
7228
7229
</P
7230
><P
7231
></P
7232
><UL
7233
><LI
7234
><P
7235
>
7236
When <TT
7237
CLASS="literal"
7238
>--implicit-cache</TT
7239
> is used, <SPAN
7240
CLASS="application"
7241
>SCons</SPAN
7242
> will ignore any changes that
7243
may have been made to search paths
7244
(like <CODE
7245
CLASS="envar"
7246
>$CPPPATH</CODE
7247
> or <CODE
7248
CLASS="envar"
7249
>$LIBPATH</CODE
7250
>,).
7251
This can lead to <SPAN
7252
CLASS="application"
7253
>SCons</SPAN
7254
> not rebuilding a file if a change to
7255
<CODE
7256
CLASS="envar"
7257
>$CPPPATH</CODE
7258
> would normally cause a different, same-named file from
7259
a different directory to be used.
7260
7261
</P
7262
></LI
7263
><LI
7264
><P
7265
>
7266
When <TT
7267
CLASS="literal"
7268
>--implicit-cache</TT
7269
> is used, <SPAN
7270
CLASS="application"
7271
>SCons</SPAN
7272
> will not detect if a
7273
same-named file has been added to a directory that is earlier in
7274
the search path than the directory in which the file was found
7275
last time.
7276
7277
</P
7278
></LI
7279
></UL
7280
><DIV
7281
CLASS="section"
7282
><HR><H3
7283
CLASS="section"
7284
><A
7285
NAME="AEN1154"
7286
>6.4.1. The <TT
7287
CLASS="literal"
7288
>--implicit-deps-changed</TT
7289
> Option</A
7290
></H3
7291
><P
7292
>
7293
When using cached implicit dependencies,
7294
sometimes you want to "start fresh"
7295
and have <SPAN
7296
CLASS="application"
7297
>SCons</SPAN
7298
> re-scan the files
7299
for which it previously cached the dependencies.
7300
For example,
7301
if you have recently installed a new version of
7302
external code that you use for compilation,
7303
the external header files will have changed
7304
and the previously-cached implicit dependencies
7305
will be out of date.
7306
You can update them by
7307
running <SPAN
7308
CLASS="application"
7309
>SCons</SPAN
7310
> with the <TT
7311
CLASS="literal"
7312
>--implicit-deps-changed</TT
7313
> option:
7314
7315
</P
7316
><PRE
7317
CLASS="screen"
7318
> % <KBD
7319
CLASS="userinput"
7320
>scons -Q --implicit-deps-changed hello</KBD
7321
>
7322
cc -o hello.o -c hello.c
7323
cc -o hello hello.o
7324
% <KBD
7325
CLASS="userinput"
7326
>scons -Q hello</KBD
7327
>
7328
scons: `hello' is up to date.
7329
</PRE
7330
><P
7331
>
7332
In this case, <SPAN
7333
CLASS="application"
7334
>SCons</SPAN
7335
> will re-scan all of the implicit dependencies
7336
and cache updated copies of the information.
7337
7338
</P
7339
></DIV
7340
><DIV
7341
CLASS="section"
7342
><HR><H3
7343
CLASS="section"
7344
><A
7345
NAME="AEN1166"
7346
>6.4.2. The <TT
7347
CLASS="literal"
7348
>--implicit-deps-unchanged</TT
7349
> Option</A
7350
></H3
7351
><P
7352
>
7353
By default when caching dependencies,
7354
<SPAN
7355
CLASS="application"
7356
>SCons</SPAN
7357
> notices when a file has been modified
7358
and re-scans the file for any updated
7359
implicit dependency information.
7360
Sometimes, however, you may want
7361
to force <SPAN
7362
CLASS="application"
7363
>SCons</SPAN
7364
> to use the cached implicit dependencies,
7365
even if the source files changed.
7366
This can speed up a build for example,
7367
when you have changed your source files
7368
but know that you haven't changed
7369
any <TT
7370
CLASS="literal"
7371
>#include</TT
7372
> lines.
7373
In this case,
7374
you can use the <TT
7375
CLASS="literal"
7376
>--implicit-deps-unchanged</TT
7377
> option:
7378
7379
</P
7380
><PRE
7381
CLASS="screen"
7382
> % <KBD
7383
CLASS="userinput"
7384
>scons -Q --implicit-deps-unchanged hello</KBD
7385
>
7386
cc -o hello.o -c hello.c
7387
cc -o hello hello.o
7388
% <KBD
7389
CLASS="userinput"
7390
>scons -Q hello</KBD
7391
>
7392
scons: `hello' is up to date.
7393
</PRE
7394
><P
7395
>
7396
In this case,
7397
<SPAN
7398
CLASS="application"
7399
>SCons</SPAN
7400
> will assume that the cached implicit
7401
dependencies are correct and
7402
will not bother to re-scan changed files.
7403
For typical builds after small,
7404
incremental changes to source files,
7405
the savings may not be very big,
7406
but sometimes every bit of
7407
improved performance counts.
7408
7409
</P
7410
></DIV
7411
></DIV
7412
><DIV
7413
CLASS="section"
7414
><HR><H2
7415
CLASS="section"
7416
><A
7417
NAME="AEN1179"
7418
>6.5. Explicit Dependencies: the <CODE
7419
CLASS="function"
7420
>Depends</CODE
7421
> Function</A
7422
></H2
7423
><P
7424
>
7425
Sometimes a file depends on another file
7426
that is not detected by an <SPAN
7427
CLASS="application"
7428
>SCons</SPAN
7429
> scanner.
7430
For this situation,
7431
<SPAN
7432
CLASS="application"
7433
>SCons</SPAN
7434
> allows you to specific explicitly that one file
7435
depends on another file,
7436
and must be rebuilt whenever that file changes.
7437
This is specified using the <CODE
7438
CLASS="function"
7439
>Depends</CODE
7440
> method:
7441
7442
</P
7443
><PRE
7444
CLASS="programlisting"
7445
> hello = Program('hello.c')
7446
Depends(hello, 'other_file')
7447
</PRE
7448
><PRE
7449
CLASS="screen"
7450
> % <KBD
7451
CLASS="userinput"
7452
>scons -Q hello</KBD
7453
>
7454
cc -c hello.c -o hello.o
7455
cc -o hello hello.o
7456
% <KBD
7457
CLASS="userinput"
7458
>scons -Q hello</KBD
7459
>
7460
scons: `hello' is up to date.
7461
% <KBD
7462
CLASS="userinput"
7463
>edit other_file</KBD
7464
>
7465
[CHANGE THE CONTENTS OF other_file]
7466
% <KBD
7467
CLASS="userinput"
7468
>scons -Q hello</KBD
7469
>
7470
cc -c hello.c -o hello.o
7471
cc -o hello hello.o
7472
</PRE
7473
><P
7474
>
7475
Note that the dependency
7476
(the second argument to <CODE
7477
CLASS="function"
7478
>Depends</CODE
7479
>)
7480
may also be a list of Node objects
7481
(for example, as returned by a call to a Builder):
7482
7483
</P
7484
><PRE
7485
CLASS="programlisting"
7486
> hello = Program('hello.c')
7487
goodbye = Program('goodbye.c')
7488
Depends(hello, goodbye)
7489
</PRE
7490
><P
7491
>
7492
in which case the dependency or dependencies
7493
will be built before the target(s):
7494
7495
</P
7496
><PRE
7497
CLASS="screen"
7498
> % <KBD
7499
CLASS="userinput"
7500
>scons -Q hello</KBD
7501
>
7502
cc -c goodbye.c -o goodbye.o
7503
cc -o goodbye goodbye.o
7504
cc -c hello.c -o hello.o
7505
cc -o hello hello.o
7506
</PRE
7507
></DIV
7508
><DIV
7509
CLASS="section"
7510
><HR><H2
7511
CLASS="section"
7512
><A
7513
NAME="AEN1198"
7514
>6.6. Dependencies From External Files: the <CODE
7515
CLASS="function"
7516
>ParseDepends</CODE
7517
>
7518
Function</A
7519
></H2
7520
><P
7521
>
7522
<SPAN
7523
CLASS="application"
7524
>SCons</SPAN
7525
> has built-in scanners for a number of languages. Sometimes
7526
these scanners fail to extract certain implicit dependencies due
7527
to limitations of the scanner implementation.
7528
7529
</P
7530
><P
7531
>
7532
The following example illustrates a case where the built-in C
7533
scanner is unable to extract the implicit dependency on a header
7534
file.
7535
7536
</P
7537
><PRE
7538
CLASS="programlisting"
7539
> #define FOO_HEADER <foo.h>
7540
#include FOO_HEADER
7541
7542
int main() {
7543
return FOO;
7544
}
7545
</PRE
7546
><PRE
7547
CLASS="screen"
7548
> % <KBD
7549
CLASS="userinput"
7550
>scons -Q</KBD
7551
>
7552
cc -o hello.o -c -I. hello.c
7553
cc -o hello hello.o
7554
% <KBD
7555
CLASS="userinput"
7556
>edit foo.h</KBD
7557
>
7558
[CHANGE CONTENTS OF foo.h]
7559
% <KBD
7560
CLASS="userinput"
7561
>scons -Q</KBD
7562
>
7563
scons: `.' is up to date.
7564
</PRE
7565
><P
7566
>
7567
Apparently, the scanner does not know about the header dependency.
7568
Being not a full-fledged C preprocessor, the scanner does not
7569
expand the macro.
7570
7571
</P
7572
><P
7573
>
7574
In these cases, you may also use the compiler to extract the
7575
implicit dependencies. <CODE
7576
CLASS="function"
7577
>ParseDepends</CODE
7578
> can parse the contents of
7579
the compiler output in the style of <SPAN
7580
CLASS="application"
7581
>Make</SPAN
7582
>, and explicitly
7583
establish all of the listed dependencies.
7584
7585
</P
7586
><P
7587
>
7588
The following example uses <CODE
7589
CLASS="function"
7590
>ParseDepends</CODE
7591
> to process a compiler
7592
generated dependency file which is generated as a side effect
7593
during compilation of the object file:
7594
7595
</P
7596
><PRE
7597
CLASS="programlisting"
7598
> obj = Object('hello.c', CCFLAGS='-MD -MF hello.d', CPPPATH='.')
7599
SideEffect('hello.d', obj)
7600
ParseDepends('hello.d')
7601
Program('hello', obj)
7602
</PRE
7603
><PRE
7604
CLASS="screen"
7605
> % <KBD
7606
CLASS="userinput"
7607
>scons -Q</KBD
7608
>
7609
cc -o hello.o -c -MD -MF hello.d -I. hello.c
7610
cc -o hello hello.o
7611
% <KBD
7612
CLASS="userinput"
7613
>edit foo.h</KBD
7614
>
7615
[CHANGE CONTENTS OF foo.h]
7616
% <KBD
7617
CLASS="userinput"
7618
>scons -Q</KBD
7619
>
7620
cc -o hello.o -c -MD -MF hello.d -I. hello.c
7621
</PRE
7622
><P
7623
>
7624
Parsing dependencies from a compiler-generated
7625
<TT
7626
CLASS="filename"
7627
>.d</TT
7628
> file has a chicken-and-egg problem, that
7629
causes unnecessary rebuilds:
7630
7631
</P
7632
><PRE
7633
CLASS="screen"
7634
> % <KBD
7635
CLASS="userinput"
7636
>scons -Q</KBD
7637
>
7638
cc -o hello.o -c -MD -MF hello.d -I. hello.c
7639
cc -o hello hello.o
7640
% <KBD
7641
CLASS="userinput"
7642
>scons -Q --debug=explain</KBD
7643
>
7644
scons: rebuilding `hello.o' because `foo.h' is a new dependency
7645
cc -o hello.o -c -MD -MF hello.d -I. hello.c
7646
% <KBD
7647
CLASS="userinput"
7648
>scons -Q</KBD
7649
>
7650
scons: `.' is up to date.
7651
</PRE
7652
><P
7653
>
7654
In the first pass, the dependency file is generated while the
7655
object file is compiled. At that time, <SPAN
7656
CLASS="application"
7657
>SCons</SPAN
7658
> does not know about
7659
the dependency on <TT
7660
CLASS="filename"
7661
>foo.h</TT
7662
>. In the second pass,
7663
the object file is regenerated because <TT
7664
CLASS="filename"
7665
>foo.h</TT
7666
>
7667
is detected as a new dependency.
7668
7669
</P
7670
><P
7671
>
7672
<CODE
7673
CLASS="function"
7674
>ParseDepends</CODE
7675
> immediately reads the specified file at invocation
7676
time and just returns if the file does not exist. A dependency
7677
file generated during the build process is not automatically
7678
parsed again. Hence, the compiler-extracted dependencies are not
7679
stored in the signature database during the same build pass. This
7680
limitation of <CODE
7681
CLASS="function"
7682
>ParseDepends</CODE
7683
> leads to unnecessary recompilations.
7684
Therefore, <CODE
7685
CLASS="function"
7686
>ParseDepends</CODE
7687
> should only be used if scanners are not
7688
available for the employed language or not powerful enough for the
7689
specific task.
7690
7691
</P
7692
></DIV
7693
><DIV
7694
CLASS="section"
7695
><HR><H2
7696
CLASS="section"
7697
><A
7698
NAME="AEN1234"
7699
>6.7. Ignoring Dependencies: the <CODE
7700
CLASS="function"
7701
>Ignore</CODE
7702
> Function</A
7703
></H2
7704
><P
7705
>
7706
Sometimes it makes sense
7707
to not rebuild a program,
7708
even if a dependency file changes.
7709
In this case,
7710
you would tell <SPAN
7711
CLASS="application"
7712
>SCons</SPAN
7713
> specifically
7714
to ignore a dependency as follows:
7715
7716
</P
7717
><PRE
7718
CLASS="programlisting"
7719
> hello = Program('hello.c')
7720
Ignore(hello, 'hello.h')
7721
</PRE
7722
><PRE
7723
CLASS="screen"
7724
> % <KBD
7725
CLASS="userinput"
7726
>scons -Q hello</KBD
7727
>
7728
cc -c -o hello.o hello.c
7729
cc -o hello hello.o
7730
% <KBD
7731
CLASS="userinput"
7732
>scons -Q hello</KBD
7733
>
7734
scons: `hello' is up to date.
7735
% <KBD
7736
CLASS="userinput"
7737
>edit hello.h</KBD
7738
>
7739
[CHANGE THE CONTENTS OF hello.h]
7740
% <KBD
7741
CLASS="userinput"
7742
>scons -Q hello</KBD
7743
>
7744
scons: `hello' is up to date.
7745
</PRE
7746
><P
7747
>
7748
Now, the above example is a little contrived,
7749
because it's hard to imagine a real-world situation
7750
where you wouldn't want to rebuild <SPAN
7751
CLASS="application"
7752
>hello</SPAN
7753
>
7754
if the <TT
7755
CLASS="filename"
7756
>hello.h</TT
7757
> file changed.
7758
A more realistic example
7759
might be if the <SPAN
7760
CLASS="application"
7761
>hello</SPAN
7762
>
7763
program is being built in a
7764
directory that is shared between multiple systems
7765
that have different copies of the
7766
<TT
7767
CLASS="filename"
7768
>stdio.h</TT
7769
> include file.
7770
In that case,
7771
<SPAN
7772
CLASS="application"
7773
>SCons</SPAN
7774
> would notice the differences between
7775
the different systems' copies of <TT
7776
CLASS="filename"
7777
>stdio.h</TT
7778
>
7779
and would rebuild <SPAN
7780
CLASS="application"
7781
>hello</SPAN
7782
>
7783
each time you change systems.
7784
You could avoid these rebuilds as follows:
7785
7786
</P
7787
><PRE
7788
CLASS="programlisting"
7789
> hello = Program('hello.c', CPPPATH=['/usr/include'])
7790
Ignore(hello, '/usr/include/stdio.h')
7791
</PRE
7792
><P
7793
> <CODE
7794
CLASS="function"
7795
>Ignore</CODE
7796
> can also be used to prevent a generated file from being built
7797
by default. This is due to the fact that directories depend on
7798
their contents. So to ignore a generated file from the default build,
7799
you specify that the directory should ignore the generated file.
7800
Note that the file will still be built if the user specifically
7801
requests the target on scons command line, or if the file is
7802
a dependency of another file which is requested and/or is built
7803
by default.
7804
</P
7805
><PRE
7806
CLASS="programlisting"
7807
> hello_obj=Object('hello.c')
7808
hello = Program(hello_obj)
7809
Ignore('.',[hello,hello_obj])
7810
</PRE
7811
><PRE
7812
CLASS="screen"
7813
> % <KBD
7814
CLASS="userinput"
7815
>scons -Q</KBD
7816
>
7817
scons: `.' is up to date.
7818
% <KBD
7819
CLASS="userinput"
7820
>scons -Q hello</KBD
7821
>
7822
cc -o hello.o -c hello.c
7823
cc -o hello hello.o
7824
% <KBD
7825
CLASS="userinput"
7826
>scons -Q hello</KBD
7827
>
7828
scons: `hello' is up to date.
7829
</PRE
7830
></DIV
7831
><DIV
7832
CLASS="section"
7833
><HR><H2
7834
CLASS="section"
7835
><A
7836
NAME="AEN1261"
7837
>6.8. Order-Only Dependencies: the <CODE
7838
CLASS="function"
7839
>Requires</CODE
7840
> Function</A
7841
></H2
7842
><P
7843
>
7844
Occasionally,
7845
it may be useful to specify that a certain
7846
file or directory must, if necessary,
7847
be built or created before some other target is built,
7848
but that changes to that file or directory
7849
do <SPAN
7850
CLASS="emphasis"
7851
><I
7852
CLASS="emphasis"
7853
>not</I
7854
></SPAN
7855
>
7856
require that the target itself be rebuilt.
7857
Such a relationship is called an
7858
<SPAN
7859
CLASS="emphasis"
7860
><I
7861
CLASS="emphasis"
7862
>order-only dependency</I
7863
></SPAN
7864
>
7865
because it only affects the order in which
7866
things must be built--the dependency before the target--but
7867
it is not a strict dependency relationship
7868
because the target should not
7869
change in response to changes in the dependent file.
7870
7871
</P
7872
><P
7873
>
7874
For example, suppose that you want to create a file
7875
every time you run a build
7876
that identifies the time the build was performed,
7877
the version number, etc.,
7878
and which is included in every program that you build.
7879
The version file's contents will change every build.
7880
If you specify a normal dependency relationship,
7881
then every program that depends on
7882
that file would be rebuilt every time you ran <SPAN
7883
CLASS="application"
7884
>SCons</SPAN
7885
>.
7886
For example, we could use some Python code in
7887
a <TT
7888
CLASS="filename"
7889
>SConstruct</TT
7890
> file to create a new <TT
7891
CLASS="filename"
7892
>version.c</TT
7893
> file
7894
with a string containing the current date every time
7895
we run <SPAN
7896
CLASS="application"
7897
>SCons</SPAN
7898
>,
7899
and then link a program with the resulting object file
7900
by listing <TT
7901
CLASS="filename"
7902
>version.c</TT
7903
> in the sources:
7904
7905
</P
7906
><PRE
7907
CLASS="programlisting"
7908
> import time
7909
7910
version_c_text = """
7911
char *date = "%s";
7912
""" % time.ctime(time.time())
7913
open('version.c', 'w').write(version_c_text)
7914
7915
hello = Program(['hello.c', 'version.c'])
7916
</PRE
7917
><P
7918
>
7919
If we list <TT
7920
CLASS="filename"
7921
>version.c</TT
7922
> as an actual source file,
7923
though, then <TT
7924
CLASS="filename"
7925
>version.o</TT
7926
>
7927
will get rebuilt every time we run <SPAN
7928
CLASS="application"
7929
>SCons</SPAN
7930
>
7931
(because the <TT
7932
CLASS="filename"
7933
>SConstruct</TT
7934
> file itself changes
7935
the contents of <TT
7936
CLASS="filename"
7937
>version.c</TT
7938
>)
7939
and the <TT
7940
CLASS="filename"
7941
>hello</TT
7942
> executable
7943
will get re-linked every time
7944
(because the <TT
7945
CLASS="filename"
7946
>version.o</TT
7947
> file changes):
7948
7949
</P
7950
><PRE
7951
CLASS="screen"
7952
> % <KBD
7953
CLASS="userinput"
7954
>scons -Q</KBD
7955
>
7956
gcc -o hello.o -c hello.c
7957
gcc -o version.o -c version.c
7958
gcc -o hello hello.o version.o
7959
% <KBD
7960
CLASS="userinput"
7961
>scons -Q</KBD
7962
>
7963
gcc -o version.o -c version.c
7964
gcc -o hello hello.o version.o
7965
% <KBD
7966
CLASS="userinput"
7967
>scons -Q</KBD
7968
>
7969
gcc -o version.o -c version.c
7970
gcc -o hello hello.o version.o
7971
</PRE
7972
><P
7973
>
7974
One solution is to use the <CODE
7975
CLASS="function"
7976
>Requires</CODE
7977
> function
7978
to specify that the <TT
7979
CLASS="filename"
7980
>version.o</TT
7981
>
7982
must be rebuilt before it is used by the link step,
7983
but that changes to <TT
7984
CLASS="filename"
7985
>version.o</TT
7986
>
7987
should not actually cause the <TT
7988
CLASS="filename"
7989
>hello</TT
7990
>
7991
executable to be re-linked:
7992
7993
</P
7994
><PRE
7995
CLASS="programlisting"
7996
> import time
7997
7998
version_c_text = """
7999
char *date = "%s";
8000
""" % time.ctime(time.time())
8001
open('version.c', 'w').write(version_c_text)
8002
8003
version_obj = Object('version.c')
8004
8005
hello = Program('hello.c',
8006
LINKFLAGS = str(version_obj[0]))
8007
8008
Requires(hello, version_obj)
8009
</PRE
8010
><P
8011
>
8012
Notice that because we can no longer list <TT
8013
CLASS="filename"
8014
>version.c</TT
8015
>
8016
as one of the sources for the <TT
8017
CLASS="filename"
8018
>hello</TT
8019
> program,
8020
we have to find some other way to get it into the link command line.
8021
For this example, we're cheating a bit and stuffing the
8022
object file name (extracted from <TT
8023
CLASS="literal"
8024
>version_obj</TT
8025
>
8026
list returned by the <CODE
8027
CLASS="function"
8028
>Object</CODE
8029
> call)
8030
into the <A
8031
HREF="#cv-LINKFLAGS"
8032
><CODE
8033
CLASS="envar"
8034
>$LINKFLAGS</CODE
8035
></A
8036
> variable,
8037
because <CODE
8038
CLASS="envar"
8039
>$LINKFLAGS</CODE
8040
> is already included
8041
in the <A
8042
HREF="#cv-LINKCOM"
8043
><CODE
8044
CLASS="envar"
8045
>$LINKCOM</CODE
8046
></A
8047
> command line.
8048
8049
</P
8050
><P
8051
>
8052
With these changes,
8053
we get the desired behavior of
8054
re-building the <TT
8055
CLASS="filename"
8056
>version.o</TT
8057
> file,
8058
and therefore re-linking the <TT
8059
CLASS="filename"
8060
>hello</TT
8061
> executable,
8062
only when the <TT
8063
CLASS="filename"
8064
>hello.c</TT
8065
> has changed:
8066
8067
</P
8068
><PRE
8069
CLASS="screen"
8070
> % <KBD
8071
CLASS="userinput"
8072
>scons -Q</KBD
8073
>
8074
cc -o hello.o -c hello.c
8075
cc -o version.o -c version.c
8076
cc -o hello version.o hello.o
8077
% <KBD
8078
CLASS="userinput"
8079
>scons -Q</KBD
8080
>
8081
scons: `.' is up to date.
8082
% <KBD
8083
CLASS="userinput"
8084
>edit hello.c</KBD
8085
>
8086
[CHANGE THE CONTENTS OF hello.c]
8087
% <KBD
8088
CLASS="userinput"
8089
>scons -Q</KBD
8090
>
8091
cc -o hello.o -c hello.c
8092
cc -o hello version.o hello.o
8093
% <KBD
8094
CLASS="userinput"
8095
>scons -Q</KBD
8096
>
8097
scons: `.' is up to date.
8098
</PRE
8099
></DIV
8100
><DIV
8101
CLASS="section"
8102
><HR><H2
8103
CLASS="section"
8104
><A
8105
NAME="AEN1312"
8106
>6.9. The <CODE
8107
CLASS="function"
8108
>AlwaysBuild</CODE
8109
> Function</A
8110
></H2
8111
><P
8112
>
8113
How <SPAN
8114
CLASS="application"
8115
>SCons</SPAN
8116
> handles dependencies can also be affected
8117
by the <CODE
8118
CLASS="function"
8119
>AlwaysBuild</CODE
8120
> method.
8121
When a file is passed to the <CODE
8122
CLASS="function"
8123
>AlwaysBuild</CODE
8124
> method,
8125
like so:
8126
8127
</P
8128
><PRE
8129
CLASS="programlisting"
8130
> hello = Program('hello.c')
8131
AlwaysBuild(hello)
8132
</PRE
8133
><P
8134
>
8135
Then the specified target file (<SPAN
8136
CLASS="application"
8137
>hello</SPAN
8138
> in our example)
8139
will always be considered out-of-date and
8140
rebuilt whenever that target file is evaluated
8141
while walking the dependency graph:
8142
8143
</P
8144
><PRE
8145
CLASS="screen"
8146
> % <KBD
8147
CLASS="userinput"
8148
>scons -Q</KBD
8149
>
8150
cc -o hello.o -c hello.c
8151
cc -o hello hello.o
8152
% <KBD
8153
CLASS="userinput"
8154
>scons -Q</KBD
8155
>
8156
cc -o hello hello.o
8157
</PRE
8158
><P
8159
>
8160
The <CODE
8161
CLASS="function"
8162
>AlwaysBuild</CODE
8163
> function has a somewhat misleading name,
8164
because it does not actually mean the target file will
8165
be rebuilt every single time <SPAN
8166
CLASS="application"
8167
>SCons</SPAN
8168
> is invoked.
8169
Instead, it means that the target will, in fact,
8170
be rebuilt whenever the target file is encountered
8171
while evaluating the targets specified on
8172
the command line (and their dependencies).
8173
So specifying some other target on the command line,
8174
a target that does <SPAN
8175
CLASS="emphasis"
8176
><I
8177
CLASS="emphasis"
8178
>not</I
8179
></SPAN
8180
>
8181
itself depend on the <CODE
8182
CLASS="function"
8183
>AlwaysBuild</CODE
8184
> target,
8185
will still be rebuilt only if it's out-of-date
8186
with respect to its dependencies:
8187
8188
</P
8189
><PRE
8190
CLASS="screen"
8191
> % <KBD
8192
CLASS="userinput"
8193
>scons -Q</KBD
8194
>
8195
cc -o hello.o -c hello.c
8196
cc -o hello hello.o
8197
% <KBD
8198
CLASS="userinput"
8199
>scons -Q hello.o</KBD
8200
>
8201
scons: `hello.o' is up to date.
8202
</PRE
8203
></DIV
8204
></DIV
8205
><DIV
8206
CLASS="chapter"
8207
><HR><H1
8208
><A
8209
NAME="chap-environments"
8210
></A
8211
>Chapter 7. Environments</H1
8212
><P
8213
>
8214
An <TT
8215
CLASS="literal"
8216
>environment</TT
8217
>
8218
is a collection of values that
8219
can affect how a program executes.
8220
<SPAN
8221
CLASS="application"
8222
>SCons</SPAN
8223
> distinguishes between three
8224
different types of environments
8225
that can affect the behavior of <SPAN
8226
CLASS="application"
8227
>SCons</SPAN
8228
> itself
8229
(subject to the configuration in the <TT
8230
CLASS="filename"
8231
>SConscript</TT
8232
> files),
8233
as well as the compilers and other tools it executes:
8234
8235
</P
8236
><P
8237
></P
8238
><DIV
8239
CLASS="variablelist"
8240
><DL
8241
><DT
8242
>External Environment</DT
8243
><DD
8244
><P
8245
>
8246
The <TT
8247
CLASS="literal"
8248
>external environment</TT
8249
>
8250
is the set of variables in the user's environment
8251
at the time the user runs <SPAN
8252
CLASS="application"
8253
>SCons</SPAN
8254
>.
8255
These variables are available within the <TT
8256
CLASS="filename"
8257
>SConscript</TT
8258
> files
8259
through the Python <TT
8260
CLASS="literal"
8261
>os.environ</TT
8262
> dictionary.
8263
See <A
8264
HREF="#sect-external-environments"
8265
>Section 7.1</A
8266
>, below.
8267
8268
</P
8269
></DD
8270
><DT
8271
><TT
8272
CLASS="literal"
8273
>Construction Environment</TT
8274
></DT
8275
><DD
8276
><P
8277
>
8278
A <TT
8279
CLASS="literal"
8280
>construction environment</TT
8281
>
8282
is a distinct object creating within
8283
a <TT
8284
CLASS="filename"
8285
>SConscript</TT
8286
> file and
8287
and which contains values that
8288
affect how <SPAN
8289
CLASS="application"
8290
>SCons</SPAN
8291
> decides
8292
what action to use to build a target,
8293
and even to define which targets
8294
should be built from which sources.
8295
One of the most powerful features of <SPAN
8296
CLASS="application"
8297
>SCons</SPAN
8298
>
8299
is the ability to create multiple <TT
8300
CLASS="literal"
8301
>construction environments</TT
8302
>,
8303
including the ability to clone a new, customized
8304
<TT
8305
CLASS="literal"
8306
>construction environment</TT
8307
> from an existing <TT
8308
CLASS="literal"
8309
>construction environment</TT
8310
>.
8311
See <A
8312
HREF="#sect-construction-environments"
8313
>Section 7.2</A
8314
>, below.
8315
8316
</P
8317
></DD
8318
><DT
8319
>Execution Environment</DT
8320
><DD
8321
><P
8322
>
8323
An <TT
8324
CLASS="literal"
8325
>execution environment</TT
8326
>
8327
is the values that <SPAN
8328
CLASS="application"
8329
>SCons</SPAN
8330
> sets
8331
when executing an external
8332
command (such as a compiler or linker)
8333
to build one or more targets.
8334
Note that this is not the same as
8335
the <TT
8336
CLASS="literal"
8337
>external environment</TT
8338
>
8339
(see above).
8340
See <A
8341
HREF="#sect-execution-environments"
8342
>Section 7.3</A
8343
>, below.
8344
8345
</P
8346
></DD
8347
></DL
8348
></DIV
8349
><P
8350
>
8351
Unlike <SPAN
8352
CLASS="application"
8353
>Make</SPAN
8354
>, <SPAN
8355
CLASS="application"
8356
>SCons</SPAN
8357
> does not automatically
8358
copy or import values between different environments
8359
(with the exception of explicit clones of <TT
8360
CLASS="literal"
8361
>construction environments</TT
8362
>,
8363
which inherit values from their parent).
8364
This is a deliberate design choice
8365
to make sure that builds are,
8366
by default, repeatable regardless of
8367
the values in the user's external environment.
8368
This avoids a whole class of problems with builds
8369
where a developer's local build works
8370
because a custom variable setting
8371
causes a different comiler or build option to be used,
8372
but the checked-in change breaks the official build
8373
because it uses different environment variable settings.
8374
8375
</P
8376
><P
8377
>
8378
Note that the <TT
8379
CLASS="filename"
8380
>SConscript</TT
8381
> writer can
8382
easily arrange for variables to be
8383
copied or imported between environments,
8384
and this is often very useful
8385
(or even downright necessary)
8386
to make it easy for developers
8387
to customize the build in appropriate ways.
8388
The point is <SPAN
8389
CLASS="emphasis"
8390
><I
8391
CLASS="emphasis"
8392
>not</I
8393
></SPAN
8394
>
8395
that copying variables between different environments
8396
is evil and must always be avoided.
8397
Instead, it should be up to the
8398
implementer of the build system
8399
to make conscious choices
8400
about how and when to import
8401
a variable from one environment to another,
8402
making informed decisions about
8403
striking the right balance
8404
between making the build
8405
repeatable on the one hand
8406
and convenient to use on the other.
8407
8408
</P
8409
><DIV
8410
CLASS="section"
8411
><HR><H2
8412
CLASS="section"
8413
><A
8414
NAME="sect-external-environments"
8415
>7.1. Using Values From the External Environment</A
8416
></H2
8417
><P
8418
>
8419
The <TT
8420
CLASS="literal"
8421
>external environment</TT
8422
>
8423
variable settings that
8424
the user has in force
8425
when executing <SPAN
8426
CLASS="application"
8427
>SCons</SPAN
8428
>
8429
are available through the normal Python
8430
<CODE
8431
CLASS="envar"
8432
>os.environ</CODE
8433
>
8434
dictionary.
8435
This means that you must add an
8436
<TT
8437
CLASS="literal"
8438
>import os</TT
8439
> statuement
8440
to any <TT
8441
CLASS="filename"
8442
>SConscript</TT
8443
> file
8444
in which you want to use
8445
values from the user's external environment.
8446
8447
</P
8448
><PRE
8449
CLASS="programlisting"
8450
> import os
8451
</PRE
8452
><P
8453
>
8454
More usefully, you can use the
8455
<CODE
8456
CLASS="envar"
8457
>os.environ</CODE
8458
>
8459
dictionary in your <TT
8460
CLASS="filename"
8461
>SConscript</TT
8462
>
8463
files to initialize <TT
8464
CLASS="literal"
8465
>construction environments</TT
8466
>
8467
with values from the user's external environment.
8468
See the next section,
8469
<A
8470
HREF="#sect-construction-environments"
8471
>Section 7.2</A
8472
>,
8473
for information on how to do this.
8474
8475
</P
8476
></DIV
8477
><DIV
8478
CLASS="section"
8479
><HR><H2
8480
CLASS="section"
8481
><A
8482
NAME="sect-construction-environments"
8483
>7.2. Construction Environments</A
8484
></H2
8485
><P
8486
>
8487
It is rare that all of the software in a large,
8488
complicated system needs to be built the same way.
8489
For example, different source files may need different options
8490
enabled on the command line,
8491
or different executable programs need to be linked
8492
with different libraries.
8493
<SPAN
8494
CLASS="application"
8495
>SCons</SPAN
8496
> accommodates these different build
8497
requirements by allowing you to create and
8498
configure multiple <TT
8499
CLASS="literal"
8500
>construction environments</TT
8501
>
8502
that control how the software is built.
8503
A <TT
8504
CLASS="literal"
8505
>construction environment</TT
8506
> is an object
8507
that has a number of associated
8508
<TT
8509
CLASS="literal"
8510
>construction variables</TT
8511
>, each with a name and a value.
8512
(A construction environment also has an attached
8513
set of <CODE
8514
CLASS="classname"
8515
>Builder</CODE
8516
> methods,
8517
about which we'll learn more later.)
8518
8519
</P
8520
><DIV
8521
CLASS="section"
8522
><HR><H3
8523
CLASS="section"
8524
><A
8525
NAME="AEN1400"
8526
>7.2.1. Creating a <TT
8527
CLASS="literal"
8528
>Construction Environment</TT
8529
>: the <CODE
8530
CLASS="function"
8531
>Environment</CODE
8532
> Function</A
8533
></H3
8534
><P
8535
>
8536
A <TT
8537
CLASS="literal"
8538
>construction environment</TT
8539
> is created by the <CODE
8540
CLASS="function"
8541
>Environment</CODE
8542
> method:
8543
8544
</P
8545
><PRE
8546
CLASS="programlisting"
8547
> env = Environment()
8548
</PRE
8549
><P
8550
>
8551
By default, <SPAN
8552
CLASS="application"
8553
>SCons</SPAN
8554
> initializes every
8555
new construction environment
8556
with a set of <TT
8557
CLASS="literal"
8558
>construction variables</TT
8559
>
8560
based on the tools that it finds on your system,
8561
plus the default set of builder methods
8562
necessary for using those tools.
8563
The construction variables
8564
are initialized with values describing
8565
the C compiler,
8566
the Fortran compiler,
8567
the linker,
8568
etc.,
8569
as well as the command lines to invoke them.
8570
8571
</P
8572
><P
8573
>
8574
When you initialize a construction environment
8575
you can set the values of the
8576
environment's <TT
8577
CLASS="literal"
8578
>construction variables</TT
8579
>
8580
to control how a program is built.
8581
For example:
8582
8583
</P
8584
><PRE
8585
CLASS="programlisting"
8586
> import os
8587
8588
env = Environment(CC = 'gcc',
8589
CCFLAGS = '-O2')
8590
8591
env.Program('foo.c')
8592
</PRE
8593
><P
8594
>
8595
The construction environment in this example
8596
is still initialized with the same default
8597
construction variable values,
8598
except that the user has explicitly specified use of the
8599
GNU C compiler <SPAN
8600
CLASS="application"
8601
>gcc</SPAN
8602
>,
8603
and further specifies that the <TT
8604
CLASS="literal"
8605
>-O2</TT
8606
>
8607
(optimization level two)
8608
flag should be used when compiling the object file.
8609
In other words, the explicit initializations of
8610
<A
8611
HREF="#cv-CC"
8612
><CODE
8613
CLASS="envar"
8614
>$CC</CODE
8615
></A
8616
> and <A
8617
HREF="#cv-CCFLAGS"
8618
><CODE
8619
CLASS="envar"
8620
>$CCFLAGS</CODE
8621
></A
8622
>
8623
override the default values in the newly-created
8624
construction environment.
8625
So a run from this example would look like:
8626
8627
</P
8628
><PRE
8629
CLASS="screen"
8630
> % <KBD
8631
CLASS="userinput"
8632
>scons -Q</KBD
8633
>
8634
gcc -o foo.o -c -O2 foo.c
8635
gcc -o foo foo.o
8636
</PRE
8637
></DIV
8638
><DIV
8639
CLASS="section"
8640
><HR><H3
8641
CLASS="section"
8642
><A
8643
NAME="AEN1423"
8644
>7.2.2. Fetching Values From a <TT
8645
CLASS="literal"
8646
>Construction Environment</TT
8647
></A
8648
></H3
8649
><P
8650
>
8651
You can fetch individual construction variables
8652
using the normal syntax
8653
for accessing individual named items in a Python dictionary:
8654
8655
</P
8656
><PRE
8657
CLASS="programlisting"
8658
> env = Environment()
8659
print "CC is:", env['CC']
8660
</PRE
8661
><P
8662
>
8663
This example <TT
8664
CLASS="filename"
8665
>SConstruct</TT
8666
> file doesn't build anything,
8667
but because it's actually a Python script,
8668
it will print the value of <A
8669
HREF="#cv-CC"
8670
><CODE
8671
CLASS="envar"
8672
>$CC</CODE
8673
></A
8674
> for us:
8675
8676
</P
8677
><PRE
8678
CLASS="screen"
8679
> % <KBD
8680
CLASS="userinput"
8681
>scons -Q</KBD
8682
>
8683
CC is: cc
8684
scons: `.' is up to date.
8685
</PRE
8686
><P
8687
>
8688
A construction environment, however,
8689
is actually an object with associated methods, etc.
8690
If you want to have direct access to only the
8691
dictionary of construction variables,
8692
you can fetch this using the <TT
8693
CLASS="literal"
8694
>Dictionary</TT
8695
> method:
8696
8697
</P
8698
><PRE
8699
CLASS="programlisting"
8700
> env = Environment(FOO = 'foo', BAR = 'bar')
8701
dict = env.Dictionary()
8702
for key in ['OBJSUFFIX', 'LIBSUFFIX', 'PROGSUFFIX']:
8703
print "key = %s, value = %s" % (key, dict[key])
8704
</PRE
8705
><P
8706
>
8707
This <TT
8708
CLASS="filename"
8709
>SConstruct</TT
8710
> file
8711
will print the specified dictionary items for us on POSIX
8712
systems as follows:
8713
8714
</P
8715
><PRE
8716
CLASS="screen"
8717
> % <KBD
8718
CLASS="userinput"
8719
>scons -Q</KBD
8720
>
8721
key = OBJSUFFIX, value = .o
8722
key = LIBSUFFIX, value = .a
8723
key = PROGSUFFIX, value =
8724
scons: `.' is up to date.
8725
</PRE
8726
><P
8727
>
8728
And on Windows:
8729
8730
</P
8731
><PRE
8732
CLASS="screen"
8733
> C:\><KBD
8734
CLASS="userinput"
8735
>scons -Q</KBD
8736
>
8737
key = OBJSUFFIX, value = .obj
8738
key = LIBSUFFIX, value = .lib
8739
key = PROGSUFFIX, value = .exe
8740
scons: `.' is up to date.
8741
</PRE
8742
><P
8743
>
8744
If you want to loop and print the values of
8745
all of the construction variables in a construction environment,
8746
the Python code to do that in sorted order might look something like:
8747
8748
</P
8749
><PRE
8750
CLASS="programlisting"
8751
> env = Environment()
8752
dict = env.Dictionary()
8753
keys = dict.keys()
8754
keys.sort()
8755
for key in keys:
8756
print "construction variable = '%s', value = '%s'" % (key, dict[key])
8757
</PRE
8758
></DIV
8759
><DIV
8760
CLASS="section"
8761
><HR><H3
8762
CLASS="section"
8763
><A
8764
NAME="AEN1446"
8765
>7.2.3. Expanding Values From a <TT
8766
CLASS="literal"
8767
>Construction Environment</TT
8768
>: the <CODE
8769
CLASS="function"
8770
>subst</CODE
8771
> Method</A
8772
></H3
8773
><P
8774
>
8775
Another way to get information from
8776
a construction environment.
8777
is to use the <CODE
8778
CLASS="function"
8779
>subst</CODE
8780
> method
8781
on a string containing <TT
8782
CLASS="literal"
8783
>$</TT
8784
> expansions
8785
of construction variable names.
8786
As a simple example,
8787
the example from the previous
8788
section that used
8789
<TT
8790
CLASS="literal"
8791
>env['CC']</TT
8792
>
8793
to fetch the value of <A
8794
HREF="#cv-CC"
8795
><CODE
8796
CLASS="envar"
8797
>$CC</CODE
8798
></A
8799
>
8800
could also be written as:
8801
8802
</P
8803
><PRE
8804
CLASS="programlisting"
8805
> env = Environment()
8806
print "CC is:", env.subst('$CC')
8807
</PRE
8808
><P
8809
>
8810
One advantage of using
8811
<CODE
8812
CLASS="function"
8813
>subst</CODE
8814
> to expand strings is
8815
that construction variables
8816
in the result get re-expanded until
8817
there are no expansions left in the string.
8818
So a simple fetch of a value like
8819
<A
8820
HREF="#cv-CCCOM"
8821
><CODE
8822
CLASS="envar"
8823
>$CCCOM</CODE
8824
></A
8825
>:
8826
8827
</P
8828
><PRE
8829
CLASS="programlisting"
8830
> env = Environment(CCFLAGS = '-DFOO')
8831
print "CCCOM is:", env['CCCOM']
8832
</PRE
8833
><P
8834
>
8835
Will print the unexpanded value of <CODE
8836
CLASS="envar"
8837
>$CCCOM</CODE
8838
>,
8839
showing us the construction
8840
variables that still need to be expanded:
8841
8842
</P
8843
><PRE
8844
CLASS="screen"
8845
> % <KBD
8846
CLASS="userinput"
8847
>scons -Q</KBD
8848
>
8849
CCCOM is: $CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
8850
scons: `.' is up to date.
8851
</PRE
8852
><P
8853
>
8854
Calling the <CODE
8855
CLASS="function"
8856
>subst</CODE
8857
> method on <CODE
8858
CLASS="varname"
8859
>$CCOM</CODE
8860
>,
8861
however:
8862
8863
</P
8864
><PRE
8865
CLASS="programlisting"
8866
> env = Environment(CCFLAGS = '-DFOO')
8867
print "CCCOM is:", env.subst('$CCCOM')
8868
</PRE
8869
><P
8870
>
8871
Will recursively expand all of
8872
the construction variables prefixed
8873
with <TT
8874
CLASS="literal"
8875
>$</TT
8876
> (dollar signs),
8877
showing us the final output:
8878
8879
</P
8880
><PRE
8881
CLASS="screen"
8882
> % <KBD
8883
CLASS="userinput"
8884
>scons -Q</KBD
8885
>
8886
CCCOM is: gcc -DFOO -c -o
8887
scons: `.' is up to date.
8888
</PRE
8889
><P
8890
>
8891
Note that because we're not expanding this
8892
in the context of building something
8893
there are no target or source files
8894
for <A
8895
HREF="#cv-TARGET"
8896
><CODE
8897
CLASS="envar"
8898
>$TARGET</CODE
8899
></A
8900
> and <A
8901
HREF="#cv-SOURCES"
8902
><CODE
8903
CLASS="envar"
8904
>$SOURCES</CODE
8905
></A
8906
> to expand.
8907
8908
</P
8909
></DIV
8910
><DIV
8911
CLASS="section"
8912
><HR><H3
8913
CLASS="section"
8914
><A
8915
NAME="AEN1479"
8916
>7.2.4. Controlling the Default <TT
8917
CLASS="literal"
8918
>Construction Environment</TT
8919
>: the <CODE
8920
CLASS="function"
8921
>DefaultEnvironment</CODE
8922
> Function</A
8923
></H3
8924
><P
8925
>
8926
All of the <CODE
8927
CLASS="classname"
8928
>Builder</CODE
8929
> functions that we've introduced so far,
8930
like <CODE
8931
CLASS="function"
8932
>Program</CODE
8933
> and <CODE
8934
CLASS="function"
8935
>Library</CODE
8936
>,
8937
actually use a default <TT
8938
CLASS="literal"
8939
>construction environment</TT
8940
>
8941
that contains settings
8942
for the various compilers
8943
and other tools that
8944
<SPAN
8945
CLASS="application"
8946
>SCons</SPAN
8947
> configures by default,
8948
or otherwise knows about
8949
and has discovered on your system.
8950
The goal of the default construction environment
8951
is to make many configurations to "just work"
8952
to build software using
8953
readily available tools
8954
with a minimum of configuration changes.
8955
8956
</P
8957
><P
8958
>
8959
You can, however, control the settings
8960
in the default contstruction environment
8961
by using the <CODE
8962
CLASS="function"
8963
>DefaultEnvironment</CODE
8964
> function
8965
to initialize various settings:
8966
8967
</P
8968
><PRE
8969
CLASS="programlisting"
8970
>
8971
DefaultEnvironment(CC = '/usr/local/bin/gcc')
8972
8973
</PRE
8974
><P
8975
>
8976
When configured as above,
8977
all calls to the <CODE
8978
CLASS="function"
8979
>Program</CODE
8980
>
8981
or <CODE
8982
CLASS="function"
8983
>Object</CODE
8984
> Builder
8985
will build object files with the
8986
<TT
8987
CLASS="filename"
8988
>/usr/local/bin/gcc</TT
8989
>
8990
compiler.
8991
8992
</P
8993
><P
8994
>
8995
Note that the <CODE
8996
CLASS="function"
8997
>DefaultEnvironment</CODE
8998
> function
8999
returns the initialized
9000
default construction environment object,
9001
which can then be manipulated like any
9002
other construction environment.
9003
So the following
9004
would be equivalent to the
9005
previous example,
9006
setting the <CODE
9007
CLASS="envar"
9008
>$CC</CODE
9009
>
9010
variable to <TT
9011
CLASS="filename"
9012
>/usr/local/bin/gcc</TT
9013
>
9014
but as a separate step after
9015
the default construction environment has been initialized:
9016
9017
</P
9018
><PRE
9019
CLASS="programlisting"
9020
>
9021
env = DefaultEnvironment()
9022
env['CC'] = '/usr/local/bin/gcc'
9023
9024
</PRE
9025
><P
9026
>
9027
One very common use of the <CODE
9028
CLASS="function"
9029
>DefaultEnvironment</CODE
9030
> function
9031
is to speed up <SPAN
9032
CLASS="application"
9033
>SCons</SPAN
9034
> initialization.
9035
As part of trying to make most default
9036
configurations "just work,"
9037
<SPAN
9038
CLASS="application"
9039
>SCons</SPAN
9040
> will actually
9041
search the local system for installed
9042
compilers and other utilities.
9043
This search can take time,
9044
especially on systems with
9045
slow or networked file systems.
9046
If you know which compiler(s) and/or
9047
other utilities you want to configure,
9048
you can control the search
9049
that <SPAN
9050
CLASS="application"
9051
>SCons</SPAN
9052
> performs
9053
by specifying some specific
9054
tool modules with which to
9055
initialize the default construction environment:
9056
9057
</P
9058
><PRE
9059
CLASS="programlisting"
9060
>
9061
env = DefaultEnvironment(tools = ['gcc', 'gnulink'],
9062
CC = '/usr/local/bin/gcc')
9063
9064
</PRE
9065
><P
9066
>
9067
So the above example would tell <SPAN
9068
CLASS="application"
9069
>SCons</SPAN
9070
>
9071
to explicitly configure the default environment
9072
to use its normal GNU Compiler and GNU Linker settings
9073
(without having to search for them,
9074
or any other utilities for that matter),
9075
and specifically to use the compiler found at
9076
<TT
9077
CLASS="filename"
9078
>/usr/local/bin/gcc</TT
9079
>.
9080
9081
</P
9082
></DIV
9083
><DIV
9084
CLASS="section"
9085
><HR><H3
9086
CLASS="section"
9087
><A
9088
NAME="AEN1510"
9089
>7.2.5. Multiple <TT
9090
CLASS="literal"
9091
>Construction Environments</TT
9092
></A
9093
></H3
9094
><P
9095
>
9096
The real advantage of construction environments
9097
is that you can create as many different construction
9098
environments as you need,
9099
each tailored to a different way to build
9100
some piece of software or other file.
9101
If, for example, we need to build
9102
one program with the <TT
9103
CLASS="literal"
9104
>-O2</TT
9105
> flag
9106
and another with the <TT
9107
CLASS="literal"
9108
>-g</TT
9109
> (debug) flag,
9110
we would do this like so:
9111
9112
</P
9113
><PRE
9114
CLASS="programlisting"
9115
> opt = Environment(CCFLAGS = '-O2')
9116
dbg = Environment(CCFLAGS = '-g')
9117
9118
opt.Program('foo', 'foo.c')
9119
9120
dbg.Program('bar', 'bar.c')
9121
</PRE
9122
><PRE
9123
CLASS="screen"
9124
> % <KBD
9125
CLASS="userinput"
9126
>scons -Q</KBD
9127
>
9128
cc -o bar.o -c -g bar.c
9129
cc -o bar bar.o
9130
cc -o foo.o -c -O2 foo.c
9131
cc -o foo foo.o
9132
</PRE
9133
><P
9134
>
9135
We can even use multiple construction environments to build
9136
multiple versions of a single program.
9137
If you do this by simply trying to use the
9138
<A
9139
HREF="#b-Program"
9140
><CODE
9141
CLASS="function"
9142
>Program</CODE
9143
></A
9144
> builder with both environments, though,
9145
like this:
9146
9147
</P
9148
><PRE
9149
CLASS="programlisting"
9150
> opt = Environment(CCFLAGS = '-O2')
9151
dbg = Environment(CCFLAGS = '-g')
9152
9153
opt.Program('foo', 'foo.c')
9154
9155
dbg.Program('foo', 'foo.c')
9156
</PRE
9157
><P
9158
>
9159
Then <SPAN
9160
CLASS="application"
9161
>SCons</SPAN
9162
> generates the following error:
9163
9164
</P
9165
><PRE
9166
CLASS="screen"
9167
> % <KBD
9168
CLASS="userinput"
9169
>scons -Q</KBD
9170
>
9171
9172
scons: *** Two environments with different actions were specified for the same target: foo.o
9173
File "/home/my/project/SConstruct", line 6, in <module>
9174
</PRE
9175
><P
9176
>
9177
This is because the two <CODE
9178
CLASS="function"
9179
>Program</CODE
9180
> calls have
9181
each implicitly told <SPAN
9182
CLASS="application"
9183
>SCons</SPAN
9184
> to generate an object file named
9185
<TT
9186
CLASS="filename"
9187
>foo.o</TT
9188
>,
9189
one with a <A
9190
HREF="#cv-CCFLAGS"
9191
><CODE
9192
CLASS="envar"
9193
>$CCFLAGS</CODE
9194
></A
9195
> value of
9196
<TT
9197
CLASS="literal"
9198
>-O2</TT
9199
>
9200
and one with a <A
9201
HREF="#cv-CCFLAGS"
9202
><CODE
9203
CLASS="envar"
9204
>$CCFLAGS</CODE
9205
></A
9206
> value of
9207
<TT
9208
CLASS="literal"
9209
>-g</TT
9210
>.
9211
<SPAN
9212
CLASS="application"
9213
>SCons</SPAN
9214
> can't just decide that one of them
9215
should take precedence over the other,
9216
so it generates the error.
9217
To avoid this problem,
9218
we must explicitly specify
9219
that each environment compile
9220
<TT
9221
CLASS="filename"
9222
>foo.c</TT
9223
>
9224
to a separately-named object file
9225
using the <A
9226
HREF="#b-Object"
9227
><CODE
9228
CLASS="function"
9229
>Object</CODE
9230
></A
9231
> builder, like so:
9232
9233
</P
9234
><PRE
9235
CLASS="programlisting"
9236
> opt = Environment(CCFLAGS = '-O2')
9237
dbg = Environment(CCFLAGS = '-g')
9238
9239
o = opt.Object('foo-opt', 'foo.c')
9240
opt.Program(o)
9241
9242
d = dbg.Object('foo-dbg', 'foo.c')
9243
dbg.Program(d)
9244
</PRE
9245
><P
9246
>
9247
Notice that each call to the <CODE
9248
CLASS="function"
9249
>Object</CODE
9250
> builder
9251
returns a value,
9252
an internal <SPAN
9253
CLASS="application"
9254
>SCons</SPAN
9255
> object that
9256
represents the object file that will be built.
9257
We then use that object
9258
as input to the <CODE
9259
CLASS="function"
9260
>Program</CODE
9261
> builder.
9262
This avoids having to specify explicitly
9263
the object file name in multiple places,
9264
and makes for a compact, readable
9265
<TT
9266
CLASS="filename"
9267
>SConstruct</TT
9268
> file.
9269
Our <SPAN
9270
CLASS="application"
9271
>SCons</SPAN
9272
> output then looks like:
9273
9274
</P
9275
><PRE
9276
CLASS="screen"
9277
> % <KBD
9278
CLASS="userinput"
9279
>scons -Q</KBD
9280
>
9281
cc -o foo-dbg.o -c -g foo.c
9282
cc -o foo-dbg foo-dbg.o
9283
cc -o foo-opt.o -c -O2 foo.c
9284
cc -o foo-opt foo-opt.o
9285
</PRE
9286
></DIV
9287
><DIV
9288
CLASS="section"
9289
><HR><H3
9290
CLASS="section"
9291
><A
9292
NAME="AEN1550"
9293
>7.2.6. Making Copies of <TT
9294
CLASS="literal"
9295
>Construction Environments</TT
9296
>: the <CODE
9297
CLASS="function"
9298
>Clone</CODE
9299
> Method</A
9300
></H3
9301
><P
9302
>
9303
Sometimes you want more than one construction environment
9304
to share the same values for one or more variables.
9305
Rather than always having to repeat all of the common
9306
variables when you create each construction environment,
9307
you can use the <CODE
9308
CLASS="function"
9309
>Clone</CODE
9310
> method
9311
to create a copy of a construction environment.
9312
9313
</P
9314
><P
9315
>
9316
Like the <CODE
9317
CLASS="function"
9318
>Environment</CODE
9319
> call that creates a construction environment,
9320
the <CODE
9321
CLASS="function"
9322
>Clone</CODE
9323
> method takes <TT
9324
CLASS="literal"
9325
>construction variable</TT
9326
> assignments,
9327
which will override the values in the copied construction environment.
9328
For example, suppose we want to use <SPAN
9329
CLASS="application"
9330
>gcc</SPAN
9331
>
9332
to create three versions of a program,
9333
one optimized, one debug, and one with neither.
9334
We could do this by creating a "base" construction environment
9335
that sets <A
9336
HREF="#cv-CC"
9337
><CODE
9338
CLASS="envar"
9339
>$CC</CODE
9340
></A
9341
> to <SPAN
9342
CLASS="application"
9343
>gcc</SPAN
9344
>,
9345
and then creating two copies,
9346
one which sets <A
9347
HREF="#cv-CCFLAGS"
9348
><CODE
9349
CLASS="envar"
9350
>$CCFLAGS</CODE
9351
></A
9352
> for optimization
9353
and the other which sets <CODE
9354
CLASS="envar"
9355
>$CCFLAGS</CODE
9356
> for debugging:
9357
9358
</P
9359
><PRE
9360
CLASS="programlisting"
9361
> env = Environment(CC = 'gcc')
9362
opt = env.Clone(CCFLAGS = '-O2')
9363
dbg = env.Clone(CCFLAGS = '-g')
9364
9365
env.Program('foo', 'foo.c')
9366
9367
o = opt.Object('foo-opt', 'foo.c')
9368
opt.Program(o)
9369
9370
d = dbg.Object('foo-dbg', 'foo.c')
9371
dbg.Program(d)
9372
</PRE
9373
><P
9374
>
9375
Then our output would look like:
9376
9377
</P
9378
><PRE
9379
CLASS="screen"
9380
> % <KBD
9381
CLASS="userinput"
9382
>scons -Q</KBD
9383
>
9384
gcc -o foo.o -c foo.c
9385
gcc -o foo foo.o
9386
gcc -o foo-dbg.o -c -g foo.c
9387
gcc -o foo-dbg foo-dbg.o
9388
gcc -o foo-opt.o -c -O2 foo.c
9389
gcc -o foo-opt foo-opt.o
9390
</PRE
9391
></DIV
9392
><DIV
9393
CLASS="section"
9394
><HR><H3
9395
CLASS="section"
9396
><A
9397
NAME="AEN1571"
9398
>7.2.7. Replacing Values: the <CODE
9399
CLASS="function"
9400
>Replace</CODE
9401
> Method</A
9402
></H3
9403
><P
9404
>
9405
You can replace existing construction variable values
9406
using the <CODE
9407
CLASS="function"
9408
>Replace</CODE
9409
> method:
9410
9411
</P
9412
><PRE
9413
CLASS="programlisting"
9414
> env = Environment(CCFLAGS = '-DDEFINE1')
9415
env.Replace(CCFLAGS = '-DDEFINE2')
9416
env.Program('foo.c')
9417
</PRE
9418
><P
9419
>
9420
The replacing value
9421
(<TT
9422
CLASS="literal"
9423
>-DDEFINE2</TT
9424
> in the above example)
9425
completely replaces the value in the
9426
construction environment:
9427
9428
</P
9429
><PRE
9430
CLASS="screen"
9431
> % <KBD
9432
CLASS="userinput"
9433
>scons -Q</KBD
9434
>
9435
cc -o foo.o -c -DDEFINE2 foo.c
9436
cc -o foo foo.o
9437
</PRE
9438
><P
9439
>
9440
You can safely call <CODE
9441
CLASS="function"
9442
>Replace</CODE
9443
>
9444
for construction variables that
9445
don't exist in the construction environment:
9446
9447
</P
9448
><PRE
9449
CLASS="programlisting"
9450
> env = Environment()
9451
env.Replace(NEW_VARIABLE = 'xyzzy')
9452
print "NEW_VARIABLE =", env['NEW_VARIABLE']
9453
</PRE
9454
><P
9455
>
9456
In this case,
9457
the construction variable simply
9458
gets added to the construction environment:
9459
9460
</P
9461
><PRE
9462
CLASS="screen"
9463
> % <KBD
9464
CLASS="userinput"
9465
>scons -Q</KBD
9466
>
9467
NEW_VARIABLE = xyzzy
9468
scons: `.' is up to date.
9469
</PRE
9470
><P
9471
>
9472
Because the variables
9473
aren't expanded until the construction environment
9474
is actually used to build the targets,
9475
and because <SPAN
9476
CLASS="application"
9477
>SCons</SPAN
9478
> function and method calls
9479
are order-independent,
9480
the last replacement "wins"
9481
and is used to build all targets,
9482
regardless of the order in which
9483
the calls to Replace() are
9484
interspersed with calls to
9485
builder methods:
9486
9487
</P
9488
><PRE
9489
CLASS="programlisting"
9490
> env = Environment(CCFLAGS = '-DDEFINE1')
9491
print "CCFLAGS =", env['CCFLAGS']
9492
env.Program('foo.c')
9493
9494
env.Replace(CCFLAGS = '-DDEFINE2')
9495
print "CCFLAGS =", env['CCFLAGS']
9496
env.Program('bar.c')
9497
</PRE
9498
><P
9499
>
9500
The timing of when the replacement
9501
actually occurs relative
9502
to when the targets get built
9503
becomes apparent
9504
if we run <SPAN
9505
CLASS="application"
9506
>scons</SPAN
9507
> without the <TT
9508
CLASS="literal"
9509
>-Q</TT
9510
>
9511
option:
9512
9513
</P
9514
><PRE
9515
CLASS="screen"
9516
> % <KBD
9517
CLASS="userinput"
9518
>scons</KBD
9519
>
9520
scons: Reading SConscript files ...
9521
CCFLAGS = -DDEFINE1
9522
CCFLAGS = -DDEFINE2
9523
scons: done reading SConscript files.
9524
scons: Building targets ...
9525
cc -o bar.o -c -DDEFINE2 bar.c
9526
cc -o bar bar.o
9527
cc -o foo.o -c -DDEFINE2 foo.c
9528
cc -o foo foo.o
9529
scons: done building targets.
9530
</PRE
9531
><P
9532
>
9533
Because the replacement occurs while
9534
the <TT
9535
CLASS="filename"
9536
>SConscript</TT
9537
> files are being read,
9538
the <A
9539
HREF="#cv-CCFLAGS"
9540
><CODE
9541
CLASS="envar"
9542
>$CCFLAGS</CODE
9543
></A
9544
>
9545
variable has already been set to
9546
<TT
9547
CLASS="literal"
9548
>-DDEFINE2</TT
9549
>
9550
by the time the <TT
9551
CLASS="filename"
9552
>foo.o</TT
9553
> target is built,
9554
even though the call to the <CODE
9555
CLASS="function"
9556
>Replace</CODE
9557
>
9558
method does not occur until later in
9559
the <TT
9560
CLASS="filename"
9561
>SConscript</TT
9562
> file.
9563
9564
</P
9565
></DIV
9566
><DIV
9567
CLASS="section"
9568
><HR><H3
9569
CLASS="section"
9570
><A
9571
NAME="AEN1603"
9572
>7.2.8. Setting Values Only If They're Not Already Defined: the <CODE
9573
CLASS="function"
9574
>SetDefault</CODE
9575
> Method</A
9576
></H3
9577
><P
9578
>
9579
Sometimes it's useful to be able to specify
9580
that a construction variable should be
9581
set to a value only if the construction environment
9582
does not already have that variable defined
9583
You can do this with the <CODE
9584
CLASS="function"
9585
>SetDefault</CODE
9586
> method,
9587
which behaves similarly to the <CODE
9588
CLASS="function"
9589
>set_default</CODE
9590
>
9591
method of Python dictionary objects:
9592
9593
</P
9594
><PRE
9595
CLASS="programlisting"
9596
> env.SetDefault(SPECIAL_FLAG = '-extra-option')
9597
</PRE
9598
><P
9599
>
9600
This is especially useful
9601
when writing your own <TT
9602
CLASS="literal"
9603
>Tool</TT
9604
> modules
9605
to apply variables to construction environments.
9606
9607
9608
</P
9609
></DIV
9610
><DIV
9611
CLASS="section"
9612
><HR><H3
9613
CLASS="section"
9614
><A
9615
NAME="AEN1612"
9616
>7.2.9. Appending to the End of Values: the <CODE
9617
CLASS="function"
9618
>Append</CODE
9619
> Method</A
9620
></H3
9621
><P
9622
>
9623
You can append a value to
9624
an existing construction variable
9625
using the <CODE
9626
CLASS="function"
9627
>Append</CODE
9628
> method:
9629
9630
</P
9631
><PRE
9632
CLASS="programlisting"
9633
> env = Environment(CCFLAGS = ['-DMY_VALUE'])
9634
env.Append(CCFLAGS = ['-DLAST'])
9635
env.Program('foo.c')
9636
</PRE
9637
><P
9638
>
9639
<SPAN
9640
CLASS="application"
9641
>SCons</SPAN
9642
> then supplies both the <TT
9643
CLASS="literal"
9644
>-DMY_VALUE</TT
9645
> and
9646
<TT
9647
CLASS="literal"
9648
>-DLAST</TT
9649
> flags when compiling the object file:
9650
9651
</P
9652
><PRE
9653
CLASS="screen"
9654
> % <KBD
9655
CLASS="userinput"
9656
>scons -Q</KBD
9657
>
9658
cc -o foo.o -c -DMY_VALUE -DLAST foo.c
9659
cc -o foo foo.o
9660
</PRE
9661
><P
9662
>
9663
If the construction variable doesn't already exist,
9664
the <CODE
9665
CLASS="function"
9666
>Append</CODE
9667
> method will create it:
9668
9669
</P
9670
><PRE
9671
CLASS="programlisting"
9672
> env = Environment()
9673
env.Append(NEW_VARIABLE = 'added')
9674
print "NEW_VARIABLE =", env['NEW_VARIABLE']
9675
</PRE
9676
><P
9677
>
9678
Which yields:
9679
9680
</P
9681
><PRE
9682
CLASS="screen"
9683
> % <KBD
9684
CLASS="userinput"
9685
>scons -Q</KBD
9686
>
9687
NEW_VARIABLE = added
9688
scons: `.' is up to date.
9689
</PRE
9690
><P
9691
>
9692
Note that the <CODE
9693
CLASS="function"
9694
>Append</CODE
9695
> function tries to be "smart"
9696
about how the new value is appended to the old value.
9697
If both are strings, the previous and new strings
9698
are simply concatenated.
9699
Similarly, if both are lists,
9700
the lists are concatenated.
9701
If, however, one is a string and the other is a list,
9702
the string is added as a new element to the list.
9703
9704
</P
9705
></DIV
9706
><DIV
9707
CLASS="section"
9708
><HR><H3
9709
CLASS="section"
9710
><A
9711
NAME="AEN1632"
9712
>7.2.10. Appending Unique Values: the <CODE
9713
CLASS="function"
9714
>AppendUnique</CODE
9715
> Method</A
9716
></H3
9717
><P
9718
>
9719
Some times it's useful to add a new value
9720
only if the existing construction variable
9721
doesn't already contain the value.
9722
This can be done using the <CODE
9723
CLASS="function"
9724
>AppendUnique</CODE
9725
> method:
9726
9727
</P
9728
><PRE
9729
CLASS="programlisting"
9730
> env.AppendUnique(CCFLAGS=['-g'])
9731
</PRE
9732
><P
9733
>
9734
In the above example,
9735
the <TT
9736
CLASS="literal"
9737
>-g</TT
9738
> would be added
9739
only if the <CODE
9740
CLASS="envar"
9741
>$CCFLAGS</CODE
9742
> variable
9743
does not already contain a <TT
9744
CLASS="literal"
9745
>-g</TT
9746
> value.
9747
9748
</P
9749
></DIV
9750
><DIV
9751
CLASS="section"
9752
><HR><H3
9753
CLASS="section"
9754
><A
9755
NAME="AEN1642"
9756
>7.2.11. Appending to the Beginning of Values: the <CODE
9757
CLASS="function"
9758
>Prepend</CODE
9759
> Method</A
9760
></H3
9761
><P
9762
>
9763
You can append a value to the beginning of
9764
an existing construction variable
9765
using the <CODE
9766
CLASS="function"
9767
>Prepend</CODE
9768
> method:
9769
9770
</P
9771
><PRE
9772
CLASS="programlisting"
9773
> env = Environment(CCFLAGS = ['-DMY_VALUE'])
9774
env.Prepend(CCFLAGS = ['-DFIRST'])
9775
env.Program('foo.c')
9776
</PRE
9777
><P
9778
>
9779
<SPAN
9780
CLASS="application"
9781
>SCons</SPAN
9782
> then supplies both the <TT
9783
CLASS="literal"
9784
>-DFIRST</TT
9785
> and
9786
<TT
9787
CLASS="literal"
9788
>-DMY_VALUE</TT
9789
> flags when compiling the object file:
9790
9791
</P
9792
><PRE
9793
CLASS="screen"
9794
> % <KBD
9795
CLASS="userinput"
9796
>scons -Q</KBD
9797
>
9798
cc -o foo.o -c -DFIRST -DMY_VALUE foo.c
9799
cc -o foo foo.o
9800
</PRE
9801
><P
9802
>
9803
If the construction variable doesn't already exist,
9804
the <CODE
9805
CLASS="function"
9806
>Prepend</CODE
9807
> method will create it:
9808
9809
</P
9810
><PRE
9811
CLASS="programlisting"
9812
> env = Environment()
9813
env.Prepend(NEW_VARIABLE = 'added')
9814
print "NEW_VARIABLE =", env['NEW_VARIABLE']
9815
</PRE
9816
><P
9817
>
9818
Which yields:
9819
9820
</P
9821
><PRE
9822
CLASS="screen"
9823
> % <KBD
9824
CLASS="userinput"
9825
>scons -Q</KBD
9826
>
9827
NEW_VARIABLE = added
9828
scons: `.' is up to date.
9829
</PRE
9830
><P
9831
>
9832
Like the <CODE
9833
CLASS="function"
9834
>Append</CODE
9835
> function,
9836
the <CODE
9837
CLASS="function"
9838
>Prepend</CODE
9839
> function tries to be "smart"
9840
about how the new value is appended to the old value.
9841
If both are strings, the previous and new strings
9842
are simply concatenated.
9843
Similarly, if both are lists,
9844
the lists are concatenated.
9845
If, however, one is a string and the other is a list,
9846
the string is added as a new element to the list.
9847
9848
</P
9849
></DIV
9850
><DIV
9851
CLASS="section"
9852
><HR><H3
9853
CLASS="section"
9854
><A
9855
NAME="AEN1663"
9856
>7.2.12. Prepending Unique Values: the <CODE
9857
CLASS="function"
9858
>PrependUnique</CODE
9859
> Method</A
9860
></H3
9861
><P
9862
>
9863
Some times it's useful to add a new value
9864
to the beginning of a construction variable
9865
only if the existing value
9866
doesn't already contain the to-be-added value.
9867
This can be done using the <CODE
9868
CLASS="function"
9869
>PrependUnique</CODE
9870
> method:
9871
9872
</P
9873
><PRE
9874
CLASS="programlisting"
9875
> env.PrependUnique(CCFLAGS=['-g'])
9876
</PRE
9877
><P
9878
>
9879
In the above example,
9880
the <TT
9881
CLASS="literal"
9882
>-g</TT
9883
> would be added
9884
only if the <CODE
9885
CLASS="envar"
9886
>$CCFLAGS</CODE
9887
> variable
9888
does not already contain a <TT
9889
CLASS="literal"
9890
>-g</TT
9891
> value.
9892
9893
</P
9894
></DIV
9895
></DIV
9896
><DIV
9897
CLASS="section"
9898
><HR><H2
9899
CLASS="section"
9900
><A
9901
NAME="sect-execution-environments"
9902
>7.3. Controlling the Execution Environment for Issued Commands</A
9903
></H2
9904
><P
9905
>
9906
When <SPAN
9907
CLASS="application"
9908
>SCons</SPAN
9909
> builds a target file,
9910
it does not execute the commands with
9911
the same external environment
9912
that you used to execute <SPAN
9913
CLASS="application"
9914
>SCons</SPAN
9915
>.
9916
Instead, it uses the dictionary
9917
stored in the <A
9918
HREF="#cv-ENV"
9919
><CODE
9920
CLASS="envar"
9921
>$ENV</CODE
9922
></A
9923
> construction variable
9924
as the external environment
9925
for executing commands.
9926
9927
</P
9928
><P
9929
>
9930
The most important ramification of this behavior
9931
is that the <CODE
9932
CLASS="varname"
9933
>PATH</CODE
9934
> environment variable,
9935
which controls where the operating system
9936
will look for commands and utilities,
9937
is not the same as in the external environment
9938
from which you called <SPAN
9939
CLASS="application"
9940
>SCons</SPAN
9941
>.
9942
This means that <SPAN
9943
CLASS="application"
9944
>SCons</SPAN
9945
> will not, by default,
9946
necessarily find all of the tools
9947
that you can execute from the command line.
9948
9949
</P
9950
><P
9951
>
9952
The default value of the <CODE
9953
CLASS="varname"
9954
>PATH</CODE
9955
> environment variable
9956
on a POSIX system
9957
is <TT
9958
CLASS="literal"
9959
>/usr/local/bin:/bin:/usr/bin</TT
9960
>.
9961
The default value of the <CODE
9962
CLASS="varname"
9963
>PATH</CODE
9964
> environment variable
9965
on a Windows system comes from the Windows registry
9966
value for the command interpreter.
9967
If you want to execute any commands--compilers, linkers, etc.--that
9968
are not in these default locations,
9969
you need to set the <CODE
9970
CLASS="varname"
9971
>PATH</CODE
9972
> value
9973
in the <CODE
9974
CLASS="envar"
9975
>$ENV</CODE
9976
> dictionary
9977
in your construction environment.
9978
9979
</P
9980
><P
9981
>
9982
The simplest way to do this is to initialize explicitly
9983
the value when you create the construction environment;
9984
this is one way to do that:
9985
9986
</P
9987
><PRE
9988
CLASS="programlisting"
9989
> path = ['/usr/local/bin', '/bin', '/usr/bin']
9990
env = Environment(ENV = {'PATH' : path})
9991
</PRE
9992
><P
9993
>
9994
Assign a dictionary to the <CODE
9995
CLASS="envar"
9996
>$ENV</CODE
9997
>
9998
construction variable in this way
9999
completely resets the external environment
10000
so that the only variable that will be
10001
set when external commands are executed
10002
will be the <CODE
10003
CLASS="varname"
10004
>PATH</CODE
10005
> value.
10006
If you want to use the rest of
10007
the values in <CODE
10008
CLASS="envar"
10009
>$ENV</CODE
10010
> and only
10011
set the value of <CODE
10012
CLASS="varname"
10013
>PATH</CODE
10014
>,
10015
the most straightforward way is probably:
10016
10017
</P
10018
><PRE
10019
CLASS="programlisting"
10020
> env['ENV']['PATH'] = ['/usr/local/bin', '/bin', '/usr/bin']
10021
</PRE
10022
><P
10023
>
10024
Note that <SPAN
10025
CLASS="application"
10026
>SCons</SPAN
10027
> does allow you to define
10028
the directories in the <CODE
10029
CLASS="varname"
10030
>PATH</CODE
10031
> in a string,
10032
separated by the pathname-separator character
10033
for your system (':' on POSIX systems, ';' on Windows):
10034
10035
</P
10036
><PRE
10037
CLASS="programlisting"
10038
> env['ENV']['PATH'] = '/usr/local/bin:/bin:/usr/bin'
10039
</PRE
10040
><P
10041
>
10042
But doing so makes your <TT
10043
CLASS="filename"
10044
>SConscript</TT
10045
> file less portable,
10046
(although in this case that may not be a huge concern
10047
since the directories you list are likley system-specific, anyway).
10048
10049
</P
10050
><DIV
10051
CLASS="section"
10052
><HR><H3
10053
CLASS="section"
10054
><A
10055
NAME="AEN1704"
10056
>7.3.1. Propagating <CODE
10057
CLASS="varname"
10058
>PATH</CODE
10059
> From the External Environment</A
10060
></H3
10061
><P
10062
>
10063
You may want to propagate the external <CODE
10064
CLASS="varname"
10065
>PATH</CODE
10066
>
10067
to the execution environment for commands.
10068
You do this by initializing the <CODE
10069
CLASS="varname"
10070
>PATH</CODE
10071
>
10072
variable with the <CODE
10073
CLASS="varname"
10074
>PATH</CODE
10075
> value from
10076
the <TT
10077
CLASS="literal"
10078
>os.environ</TT
10079
>
10080
dictionary,
10081
which is Python's way of letting you
10082
get at the external environment:
10083
10084
</P
10085
><PRE
10086
CLASS="programlisting"
10087
> import os
10088
env = Environment(ENV = {'PATH' : os.environ['PATH']})
10089
</PRE
10090
><P
10091
>
10092
Alternatively, you may find it easier
10093
to just propagate the entire external
10094
environment to the execution environment
10095
for commands.
10096
This is simpler to code than explicity
10097
selecting the <CODE
10098
CLASS="varname"
10099
>PATH</CODE
10100
> value:
10101
10102
</P
10103
><PRE
10104
CLASS="programlisting"
10105
> import os
10106
env = Environment(ENV = os.environ)
10107
</PRE
10108
><P
10109
>
10110
Either of these will guarantee that
10111
<SPAN
10112
CLASS="application"
10113
>SCons</SPAN
10114
> will be able to execute
10115
any command that you can execute from the command line.
10116
The drawback is that the build can behave
10117
differently if it's run by people with
10118
different <CODE
10119
CLASS="varname"
10120
>PATH</CODE
10121
> values in their environment--for example,
10122
if both the <TT
10123
CLASS="literal"
10124
>/bin</TT
10125
> and
10126
<TT
10127
CLASS="literal"
10128
>/usr/local/bin</TT
10129
> directories
10130
have different <SPAN
10131
CLASS="application"
10132
>cc</SPAN
10133
> commands,
10134
then which one will be used to compile programs
10135
will depend on which directory is listed
10136
first in the user's <CODE
10137
CLASS="varname"
10138
>PATH</CODE
10139
> variable.
10140
10141
</P
10142
></DIV
10143
><DIV
10144
CLASS="section"
10145
><HR><H3
10146
CLASS="section"
10147
><A
10148
NAME="AEN1723"
10149
>7.3.2. Adding to <CODE
10150
CLASS="varname"
10151
>PATH</CODE
10152
> Values in the Execution Environment</A
10153
></H3
10154
><P
10155
>
10156
One of the most common requirements
10157
for manipulating a variable in the execution environment
10158
is to add one or more custom directories to a search
10159
like the <CODE
10160
CLASS="envar"
10161
>$PATH</CODE
10162
> variable on Linux or POSIX systems,
10163
or the <CODE
10164
CLASS="envar"
10165
>%PATH%</CODE
10166
> variable on Windows,
10167
so that a locally-installed compiler or other utility
10168
can be found when <SPAN
10169
CLASS="application"
10170
>SCons</SPAN
10171
> tries to execute it to update a target.
10172
<SPAN
10173
CLASS="application"
10174
>SCons</SPAN
10175
> provides <CODE
10176
CLASS="function"
10177
>PrependENVPath</CODE
10178
> and <CODE
10179
CLASS="function"
10180
>AppendENVPath</CODE
10181
> functions
10182
to make adding things to execution variables convenient.
10183
You call these functions by specifying the variable
10184
to which you want the value added,
10185
and then value itself.
10186
So to add some <TT
10187
CLASS="filename"
10188
>/usr/local</TT
10189
> directories
10190
to the <CODE
10191
CLASS="envar"
10192
>$PATH</CODE
10193
> and <CODE
10194
CLASS="envar"
10195
>$LIB</CODE
10196
> variables,
10197
you might:
10198
10199
</P
10200
><PRE
10201
CLASS="programlisting"
10202
> env = Environment(ENV = os.environ)
10203
env.PrependENVPath('PATH', '/usr/local/bin')
10204
env.AppendENVPath('LIB', '/usr/local/lib')
10205
</PRE
10206
><P
10207
>
10208
Note that the added values are strings,
10209
and if you want to add multiple directories to
10210
a variable like <CODE
10211
CLASS="envar"
10212
>$PATH</CODE
10213
>,
10214
you must include the path separate character
10215
(<TT
10216
CLASS="literal"
10217
>:</TT
10218
> on Linux or POSIX,
10219
<TT
10220
CLASS="literal"
10221
>;</TT
10222
> on Windows)
10223
in the string.
10224
10225
</P
10226
></DIV
10227
></DIV
10228
></DIV
10229
><DIV
10230
CLASS="chapter"
10231
><HR><H1
10232
><A
10233
NAME="chap-mergeflags"
10234
></A
10235
>Chapter 8. Merging Options into the Environment: the <CODE
10236
CLASS="function"
10237
>MergeFlags</CODE
10238
> Function</H1
10239
><P
10240
>
10241
<SPAN
10242
CLASS="application"
10243
>SCons</SPAN
10244
> construction environments have a <CODE
10245
CLASS="function"
10246
>MergeFlags</CODE
10247
> method
10248
that merges a dictionary of values into the construction environment.
10249
<CODE
10250
CLASS="function"
10251
>MergeFlags</CODE
10252
> treats each value in the dictionary
10253
as a list of options such as one might pass to a command
10254
(such as a compiler or linker).
10255
<CODE
10256
CLASS="function"
10257
>MergeFlags</CODE
10258
> will not duplicate an option
10259
if it already exists in the construction environment variable.
10260
10261
</P
10262
><P
10263
>
10264
<CODE
10265
CLASS="function"
10266
>MergeFlags</CODE
10267
> tries to be intelligent about merging options.
10268
When merging options to any variable
10269
whose name ends in <CODE
10270
CLASS="varname"
10271
>PATH</CODE
10272
>,
10273
<CODE
10274
CLASS="function"
10275
>MergeFlags</CODE
10276
> keeps the leftmost occurrence of the option,
10277
because in typical lists of directory paths,
10278
the first occurrence "wins."
10279
When merging options to any other variable name,
10280
<CODE
10281
CLASS="function"
10282
>MergeFlags</CODE
10283
> keeps the rightmost occurrence of the option,
10284
because in a list of typical command-line options,
10285
the last occurrence "wins."
10286
10287
</P
10288
><PRE
10289
CLASS="programlisting"
10290
> env = Environment()
10291
env.Append(CCFLAGS = '-option -O3 -O1')
10292
flags = { 'CCFLAGS' : '-whatever -O3' }
10293
env.MergeFlags(flags)
10294
print env['CCFLAGS']
10295
</PRE
10296
><PRE
10297
CLASS="screen"
10298
> % <KBD
10299
CLASS="userinput"
10300
>scons -Q</KBD
10301
>
10302
['-option', '-O1', '-whatever', '-O3']
10303
scons: `.' is up to date.
10304
</PRE
10305
><P
10306
>
10307
Note that the default value for <A
10308
HREF="#cv-CCFLAGS"
10309
><CODE
10310
CLASS="envar"
10311
>$CCFLAGS</CODE
10312
></A
10313
>
10314
10315
is an internal <SPAN
10316
CLASS="application"
10317
>SCons</SPAN
10318
> object
10319
which automatically converts
10320
the options we specified as a string into a list.
10321
10322
</P
10323
><PRE
10324
CLASS="programlisting"
10325
> env = Environment()
10326
env.Append(CPPPATH = ['/include', '/usr/local/include', '/usr/include'])
10327
flags = { 'CPPPATH' : ['/usr/opt/include', '/usr/local/include'] }
10328
env.MergeFlags(flags)
10329
print env['CPPPATH']
10330
</PRE
10331
><PRE
10332
CLASS="screen"
10333
> % <KBD
10334
CLASS="userinput"
10335
>scons -Q</KBD
10336
>
10337
['/include', '/usr/local/include', '/usr/include', '/usr/opt/include']
10338
scons: `.' is up to date.
10339
</PRE
10340
><P
10341
>
10342
Note that the default value for <A
10343
HREF="#cv-CPPPATH"
10344
><CODE
10345
CLASS="envar"
10346
>$CPPPATH</CODE
10347
></A
10348
>
10349
10350
is a normal Python list,
10351
so we must specify its values as a list
10352
in the dictionary we pass to the <CODE
10353
CLASS="function"
10354
>MergeFlags</CODE
10355
> function.
10356
10357
</P
10358
><P
10359
>
10360
If <CODE
10361
CLASS="function"
10362
>MergeFlags</CODE
10363
> is passed anything other than a dictionary,
10364
it calls the <CODE
10365
CLASS="function"
10366
>ParseFlags</CODE
10367
> method to convert it into a dictionary.
10368
10369
</P
10370
><PRE
10371
CLASS="programlisting"
10372
> env = Environment()
10373
env.Append(CCFLAGS = '-option -O3 -O1')
10374
env.Append(CPPPATH = ['/include', '/usr/local/include', '/usr/include'])
10375
env.MergeFlags('-whatever -I/usr/opt/include -O3 -I/usr/local/include')
10376
print env['CCFLAGS']
10377
print env['CPPPATH']
10378
</PRE
10379
><PRE
10380
CLASS="screen"
10381
> % <KBD
10382
CLASS="userinput"
10383
>scons -Q</KBD
10384
>
10385
['-option', '-O1', '-whatever', '-O3']
10386
['/include', '/usr/local/include', '/usr/include', '/usr/opt/include']
10387
scons: `.' is up to date.
10388
</PRE
10389
><P
10390
>
10391
In the combined example above,
10392
<CODE
10393
CLASS="function"
10394
>ParseFlags</CODE
10395
> has sorted the options into their corresponding variables
10396
and returned a dictionary for <CODE
10397
CLASS="function"
10398
>MergeFlags</CODE
10399
> to apply
10400
to the construction variables
10401
in the specified construction environment.
10402
10403
</P
10404
></DIV
10405
><DIV
10406
CLASS="chapter"
10407
><HR><H1
10408
><A
10409
NAME="chap-parseflags"
10410
></A
10411
>Chapter 9. Separating Compile Arguments into their Variables: the <CODE
10412
CLASS="function"
10413
>ParseFlags</CODE
10414
> Function</H1
10415
><P
10416
>
10417
<SPAN
10418
CLASS="application"
10419
>SCons</SPAN
10420
> has a bewildering array of construction variables
10421
for different types of options when building programs.
10422
Sometimes you may not know exactly which variable
10423
should be used for a particular option.
10424
10425
</P
10426
><P
10427
>
10428
<SPAN
10429
CLASS="application"
10430
>SCons</SPAN
10431
> construction environments have a <CODE
10432
CLASS="function"
10433
>ParseFlags</CODE
10434
> method
10435
that takes a set of typical command-line options
10436
and distrbutes them into the appropriate construction variables.
10437
Historically, it was created to support the <CODE
10438
CLASS="function"
10439
>ParseConfig</CODE
10440
> method,
10441
so it focuses on options used by the GNU Compiler Collection (GCC)
10442
for the C and C++ toolchains.
10443
10444
</P
10445
><P
10446
>
10447
<CODE
10448
CLASS="function"
10449
>ParseFlags</CODE
10450
> returns a dictionary containing the options
10451
distributed into their respective construction variables.
10452
Normally, this dictionary would be passed to <CODE
10453
CLASS="function"
10454
>MergeFlags</CODE
10455
>
10456
to merge the options into a <TT
10457
CLASS="literal"
10458
>construction environment</TT
10459
>,
10460
but the dictionary can be edited if desired to provide
10461
additional functionality.
10462
(Note that if the flags are not going to be edited,
10463
calling <CODE
10464
CLASS="function"
10465
>MergeFlags</CODE
10466
> with the options directly
10467
will avoid an additional step.)
10468
10469
</P
10470
><PRE
10471
CLASS="programlisting"
10472
> env = Environment()
10473
d = env.ParseFlags("-I/opt/include -L/opt/lib -lfoo")
10474
l = d.items()
10475
l.sort()
10476
for k,v in l:
10477
if v:
10478
print k, v
10479
env.MergeFlags(d)
10480
env.Program('f1.c')
10481
</PRE
10482
><PRE
10483
CLASS="screen"
10484
> % <KBD
10485
CLASS="userinput"
10486
>scons -Q</KBD
10487
>
10488
CPPPATH ['/opt/include']
10489
LIBPATH ['/opt/lib']
10490
LIBS ['foo']
10491
cc -o f1.o -c -I/opt/include f1.c
10492
cc -o f1 f1.o -L/opt/lib -lfoo
10493
</PRE
10494
><P
10495
>
10496
Note that if the options are limited to generic types
10497
like those above,
10498
they will be correctly translated for other platform types:
10499
10500
</P
10501
><PRE
10502
CLASS="screen"
10503
> C:\><KBD
10504
CLASS="userinput"
10505
>scons -Q</KBD
10506
>
10507
CPPPATH ['/opt/include']
10508
LIBPATH ['/opt/lib']
10509
LIBS ['foo']
10510
cl /nologo /I\opt\include /c f1.c /Fof1.obj
10511
link /nologo /OUT:f1.exe /LIBPATH:\opt\lib foo.lib f1.obj
10512
</PRE
10513
><P
10514
>
10515
Since the assumption is that the flags are used for the GCC toolchain,
10516
unrecognized flags are placed in <A
10517
HREF="#cv-CCFLAGS"
10518
><CODE
10519
CLASS="envar"
10520
>$CCFLAGS</CODE
10521
></A
10522
>
10523
so they will be used for both C and C++ compiles:
10524
10525
</P
10526
><PRE
10527
CLASS="programlisting"
10528
> env = Environment()
10529
d = env.ParseFlags("-whatever")
10530
l = d.items()
10531
l.sort()
10532
for k,v in l:
10533
if v:
10534
print k, v
10535
env.MergeFlags(d)
10536
env.Program('f1.c')
10537
</PRE
10538
><PRE
10539
CLASS="screen"
10540
> % <KBD
10541
CLASS="userinput"
10542
>scons -Q</KBD
10543
>
10544
CCFLAGS -whatever
10545
cc -o f1.o -c -whatever f1.c
10546
cc -o f1 f1.o
10547
</PRE
10548
><P
10549
>
10550
<CODE
10551
CLASS="function"
10552
>ParseFlags</CODE
10553
> will also accept a (recursive) list of strings as input;
10554
the list is flattened before the strings are processed:
10555
10556
</P
10557
><PRE
10558
CLASS="programlisting"
10559
> env = Environment()
10560
d = env.ParseFlags(["-I/opt/include", ["-L/opt/lib", "-lfoo"]])
10561
l = d.items()
10562
l.sort()
10563
for k,v in l:
10564
if v:
10565
print k, v
10566
env.MergeFlags(d)
10567
env.Program('f1.c')
10568
</PRE
10569
><PRE
10570
CLASS="screen"
10571
> % <KBD
10572
CLASS="userinput"
10573
>scons -Q</KBD
10574
>
10575
CPPPATH ['/opt/include']
10576
LIBPATH ['/opt/lib']
10577
LIBS ['foo']
10578
cc -o f1.o -c -I/opt/include f1.c
10579
cc -o f1 f1.o -L/opt/lib -lfoo
10580
</PRE
10581
><P
10582
>
10583
If a string begins with a "!" (an exclamation mark, often called a bang),
10584
the string is passed to the shell for execution.
10585
The output of the command is then parsed:
10586
10587
</P
10588
><PRE
10589
CLASS="programlisting"
10590
> env = Environment()
10591
d = env.ParseFlags(["!echo -I/opt/include", "!echo -L/opt/lib", "-lfoo"])
10592
l = d.items()
10593
l.sort()
10594
for k,v in l:
10595
if v:
10596
print k, v
10597
env.MergeFlags(d)
10598
env.Program('f1.c')
10599
</PRE
10600
><PRE
10601
CLASS="screen"
10602
> % <KBD
10603
CLASS="userinput"
10604
>scons -Q</KBD
10605
>
10606
CPPPATH ['/opt/include']
10607
LIBPATH ['/opt/lib']
10608
LIBS ['foo']
10609
cc -o f1.o -c -I/opt/include f1.c
10610
cc -o f1 f1.o -L/opt/lib -lfoo
10611
</PRE
10612
><P
10613
>
10614
<CODE
10615
CLASS="function"
10616
>ParseFlags</CODE
10617
> is regularly updated for new options;
10618
consult the man page for details about those currently recognized.
10619
10620
</P
10621
></DIV
10622
><DIV
10623
CLASS="chapter"
10624
><HR><H1
10625
><A
10626
NAME="chap-parseconfig"
10627
></A
10628
>Chapter 10. Finding Installed Library Information: the <CODE
10629
CLASS="function"
10630
>ParseConfig</CODE
10631
> Function</H1
10632
><P
10633
>
10634
Configuring the right options to build programs to work with
10635
libraries--especially shared libraries--that are available
10636
on POSIX systems can be very complicated.
10637
To help this situation,
10638
various utilies with names that end in <TT
10639
CLASS="filename"
10640
>config</TT
10641
>
10642
return the command-line options for the GNU Compiler Collection (GCC)
10643
that are needed to use these libraries;
10644
for example, the command-line options
10645
to use a library named <TT
10646
CLASS="filename"
10647
>lib</TT
10648
>
10649
would be found by calling a utility named <TT
10650
CLASS="filename"
10651
>lib-config</TT
10652
>.
10653
10654
</P
10655
><P
10656
>
10657
A more recent convention is that these options
10658
are available from the generic <TT
10659
CLASS="filename"
10660
>pkg-config</TT
10661
> program,
10662
which has common framework, error handling, and the like,
10663
so that all the package creator has to do is provide the set of strings
10664
for his particular package.
10665
10666
</P
10667
><P
10668
>
10669
<SPAN
10670
CLASS="application"
10671
>SCons</SPAN
10672
> construction environments have a <CODE
10673
CLASS="function"
10674
>ParseConfig</CODE
10675
> method
10676
that executes a <TT
10677
CLASS="filename"
10678
>*config</TT
10679
> utility
10680
(either <TT
10681
CLASS="filename"
10682
>pkg-config</TT
10683
> or a
10684
more specific utility)
10685
and configures the appropriate construction variables
10686
in the environment
10687
based on the command-line options
10688
returned by the specified command.
10689
10690
</P
10691
><PRE
10692
CLASS="programlisting"
10693
> env = Environment()
10694
env['CPPPATH'] = ['/lib/compat']
10695
env.ParseConfig("pkg-config x11 --cflags --libs")
10696
print env['CPPPATH']
10697
</PRE
10698
><P
10699
>
10700
<SPAN
10701
CLASS="application"
10702
>SCons</SPAN
10703
> will execute the specified command string,
10704
parse the resultant flags,
10705
and add the flags to the appropriate environment variables.
10706
10707
</P
10708
><PRE
10709
CLASS="screen"
10710
> % <KBD
10711
CLASS="userinput"
10712
>scons -Q</KBD
10713
>
10714
['/lib/compat', '/usr/X11/include']
10715
scons: `.' is up to date.
10716
</PRE
10717
><P
10718
>
10719
In the example above, <SPAN
10720
CLASS="application"
10721
>SCons</SPAN
10722
> has added the include directory to
10723
<CODE
10724
CLASS="varname"
10725
>CPPPATH</CODE
10726
>.
10727
(Depending upon what other flags are emitted by the
10728
<TT
10729
CLASS="filename"
10730
>pkg-config</TT
10731
> command,
10732
other variables may have been extended as well.)
10733
10734
</P
10735
><P
10736
>
10737
Note that the options are merged with existing options using
10738
the <CODE
10739
CLASS="function"
10740
>MergeFlags</CODE
10741
> method,
10742
so that each option only occurs once in the construction variable:
10743
10744
</P
10745
><PRE
10746
CLASS="programlisting"
10747
> env = Environment()
10748
env.ParseConfig("pkg-config x11 --cflags --libs")
10749
env.ParseConfig("pkg-config x11 --cflags --libs")
10750
print env['CPPPATH']
10751
</PRE
10752
><PRE
10753
CLASS="screen"
10754
> % <KBD
10755
CLASS="userinput"
10756
>scons -Q</KBD
10757
>
10758
['/usr/X11/include']
10759
scons: `.' is up to date.
10760
</PRE
10761
></DIV
10762
><DIV
10763
CLASS="chapter"
10764
><HR><H1
10765
><A
10766
NAME="chap-output"
10767
></A
10768
>Chapter 11. Controlling Build Output</H1
10769
><P
10770
>
10771
A key aspect of creating a usable build configuration
10772
is providing good output from the build
10773
so its users can readily understand
10774
what the build is doing
10775
and get information about how to control the build.
10776
<SPAN
10777
CLASS="application"
10778
>SCons</SPAN
10779
> provides several ways of
10780
controlling output from the build configuration
10781
to help make the build
10782
more useful and understandable.
10783
10784
</P
10785
><DIV
10786
CLASS="section"
10787
><HR><H2
10788
CLASS="section"
10789
><A
10790
NAME="AEN1846"
10791
>11.1. Providing Build Help: the <CODE
10792
CLASS="function"
10793
>Help</CODE
10794
> Function</A
10795
></H2
10796
><P
10797
>
10798
It's often very useful to be able to give
10799
users some help that describes the
10800
specific targets, build options, etc.,
10801
that can be used for your build.
10802
<SPAN
10803
CLASS="application"
10804
>SCons</SPAN
10805
> provides the <CODE
10806
CLASS="function"
10807
>Help</CODE
10808
> function
10809
to allow you to specify this help text:
10810
10811
</P
10812
><PRE
10813
CLASS="programlisting"
10814
> Help("""
10815
Type: 'scons program' to build the production program,
10816
'scons debug' to build the debug version.
10817
""")
10818
</PRE
10819
><P
10820
>
10821
(Note the above use of the Python triple-quote syntax,
10822
which comes in very handy for
10823
specifying multi-line strings like help text.)
10824
10825
</P
10826
><P
10827
>
10828
When the <TT
10829
CLASS="filename"
10830
>SConstruct</TT
10831
> or <TT
10832
CLASS="filename"
10833
>SConscript</TT
10834
> files
10835
contain such a call to the <CODE
10836
CLASS="function"
10837
>Help</CODE
10838
> function,
10839
the specified help text will be displayed in response to
10840
the <SPAN
10841
CLASS="application"
10842
>SCons</SPAN
10843
> <TT
10844
CLASS="literal"
10845
>-h</TT
10846
> option:
10847
10848
</P
10849
><PRE
10850
CLASS="screen"
10851
> % <KBD
10852
CLASS="userinput"
10853
>scons -h</KBD
10854
>
10855
scons: Reading SConscript files ...
10856
scons: done reading SConscript files.
10857
10858
Type: 'scons program' to build the production program,
10859
'scons debug' to build the debug version.
10860
10861
Use scons -H for help about command-line options.
10862
</PRE
10863
><P
10864
>
10865
The <TT
10866
CLASS="filename"
10867
>SConscript</TT
10868
> files may contain
10869
multiple calls to the <CODE
10870
CLASS="function"
10871
>Help</CODE
10872
> function,
10873
in which case the specified text(s)
10874
will be concatenated when displayed.
10875
This allows you to split up the
10876
help text across multiple <TT
10877
CLASS="filename"
10878
>SConscript</TT
10879
> files.
10880
In this situation, the order in
10881
which the <TT
10882
CLASS="filename"
10883
>SConscript</TT
10884
> files are called
10885
will determine the order in which the <CODE
10886
CLASS="function"
10887
>Help</CODE
10888
> functions are called,
10889
which will determine the order in which
10890
the various bits of text will get concatenated.
10891
10892
</P
10893
><P
10894
>
10895
Another use would be to make the help text conditional
10896
on some variable.
10897
For example, suppose you only want to display
10898
a line about building a Windows-only
10899
version of a program when actually
10900
run on Windows.
10901
The following <TT
10902
CLASS="filename"
10903
>SConstruct</TT
10904
> file:
10905
10906
</P
10907
><PRE
10908
CLASS="programlisting"
10909
> env = Environment()
10910
10911
Help("\nType: 'scons program' to build the production program.\n")
10912
10913
if env['PLATFORM'] == 'win32':
10914
Help("\nType: 'scons windebug' to build the Windows debug version.\n")
10915
</PRE
10916
><P
10917
>
10918
Will display the complete help text on Windows:
10919
10920
</P
10921
><PRE
10922
CLASS="screen"
10923
> C:\><KBD
10924
CLASS="userinput"
10925
>scons -h</KBD
10926
>
10927
scons: Reading SConscript files ...
10928
scons: done reading SConscript files.
10929
10930
Type: 'scons program' to build the production program.
10931
10932
Type: 'scons windebug' to build the Windows debug version.
10933
10934
Use scons -H for help about command-line options.
10935
</PRE
10936
><P
10937
>
10938
But only show the relevant option on a Linux or UNIX system:
10939
10940
</P
10941
><PRE
10942
CLASS="screen"
10943
> % <KBD
10944
CLASS="userinput"
10945
>scons -h</KBD
10946
>
10947
scons: Reading SConscript files ...
10948
scons: done reading SConscript files.
10949
10950
Type: 'scons program' to build the production program.
10951
10952
Use scons -H for help about command-line options.
10953
</PRE
10954
><P
10955
>
10956
If there is no <CODE
10957
CLASS="function"
10958
>Help</CODE
10959
> text in the <TT
10960
CLASS="filename"
10961
>SConstruct</TT
10962
> or
10963
<TT
10964
CLASS="filename"
10965
>SConscript</TT
10966
> files,
10967
<SPAN
10968
CLASS="application"
10969
>SCons</SPAN
10970
> will revert to displaying its
10971
standard list that describes the <SPAN
10972
CLASS="application"
10973
>SCons</SPAN
10974
> command-line
10975
options.
10976
This list is also always displayed whenever
10977
the <TT
10978
CLASS="literal"
10979
>-H</TT
10980
> option is used.
10981
10982
</P
10983
></DIV
10984
><DIV
10985
CLASS="section"
10986
><HR><H2
10987
CLASS="section"
10988
><A
10989
NAME="AEN1884"
10990
>11.2. Controlling How <SPAN
10991
CLASS="application"
10992
>SCons</SPAN
10993
> Prints Build Commands: the <CODE
10994
CLASS="envar"
10995
>$*COMSTR</CODE
10996
> Variables</A
10997
></H2
10998
><P
10999
>
11000
Sometimes the commands executed
11001
to compile object files or link programs
11002
(or build other targets)
11003
can get very long,
11004
long enough to make it difficult for users
11005
to distinguish error messages or
11006
other important build output
11007
from the commands themselves.
11008
All of the default <CODE
11009
CLASS="envar"
11010
>$*COM</CODE
11011
> variables
11012
that specify the command lines
11013
used to build various types of target files
11014
have a corresponding <CODE
11015
CLASS="envar"
11016
>$*COMSTR</CODE
11017
> variable
11018
that can be set to an alternative
11019
string that will be displayed
11020
when the target is built.
11021
11022
</P
11023
><P
11024
>
11025
For example, suppose you want to
11026
have <SPAN
11027
CLASS="application"
11028
>SCons</SPAN
11029
> display a
11030
<TT
11031
CLASS="literal"
11032
>"Compiling"</TT
11033
>
11034
message whenever it's compiling an object file,
11035
and a
11036
<TT
11037
CLASS="literal"
11038
>"Linking"</TT
11039
>
11040
when it's linking an executable.
11041
You could write a <TT
11042
CLASS="filename"
11043
>SConstruct</TT
11044
> file
11045
that looks like:
11046
11047
</P
11048
><PRE
11049
CLASS="programlisting"
11050
> env = Environment(CCCOMSTR = "Compiling $TARGET",
11051
LINKCOMSTR = "Linking $TARGET")
11052
env.Program('foo.c')
11053
</PRE
11054
><P
11055
>
11056
Which would then yield the output:
11057
11058
</P
11059
><PRE
11060
CLASS="screen"
11061
> % <KBD
11062
CLASS="userinput"
11063
>scons -Q</KBD
11064
>
11065
Compiling foo.o
11066
Linking foo
11067
</PRE
11068
><P
11069
>
11070
<SPAN
11071
CLASS="application"
11072
>SCons</SPAN
11073
> performs complete variable substitution
11074
on <CODE
11075
CLASS="envar"
11076
>$*COMSTR</CODE
11077
> variables,
11078
so they have access to all of the
11079
standard variables like <CODE
11080
CLASS="envar"
11081
>$TARGET</CODE
11082
> <CODE
11083
CLASS="envar"
11084
>$SOURCES</CODE
11085
>, etc.,
11086
as well as any construction variables
11087
that happen to be configured in
11088
the construction environment
11089
used to build a specific target.
11090
11091
</P
11092
><P
11093
>
11094
Of course, sometimes it's still important to
11095
be able to see the exact command
11096
that <SPAN
11097
CLASS="application"
11098
>SCons</SPAN
11099
> will execute to build a target.
11100
For example, you may simply need to verify
11101
that <SPAN
11102
CLASS="application"
11103
>SCons</SPAN
11104
> is configured to supply
11105
the right options to the compiler,
11106
or a developer may want to
11107
cut-and-paste a comiloe command
11108
to add a few options
11109
for a custom test.
11110
11111
</P
11112
><P
11113
>
11114
One common way to give users
11115
control over whether or not
11116
<SPAN
11117
CLASS="application"
11118
>SCons</SPAN
11119
> should print the actual command line
11120
or a short, configured summary
11121
is to add support for a
11122
<CODE
11123
CLASS="varname"
11124
>VERBOSE</CODE
11125
>
11126
command-line variable to your <TT
11127
CLASS="filename"
11128
>SConstruct</TT
11129
> file.
11130
A simple configuration for this might look like:
11131
11132
</P
11133
><PRE
11134
CLASS="programlisting"
11135
> env = Environment()
11136
if ARGUMENTS.get('VERBOSE') != "1':
11137
env['CCCOMSTR'] = "Compiling $TARGET"
11138
env['LINKCOMSTR'] = "Linking $TARGET"
11139
env.Program('foo.c')
11140
</PRE
11141
><P
11142
>
11143
11144
By only setting the appropriate
11145
<CODE
11146
CLASS="envar"
11147
>$*COMSTR</CODE
11148
> variables
11149
if the user specifies
11150
<TT
11151
CLASS="literal"
11152
>VERBOSE=1</TT
11153
>
11154
on the command line,
11155
the user has control
11156
over how <SPAN
11157
CLASS="application"
11158
>SCons</SPAN
11159
>
11160
displays these particular command lines:
11161
11162
</P
11163
><PRE
11164
CLASS="screen"
11165
> % <KBD
11166
CLASS="userinput"
11167
>scons -Q</KBD
11168
>
11169
Compiling foo.o
11170
Linking foo
11171
% <KBD
11172
CLASS="userinput"
11173
>scons -Q -c</KBD
11174
>
11175
Removed foo.o
11176
Removed foo
11177
% <KBD
11178
CLASS="userinput"
11179
>scons -Q VERBOSE=1</KBD
11180
>
11181
cc -o foo.o -c foo.c
11182
cc -o foo foo.o
11183
</PRE
11184
></DIV
11185
><DIV
11186
CLASS="section"
11187
><HR><H2
11188
CLASS="section"
11189
><A
11190
NAME="AEN1921"
11191
>11.3. Providing Build Progress Output: the <CODE
11192
CLASS="function"
11193
>Progress</CODE
11194
> Function</A
11195
></H2
11196
><P
11197
>
11198
Another aspect of providing good build output
11199
is to give the user feedback
11200
about what <SPAN
11201
CLASS="application"
11202
>SCons</SPAN
11203
> is doing
11204
even when nothing is being built at the moment.
11205
This can be especially true for large builds
11206
when most of the targets are already up-to-date.
11207
Because <SPAN
11208
CLASS="application"
11209
>SCons</SPAN
11210
> can take a long time
11211
making absolutely sure that every
11212
target is, in fact, up-to-date
11213
with respect to a lot of dependency files,
11214
it can be easy for users to mistakenly
11215
conclude that <SPAN
11216
CLASS="application"
11217
>SCons</SPAN
11218
> is hung
11219
or that there is some other problem with the build.
11220
11221
</P
11222
><P
11223
>
11224
One way to deal with this perception
11225
is to configure <SPAN
11226
CLASS="application"
11227
>SCons</SPAN
11228
> to print something to
11229
let the user know what it's "thinking about."
11230
The <CODE
11231
CLASS="function"
11232
>Progress</CODE
11233
> function
11234
allows you to specify a string
11235
that will be printed for every file
11236
that <SPAN
11237
CLASS="application"
11238
>SCons</SPAN
11239
> is "considering"
11240
while it is traversing the dependency graph
11241
to decide what targets are or are not up-to-date.
11242
11243
</P
11244
><PRE
11245
CLASS="programlisting"
11246
> Progress('Evaluating $TARGET\n')
11247
Program('f1.c')
11248
Program('f2.c')
11249
</PRE
11250
><P
11251
>
11252
Note that the <CODE
11253
CLASS="function"
11254
>Progress</CODE
11255
> function does not
11256
arrange for a newline to be printed automatically
11257
at the end of the string (as does the Python
11258
<TT
11259
CLASS="literal"
11260
>print</TT
11261
> statement),
11262
and we must specify the
11263
<TT
11264
CLASS="literal"
11265
>\n</TT
11266
>
11267
that we want printed at the end of the configured string.
11268
This configuration, then,
11269
will have <SPAN
11270
CLASS="application"
11271
>SCons</SPAN
11272
>
11273
print that it is <TT
11274
CLASS="literal"
11275
>Evaluating</TT
11276
>
11277
each file that it encounters
11278
in turn as it traverses the dependency graph:
11279
11280
</P
11281
><PRE
11282
CLASS="screen"
11283
> % <KBD
11284
CLASS="userinput"
11285
>scons -Q</KBD
11286
>
11287
Evaluating SConstruct
11288
Evaluating f1.c
11289
Evaluating f1.o
11290
cc -o f1.o -c f1.c
11291
Evaluating f1
11292
cc -o f1 f1.o
11293
Evaluating f2.c
11294
Evaluating f2.o
11295
cc -o f2.o -c f2.c
11296
Evaluating f2
11297
cc -o f2 f2.o
11298
Evaluating .
11299
</PRE
11300
><P
11301
>
11302
Of course, normally you don't want to add
11303
all of these additional lines to your build output,
11304
as that can make it difficult for the user
11305
to find errors or other important messages.
11306
A more useful way to display
11307
this progress might be
11308
to have the file names printed
11309
directly to the user's screen,
11310
not to the same standard output
11311
stream where build output is printed,
11312
and to use a carriage return character
11313
(<TT
11314
CLASS="literal"
11315
>\r</TT
11316
>)
11317
so that each file name gets re-printed on the same line.
11318
Such a configuration would look like:
11319
11320
</P
11321
><PRE
11322
CLASS="programlisting"
11323
> Progress('$TARGET\r',
11324
file=open('/dev/tty', 'w'),
11325
overwrite=True)
11326
Program('f1.c')
11327
Program('f2.c')
11328
</PRE
11329
><P
11330
>
11331
Note that we also specified the
11332
<TT
11333
CLASS="literal"
11334
>overwrite=True</TT
11335
> argument
11336
to the <CODE
11337
CLASS="function"
11338
>Progress</CODE
11339
> function,
11340
which causes <SPAN
11341
CLASS="application"
11342
>SCons</SPAN
11343
> to
11344
"wipe out" the previous string with space characters
11345
before printing the next <CODE
11346
CLASS="function"
11347
>Progress</CODE
11348
> string.
11349
Without the
11350
<TT
11351
CLASS="literal"
11352
>overwrite=True</TT
11353
> argument,
11354
a shorter file name would not overwrite
11355
all of the charactes in a longer file name that
11356
precedes it,
11357
making it difficult to tell what the
11358
actual file name is on the output.
11359
Also note that we opened up the
11360
<TT
11361
CLASS="filename"
11362
>/dev/tty</TT
11363
> file
11364
for direct access (on POSIX) to
11365
the user's screen.
11366
On Windows, the equivalent would be to open
11367
the <TT
11368
CLASS="filename"
11369
>con:</TT
11370
> file name.
11371
11372
</P
11373
><P
11374
>
11375
Also, it's important to know that although you can use
11376
<TT
11377
CLASS="literal"
11378
>$TARGET</TT
11379
> to substitute the name of
11380
the node in the string,
11381
the <CODE
11382
CLASS="function"
11383
>Progress</CODE
11384
> function does <SPAN
11385
CLASS="emphasis"
11386
><I
11387
CLASS="emphasis"
11388
>not</I
11389
></SPAN
11390
>
11391
perform general variable substitution
11392
(because there's not necessarily a construction
11393
environment involved in evaluating a node
11394
like a source file, for example).
11395
11396
</P
11397
><P
11398
>
11399
You can also specify a list of strings
11400
to the <CODE
11401
CLASS="function"
11402
>Progress</CODE
11403
> function,
11404
in which case <SPAN
11405
CLASS="application"
11406
>SCons</SPAN
11407
> will
11408
display each string in turn.
11409
This can be used to implement a "spinner"
11410
by having <SPAN
11411
CLASS="application"
11412
>SCons</SPAN
11413
> cycle through a
11414
sequence of strings:
11415
11416
</P
11417
><PRE
11418
CLASS="programlisting"
11419
> Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5)
11420
Program('f1.c')
11421
Program('f2.c')
11422
</PRE
11423
><P
11424
>
11425
Note that here we have also used the
11426
<TT
11427
CLASS="literal"
11428
>interval=</TT
11429
>
11430
keyword argument to have <SPAN
11431
CLASS="application"
11432
>SCons</SPAN
11433
>
11434
only print a new "spinner" string
11435
once every five evaluated nodes.
11436
Using an <TT
11437
CLASS="literal"
11438
>interval=</TT
11439
> count,
11440
even with strings that use <TT
11441
CLASS="literal"
11442
>$TARGET</TT
11443
> like
11444
our examples above,
11445
can be a good way to lessen the
11446
work that <SPAN
11447
CLASS="application"
11448
>SCons</SPAN
11449
> expends printing <CODE
11450
CLASS="function"
11451
>Progress</CODE
11452
> strings,
11453
while still giving the user feedback
11454
that indicates <SPAN
11455
CLASS="application"
11456
>SCons</SPAN
11457
> is still
11458
working on evaluating the build.
11459
11460
</P
11461
><P
11462
>
11463
Lastly, you can have direct control
11464
over how to print each evaluated node
11465
by passing a Python function
11466
(or other Python callable)
11467
to the <CODE
11468
CLASS="function"
11469
>Progress</CODE
11470
> function.
11471
Your function will be called
11472
for each evaluated node,
11473
allowing you to
11474
implement more sophisticated logic
11475
like adding a counter:
11476
11477
</P
11478
><PRE
11479
CLASS="programlisting"
11480
> screen = open('/dev/tty', 'w')
11481
count = 0
11482
def progress_function(node)
11483
count += 1
11484
screen.write('Node %4d: %s\r' % (count, node))
11485
11486
Progress(progress_function)
11487
</PRE
11488
><P
11489
>
11490
Of course, if you choose,
11491
you could completely ignore the
11492
<CODE
11493
CLASS="varname"
11494
>node</CODE
11495
> argument to the function,
11496
and just print a count,
11497
or anything else you wish.
11498
11499
</P
11500
><P
11501
>
11502
(Note that there's an obvious follow-on question here:
11503
how would you find the total number of nodes
11504
that <SPAN
11505
CLASS="emphasis"
11506
><I
11507
CLASS="emphasis"
11508
>will be</I
11509
></SPAN
11510
>
11511
evaluated so you can tell the user how
11512
close the build is to finishing?
11513
Unfortunately, in the general case,
11514
there isn't a good way to do that,
11515
short of having <SPAN
11516
CLASS="application"
11517
>SCons</SPAN
11518
> evaluate its
11519
dependency graph twice,
11520
first to count the total and
11521
the second time to actually build the targets.
11522
This would be necessary because
11523
you can't know in advance which
11524
target(s) the user actually requested
11525
to be built.
11526
The entire build may consist of thousands of Nodes,
11527
for example,
11528
but maybe the user specifically requested
11529
that only a single object file be built.)
11530
11531
</P
11532
></DIV
11533
><DIV
11534
CLASS="section"
11535
><HR><H2
11536
CLASS="section"
11537
><A
11538
NAME="AEN1977"
11539
>11.4. Printing Detailed Build Status: the <CODE
11540
CLASS="function"
11541
>GetBuildFailures</CODE
11542
> Function</A
11543
></H2
11544
><P
11545
>
11546
SCons, like most build tools, returns zero status to
11547
the shell on success and nonzero status on failure.
11548
Sometimes it's useful to give more information about
11549
the build status at the end of the run, for instance
11550
to print an informative message, send an email, or
11551
page the poor slob who broke the build.
11552
11553
</P
11554
><P
11555
>
11556
SCons provides a <CODE
11557
CLASS="function"
11558
>GetBuildFailures</CODE
11559
> method that
11560
you can use in a python <CODE
11561
CLASS="function"
11562
>atexit</CODE
11563
> function
11564
to get a list of objects describing the actions that failed
11565
while attempting to build targets. There can be more
11566
than one if you're using <TT
11567
CLASS="literal"
11568
>-j</TT
11569
>. Here's a
11570
simple example:
11571
11572
</P
11573
><PRE
11574
CLASS="programlisting"
11575
> import atexit
11576
11577
def print_build_failures():
11578
from SCons.Script import GetBuildFailures
11579
for bf in GetBuildFailures():
11580
print "%s failed: %s" % (bf.node, bf.errstr)
11581
atexit.register(print_build_failures)
11582
</PRE
11583
><P
11584
>
11585
The <CODE
11586
CLASS="function"
11587
>atexit.register</CODE
11588
> call
11589
registers <CODE
11590
CLASS="function"
11591
>print_build_failures</CODE
11592
>
11593
as an <CODE
11594
CLASS="function"
11595
>atexit</CODE
11596
> callback, to be called
11597
before <SPAN
11598
CLASS="application"
11599
>SCons</SPAN
11600
> exits. When that function is called,
11601
it calls <CODE
11602
CLASS="function"
11603
>GetBuildFailures</CODE
11604
> to fetch the list of failed objects.
11605
See the man page
11606
for the detailed contents of the returned objects;
11607
some of the more useful attributes are
11608
<TT
11609
CLASS="literal"
11610
>.node</TT
11611
>,
11612
<TT
11613
CLASS="literal"
11614
>.errstr</TT
11615
>,
11616
<TT
11617
CLASS="literal"
11618
>.filename</TT
11619
>, and
11620
<TT
11621
CLASS="literal"
11622
>.command</TT
11623
>.
11624
The <TT
11625
CLASS="literal"
11626
>filename</TT
11627
> is not necessarily
11628
the same file as the <TT
11629
CLASS="literal"
11630
>node</TT
11631
>; the
11632
<TT
11633
CLASS="literal"
11634
>node</TT
11635
> is the target that was
11636
being built when the error occurred, while the
11637
<TT
11638
CLASS="literal"
11639
>filename</TT
11640
>is the file or dir that
11641
actually caused the error.
11642
Note: only call <CODE
11643
CLASS="function"
11644
>GetBuildFailures</CODE
11645
> at the end of the
11646
build; calling it at any other time is undefined.
11647
11648
</P
11649
><P
11650
>
11651
11652
Here is a more complete example showing how to
11653
turn each element of <CODE
11654
CLASS="function"
11655
>GetBuildFailures</CODE
11656
> into a string:
11657
11658
</P
11659
><PRE
11660
CLASS="programlisting"
11661
> # Make the build fail if we pass fail=1 on the command line
11662
if ARGUMENTS.get('fail', 0):
11663
Command('target', 'source', ['/bin/false'])
11664
11665
def bf_to_str(bf):
11666
"""Convert an element of GetBuildFailures() to a string
11667
in a useful way."""
11668
import SCons.Errors
11669
if bf is None: # unknown targets product None in list
11670
return '(unknown tgt)'
11671
elif isinstance(bf, SCons.Errors.StopError):
11672
return str(bf)
11673
elif bf.node:
11674
return str(bf.node) + ': ' + bf.errstr
11675
elif bf.filename:
11676
return bf.filename + ': ' + bf.errstr
11677
return 'unknown failure: ' + bf.errstr
11678
import atexit
11679
11680
def build_status():
11681
"""Convert the build status to a 2-tuple, (status, msg)."""
11682
from SCons.Script import GetBuildFailures
11683
bf = GetBuildFailures()
11684
if bf:
11685
# bf is normally a list of build failures; if an element is None,
11686
# it's because of a target that scons doesn't know anything about.
11687
status = 'failed'
11688
failures_message = "\n".join(["Failed building %s" % bf_to_str(x)
11689
for x in bf if x is not None])
11690
else:
11691
# if bf is None, the build completed successfully.
11692
status = 'ok'
11693
failures_message = ''
11694
return (status, failures_message)
11695
11696
def display_build_status():
11697
"""Display the build status. Called by atexit.
11698
Here you could do all kinds of complicated things."""
11699
status, failures_message = build_status()
11700
if status == 'failed':
11701
print "FAILED!!!!" # could display alert, ring bell, etc.
11702
elif status == 'ok':
11703
print "Build succeeded."
11704
print failures_message
11705
11706
atexit.register(display_build_status)
11707
</PRE
11708
><P
11709
>
11710
When this runs, you'll see the appropriate output:
11711
11712
</P
11713
><PRE
11714
CLASS="screen"
11715
> % <KBD
11716
CLASS="userinput"
11717
>scons -Q</KBD
11718
>
11719
scons: `.' is up to date.
11720
Build succeeded.
11721
% <KBD
11722
CLASS="userinput"
11723
>scons -Q fail=1</KBD
11724
>
11725
scons: *** Source `source' not found, needed by target `target'. Stop.
11726
FAILED!!!!
11727
Failed building Source `source' not found, needed by target `target'.
11728
</PRE
11729
></DIV
11730
></DIV
11731
><DIV
11732
CLASS="chapter"
11733
><HR><H1
11734
><A
11735
NAME="chap-command-line"
11736
></A
11737
>Chapter 12. Controlling a Build From the Command Line</H1
11738
><P
11739
>
11740
<SPAN
11741
CLASS="application"
11742
>SCons</SPAN
11743
> provides a number of ways
11744
for the writer of the <TT
11745
CLASS="filename"
11746
>SConscript</TT
11747
> files
11748
to give the users who will run <SPAN
11749
CLASS="application"
11750
>SCons</SPAN
11751
>
11752
a great deal of control over the build execution.
11753
The arguments that the user can specify on
11754
the command line are broken down into three types:
11755
11756
</P
11757
><P
11758
></P
11759
><DIV
11760
CLASS="variablelist"
11761
><DL
11762
><DT
11763
>Options</DT
11764
><DD
11765
><P
11766
>
11767
Command-line options always begin with
11768
one or two <TT
11769
CLASS="literal"
11770
>-</TT
11771
> (hyphen) characters.
11772
<SPAN
11773
CLASS="application"
11774
>SCons</SPAN
11775
> provides ways for you to examind
11776
and set options values from within your <TT
11777
CLASS="filename"
11778
>SConscript</TT
11779
> files,
11780
as well as the ability to define your own
11781
custom options.
11782
See <A
11783
HREF="#sect-command-line-options"
11784
>Section 12.1</A
11785
>, below.
11786
11787
</P
11788
></DD
11789
><DT
11790
>Variables</DT
11791
><DD
11792
><P
11793
>
11794
Any command-line argument containing an <TT
11795
CLASS="literal"
11796
>=</TT
11797
>
11798
(equal sign) is considered a variable setting with the form
11799
<CODE
11800
CLASS="varname"
11801
>variable</CODE
11802
>=<CODE
11803
CLASS="varname"
11804
>value</CODE
11805
>
11806
<SPAN
11807
CLASS="application"
11808
>SCons</SPAN
11809
> provides direct access to
11810
all of the command-line variable settings,
11811
the ability to apply command-line variable settings
11812
to construction environments,
11813
and functions for configuring
11814
specific types of variables
11815
(Boolean values, path names, etc.)
11816
with automatic validation of the user's specified values.
11817
See <A
11818
HREF="#sect-command-line-variables"
11819
>Section 12.2</A
11820
>, below.
11821
11822
</P
11823
></DD
11824
><DT
11825
>Targets</DT
11826
><DD
11827
><P
11828
>
11829
Any command-line argument that is not an option
11830
or a variable setting
11831
(does not begin with a hyphen
11832
and does not contain an equal sign)
11833
is considered a target that the user
11834
(presumably) wants <SPAN
11835
CLASS="application"
11836
>SCons</SPAN
11837
> to build.
11838
A list of Node objects representing
11839
the target or targets to build.
11840
<SPAN
11841
CLASS="application"
11842
>SCons</SPAN
11843
> provides access to the list of specified targets,
11844
as well as ways to set the default list of targets
11845
from within the <TT
11846
CLASS="filename"
11847
>SConscript</TT
11848
> files.
11849
See <A
11850
HREF="#sect-command-line-targets"
11851
>Section 12.3</A
11852
>, below.
11853
11854
</P
11855
></DD
11856
></DL
11857
></DIV
11858
><DIV
11859
CLASS="section"
11860
><HR><H2
11861
CLASS="section"
11862
><A
11863
NAME="sect-command-line-options"
11864
>12.1. Command-Line Options</A
11865
></H2
11866
><P
11867
>
11868
<SPAN
11869
CLASS="application"
11870
>SCons</SPAN
11871
> has many <SPAN
11872
CLASS="emphasis"
11873
><I
11874
CLASS="emphasis"
11875
>command-line options</I
11876
></SPAN
11877
>
11878
that control its behavior.
11879
A <SPAN
11880
CLASS="application"
11881
>SCons</SPAN
11882
> <SPAN
11883
CLASS="emphasis"
11884
><I
11885
CLASS="emphasis"
11886
>command-line option</I
11887
></SPAN
11888
>
11889
always begins with one or two <TT
11890
CLASS="literal"
11891
>-</TT
11892
> (hyphen)
11893
characters.
11894
11895
</P
11896
><DIV
11897
CLASS="section"
11898
><HR><H3
11899
CLASS="section"
11900
><A
11901
NAME="AEN2048"
11902
>12.1.1. Not Having to Specify Command-Line Options Each Time: the <CODE
11903
CLASS="varname"
11904
>SCONSFLAGS</CODE
11905
> Environment Variable</A
11906
></H3
11907
><P
11908
>
11909
Users may find themselves supplying
11910
the same command-line options every time
11911
they run <SPAN
11912
CLASS="application"
11913
>SCons</SPAN
11914
>.
11915
For example, you might find it saves time
11916
to specify a value of <TT
11917
CLASS="literal"
11918
>-j 2</TT
11919
>
11920
to have <SPAN
11921
CLASS="application"
11922
>SCons</SPAN
11923
> run up to two build commands in parallel.
11924
To avoid having to type <TT
11925
CLASS="literal"
11926
>-j 2</TT
11927
> by hand
11928
every time,
11929
you can set the external environment variable
11930
<CODE
11931
CLASS="varname"
11932
>SCONSFLAGS</CODE
11933
> to a string containing
11934
command-line options that you want <SPAN
11935
CLASS="application"
11936
>SCons</SPAN
11937
> to use.
11938
11939
</P
11940
><P
11941
>
11942
If, for example,
11943
you're using a POSIX shell that's
11944
compatible with the Bourne shell,
11945
and you always want <SPAN
11946
CLASS="application"
11947
>SCons</SPAN
11948
> to use the
11949
<TT
11950
CLASS="literal"
11951
>-Q</TT
11952
> option,
11953
you can set the <CODE
11954
CLASS="varname"
11955
>SCONSFLAGS</CODE
11956
>
11957
environment as follows:
11958
11959
</P
11960
><PRE
11961
CLASS="screen"
11962
> % <KBD
11963
CLASS="userinput"
11964
>scons</KBD
11965
>
11966
scons: Reading SConscript files ...
11967
scons: done reading SConscript files.
11968
scons: Building targets ...
11969
... [build output] ...
11970
scons: done building targets.
11971
% <KBD
11972
CLASS="userinput"
11973
>export SCONSFLAGS="-Q"</KBD
11974
>
11975
% <KBD
11976
CLASS="userinput"
11977
>scons</KBD
11978
>
11979
... [build output] ...
11980
</PRE
11981
><P
11982
>
11983
Users of <SPAN
11984
CLASS="application"
11985
>csh</SPAN
11986
>-style shells on POSIX systems
11987
can set the <CODE
11988
CLASS="varname"
11989
>SCONSFLAGS</CODE
11990
> environment as follows:
11991
11992
</P
11993
><PRE
11994
CLASS="screen"
11995
> $ <KBD
11996
CLASS="userinput"
11997
>setenv SCONSFLAGS "-Q"</KBD
11998
>
11999
</PRE
12000
><P
12001
>
12002
Windows users may typically want to set the
12003
<CODE
12004
CLASS="varname"
12005
>SCONSFLAGS</CODE
12006
> in the appropriate tab of the
12007
<TT
12008
CLASS="literal"
12009
>System Properties</TT
12010
> window.
12011
12012
</P
12013
></DIV
12014
><DIV
12015
CLASS="section"
12016
><HR><H3
12017
CLASS="section"
12018
><A
12019
NAME="AEN2074"
12020
>12.1.2. Getting Values Set by Command-Line Options: the <CODE
12021
CLASS="function"
12022
>GetOption</CODE
12023
> Function</A
12024
></H3
12025
><P
12026
>
12027
<SPAN
12028
CLASS="application"
12029
>SCons</SPAN
12030
> provides the <CODE
12031
CLASS="function"
12032
>GetOption</CODE
12033
> function
12034
to get the values set by the various command-line options.
12035
One common use of this is to check whether or not
12036
the <TT
12037
CLASS="literal"
12038
>-h</TT
12039
> or <TT
12040
CLASS="literal"
12041
>--help</TT
12042
> option
12043
has been specified.
12044
Normally, <SPAN
12045
CLASS="application"
12046
>SCons</SPAN
12047
> does not print its help text
12048
until after it has read all of the <TT
12049
CLASS="filename"
12050
>SConscript</TT
12051
> files,
12052
because it's possible that help text has been added
12053
by some subsidiary <TT
12054
CLASS="filename"
12055
>SConscript</TT
12056
> file deep in the
12057
source tree hierarchy.
12058
Of course, reading all of the <TT
12059
CLASS="filename"
12060
>SConscript</TT
12061
> files
12062
takes extra time.
12063
12064
</P
12065
><P
12066
>
12067
If you know that your configuration does not define
12068
any additional help text in subsidiary <TT
12069
CLASS="filename"
12070
>SConscript</TT
12071
> files,
12072
you can speed up the command-line help available to users
12073
by using the <CODE
12074
CLASS="function"
12075
>GetOption</CODE
12076
> function to load the
12077
subsidiary <TT
12078
CLASS="filename"
12079
>SConscript</TT
12080
> files only if the
12081
the user has <SPAN
12082
CLASS="emphasis"
12083
><I
12084
CLASS="emphasis"
12085
>not</I
12086
></SPAN
12087
> specified
12088
the <TT
12089
CLASS="literal"
12090
>-h</TT
12091
> or <TT
12092
CLASS="literal"
12093
>--help</TT
12094
> option,
12095
like so:
12096
12097
</P
12098
><PRE
12099
CLASS="programlisting"
12100
></PRE
12101
><P
12102
>
12103
In general, the string that you pass to the
12104
<CODE
12105
CLASS="function"
12106
>GetOption</CODE
12107
> function to fetch the value of a command-line
12108
option setting is the same as the "most common" long option name
12109
(beginning with two hyphen characters),
12110
although there are some exceptions.
12111
The list of <SPAN
12112
CLASS="application"
12113
>SCons</SPAN
12114
> command-line options
12115
and the <CODE
12116
CLASS="function"
12117
>GetOption</CODE
12118
> strings for fetching them,
12119
are available in the
12120
<A
12121
HREF="#sect-command-line-option-strings"
12122
>Section 12.1.4</A
12123
> section,
12124
below.
12125
12126
</P
12127
></DIV
12128
><DIV
12129
CLASS="section"
12130
><HR><H3
12131
CLASS="section"
12132
><A
12133
NAME="AEN2099"
12134
>12.1.3. Setting Values of Command-Line Options: the <CODE
12135
CLASS="function"
12136
>SetOption</CODE
12137
> Function</A
12138
></H3
12139
><P
12140
>
12141
You can also set the values of <SPAN
12142
CLASS="application"
12143
>SCons</SPAN
12144
>
12145
command-line options from within the <TT
12146
CLASS="filename"
12147
>SConscript</TT
12148
> files
12149
by using the <CODE
12150
CLASS="function"
12151
>SetOption</CODE
12152
> function.
12153
The strings that you use to set the values of <SPAN
12154
CLASS="application"
12155
>SCons</SPAN
12156
>
12157
command-line options are available in the
12158
<A
12159
HREF="#sect-command-line-option-strings"
12160
>Section 12.1.4</A
12161
> section,
12162
below.
12163
12164
</P
12165
><P
12166
>
12167
One use of the <CODE
12168
CLASS="function"
12169
>SetOption</CODE
12170
> function is to
12171
specify a value for the <TT
12172
CLASS="literal"
12173
>-j</TT
12174
>
12175
or <TT
12176
CLASS="literal"
12177
>--jobs</TT
12178
> option,
12179
so that users get the improved performance
12180
of a parallel build without having to specify the option by hand.
12181
A complicating factor is that a good value
12182
for the <TT
12183
CLASS="literal"
12184
>-j</TT
12185
> option is
12186
somewhat system-dependent.
12187
One rough guideline is that the more processors
12188
your system has,
12189
the higher you want to set the
12190
<TT
12191
CLASS="literal"
12192
>-j</TT
12193
> value,
12194
in order to take advantage of the number of CPUs.
12195
12196
</P
12197
><P
12198
>
12199
For example, suppose the administrators
12200
of your development systems
12201
have standardized on setting a
12202
<CODE
12203
CLASS="varname"
12204
>NUM_CPU</CODE
12205
> environment variable
12206
to the number of processors on each system.
12207
A little bit of Python code
12208
to access the environment variable
12209
and the <CODE
12210
CLASS="function"
12211
>SetOption</CODE
12212
> function
12213
provide the right level of flexibility:
12214
12215
</P
12216
><PRE
12217
CLASS="programlisting"
12218
> import os
12219
num_cpu = int(os.environ.get('NUM_CPU', 2))
12220
SetOption('num_jobs', num_cpu)
12221
print "running with -j", GetOption('num_jobs')
12222
</PRE
12223
><P
12224
>
12225
The above snippet of code
12226
sets the value of the <TT
12227
CLASS="literal"
12228
>--jobs</TT
12229
> option
12230
to the value specified in the
12231
<CODE
12232
CLASS="varname"
12233
>$NUM_CPU</CODE
12234
> environment variable.
12235
(This is one of the exception cases
12236
where the string is spelled differently from
12237
the from command-line option.
12238
The string for fetching or setting the <TT
12239
CLASS="literal"
12240
>--jobs</TT
12241
>
12242
value is <TT
12243
CLASS="literal"
12244
>num_jobs</TT
12245
>
12246
for historical reasons.)
12247
The code in this example prints the <TT
12248
CLASS="literal"
12249
>num_jobs</TT
12250
>
12251
value for illustrative purposes.
12252
It uses a default value of <TT
12253
CLASS="literal"
12254
>2</TT
12255
>
12256
to provide some minimal parallelism even on
12257
single-processor systems:
12258
12259
</P
12260
><PRE
12261
CLASS="screen"
12262
> % <KBD
12263
CLASS="userinput"
12264
>scons -Q</KBD
12265
>
12266
running with -j 2
12267
scons: `.' is up to date.
12268
</PRE
12269
><P
12270
>
12271
But if the <CODE
12272
CLASS="varname"
12273
>$NUM_CPU</CODE
12274
>
12275
environment variable is set,
12276
then we use that for the default number of jobs:
12277
12278
</P
12279
><PRE
12280
CLASS="screen"
12281
> % <KBD
12282
CLASS="userinput"
12283
>export NUM_CPU="4"</KBD
12284
>
12285
% <KBD
12286
CLASS="userinput"
12287
>scons -Q</KBD
12288
>
12289
running with -j 4
12290
scons: `.' is up to date.
12291
</PRE
12292
><P
12293
>
12294
But any explicit
12295
<TT
12296
CLASS="literal"
12297
>-j</TT
12298
> or <TT
12299
CLASS="literal"
12300
>--jobs</TT
12301
>
12302
value the user specifies an the command line is used first,
12303
regardless of whether or not
12304
the <CODE
12305
CLASS="varname"
12306
>$NUM_CPU</CODE
12307
> environment
12308
variable is set:
12309
12310
</P
12311
><PRE
12312
CLASS="screen"
12313
> % <KBD
12314
CLASS="userinput"
12315
>scons -Q -j 7</KBD
12316
>
12317
running with -j 7
12318
scons: `.' is up to date.
12319
% <KBD
12320
CLASS="userinput"
12321
>export NUM_CPU="4"</KBD
12322
>
12323
% <KBD
12324
CLASS="userinput"
12325
>scons -Q -j 3</KBD
12326
>
12327
running with -j 3
12328
scons: `.' is up to date.
12329
</PRE
12330
></DIV
12331
><DIV
12332
CLASS="section"
12333
><HR><H3
12334
CLASS="section"
12335
><A
12336
NAME="sect-command-line-option-strings"
12337
>12.1.4. Strings for Getting or Setting Values of <SPAN
12338
CLASS="application"
12339
>SCons</SPAN
12340
> Command-Line Options</A
12341
></H3
12342
><P
12343
>
12344
The strings that you can pass to the <CODE
12345
CLASS="function"
12346
>GetOption</CODE
12347
>
12348
and <CODE
12349
CLASS="function"
12350
>SetOption</CODE
12351
> functions usually correspond to the
12352
first long-form option name
12353
(beginning with two hyphen characters: <TT
12354
CLASS="literal"
12355
>--</TT
12356
>),
12357
after replacing any remaining hyphen characters
12358
with underscores.
12359
12360
</P
12361
><P
12362
>
12363
The full list of strings and the variables they
12364
correspond to is as follows:
12365
12366
</P
12367
><DIV
12368
CLASS="informaltable"
12369
><P
12370
></P
12371
><A
12372
NAME="AEN2148"
12373
></A
12374
><TABLE
12375
BORDER="1"
12376
CLASS="CALSTABLE"
12377
><COL><COL><THEAD
12378
><TR
12379
><TH
12380
>String for <CODE
12381
CLASS="function"
12382
>GetOption</CODE
12383
> and <CODE
12384
CLASS="function"
12385
>SetOption</CODE
12386
></TH
12387
><TH
12388
>Command-Line Option(s)</TH
12389
></TR
12390
></THEAD
12391
><TBODY
12392
><TR
12393
><TD
12394
><TT
12395
CLASS="literal"
12396
>cache_debug</TT
12397
></TD
12398
><TD
12399
><CODE
12400
CLASS="option"
12401
>--cache-debug</CODE
12402
></TD
12403
></TR
12404
><TR
12405
><TD
12406
><TT
12407
CLASS="literal"
12408
>cache_disable</TT
12409
></TD
12410
><TD
12411
><CODE
12412
CLASS="option"
12413
>--cache-disable</CODE
12414
></TD
12415
></TR
12416
><TR
12417
><TD
12418
><TT
12419
CLASS="literal"
12420
>cache_force</TT
12421
></TD
12422
><TD
12423
><CODE
12424
CLASS="option"
12425
>--cache-force</CODE
12426
></TD
12427
></TR
12428
><TR
12429
><TD
12430
><TT
12431
CLASS="literal"
12432
>cache_show</TT
12433
></TD
12434
><TD
12435
><CODE
12436
CLASS="option"
12437
>--cache-show</CODE
12438
></TD
12439
></TR
12440
><TR
12441
><TD
12442
><TT
12443
CLASS="literal"
12444
>clean</TT
12445
></TD
12446
><TD
12447
><CODE
12448
CLASS="option"
12449
>-c</CODE
12450
>,
12451
<CODE
12452
CLASS="option"
12453
>--clean</CODE
12454
>,
12455
<CODE
12456
CLASS="option"
12457
>--remove</CODE
12458
></TD
12459
></TR
12460
><TR
12461
><TD
12462
><TT
12463
CLASS="literal"
12464
>config</TT
12465
></TD
12466
><TD
12467
><CODE
12468
CLASS="option"
12469
>--config</CODE
12470
></TD
12471
></TR
12472
><TR
12473
><TD
12474
><TT
12475
CLASS="literal"
12476
>directory</TT
12477
></TD
12478
><TD
12479
><CODE
12480
CLASS="option"
12481
>-C</CODE
12482
>,
12483
<CODE
12484
CLASS="option"
12485
>--directory</CODE
12486
></TD
12487
></TR
12488
><TR
12489
><TD
12490
><TT
12491
CLASS="literal"
12492
>diskcheck</TT
12493
></TD
12494
><TD
12495
><CODE
12496
CLASS="option"
12497
>--diskcheck</CODE
12498
></TD
12499
></TR
12500
><TR
12501
><TD
12502
><TT
12503
CLASS="literal"
12504
>duplicate</TT
12505
></TD
12506
><TD
12507
><CODE
12508
CLASS="option"
12509
>--duplicate</CODE
12510
></TD
12511
></TR
12512
><TR
12513
><TD
12514
><TT
12515
CLASS="literal"
12516
>file</TT
12517
></TD
12518
><TD
12519
><CODE
12520
CLASS="option"
12521
>-f</CODE
12522
>,
12523
<CODE
12524
CLASS="option"
12525
>--file</CODE
12526
>,
12527
<CODE
12528
CLASS="option"
12529
>--makefile </CODE
12530
>,
12531
<CODE
12532
CLASS="option"
12533
>--sconstruct</CODE
12534
></TD
12535
></TR
12536
><TR
12537
><TD
12538
><TT
12539
CLASS="literal"
12540
>help</TT
12541
></TD
12542
><TD
12543
><CODE
12544
CLASS="option"
12545
>-h</CODE
12546
>,
12547
<CODE
12548
CLASS="option"
12549
>--help</CODE
12550
></TD
12551
></TR
12552
><TR
12553
><TD
12554
><TT
12555
CLASS="literal"
12556
>ignore_errors</TT
12557
></TD
12558
><TD
12559
><CODE
12560
CLASS="option"
12561
>--ignore-errors</CODE
12562
></TD
12563
></TR
12564
><TR
12565
><TD
12566
><TT
12567
CLASS="literal"
12568
>implicit_cache</TT
12569
></TD
12570
><TD
12571
><CODE
12572
CLASS="option"
12573
>--implicit-cache</CODE
12574
></TD
12575
></TR
12576
><TR
12577
><TD
12578
><TT
12579
CLASS="literal"
12580
>implicit_deps_changed</TT
12581
></TD
12582
><TD
12583
><CODE
12584
CLASS="option"
12585
>--implicit-deps-changed</CODE
12586
></TD
12587
></TR
12588
><TR
12589
><TD
12590
><TT
12591
CLASS="literal"
12592
>implicit_deps_unchanged</TT
12593
></TD
12594
><TD
12595
><CODE
12596
CLASS="option"
12597
>--implicit-deps-unchanged</CODE
12598
></TD
12599
></TR
12600
><TR
12601
><TD
12602
><TT
12603
CLASS="literal"
12604
>interactive</TT
12605
></TD
12606
><TD
12607
><CODE
12608
CLASS="option"
12609
>--interact</CODE
12610
>,
12611
<CODE
12612
CLASS="option"
12613
>--interactive</CODE
12614
></TD
12615
></TR
12616
><TR
12617
><TD
12618
><TT
12619
CLASS="literal"
12620
>keep_going</TT
12621
></TD
12622
><TD
12623
><CODE
12624
CLASS="option"
12625
>-k</CODE
12626
>,
12627
<CODE
12628
CLASS="option"
12629
>--keep-going</CODE
12630
></TD
12631
></TR
12632
><TR
12633
><TD
12634
><TT
12635
CLASS="literal"
12636
>max_drift</TT
12637
></TD
12638
><TD
12639
><CODE
12640
CLASS="option"
12641
>--max-drift</CODE
12642
></TD
12643
></TR
12644
><TR
12645
><TD
12646
><TT
12647
CLASS="literal"
12648
>no_exec</TT
12649
></TD
12650
><TD
12651
><CODE
12652
CLASS="option"
12653
>-n</CODE
12654
>,
12655
<CODE
12656
CLASS="option"
12657
>--no-exec</CODE
12658
>,
12659
<CODE
12660
CLASS="option"
12661
>--just-print</CODE
12662
>,
12663
<CODE
12664
CLASS="option"
12665
>--dry-run</CODE
12666
>,
12667
<CODE
12668
CLASS="option"
12669
>--recon</CODE
12670
></TD
12671
></TR
12672
><TR
12673
><TD
12674
><TT
12675
CLASS="literal"
12676
>no_site_dir</TT
12677
></TD
12678
><TD
12679
><CODE
12680
CLASS="option"
12681
>--no-site-dir</CODE
12682
></TD
12683
></TR
12684
><TR
12685
><TD
12686
><TT
12687
CLASS="literal"
12688
>num_jobs</TT
12689
></TD
12690
><TD
12691
><CODE
12692
CLASS="option"
12693
>-j</CODE
12694
>,
12695
<CODE
12696
CLASS="option"
12697
>--jobs</CODE
12698
></TD
12699
></TR
12700
><TR
12701
><TD
12702
><TT
12703
CLASS="literal"
12704
>profile_file</TT
12705
></TD
12706
><TD
12707
><CODE
12708
CLASS="option"
12709
>--profile</CODE
12710
></TD
12711
></TR
12712
><TR
12713
><TD
12714
><TT
12715
CLASS="literal"
12716
>question</TT
12717
></TD
12718
><TD
12719
><CODE
12720
CLASS="option"
12721
>-q</CODE
12722
>,
12723
<CODE
12724
CLASS="option"
12725
>--question</CODE
12726
></TD
12727
></TR
12728
><TR
12729
><TD
12730
><TT
12731
CLASS="literal"
12732
>random</TT
12733
></TD
12734
><TD
12735
><CODE
12736
CLASS="option"
12737
>--random</CODE
12738
></TD
12739
></TR
12740
><TR
12741
><TD
12742
><TT
12743
CLASS="literal"
12744
>repository</TT
12745
></TD
12746
><TD
12747
><CODE
12748
CLASS="option"
12749
>-Y</CODE
12750
>,
12751
<CODE
12752
CLASS="option"
12753
>--repository</CODE
12754
>,
12755
<CODE
12756
CLASS="option"
12757
>--srcdir</CODE
12758
></TD
12759
></TR
12760
><TR
12761
><TD
12762
><TT
12763
CLASS="literal"
12764
>silent</TT
12765
></TD
12766
><TD
12767
><CODE
12768
CLASS="option"
12769
>-s</CODE
12770
>,
12771
<CODE
12772
CLASS="option"
12773
>--silent</CODE
12774
>,
12775
<CODE
12776
CLASS="option"
12777
>--quiet</CODE
12778
></TD
12779
></TR
12780
><TR
12781
><TD
12782
><TT
12783
CLASS="literal"
12784
>site_dir</TT
12785
></TD
12786
><TD
12787
><CODE
12788
CLASS="option"
12789
>--site-dir</CODE
12790
></TD
12791
></TR
12792
><TR
12793
><TD
12794
><TT
12795
CLASS="literal"
12796
>stack_size</TT
12797
></TD
12798
><TD
12799
><CODE
12800
CLASS="option"
12801
>--stack-size</CODE
12802
></TD
12803
></TR
12804
><TR
12805
><TD
12806
><TT
12807
CLASS="literal"
12808
>taskmastertrace_file</TT
12809
></TD
12810
><TD
12811
><CODE
12812
CLASS="option"
12813
>--taskmastertrace</CODE
12814
></TD
12815
></TR
12816
><TR
12817
><TD
12818
><TT
12819
CLASS="literal"
12820
>warn</TT
12821
></TD
12822
><TD
12823
><CODE
12824
CLASS="option"
12825
>--warn</CODE
12826
> <CODE
12827
CLASS="option"
12828
>--warning</CODE
12829
></TD
12830
></TR
12831
></TBODY
12832
></TABLE
12833
><P
12834
></P
12835
></DIV
12836
></DIV
12837
><DIV
12838
CLASS="section"
12839
><HR><H3
12840
CLASS="section"
12841
><A
12842
NAME="AEN2327"
12843
>12.1.5. Adding Custom Command-Line Options: the <CODE
12844
CLASS="function"
12845
>AddOption</CODE
12846
> Function</A
12847
></H3
12848
><P
12849
>
12850
<SPAN
12851
CLASS="application"
12852
>SCons</SPAN
12853
> also allows you to define your own
12854
command-line options with the <CODE
12855
CLASS="function"
12856
>AddOption</CODE
12857
> function.
12858
The <CODE
12859
CLASS="function"
12860
>AddOption</CODE
12861
> function takes the same arguments
12862
as the <CODE
12863
CLASS="function"
12864
>optparse.add_option</CODE
12865
> function
12866
from the standard Python library.
12867
<A
12868
NAME="AEN2335"
12869
HREF="#FTN.AEN2335"
12870
><SPAN
12871
CLASS="footnote"
12872
>[3]</SPAN
12873
></A
12874
>
12875
Once you have added a custom command-line option
12876
with the <CODE
12877
CLASS="function"
12878
>AddOption</CODE
12879
> function,
12880
the value of the option (if any) is immediately available
12881
using the standard <CODE
12882
CLASS="function"
12883
>GetOption</CODE
12884
> function.
12885
(The value can also be set using <CODE
12886
CLASS="function"
12887
>SetOption</CODE
12888
>,
12889
although that's not very useful in practice
12890
because a default value can be specified in
12891
directly in the <CODE
12892
CLASS="function"
12893
>AddOption</CODE
12894
> call.)
12895
12896
</P
12897
><P
12898
>
12899
One useful example of using this functionality
12900
is to provide a <CODE
12901
CLASS="option"
12902
>--prefix</CODE
12903
> for users:
12904
12905
</P
12906
><PRE
12907
CLASS="programlisting"
12908
> AddOption('--prefix',
12909
dest='prefix',
12910
type='string',
12911
nargs=1,
12912
action='store',
12913
metavar='DIR',
12914
help='installation prefix')
12915
12916
env = Environment(PREFIX = GetOption('prefix'))
12917
12918
installed_foo = env.Install('$PREFIX/usr/bin', 'foo.in')
12919
Default(installed_foo)
12920
</PRE
12921
><P
12922
>
12923
The above code uses the <CODE
12924
CLASS="function"
12925
>GetOption</CODE
12926
> function
12927
to set the <CODE
12928
CLASS="varname"
12929
>$PREFIX</CODE
12930
>
12931
construction variable to any
12932
value that the user specifies with a command-line
12933
option of <TT
12934
CLASS="literal"
12935
>--prefix</TT
12936
>.
12937
Because <CODE
12938
CLASS="varname"
12939
>$PREFIX</CODE
12940
>
12941
will expand to a null string if it's not initialized,
12942
running <SPAN
12943
CLASS="application"
12944
>SCons</SPAN
12945
> without the
12946
option of <TT
12947
CLASS="literal"
12948
>--prefix</TT
12949
>
12950
will install the file in the
12951
<TT
12952
CLASS="filename"
12953
>/usr/bin/</TT
12954
> directory:
12955
12956
</P
12957
><PRE
12958
CLASS="screen"
12959
> % <KBD
12960
CLASS="userinput"
12961
>scons -Q -n</KBD
12962
>
12963
Install file: "foo.in" as "/usr/bin/foo.in"
12964
</PRE
12965
><P
12966
>
12967
But specifying <TT
12968
CLASS="literal"
12969
>--prefix=/tmp/install</TT
12970
>
12971
on the command line causes the file to be installed in the
12972
<TT
12973
CLASS="filename"
12974
>/tmp/install/usr/bin/</TT
12975
> directory:
12976
12977
</P
12978
><PRE
12979
CLASS="screen"
12980
> % <KBD
12981
CLASS="userinput"
12982
>scons -Q -n --prefix=/tmp/install</KBD
12983
>
12984
Install file: "foo.in" as "/tmp/install/usr/bin/foo.in"
12985
</PRE
12986
></DIV
12987
></DIV
12988
><DIV
12989
CLASS="section"
12990
><HR><H2
12991
CLASS="section"
12992
><A
12993
NAME="sect-command-line-variables"
12994
>12.2. Command-Line <CODE
12995
CLASS="varname"
12996
>variable</CODE
12997
>=<CODE
12998
CLASS="varname"
12999
>value</CODE
13000
> Build Variables</A
13001
></H2
13002
><P
13003
>
13004
You may want to control various aspects
13005
of your build by allowing the user
13006
to specify <CODE
13007
CLASS="varname"
13008
>variable</CODE
13009
>=<CODE
13010
CLASS="varname"
13011
>value</CODE
13012
>
13013
values on the command line.
13014
For example, suppose you
13015
want users to be able to
13016
build a debug version of a program
13017
by running <SPAN
13018
CLASS="application"
13019
>SCons</SPAN
13020
> as follows:
13021
13022
</P
13023
><PRE
13024
CLASS="screen"
13025
> % <KBD
13026
CLASS="userinput"
13027
>scons -Q debug=1</KBD
13028
>
13029
</PRE
13030
><P
13031
>
13032
<SPAN
13033
CLASS="application"
13034
>SCons</SPAN
13035
> provides an <CODE
13036
CLASS="varname"
13037
>ARGUMENTS</CODE
13038
> dictionary
13039
that stores all of the
13040
<CODE
13041
CLASS="varname"
13042
>variable</CODE
13043
>=<CODE
13044
CLASS="varname"
13045
>value</CODE
13046
>
13047
assignments from the command line.
13048
This allows you to modify
13049
aspects of your build in response
13050
to specifications on the command line.
13051
(Note that unless you want to require
13052
that users <SPAN
13053
CLASS="emphasis"
13054
><I
13055
CLASS="emphasis"
13056
>always</I
13057
></SPAN
13058
>
13059
specify a variable,
13060
you probably want to use
13061
the Python
13062
<TT
13063
CLASS="literal"
13064
>ARGUMENTS.get()</TT
13065
> function,
13066
which allows you to specify a default value
13067
to be used if there is no specification
13068
on the command line.)
13069
13070
</P
13071
><P
13072
>
13073
The following code sets the <A
13074
HREF="#cv-CCFLAGS"
13075
><CODE
13076
CLASS="envar"
13077
>$CCFLAGS</CODE
13078
></A
13079
> construction
13080
variable in response to the <CODE
13081
CLASS="varname"
13082
>debug</CODE
13083
>
13084
flag being set in the <CODE
13085
CLASS="varname"
13086
>ARGUMENTS</CODE
13087
> dictionary:
13088
13089
</P
13090
><PRE
13091
CLASS="programlisting"
13092
> env = Environment()
13093
debug = ARGUMENTS.get('debug', 0)
13094
if int(debug):
13095
env.Append(CCFLAGS = '-g')
13096
env.Program('prog.c')
13097
</PRE
13098
><P
13099
>
13100
This results in the <CODE
13101
CLASS="varname"
13102
>-g</CODE
13103
>
13104
compiler option being used when
13105
<TT
13106
CLASS="literal"
13107
>debug=1</TT
13108
>
13109
is used on the command line:
13110
13111
</P
13112
><PRE
13113
CLASS="screen"
13114
> % <KBD
13115
CLASS="userinput"
13116
>scons -Q debug=0</KBD
13117
>
13118
cc -o prog.o -c prog.c
13119
cc -o prog prog.o
13120
% <KBD
13121
CLASS="userinput"
13122
>scons -Q debug=0</KBD
13123
>
13124
scons: `.' is up to date.
13125
% <KBD
13126
CLASS="userinput"
13127
>scons -Q debug=1</KBD
13128
>
13129
cc -o prog.o -c -g prog.c
13130
cc -o prog prog.o
13131
% <KBD
13132
CLASS="userinput"
13133
>scons -Q debug=1</KBD
13134
>
13135
scons: `.' is up to date.
13136
</PRE
13137
><P
13138
>
13139
Notice that <SPAN
13140
CLASS="application"
13141
>SCons</SPAN
13142
> keeps track of
13143
the last values used to build the object files,
13144
and as a result correctly rebuilds
13145
the object and executable files
13146
only when the value of the <TT
13147
CLASS="literal"
13148
>debug</TT
13149
>
13150
argument has changed.
13151
13152
</P
13153
><P
13154
>
13155
The <CODE
13156
CLASS="varname"
13157
>ARGUMENTS</CODE
13158
> dictionary has two minor drawbacks.
13159
First, because it is a dictionary,
13160
it can only store one value for each specified keyword,
13161
and thus only "remembers" the last setting
13162
for each keyword on the command line.
13163
This makes the <CODE
13164
CLASS="varname"
13165
>ARGUMENTS</CODE
13166
> dictionary
13167
inappropriate if users should be able to
13168
specify multiple values
13169
on the command line for a given keyword.
13170
Second, it does not preserve
13171
the order in which the variable settings
13172
were specified,
13173
which is a problem if
13174
you want the configuration to
13175
behave differently in response
13176
to the order in which the build
13177
variable settings were specified on the command line.
13178
13179
</P
13180
><P
13181
>
13182
To accomodate these requirements,
13183
<SPAN
13184
CLASS="application"
13185
>SCons</SPAN
13186
> provides an <CODE
13187
CLASS="varname"
13188
>ARGLIST</CODE
13189
> variable
13190
that gives you direct access to
13191
<CODE
13192
CLASS="varname"
13193
>variable</CODE
13194
>=<CODE
13195
CLASS="varname"
13196
>value</CODE
13197
>
13198
settings on the command line,
13199
in the exact order they were specified,
13200
and without removing any duplicate settings.
13201
Each element in the <CODE
13202
CLASS="varname"
13203
>ARGLIST</CODE
13204
> variable
13205
is itself a two-element list
13206
containing the keyword and the value
13207
of the setting,
13208
and you must loop through,
13209
or otherwise select from,
13210
the elements of <CODE
13211
CLASS="varname"
13212
>ARGLIST</CODE
13213
> to
13214
process the specific settings you want
13215
in whatever way is appropriate for your configuration.
13216
For example,
13217
the following code to let the user
13218
add to the <CODE
13219
CLASS="varname"
13220
>CPPDEFINES</CODE
13221
> construction variable
13222
by specifying multiple
13223
<CODE
13224
CLASS="varname"
13225
>define=</CODE
13226
>
13227
settings on the command line:
13228
13229
</P
13230
><PRE
13231
CLASS="programlisting"
13232
> cppdefines = []
13233
for key, value in ARGLIST:
13234
if key == 'define':
13235
cppdefines.append(value)
13236
env = Environment(CPPDEFINES = cppdefines)
13237
env.Object('prog.c')
13238
</PRE
13239
><P
13240
>
13241
Yields the followig output:
13242
13243
</P
13244
><PRE
13245
CLASS="screen"
13246
> % <KBD
13247
CLASS="userinput"
13248
>scons -Q define=FOO</KBD
13249
>
13250
cc -o prog.o -c -DFOO prog.c
13251
% <KBD
13252
CLASS="userinput"
13253
>scons -Q define=FOO define=BAR</KBD
13254
>
13255
cc -o prog.o -c -DFOO -DBAR prog.c
13256
</PRE
13257
><P
13258
>
13259
Note that the <CODE
13260
CLASS="varname"
13261
>ARGLIST</CODE
13262
> and <CODE
13263
CLASS="varname"
13264
>ARGUMENTS</CODE
13265
>
13266
variables do not interfere with each other,
13267
but merely provide slightly different views
13268
into how the user specified
13269
<CODE
13270
CLASS="varname"
13271
>variable</CODE
13272
>=<CODE
13273
CLASS="varname"
13274
>value</CODE
13275
>
13276
settings on the command line.
13277
You can use both variables in the same
13278
<SPAN
13279
CLASS="application"
13280
>SCons</SPAN
13281
> configuration.
13282
In general, the <CODE
13283
CLASS="varname"
13284
>ARGUMENTS</CODE
13285
> dictionary
13286
is more convenient to use,
13287
(since you can just fetch variable
13288
settings through a dictionary access),
13289
and the <CODE
13290
CLASS="varname"
13291
>ARGLIST</CODE
13292
> list
13293
is more flexible
13294
(since you can examine the
13295
specific order in which
13296
the user's command-line variabe settings).
13297
13298
</P
13299
><DIV
13300
CLASS="section"
13301
><HR><H3
13302
CLASS="section"
13303
><A
13304
NAME="AEN2420"
13305
>12.2.1. Controlling Command-Line Build Variables</A
13306
></H3
13307
><P
13308
>
13309
Being able to use a command-line build variable like
13310
<TT
13311
CLASS="literal"
13312
>debug=1</TT
13313
> is handy,
13314
but it can be a chore to write specific Python code
13315
to recognize each such variable,
13316
check for errors and provide appropriate messages,
13317
and apply the values to a construction variable.
13318
To help with this,
13319
<SPAN
13320
CLASS="application"
13321
>SCons</SPAN
13322
> supports a class to
13323
define such build variables easily,
13324
and a mechanism to apply the
13325
build variables to a construction environment.
13326
This allows you to control how the build variables affect
13327
construction environments.
13328
13329
</P
13330
><P
13331
>
13332
For example, suppose that you want users to set
13333
a <CODE
13334
CLASS="varname"
13335
>RELEASE</CODE
13336
> construction variable on the
13337
command line whenever the time comes to build
13338
a program for release,
13339
and that the value of this variable
13340
should be added to the command line
13341
with the appropriate <TT
13342
CLASS="literal"
13343
>-D</TT
13344
> option
13345
(or other command line option)
13346
to pass the value to the C compiler.
13347
Here's how you might do that by setting
13348
the appropriate value in a dictionary for the
13349
<A
13350
HREF="#cv-CPPDEFINES"
13351
><CODE
13352
CLASS="envar"
13353
>$CPPDEFINES</CODE
13354
></A
13355
> construction variable:
13356
13357
</P
13358
><PRE
13359
CLASS="programlisting"
13360
> vars = Variables()
13361
vars.Add('RELEASE', 'Set to 1 to build for release', 0)
13362
env = Environment(variables = vars,
13363
CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'})
13364
env.Program(['foo.c', 'bar.c'])
13365
</PRE
13366
><P
13367
>
13368
This <TT
13369
CLASS="filename"
13370
>SConstruct</TT
13371
> file first creates a <CODE
13372
CLASS="function"
13373
>Variables</CODE
13374
> object
13375
(the <TT
13376
CLASS="literal"
13377
>vars = Variables()</TT
13378
> call),
13379
and then uses the object's <CODE
13380
CLASS="function"
13381
>Add</CODE
13382
>
13383
method to indicate that the <CODE
13384
CLASS="varname"
13385
>RELEASE</CODE
13386
>
13387
variable can be set on the command line,
13388
and that its default value will be <TT
13389
CLASS="literal"
13390
>0</TT
13391
>
13392
(the third argument to the <CODE
13393
CLASS="function"
13394
>Add</CODE
13395
> method).
13396
The second argument is a line of help text;
13397
we'll learn how to use it in the next section.
13398
13399
</P
13400
><P
13401
>
13402
We then pass the created <CODE
13403
CLASS="function"
13404
>Variables</CODE
13405
>
13406
object as a <CODE
13407
CLASS="varname"
13408
>variables</CODE
13409
> keyword argument
13410
to the <CODE
13411
CLASS="function"
13412
>Environment</CODE
13413
> call
13414
used to create the construction environment.
13415
This then allows a user to set the
13416
<CODE
13417
CLASS="varname"
13418
>RELEASE</CODE
13419
> build variable on the command line
13420
and have the variable show up in
13421
the command line used to build each object from
13422
a C source file:
13423
13424
</P
13425
><PRE
13426
CLASS="screen"
13427
> % <KBD
13428
CLASS="userinput"
13429
>scons -Q RELEASE=1</KBD
13430
>
13431
cc -o bar.o -c -DRELEASE_BUILD=1 bar.c
13432
cc -o foo.o -c -DRELEASE_BUILD=1 foo.c
13433
cc -o foo foo.o bar.o
13434
</PRE
13435
><P
13436
>
13437
NOTE: Before <SPAN
13438
CLASS="application"
13439
>SCons</SPAN
13440
> release 0.98.1, these build variables
13441
were known as "command-line build options."
13442
The class was actually named the <CODE
13443
CLASS="function"
13444
>Options</CODE
13445
> class,
13446
and in the sections below,
13447
the various functions were named
13448
<CODE
13449
CLASS="function"
13450
>BoolOption</CODE
13451
>, <CODE
13452
CLASS="function"
13453
>EnumOption</CODE
13454
>, <CODE
13455
CLASS="function"
13456
>ListOption</CODE
13457
>,
13458
<CODE
13459
CLASS="function"
13460
>PathOption</CODE
13461
>, <CODE
13462
CLASS="function"
13463
>PackageOption</CODE
13464
> and <CODE
13465
CLASS="function"
13466
>AddOptions</CODE
13467
>.
13468
These older names still work,
13469
and you may encounter them in older
13470
<TT
13471
CLASS="filename"
13472
>SConscript</TT
13473
> fles,
13474
but their use is discouraged
13475
and will be officially deprecated some day.
13476
13477
</P
13478
></DIV
13479
><DIV
13480
CLASS="section"
13481
><HR><H3
13482
CLASS="section"
13483
><A
13484
NAME="AEN2456"
13485
>12.2.2. Providing Help for Command-Line Build Variables</A
13486
></H3
13487
><P
13488
>
13489
To make command-line build variables most useful,
13490
you ideally want to provide
13491
some help text that will describe
13492
the available variables
13493
when the user runs <TT
13494
CLASS="literal"
13495
>scons -h</TT
13496
>.
13497
You could write this text by hand,
13498
but <SPAN
13499
CLASS="application"
13500
>SCons</SPAN
13501
> provides an easier way.
13502
<CODE
13503
CLASS="function"
13504
>Variables</CODE
13505
> objects support a
13506
<CODE
13507
CLASS="function"
13508
>GenerateHelpText</CODE
13509
> method
13510
that will, as its name suggests,
13511
generate text that describes
13512
the various variables that
13513
have been added to it.
13514
You then pass the output from this method to
13515
the <CODE
13516
CLASS="function"
13517
>Help</CODE
13518
> function:
13519
13520
</P
13521
><PRE
13522
CLASS="programlisting"
13523
> vars = Variables('custom.py')
13524
vars.Add('RELEASE', 'Set to 1 to build for release', 0)
13525
env = Environment(variables = vars)
13526
Help(vars.GenerateHelpText(env))
13527
</PRE
13528
><P
13529
>
13530
<SPAN
13531
CLASS="application"
13532
>SCons</SPAN
13533
> will now display some useful text
13534
when the <TT
13535
CLASS="literal"
13536
>-h</TT
13537
> option is used:
13538
13539
</P
13540
><PRE
13541
CLASS="screen"
13542
> % <KBD
13543
CLASS="userinput"
13544
>scons -Q -h</KBD
13545
>
13546
13547
RELEASE: Set to 1 to build for release
13548
default: 0
13549
actual: 0
13550
13551
Use scons -H for help about command-line options.
13552
</PRE
13553
><P
13554
>
13555
Notice that the help output shows the default value,
13556
and the current actual value of the build variable.
13557
13558
</P
13559
></DIV
13560
><DIV
13561
CLASS="section"
13562
><HR><H3
13563
CLASS="section"
13564
><A
13565
NAME="AEN2471"
13566
>12.2.3. Reading Build Variables From a File</A
13567
></H3
13568
><P
13569
>
13570
Giving the user a way to specify the
13571
value of a build variable on the command line
13572
is useful,
13573
but can still be tedious
13574
if users must specify the variable
13575
every time they run <SPAN
13576
CLASS="application"
13577
>SCons</SPAN
13578
>.
13579
We can let users provide customized build variable settings
13580
in a local file by providing a
13581
file name when we create the
13582
<CODE
13583
CLASS="function"
13584
>Variables</CODE
13585
> object:
13586
13587
</P
13588
><PRE
13589
CLASS="programlisting"
13590
> vars = Variables('custom.py')
13591
vars.Add('RELEASE', 'Set to 1 to build for release', 0)
13592
env = Environment(variables = vars,
13593
CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'})
13594
env.Program(['foo.c', 'bar.c'])
13595
Help(vars.GenerateHelpText(env))
13596
</PRE
13597
><P
13598
>
13599
This then allows the user to control the <CODE
13600
CLASS="varname"
13601
>RELEASE</CODE
13602
>
13603
variable by setting it in the <TT
13604
CLASS="filename"
13605
>custom.py</TT
13606
> file:
13607
13608
</P
13609
><PRE
13610
CLASS="programlisting"
13611
> RELEASE = 1
13612
</PRE
13613
><P
13614
>
13615
Note that this file is actually executed
13616
like a Python script.
13617
Now when we run <SPAN
13618
CLASS="application"
13619
>SCons</SPAN
13620
>:
13621
13622
</P
13623
><PRE
13624
CLASS="screen"
13625
> % <KBD
13626
CLASS="userinput"
13627
>scons -Q</KBD
13628
>
13629
cc -o bar.o -c -DRELEASE_BUILD=1 bar.c
13630
cc -o foo.o -c -DRELEASE_BUILD=1 foo.c
13631
cc -o foo foo.o bar.o
13632
</PRE
13633
><P
13634
>
13635
And if we change the contents of <TT
13636
CLASS="filename"
13637
>custom.py</TT
13638
> to:
13639
13640
</P
13641
><PRE
13642
CLASS="programlisting"
13643
> RELEASE = 0
13644
</PRE
13645
><P
13646
>
13647
The object files are rebuilt appropriately
13648
with the new variable:
13649
13650
</P
13651
><PRE
13652
CLASS="screen"
13653
> % <KBD
13654
CLASS="userinput"
13655
>scons -Q</KBD
13656
>
13657
cc -o bar.o -c -DRELEASE_BUILD=0 bar.c
13658
cc -o foo.o -c -DRELEASE_BUILD=0 foo.c
13659
cc -o foo foo.o bar.o
13660
</PRE
13661
></DIV
13662
><DIV
13663
CLASS="section"
13664
><HR><H3
13665
CLASS="section"
13666
><A
13667
NAME="AEN2491"
13668
>12.2.4. Pre-Defined Build Variable Functions</A
13669
></H3
13670
><P
13671
>
13672
<SPAN
13673
CLASS="application"
13674
>SCons</SPAN
13675
> provides a number of functions
13676
that provide ready-made behaviors
13677
for various types of command-line build variables.
13678
13679
</P
13680
><DIV
13681
CLASS="section"
13682
><HR><H4
13683
CLASS="section"
13684
><A
13685
NAME="AEN2495"
13686
>12.2.4.1. True/False Values: the <CODE
13687
CLASS="function"
13688
>BoolVariable</CODE
13689
> Build Variable Function</A
13690
></H4
13691
><P
13692
>
13693
It's often handy to be able to specify a
13694
variable that controls a simple Boolean variable
13695
with a <TT
13696
CLASS="literal"
13697
>true</TT
13698
> or <TT
13699
CLASS="literal"
13700
>false</TT
13701
> value.
13702
It would be even more handy to accomodate
13703
users who have different preferences for how to represent
13704
<TT
13705
CLASS="literal"
13706
>true</TT
13707
> or <TT
13708
CLASS="literal"
13709
>false</TT
13710
> values.
13711
The <CODE
13712
CLASS="function"
13713
>BoolVariable</CODE
13714
> function
13715
makes it easy to accomodate these
13716
common representations of
13717
<TT
13718
CLASS="literal"
13719
>true</TT
13720
> or <TT
13721
CLASS="literal"
13722
>false</TT
13723
>.
13724
13725
</P
13726
><P
13727
>
13728
The <CODE
13729
CLASS="function"
13730
>BoolVariable</CODE
13731
> function takes three arguments:
13732
the name of the build variable,
13733
the default value of the build variable,
13734
and the help string for the variable.
13735
It then returns appropriate information for
13736
passing to the <CODE
13737
CLASS="function"
13738
>Add</CODE
13739
> method of a <CODE
13740
CLASS="function"
13741
>Variables</CODE
13742
> object, like so:
13743
13744
</P
13745
><PRE
13746
CLASS="programlisting"
13747
> vars = Variables('custom.py')
13748
vars.Add(BoolVariable('RELEASE', 'Set to build for release', 0))
13749
env = Environment(variables = vars,
13750
CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'})
13751
env.Program('foo.c')
13752
</PRE
13753
><P
13754
>
13755
With this build variable,
13756
the <CODE
13757
CLASS="varname"
13758
>RELEASE</CODE
13759
> variable can now be enabled by
13760
setting it to the value <TT
13761
CLASS="literal"
13762
>yes</TT
13763
>
13764
or <TT
13765
CLASS="literal"
13766
>t</TT
13767
>:
13768
13769
</P
13770
><PRE
13771
CLASS="screen"
13772
> % <KBD
13773
CLASS="userinput"
13774
>scons -Q RELEASE=yes foo.o</KBD
13775
>
13776
cc -o foo.o -c -DRELEASE_BUILD=True foo.c
13777
</PRE
13778
><PRE
13779
CLASS="screen"
13780
> % <KBD
13781
CLASS="userinput"
13782
>scons -Q RELEASE=t foo.o</KBD
13783
>
13784
cc -o foo.o -c -DRELEASE_BUILD=True foo.c
13785
</PRE
13786
><P
13787
>
13788
Other values that equate to <TT
13789
CLASS="literal"
13790
>true</TT
13791
> include
13792
<TT
13793
CLASS="literal"
13794
>y</TT
13795
>,
13796
<TT
13797
CLASS="literal"
13798
>1</TT
13799
>,
13800
<TT
13801
CLASS="literal"
13802
>on</TT
13803
>
13804
and
13805
<TT
13806
CLASS="literal"
13807
>all</TT
13808
>.
13809
13810
</P
13811
><P
13812
>
13813
Conversely, <CODE
13814
CLASS="varname"
13815
>RELEASE</CODE
13816
> may now be given a <TT
13817
CLASS="literal"
13818
>false</TT
13819
>
13820
value by setting it to
13821
<TT
13822
CLASS="literal"
13823
>no</TT
13824
>
13825
or
13826
<TT
13827
CLASS="literal"
13828
>f</TT
13829
>:
13830
13831
</P
13832
><PRE
13833
CLASS="screen"
13834
> % <KBD
13835
CLASS="userinput"
13836
>scons -Q RELEASE=no foo.o</KBD
13837
>
13838
cc -o foo.o -c -DRELEASE_BUILD=False foo.c
13839
</PRE
13840
><PRE
13841
CLASS="screen"
13842
> % <KBD
13843
CLASS="userinput"
13844
>scons -Q RELEASE=f foo.o</KBD
13845
>
13846
cc -o foo.o -c -DRELEASE_BUILD=False foo.c
13847
</PRE
13848
><P
13849
>
13850
Other values that equate to <TT
13851
CLASS="literal"
13852
>false</TT
13853
> include
13854
<TT
13855
CLASS="literal"
13856
>n</TT
13857
>,
13858
<TT
13859
CLASS="literal"
13860
>0</TT
13861
>,
13862
<TT
13863
CLASS="literal"
13864
>off</TT
13865
>
13866
and
13867
<TT
13868
CLASS="literal"
13869
>none</TT
13870
>.
13871
13872
</P
13873
><P
13874
>
13875
Lastly, if a user tries to specify
13876
any other value,
13877
<SPAN
13878
CLASS="application"
13879
>SCons</SPAN
13880
> supplies an appropriate error message:
13881
13882
</P
13883
><PRE
13884
CLASS="screen"
13885
> % <KBD
13886
CLASS="userinput"
13887
>scons -Q RELEASE=bad_value foo.o</KBD
13888
>
13889
13890
scons: *** Error converting option: RELEASE
13891
Invalid value for boolean option: bad_value
13892
File "/home/my/project/SConstruct", line 4, in <module>
13893
</PRE
13894
></DIV
13895
><DIV
13896
CLASS="section"
13897
><HR><H4
13898
CLASS="section"
13899
><A
13900
NAME="AEN2544"
13901
>12.2.4.2. Single Value From a List: the <CODE
13902
CLASS="function"
13903
>EnumVariable</CODE
13904
> Build Variable Function</A
13905
></H4
13906
><P
13907
>
13908
Suppose that we want a user to be able to
13909
set a <CODE
13910
CLASS="varname"
13911
>COLOR</CODE
13912
> variable
13913
that selects a background color to be
13914
displayed by an application,
13915
but that we want to restrict the
13916
choices to a specific set of allowed colors.
13917
This can be set up quite easily
13918
using the <CODE
13919
CLASS="function"
13920
>EnumVariable</CODE
13921
>,
13922
which takes a list of <CODE
13923
CLASS="varname"
13924
>allowed_values</CODE
13925
> in addition to the variable name,
13926
default value,
13927
and help text arguments:
13928
13929
</P
13930
><PRE
13931
CLASS="programlisting"
13932
> vars = Variables('custom.py')
13933
vars.Add(EnumVariable('COLOR', 'Set background color', 'red',
13934
allowed_values=('red', 'green', 'blue')))
13935
env = Environment(variables = vars,
13936
CPPDEFINES={'COLOR' : '"${COLOR}"'})
13937
env.Program('foo.c')
13938
</PRE
13939
><P
13940
>
13941
The user can now explicity set the <CODE
13942
CLASS="varname"
13943
>COLOR</CODE
13944
> build variable
13945
to any of the specified allowed values:
13946
13947
</P
13948
><PRE
13949
CLASS="screen"
13950
> % <KBD
13951
CLASS="userinput"
13952
>scons -Q COLOR=red foo.o</KBD
13953
>
13954
cc -o foo.o -c -DCOLOR="red" foo.c
13955
% <KBD
13956
CLASS="userinput"
13957
>scons -Q COLOR=blue foo.o</KBD
13958
>
13959
cc -o foo.o -c -DCOLOR="blue" foo.c
13960
% <KBD
13961
CLASS="userinput"
13962
>scons -Q COLOR=green foo.o</KBD
13963
>
13964
cc -o foo.o -c -DCOLOR="green" foo.c
13965
</PRE
13966
><P
13967
>
13968
But, almost more importantly,
13969
an attempt to set <CODE
13970
CLASS="varname"
13971
>COLOR</CODE
13972
>
13973
to a value that's not in the list
13974
generates an error message:
13975
13976
</P
13977
><PRE
13978
CLASS="screen"
13979
> % <KBD
13980
CLASS="userinput"
13981
>scons -Q COLOR=magenta foo.o</KBD
13982
>
13983
13984
scons: *** Invalid value for option COLOR: magenta
13985
File "/home/my/project/SConstruct", line 5, in <module>
13986
</PRE
13987
><P
13988
>
13989
The <CODE
13990
CLASS="function"
13991
>EnumVariable</CODE
13992
> function also supports a way
13993
to map alternate names to allowed values.
13994
Suppose, for example,
13995
that we want to allow the user
13996
to use the word <TT
13997
CLASS="literal"
13998
>navy</TT
13999
> as a synonym for
14000
<TT
14001
CLASS="literal"
14002
>blue</TT
14003
>.
14004
We do this by adding a <CODE
14005
CLASS="varname"
14006
>map</CODE
14007
> dictionary
14008
that will map its key values
14009
to the desired legal value:
14010
14011
</P
14012
><PRE
14013
CLASS="programlisting"
14014
> vars = Variables('custom.py')
14015
vars.Add(EnumVariable('COLOR', 'Set background color', 'red',
14016
allowed_values=('red', 'green', 'blue'),
14017
map={'navy':'blue'}))
14018
env = Environment(variables = vars,
14019
CPPDEFINES={'COLOR' : '"${COLOR}"'})
14020
env.Program('foo.c')
14021
</PRE
14022
><P
14023
>
14024
As desired, the user can then use
14025
<TT
14026
CLASS="literal"
14027
>navy</TT
14028
> on the command line,
14029
and <SPAN
14030
CLASS="application"
14031
>SCons</SPAN
14032
> will translate it into <TT
14033
CLASS="literal"
14034
>blue</TT
14035
>
14036
when it comes time to use the <CODE
14037
CLASS="varname"
14038
>COLOR</CODE
14039
>
14040
variable to build a target:
14041
14042
</P
14043
><PRE
14044
CLASS="screen"
14045
> % <KBD
14046
CLASS="userinput"
14047
>scons -Q COLOR=navy foo.o</KBD
14048
>
14049
cc -o foo.o -c -DCOLOR="blue" foo.c
14050
</PRE
14051
><P
14052
>
14053
By default, when using the <CODE
14054
CLASS="function"
14055
>EnumVariable</CODE
14056
> function,
14057
arguments that differ
14058
from the legal values
14059
only in case
14060
are treated as illegal values:
14061
14062
</P
14063
><PRE
14064
CLASS="screen"
14065
> % <KBD
14066
CLASS="userinput"
14067
>scons -Q COLOR=Red foo.o</KBD
14068
>
14069
14070
scons: *** Invalid value for option COLOR: Red
14071
File "/home/my/project/SConstruct", line 5, in <module>
14072
% <KBD
14073
CLASS="userinput"
14074
>scons -Q COLOR=BLUE foo.o</KBD
14075
>
14076
14077
scons: *** Invalid value for option COLOR: BLUE
14078
File "/home/my/project/SConstruct", line 5, in <module>
14079
% <KBD
14080
CLASS="userinput"
14081
>scons -Q COLOR=nAvY foo.o</KBD
14082
>
14083
14084
scons: *** Invalid value for option COLOR: nAvY
14085
File "/home/my/project/SConstruct", line 5, in <module>
14086
</PRE
14087
><P
14088
>
14089
The <CODE
14090
CLASS="function"
14091
>EnumVariable</CODE
14092
> function can take an additional
14093
<CODE
14094
CLASS="varname"
14095
>ignorecase</CODE
14096
> keyword argument that,
14097
when set to <TT
14098
CLASS="literal"
14099
>1</TT
14100
>,
14101
tells <SPAN
14102
CLASS="application"
14103
>SCons</SPAN
14104
> to allow case differences
14105
when the values are specified:
14106
14107
</P
14108
><PRE
14109
CLASS="programlisting"
14110
> vars = Variables('custom.py')
14111
vars.Add(EnumVariable('COLOR', 'Set background color', 'red',
14112
allowed_values=('red', 'green', 'blue'),
14113
map={'navy':'blue'},
14114
ignorecase=1))
14115
env = Environment(variables = vars,
14116
CPPDEFINES={'COLOR' : '"${COLOR}"'})
14117
env.Program('foo.c')
14118
</PRE
14119
><P
14120
>
14121
Which yields the output:
14122
14123
</P
14124
><PRE
14125
CLASS="screen"
14126
> % <KBD
14127
CLASS="userinput"
14128
>scons -Q COLOR=Red foo.o</KBD
14129
>
14130
cc -o foo.o -c -DCOLOR="Red" foo.c
14131
% <KBD
14132
CLASS="userinput"
14133
>scons -Q COLOR=BLUE foo.o</KBD
14134
>
14135
cc -o foo.o -c -DCOLOR="BLUE" foo.c
14136
% <KBD
14137
CLASS="userinput"
14138
>scons -Q COLOR=nAvY foo.o</KBD
14139
>
14140
cc -o foo.o -c -DCOLOR="blue" foo.c
14141
% <KBD
14142
CLASS="userinput"
14143
>scons -Q COLOR=green foo.o</KBD
14144
>
14145
cc -o foo.o -c -DCOLOR="green" foo.c
14146
</PRE
14147
><P
14148
>
14149
Notice that an <CODE
14150
CLASS="varname"
14151
>ignorecase</CODE
14152
> value of <TT
14153
CLASS="literal"
14154
>1</TT
14155
>
14156
preserves the case-spelling that the user supplied.
14157
If you want <SPAN
14158
CLASS="application"
14159
>SCons</SPAN
14160
> to translate the names
14161
into lower-case,
14162
regardless of the case used by the user,
14163
specify an <CODE
14164
CLASS="varname"
14165
>ignorecase</CODE
14166
> value of <TT
14167
CLASS="literal"
14168
>2</TT
14169
>:
14170
14171
</P
14172
><PRE
14173
CLASS="programlisting"
14174
> vars = Variables('custom.py')
14175
vars.Add(EnumVariable('COLOR', 'Set background color', 'red',
14176
allowed_values=('red', 'green', 'blue'),
14177
map={'navy':'blue'},
14178
ignorecase=2))
14179
env = Environment(variables = vars,
14180
CPPDEFINES={'COLOR' : '"${COLOR}"'})
14181
env.Program('foo.c')
14182
</PRE
14183
><P
14184
>
14185
Now <SPAN
14186
CLASS="application"
14187
>SCons</SPAN
14188
> will use values of
14189
<TT
14190
CLASS="literal"
14191
>red</TT
14192
>,
14193
<TT
14194
CLASS="literal"
14195
>green</TT
14196
> or
14197
<TT
14198
CLASS="literal"
14199
>blue</TT
14200
>
14201
regardless of how the user spells
14202
those values on the command line:
14203
14204
</P
14205
><PRE
14206
CLASS="screen"
14207
> % <KBD
14208
CLASS="userinput"
14209
>scons -Q COLOR=Red foo.o</KBD
14210
>
14211
cc -o foo.o -c -DCOLOR="red" foo.c
14212
% <KBD
14213
CLASS="userinput"
14214
>scons -Q COLOR=nAvY foo.o</KBD
14215
>
14216
cc -o foo.o -c -DCOLOR="blue" foo.c
14217
% <KBD
14218
CLASS="userinput"
14219
>scons -Q COLOR=GREEN foo.o</KBD
14220
>
14221
cc -o foo.o -c -DCOLOR="green" foo.c
14222
</PRE
14223
></DIV
14224
><DIV
14225
CLASS="section"
14226
><HR><H4
14227
CLASS="section"
14228
><A
14229
NAME="AEN2609"
14230
>12.2.4.3. Multiple Values From a List: the <CODE
14231
CLASS="function"
14232
>ListVariable</CODE
14233
> Build Variable Function</A
14234
></H4
14235
><P
14236
>
14237
Another way in which you might want to allow users
14238
to control a build variable is to
14239
specify a list of one or more legal values.
14240
<SPAN
14241
CLASS="application"
14242
>SCons</SPAN
14243
> supports this through the <CODE
14244
CLASS="function"
14245
>ListVariable</CODE
14246
> function.
14247
If, for example, we want a user to be able to set a
14248
<CODE
14249
CLASS="varname"
14250
>COLORS</CODE
14251
> variable to one or more of the legal list of values:
14252
14253
</P
14254
><PRE
14255
CLASS="programlisting"
14256
> vars = Variables('custom.py')
14257
vars.Add(ListVariable('COLORS', 'List of colors', 0,
14258
['red', 'green', 'blue']))
14259
env = Environment(variables = vars,
14260
CPPDEFINES={'COLORS' : '"${COLORS}"'})
14261
env.Program('foo.c')
14262
</PRE
14263
><P
14264
>
14265
A user can now specify a comma-separated list
14266
of legal values,
14267
which will get translated into a space-separated
14268
list for passing to the any build commands:
14269
14270
</P
14271
><PRE
14272
CLASS="screen"
14273
> % <KBD
14274
CLASS="userinput"
14275
>scons -Q COLORS=red,blue foo.o</KBD
14276
>
14277
cc -o foo.o -c -DCOLORS="red blue" foo.c
14278
% <KBD
14279
CLASS="userinput"
14280
>scons -Q COLORS=blue,green,red foo.o</KBD
14281
>
14282
cc -o foo.o -c -DCOLORS="blue green red" foo.c
14283
</PRE
14284
><P
14285
>
14286
In addition, the <CODE
14287
CLASS="function"
14288
>ListVariable</CODE
14289
> function
14290
allows the user to specify explicit keywords of
14291
<TT
14292
CLASS="literal"
14293
>all</TT
14294
> or <TT
14295
CLASS="literal"
14296
>none</TT
14297
>
14298
to select all of the legal values,
14299
or none of them, respectively:
14300
14301
</P
14302
><PRE
14303
CLASS="screen"
14304
> % <KBD
14305
CLASS="userinput"
14306
>scons -Q COLORS=all foo.o</KBD
14307
>
14308
cc -o foo.o -c -DCOLORS="red green blue" foo.c
14309
% <KBD
14310
CLASS="userinput"
14311
>scons -Q COLORS=none foo.o</KBD
14312
>
14313
cc -o foo.o -c -DCOLORS="" foo.c
14314
</PRE
14315
><P
14316
>
14317
And, of course, an illegal value
14318
still generates an error message:
14319
14320
</P
14321
><PRE
14322
CLASS="screen"
14323
> % <KBD
14324
CLASS="userinput"
14325
>scons -Q COLORS=magenta foo.o</KBD
14326
>
14327
14328
scons: *** Error converting option: COLORS
14329
Invalid value(s) for option: magenta
14330
File "/home/my/project/SConstruct", line 5, in <module>
14331
</PRE
14332
></DIV
14333
><DIV
14334
CLASS="section"
14335
><HR><H4
14336
CLASS="section"
14337
><A
14338
NAME="AEN2631"
14339
>12.2.4.4. Path Names: the <CODE
14340
CLASS="function"
14341
>PathVariable</CODE
14342
> Build Variable Function</A
14343
></H4
14344
><P
14345
>
14346
<SPAN
14347
CLASS="application"
14348
>SCons</SPAN
14349
> supports a <CODE
14350
CLASS="function"
14351
>PathVariable</CODE
14352
> function
14353
to make it easy to create a build variable
14354
to control an expected path name.
14355
If, for example, you need to
14356
define a variable in the preprocessor
14357
that controls the location of a
14358
configuration file:
14359
14360
</P
14361
><PRE
14362
CLASS="programlisting"
14363
> vars = Variables('custom.py')
14364
vars.Add(PathVariable('CONFIG',
14365
'Path to configuration file',
14366
'/etc/my_config'))
14367
env = Environment(variables = vars,
14368
CPPDEFINES={'CONFIG_FILE' : '"$CONFIG"'})
14369
env.Program('foo.c')
14370
</PRE
14371
><P
14372
>
14373
This then allows the user to
14374
override the <CODE
14375
CLASS="varname"
14376
>CONFIG</CODE
14377
> build variable
14378
on the command line as necessary:
14379
14380
</P
14381
><PRE
14382
CLASS="screen"
14383
> % <KBD
14384
CLASS="userinput"
14385
>scons -Q foo.o</KBD
14386
>
14387
cc -o foo.o -c -DCONFIG_FILE="/etc/my_config" foo.c
14388
% <KBD
14389
CLASS="userinput"
14390
>scons -Q CONFIG=/usr/local/etc/other_config foo.o</KBD
14391
>
14392
scons: `foo.o' is up to date.
14393
</PRE
14394
><P
14395
>
14396
By default, <CODE
14397
CLASS="function"
14398
>PathVariable</CODE
14399
> checks to make sure
14400
that the specified path exists and generates an error if it
14401
doesn't:
14402
14403
</P
14404
><PRE
14405
CLASS="screen"
14406
> % <KBD
14407
CLASS="userinput"
14408
>scons -Q CONFIG=/does/not/exist foo.o</KBD
14409
>
14410
14411
scons: *** Path for option CONFIG does not exist: /does/not/exist
14412
File "/home/my/project/SConstruct", line 6, in <module>
14413
</PRE
14414
><P
14415
>
14416
<CODE
14417
CLASS="function"
14418
>PathVariable</CODE
14419
> provides a number of methods
14420
that you can use to change this behavior.
14421
If you want to ensure that any specified paths are,
14422
in fact, files and not directories,
14423
use the <CODE
14424
CLASS="function"
14425
>PathVariable.PathIsFile</CODE
14426
> method:
14427
14428
</P
14429
><PRE
14430
CLASS="programlisting"
14431
> vars = Variables('custom.py')
14432
vars.Add(PathVariable('CONFIG',
14433
'Path to configuration file',
14434
'/etc/my_config',
14435
PathVariable.PathIsFile))
14436
env = Environment(variables = vars,
14437
CPPDEFINES={'CONFIG_FILE' : '"$CONFIG"'})
14438
env.Program('foo.c')
14439
</PRE
14440
><P
14441
>
14442
Conversely, to ensure that any specified paths are
14443
directories and not files,
14444
use the <CODE
14445
CLASS="function"
14446
>PathVariable.PathIsDir</CODE
14447
> method:
14448
14449
</P
14450
><PRE
14451
CLASS="programlisting"
14452
> vars = Variables('custom.py')
14453
vars.Add(PathVariable('DBDIR',
14454
'Path to database directory',
14455
'/var/my_dbdir',
14456
PathVariable.PathIsDir))
14457
env = Environment(variables = vars,
14458
CPPDEFINES={'DBDIR' : '"$DBDIR"'})
14459
env.Program('foo.c')
14460
</PRE
14461
><P
14462
>
14463
If you want to make sure that any specified paths
14464
are directories,
14465
and you would like the directory created
14466
if it doesn't already exist,
14467
use the <CODE
14468
CLASS="function"
14469
>PathVariable.PathIsDirCreate</CODE
14470
> method:
14471
14472
</P
14473
><PRE
14474
CLASS="programlisting"
14475
> vars = Variables('custom.py')
14476
vars.Add(PathVariable('DBDIR',
14477
'Path to database directory',
14478
'/var/my_dbdir',
14479
PathVariable.PathIsDirCreate))
14480
env = Environment(variables = vars,
14481
CPPDEFINES={'DBDIR' : '"$DBDIR"'})
14482
env.Program('foo.c')
14483
</PRE
14484
><P
14485
>
14486
Lastly, if you don't care whether the path exists,
14487
is a file, or a directory,
14488
use the <CODE
14489
CLASS="function"
14490
>PathVariable.PathAccept</CODE
14491
> method
14492
to accept any path that the user supplies:
14493
14494
</P
14495
><PRE
14496
CLASS="programlisting"
14497
> vars = Variables('custom.py')
14498
vars.Add(PathVariable('OUTPUT',
14499
'Path to output file or directory',
14500
None,
14501
PathVariable.PathAccept))
14502
env = Environment(variables = vars,
14503
CPPDEFINES={'OUTPUT' : '"$OUTPUT"'})
14504
env.Program('foo.c')
14505
</PRE
14506
></DIV
14507
><DIV
14508
CLASS="section"
14509
><HR><H4
14510
CLASS="section"
14511
><A
14512
NAME="AEN2660"
14513
>12.2.4.5. Enabled/Disabled Path Names: the <CODE
14514
CLASS="function"
14515
>PackageVariable</CODE
14516
> Build Variable Function</A
14517
></H4
14518
><P
14519
>
14520
Sometimes you want to give users
14521
even more control over a path name variable,
14522
allowing them to explicitly enable or
14523
disable the path name
14524
by using <TT
14525
CLASS="literal"
14526
>yes</TT
14527
> or <TT
14528
CLASS="literal"
14529
>no</TT
14530
> keywords,
14531
in addition to allow them
14532
to supply an explicit path name.
14533
<SPAN
14534
CLASS="application"
14535
>SCons</SPAN
14536
> supports the <CODE
14537
CLASS="function"
14538
>PackageVariable</CODE
14539
>
14540
function to support this:
14541
14542
</P
14543
><PRE
14544
CLASS="programlisting"
14545
> vars = Variables('custom.py')
14546
vars.Add(PackageVariable('PACKAGE',
14547
'Location package',
14548
'/opt/location'))
14549
env = Environment(variables = vars,
14550
CPPDEFINES={'PACKAGE' : '"$PACKAGE"'})
14551
env.Program('foo.c')
14552
</PRE
14553
><P
14554
>
14555
When the <TT
14556
CLASS="filename"
14557
>SConscript</TT
14558
> file uses the <CODE
14559
CLASS="function"
14560
>PackageVariable</CODE
14561
> funciton,
14562
user can now still use the default
14563
or supply an overriding path name,
14564
but can now explicitly set the
14565
specified variable to a value
14566
that indicates the package should be enabled
14567
(in which case the default should be used)
14568
or disabled:
14569
14570
</P
14571
><PRE
14572
CLASS="screen"
14573
> % <KBD
14574
CLASS="userinput"
14575
>scons -Q foo.o</KBD
14576
>
14577
cc -o foo.o -c -DPACKAGE="/opt/location" foo.c
14578
% <KBD
14579
CLASS="userinput"
14580
>scons -Q PACKAGE=/usr/local/location foo.o</KBD
14581
>
14582
cc -o foo.o -c -DPACKAGE="/usr/local/location" foo.c
14583
% <KBD
14584
CLASS="userinput"
14585
>scons -Q PACKAGE=yes foo.o</KBD
14586
>
14587
cc -o foo.o -c -DPACKAGE="True" foo.c
14588
% <KBD
14589
CLASS="userinput"
14590
>scons -Q PACKAGE=no foo.o</KBD
14591
>
14592
cc -o foo.o -c -DPACKAGE="False" foo.c
14593
</PRE
14594
></DIV
14595
></DIV
14596
><DIV
14597
CLASS="section"
14598
><HR><H3
14599
CLASS="section"
14600
><A
14601
NAME="AEN2677"
14602
>12.2.5. Adding Multiple Command-Line Build Variables at Once</A
14603
></H3
14604
><P
14605
>
14606
Lastly, <SPAN
14607
CLASS="application"
14608
>SCons</SPAN
14609
> provides a way to add
14610
multiple build variables to a <CODE
14611
CLASS="function"
14612
>Variables</CODE
14613
> object at once.
14614
Instead of having to call the <CODE
14615
CLASS="function"
14616
>Add</CODE
14617
> method
14618
multiple times,
14619
you can call the <CODE
14620
CLASS="function"
14621
>AddVariables</CODE
14622
>
14623
method with a list of build variables
14624
to be added to the object.
14625
Each build variable is specified
14626
as either a tuple of arguments,
14627
just like you'd pass to the <CODE
14628
CLASS="function"
14629
>Add</CODE
14630
> method itself,
14631
or as a call to one of the pre-defined
14632
functions for pre-packaged command-line build variables.
14633
in any order:
14634
14635
</P
14636
><PRE
14637
CLASS="programlisting"
14638
> vars = Variables()
14639
vars.AddVariables(
14640
('RELEASE', 'Set to 1 to build for release', 0),
14641
('CONFIG', 'Configuration file', '/etc/my_config'),
14642
BoolVariable('warnings', 'compilation with -Wall and similiar', 1),
14643
EnumVariable('debug', 'debug output and symbols', 'no',
14644
allowed_values=('yes', 'no', 'full'),
14645
map={}, ignorecase=0), # case sensitive
14646
ListVariable('shared',
14647
'libraries to build as shared libraries',
14648
'all',
14649
names = list_of_libs),
14650
PackageVariable('x11',
14651
'use X11 installed here (yes = search some places)',
14652
'yes'),
14653
PathVariable('qtdir', 'where the root of Qt is installed', qtdir),
14654
)
14655
</PRE
14656
><P
14657
> </P
14658
></DIV
14659
><DIV
14660
CLASS="section"
14661
><HR><H3
14662
CLASS="section"
14663
><A
14664
NAME="AEN2687"
14665
>12.2.6. Handling Unknown Command-Line Build Variables: the <CODE
14666
CLASS="function"
14667
>UnknownVariables</CODE
14668
> Function</A
14669
></H3
14670
><P
14671
>
14672
Users may, of course,
14673
occasionally misspell variable names in their command-line settings.
14674
<SPAN
14675
CLASS="application"
14676
>SCons</SPAN
14677
> does not generate an error or warning
14678
for any unknown variables the users specifies on the command line.
14679
(This is in no small part because you may be
14680
processing the arguments directly using the <CODE
14681
CLASS="varname"
14682
>ARGUMENTS</CODE
14683
> dictionary,
14684
and therefore <SPAN
14685
CLASS="application"
14686
>SCons</SPAN
14687
> can't know in the general case
14688
whether a given "misspelled" variable is
14689
really unknown and a potential problem,
14690
or something that your <TT
14691
CLASS="filename"
14692
>SConscript</TT
14693
> file
14694
will handle directly with some Python code.)
14695
14696
</P
14697
><P
14698
>
14699
If, however, you're using a <CODE
14700
CLASS="function"
14701
>Variables</CODE
14702
> object to
14703
define a specific set of command-line build variables
14704
that you expect users to be able to set,
14705
you may want to provide an error
14706
message or warning of your own
14707
if the user supplies a variable setting
14708
that is <SPAN
14709
CLASS="emphasis"
14710
><I
14711
CLASS="emphasis"
14712
>not</I
14713
></SPAN
14714
> among
14715
the defined list of variable names known to the <CODE
14716
CLASS="function"
14717
>Variables</CODE
14718
> object.
14719
You can do this by calling the <CODE
14720
CLASS="function"
14721
>UnknownVariables</CODE
14722
>
14723
method of the <CODE
14724
CLASS="function"
14725
>Variables</CODE
14726
> object:
14727
14728
</P
14729
><PRE
14730
CLASS="programlisting"
14731
> vars = Variables(None)
14732
vars.Add('RELEASE', 'Set to 1 to build for release', 0)
14733
env = Environment(variables = vars,
14734
CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'})
14735
unknown = vars.UnknownVariables()
14736
if unknown:
14737
print "Unknown variables:", unknown.keys()
14738
Exit(1)
14739
env.Program('foo.c')
14740
</PRE
14741
><P
14742
>
14743
The <CODE
14744
CLASS="function"
14745
>UnknownVariables</CODE
14746
> method returns a dictionary
14747
containing the keywords and values
14748
of any variables the user specified on the command line
14749
that are <SPAN
14750
CLASS="emphasis"
14751
><I
14752
CLASS="emphasis"
14753
>not</I
14754
></SPAN
14755
>
14756
among the variables known to the <CODE
14757
CLASS="function"
14758
>Variables</CODE
14759
> object
14760
(from having been specified using
14761
the <CODE
14762
CLASS="function"
14763
>Variables</CODE
14764
> object's<CODE
14765
CLASS="function"
14766
>Add</CODE
14767
> method).
14768
In the examble above,
14769
we check for whether the dictionary
14770
returned by the <CODE
14771
CLASS="function"
14772
>UnknownVariables</CODE
14773
> is non-empty,
14774
and if so print the Python list
14775
containing the names of the unknwown variables
14776
and then call the <CODE
14777
CLASS="function"
14778
>Exit</CODE
14779
> function
14780
to terminate <SPAN
14781
CLASS="application"
14782
>SCons</SPAN
14783
>:
14784
14785
</P
14786
><PRE
14787
CLASS="screen"
14788
> % <KBD
14789
CLASS="userinput"
14790
>scons -Q NOT_KNOWN=foo</KBD
14791
>
14792
Unknown variables: ['NOT_KNOWN']
14793
</PRE
14794
><P
14795
>
14796
Of course, you can process the items in the
14797
dictionary returned by the <CODE
14798
CLASS="function"
14799
>UnknownVariables</CODE
14800
> function
14801
in any way appropriate to your bulid configuration,
14802
including just printing a warning message
14803
but not exiting,
14804
logging an error somewhere,
14805
etc.
14806
14807
</P
14808
><P
14809
>
14810
Note that you must delay the call of <CODE
14811
CLASS="function"
14812
>UnknownVariables</CODE
14813
>
14814
until after you have applied the <CODE
14815
CLASS="function"
14816
>Variables</CODE
14817
> object
14818
to a construction environment
14819
with the <TT
14820
CLASS="literal"
14821
>variables=</TT
14822
>
14823
keyword argument of an <CODE
14824
CLASS="function"
14825
>Environment</CODE
14826
> call.
14827
14828
</P
14829
></DIV
14830
></DIV
14831
><DIV
14832
CLASS="section"
14833
><HR><H2
14834
CLASS="section"
14835
><A
14836
NAME="sect-command-line-targets"
14837
>12.3. Command-Line Targets</A
14838
></H2
14839
><DIV
14840
CLASS="section"
14841
><H3
14842
CLASS="section"
14843
><A
14844
NAME="AEN2722"
14845
>12.3.1. Fetching Command-Line Targets: the <CODE
14846
CLASS="varname"
14847
>COMMAND_LINE_TARGETS</CODE
14848
> Variable</A
14849
></H3
14850
><P
14851
>
14852
<SPAN
14853
CLASS="application"
14854
>SCons</SPAN
14855
> supports a <CODE
14856
CLASS="varname"
14857
>COMMAND_LINE_TARGETS</CODE
14858
> variable
14859
that lets you fetch the list of targets that the
14860
user specified on the command line.
14861
You can use the targets to manipulate the
14862
build in any way you wish.
14863
As a simple example,
14864
suppose that you want to print a reminder
14865
to the user whenever a specific program is built.
14866
You can do this by checking for the
14867
target in the <CODE
14868
CLASS="varname"
14869
>COMMAND_LINE_TARGETS</CODE
14870
> list:
14871
14872
</P
14873
><PRE
14874
CLASS="programlisting"
14875
> if 'bar' in COMMAND_LINE_TARGETS:
14876
print "Don't forget to copy `bar' to the archive!"
14877
Default(Program('foo.c'))
14878
Program('bar.c')
14879
</PRE
14880
><P
14881
>
14882
Then, running <SPAN
14883
CLASS="application"
14884
>SCons</SPAN
14885
> with the default target
14886
works as it always does,
14887
but explicity specifying the <SPAN
14888
CLASS="application"
14889
>bar</SPAN
14890
> target
14891
on the command line generates the warning message:
14892
14893
</P
14894
><PRE
14895
CLASS="screen"
14896
> % <KBD
14897
CLASS="userinput"
14898
>scons -Q</KBD
14899
>
14900
cc -o foo.o -c foo.c
14901
cc -o foo foo.o
14902
% <KBD
14903
CLASS="userinput"
14904
>scons -Q bar</KBD
14905
>
14906
Don't forget to copy `bar' to the archive!
14907
cc -o bar.o -c bar.c
14908
cc -o bar bar.o
14909
</PRE
14910
><P
14911
>
14912
Another practical use for the <CODE
14913
CLASS="varname"
14914
>COMMAND_LINE_TARGETS</CODE
14915
> variable
14916
might be to speed up a build
14917
by only reading certain subsidiary <TT
14918
CLASS="filename"
14919
>SConscript</TT
14920
>
14921
files if a specific target is requested.
14922
14923
</P
14924
></DIV
14925
><DIV
14926
CLASS="section"
14927
><HR><H3
14928
CLASS="section"
14929
><A
14930
NAME="AEN2739"
14931
>12.3.2. Controlling the Default Targets: the <CODE
14932
CLASS="function"
14933
>Default</CODE
14934
> Function</A
14935
></H3
14936
><P
14937
>
14938
One of the most basic things you can control
14939
is which targets <SPAN
14940
CLASS="application"
14941
>SCons</SPAN
14942
> will build by default--that is,
14943
when there are no targets specified on the command line.
14944
As mentioned previously,
14945
<SPAN
14946
CLASS="application"
14947
>SCons</SPAN
14948
> will normally build every target
14949
in or below the current directory
14950
by default--that is, when you don't
14951
explicitly specify one or more targets
14952
on the command line.
14953
Sometimes, however, you may want
14954
to specify explicitly that only
14955
certain programs, or programs in certain directories,
14956
should be built by default.
14957
You do this with the <CODE
14958
CLASS="function"
14959
>Default</CODE
14960
> function:
14961
14962
</P
14963
><PRE
14964
CLASS="programlisting"
14965
> env = Environment()
14966
hello = env.Program('hello.c')
14967
env.Program('goodbye.c')
14968
Default(hello)
14969
</PRE
14970
><P
14971
>
14972
This <TT
14973
CLASS="filename"
14974
>SConstruct</TT
14975
> file knows how to build two programs,
14976
<SPAN
14977
CLASS="application"
14978
>hello</SPAN
14979
> and <SPAN
14980
CLASS="application"
14981
>goodbye</SPAN
14982
>,
14983
but only builds the
14984
<SPAN
14985
CLASS="application"
14986
>hello</SPAN
14987
> program by default:
14988
14989
</P
14990
><PRE
14991
CLASS="screen"
14992
> % <KBD
14993
CLASS="userinput"
14994
>scons -Q</KBD
14995
>
14996
cc -o hello.o -c hello.c
14997
cc -o hello hello.o
14998
% <KBD
14999
CLASS="userinput"
15000
>scons -Q</KBD
15001
>
15002
scons: `hello' is up to date.
15003
% <KBD
15004
CLASS="userinput"
15005
>scons -Q goodbye</KBD
15006
>
15007
cc -o goodbye.o -c goodbye.c
15008
cc -o goodbye goodbye.o
15009
</PRE
15010
><P
15011
>
15012
Note that, even when you use the <CODE
15013
CLASS="function"
15014
>Default</CODE
15015
>
15016
function in your <TT
15017
CLASS="filename"
15018
>SConstruct</TT
15019
> file,
15020
you can still explicitly specify the current directory
15021
(<TT
15022
CLASS="literal"
15023
>.</TT
15024
>) on the command line
15025
to tell <SPAN
15026
CLASS="application"
15027
>SCons</SPAN
15028
> to build
15029
everything in (or below) the current directory:
15030
15031
</P
15032
><PRE
15033
CLASS="screen"
15034
> % <KBD
15035
CLASS="userinput"
15036
>scons -Q .</KBD
15037
>
15038
cc -o goodbye.o -c goodbye.c
15039
cc -o goodbye goodbye.o
15040
cc -o hello.o -c hello.c
15041
cc -o hello hello.o
15042
</PRE
15043
><P
15044
>
15045
You can also call the <CODE
15046
CLASS="function"
15047
>Default</CODE
15048
>
15049
function more than once,
15050
in which case each call
15051
adds to the list of targets to be built by default:
15052
15053
</P
15054
><PRE
15055
CLASS="programlisting"
15056
> env = Environment()
15057
prog1 = env.Program('prog1.c')
15058
Default(prog1)
15059
prog2 = env.Program('prog2.c')
15060
prog3 = env.Program('prog3.c')
15061
Default(prog3)
15062
</PRE
15063
><P
15064
>
15065
Or you can specify more than one target
15066
in a single call to the <CODE
15067
CLASS="function"
15068
>Default</CODE
15069
> function:
15070
15071
</P
15072
><PRE
15073
CLASS="programlisting"
15074
> env = Environment()
15075
prog1 = env.Program('prog1.c')
15076
prog2 = env.Program('prog2.c')
15077
prog3 = env.Program('prog3.c')
15078
Default(prog1, prog3)
15079
</PRE
15080
><P
15081
>
15082
Either of these last two examples
15083
will build only the
15084
<SPAN
15085
CLASS="application"
15086
>prog1</SPAN
15087
>
15088
and
15089
<SPAN
15090
CLASS="application"
15091
>prog3</SPAN
15092
>
15093
programs by default:
15094
15095
</P
15096
><PRE
15097
CLASS="screen"
15098
> % <KBD
15099
CLASS="userinput"
15100
>scons -Q</KBD
15101
>
15102
cc -o prog1.o -c prog1.c
15103
cc -o prog1 prog1.o
15104
cc -o prog3.o -c prog3.c
15105
cc -o prog3 prog3.o
15106
% <KBD
15107
CLASS="userinput"
15108
>scons -Q .</KBD
15109
>
15110
cc -o prog2.o -c prog2.c
15111
cc -o prog2 prog2.o
15112
</PRE
15113
><P
15114
>
15115
You can list a directory as
15116
an argument to <CODE
15117
CLASS="function"
15118
>Default</CODE
15119
>:
15120
15121
</P
15122
><PRE
15123
CLASS="programlisting"
15124
> env = Environment()
15125
env.Program(['prog1/main.c', 'prog1/foo.c'])
15126
env.Program(['prog2/main.c', 'prog2/bar.c'])
15127
Default('prog1')
15128
</PRE
15129
><P
15130
>
15131
In which case only the target(s) in that
15132
directory will be built by default:
15133
15134
</P
15135
><PRE
15136
CLASS="screen"
15137
> % <KBD
15138
CLASS="userinput"
15139
>scons -Q</KBD
15140
>
15141
cc -o prog1/foo.o -c prog1/foo.c
15142
cc -o prog1/main.o -c prog1/main.c
15143
cc -o prog1/main prog1/main.o prog1/foo.o
15144
% <KBD
15145
CLASS="userinput"
15146
>scons -Q</KBD
15147
>
15148
scons: `prog1' is up to date.
15149
% <KBD
15150
CLASS="userinput"
15151
>scons -Q .</KBD
15152
>
15153
cc -o prog2/bar.o -c prog2/bar.c
15154
cc -o prog2/main.o -c prog2/main.c
15155
cc -o prog2/main prog2/main.o prog2/bar.o
15156
</PRE
15157
><P
15158
>
15159
Lastly, if for some reason you don't want
15160
any targets built by default,
15161
you can use the Python <TT
15162
CLASS="literal"
15163
>None</TT
15164
>
15165
variable:
15166
15167
</P
15168
><PRE
15169
CLASS="programlisting"
15170
> env = Environment()
15171
prog1 = env.Program('prog1.c')
15172
prog2 = env.Program('prog2.c')
15173
Default(None)
15174
</PRE
15175
><P
15176
>
15177
Which would produce build output like:
15178
15179
</P
15180
><PRE
15181
CLASS="screen"
15182
> % <KBD
15183
CLASS="userinput"
15184
>scons -Q</KBD
15185
>
15186
scons: *** No targets specified and no Default() targets found. Stop.
15187
% <KBD
15188
CLASS="userinput"
15189
>scons -Q .</KBD
15190
>
15191
cc -o prog1.o -c prog1.c
15192
cc -o prog1 prog1.o
15193
cc -o prog2.o -c prog2.c
15194
cc -o prog2 prog2.o
15195
</PRE
15196
><DIV
15197
CLASS="section"
15198
><HR><H4
15199
CLASS="section"
15200
><A
15201
NAME="AEN2790"
15202
>12.3.2.1. Fetching the List of Default Targets: the <CODE
15203
CLASS="varname"
15204
>DEFAULT_TARGETS</CODE
15205
> Variable</A
15206
></H4
15207
><P
15208
>
15209
<SPAN
15210
CLASS="application"
15211
>SCons</SPAN
15212
> supports a <CODE
15213
CLASS="varname"
15214
>DEFAULT_TARGETS</CODE
15215
> variable
15216
that lets you get at the current list of default targets.
15217
The <CODE
15218
CLASS="varname"
15219
>DEFAULT_TARGETS</CODE
15220
> variable has
15221
two important differences from the <CODE
15222
CLASS="varname"
15223
>COMMAND_LINE_TARGETS</CODE
15224
> variable.
15225
First, the <CODE
15226
CLASS="varname"
15227
>DEFAULT_TARGETS</CODE
15228
> variable is a list of
15229
internal <SPAN
15230
CLASS="application"
15231
>SCons</SPAN
15232
> nodes,
15233
so you need to convert the list elements to strings
15234
if you want to print them or look for a specific target name.
15235
Fortunately, you can do this easily
15236
by using the Python <CODE
15237
CLASS="function"
15238
>map</CODE
15239
> function
15240
to run the list through <CODE
15241
CLASS="function"
15242
>str</CODE
15243
>:
15244
15245
</P
15246
><PRE
15247
CLASS="programlisting"
15248
> prog1 = Program('prog1.c')
15249
Default(prog1)
15250
print "DEFAULT_TARGETS is", map(str, DEFAULT_TARGETS)
15251
</PRE
15252
><P
15253
>
15254
(Keep in mind that all of the manipulation of the
15255
<CODE
15256
CLASS="varname"
15257
>DEFAULT_TARGETS</CODE
15258
> list takes place during the
15259
first phase when <SPAN
15260
CLASS="application"
15261
>SCons</SPAN
15262
> is reading up the <TT
15263
CLASS="filename"
15264
>SConscript</TT
15265
> files,
15266
which is obvious if
15267
we leave off the <TT
15268
CLASS="literal"
15269
>-Q</TT
15270
> flag when we run <SPAN
15271
CLASS="application"
15272
>SCons</SPAN
15273
>:)
15274
15275
</P
15276
><PRE
15277
CLASS="screen"
15278
> % <KBD
15279
CLASS="userinput"
15280
>scons</KBD
15281
>
15282
scons: Reading SConscript files ...
15283
DEFAULT_TARGETS is ['prog1']
15284
scons: done reading SConscript files.
15285
scons: Building targets ...
15286
cc -o prog1.o -c prog1.c
15287
cc -o prog1 prog1.o
15288
scons: done building targets.
15289
</PRE
15290
><P
15291
>
15292
Second,
15293
the contents of the <CODE
15294
CLASS="varname"
15295
>DEFAULT_TARGETS</CODE
15296
> list change
15297
in response to calls to the <CODE
15298
CLASS="function"
15299
>Default</CODE
15300
>: function,
15301
as you can see from the following <TT
15302
CLASS="filename"
15303
>SConstruct</TT
15304
> file:
15305
15306
</P
15307
><PRE
15308
CLASS="programlisting"
15309
> prog1 = Program('prog1.c')
15310
Default(prog1)
15311
print "DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS)
15312
prog2 = Program('prog2.c')
15313
Default(prog2)
15314
print "DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS)
15315
</PRE
15316
><P
15317
>
15318
Which yields the output:
15319
15320
</P
15321
><PRE
15322
CLASS="screen"
15323
> % <KBD
15324
CLASS="userinput"
15325
>scons</KBD
15326
>
15327
scons: Reading SConscript files ...
15328
DEFAULT_TARGETS is now ['prog1']
15329
DEFAULT_TARGETS is now ['prog1', 'prog2']
15330
scons: done reading SConscript files.
15331
scons: Building targets ...
15332
cc -o prog1.o -c prog1.c
15333
cc -o prog1 prog1.o
15334
cc -o prog2.o -c prog2.c
15335
cc -o prog2 prog2.o
15336
scons: done building targets.
15337
</PRE
15338
><P
15339
>
15340
In practice, this simply means that you
15341
need to pay attention to the order in
15342
which you call the <CODE
15343
CLASS="function"
15344
>Default</CODE
15345
> function
15346
and refer to the <CODE
15347
CLASS="varname"
15348
>DEFAULT_TARGETS</CODE
15349
> list,
15350
to make sure that you don't examine the
15351
list before you've added the default targets
15352
you expect to find in it.
15353
15354
</P
15355
></DIV
15356
></DIV
15357
><DIV
15358
CLASS="section"
15359
><HR><H3
15360
CLASS="section"
15361
><A
15362
NAME="AEN2822"
15363
>12.3.3. Fetching the List of Build Targets, Regardless of Origin: the <CODE
15364
CLASS="varname"
15365
>BUILD_TARGETS</CODE
15366
> Variable</A
15367
></H3
15368
><P
15369
>
15370
We've already been introduced to the
15371
<CODE
15372
CLASS="varname"
15373
>COMMAND_LINE_TARGETS</CODE
15374
> variable,
15375
which contains a list of targets specified on the command line,
15376
and the <CODE
15377
CLASS="varname"
15378
>DEFAULT_TARGETS</CODE
15379
> variable,
15380
which contains a list of targets specified
15381
via calls to the <CODE
15382
CLASS="function"
15383
>Default</CODE
15384
> method or function.
15385
Sometimes, however,
15386
you want a list of whatever targets
15387
<SPAN
15388
CLASS="application"
15389
>SCons</SPAN
15390
> will try to build,
15391
regardless of whether the targets came from the
15392
command line or a <CODE
15393
CLASS="function"
15394
>Default</CODE
15395
> call.
15396
You could code this up by hand, as follows:
15397
15398
</P
15399
><PRE
15400
CLASS="programlisting"
15401
> if COMMAND_LINE_TARGETS:
15402
targets = COMMAND_LINE_TARGETS
15403
else:
15404
targets = DEFAULT_TARGETS
15405
</PRE
15406
><P
15407
>
15408
<SPAN
15409
CLASS="application"
15410
>SCons</SPAN
15411
>, however, provides a convenient
15412
<CODE
15413
CLASS="varname"
15414
>BUILD_TARGETS</CODE
15415
> variable
15416
that eliminates the need for this by-hand manipulation.
15417
Essentially, the <CODE
15418
CLASS="varname"
15419
>BUILD_TARGETS</CODE
15420
> variable
15421
contains a list of the command-line targets,
15422
if any were specified,
15423
and if no command-line targets were specified,
15424
it contains a list of the targets specified
15425
via the <CODE
15426
CLASS="function"
15427
>Default</CODE
15428
> method or function.
15429
15430
</P
15431
><P
15432
>
15433
Because <CODE
15434
CLASS="varname"
15435
>BUILD_TARGETS</CODE
15436
> may contain a list of <SPAN
15437
CLASS="application"
15438
>SCons</SPAN
15439
> nodes,
15440
you must convert the list elements to strings
15441
if you want to print them or look for a specific target name,
15442
just like the <CODE
15443
CLASS="varname"
15444
>DEFAULT_TARGETS</CODE
15445
> list:
15446
15447
</P
15448
><PRE
15449
CLASS="programlisting"
15450
> prog1 = Program('prog1.c')
15451
Program('prog2.c')
15452
Default(prog1)
15453
print "BUILD_TARGETS is", map(str, BUILD_TARGETS)
15454
</PRE
15455
><P
15456
>
15457
Notice how the value of <CODE
15458
CLASS="varname"
15459
>BUILD_TARGETS</CODE
15460
>
15461
changes depending on whether a target is
15462
specified on the command line:
15463
15464
</P
15465
><PRE
15466
CLASS="screen"
15467
> % <KBD
15468
CLASS="userinput"
15469
>scons -Q</KBD
15470
>
15471
BUILD_TARGETS is ['prog1']
15472
cc -o prog1.o -c prog1.c
15473
cc -o prog1 prog1.o
15474
% <KBD
15475
CLASS="userinput"
15476
>scons -Q prog2</KBD
15477
>
15478
BUILD_TARGETS is ['prog2']
15479
cc -o prog2.o -c prog2.c
15480
cc -o prog2 prog2.o
15481
% <KBD
15482
CLASS="userinput"
15483
>scons -Q -c .</KBD
15484
>
15485
BUILD_TARGETS is ['.']
15486
Removed prog1.o
15487
Removed prog1
15488
Removed prog2.o
15489
Removed prog2
15490
</PRE
15491
></DIV
15492
></DIV
15493
></DIV
15494
><DIV
15495
CLASS="chapter"
15496
><HR><H1
15497
><A
15498
NAME="chap-install"
15499
></A
15500
>Chapter 13. Installing Files in Other Directories: the <CODE
15501
CLASS="function"
15502
>Install</CODE
15503
> Builder</H1
15504
><P
15505
>
15506
Once a program is built,
15507
it is often appropriate to install it in another
15508
directory for public use.
15509
You use the <CODE
15510
CLASS="function"
15511
>Install</CODE
15512
> method
15513
to arrange for a program, or any other file,
15514
to be copied into a destination directory:
15515
15516
</P
15517
><PRE
15518
CLASS="programlisting"
15519
> env = Environment()
15520
hello = env.Program('hello.c')
15521
env.Install('/usr/bin', hello)
15522
</PRE
15523
><P
15524
>
15525
Note, however, that installing a file is
15526
still considered a type of file "build."
15527
This is important when you remember that
15528
the default behavior of <SPAN
15529
CLASS="application"
15530
>SCons</SPAN
15531
> is
15532
to build files in or below the current directory.
15533
If, as in the example above,
15534
you are installing files in a directory
15535
outside of the top-level <TT
15536
CLASS="filename"
15537
>SConstruct</TT
15538
> file's directory tree,
15539
you must specify that directory
15540
(or a higher directory, such as <TT
15541
CLASS="literal"
15542
>/</TT
15543
>)
15544
for it to install anything there:
15545
15546
</P
15547
><PRE
15548
CLASS="screen"
15549
> % <KBD
15550
CLASS="userinput"
15551
>scons -Q</KBD
15552
>
15553
cc -o hello.o -c hello.c
15554
cc -o hello hello.o
15555
% <KBD
15556
CLASS="userinput"
15557
>scons -Q /usr/bin</KBD
15558
>
15559
Install file: "hello" as "/usr/bin/hello"
15560
</PRE
15561
><P
15562
>
15563
It can, however, be cumbersome to remember
15564
(and type) the specific destination directory
15565
in which the program (or any other file)
15566
should be installed.
15567
This is an area where the <CODE
15568
CLASS="function"
15569
>Alias</CODE
15570
>
15571
function comes in handy,
15572
allowing you, for example,
15573
to create a pseudo-target named <TT
15574
CLASS="literal"
15575
>install</TT
15576
>
15577
that can expand to the specified destination directory:
15578
15579
</P
15580
><PRE
15581
CLASS="programlisting"
15582
> env = Environment()
15583
hello = env.Program('hello.c')
15584
env.Install('/usr/bin', hello)
15585
env.Alias('install', '/usr/bin')
15586
</PRE
15587
><P
15588
>
15589
This then yields the more natural
15590
ability to install the program
15591
in its destination as follows:
15592
15593
</P
15594
><PRE
15595
CLASS="screen"
15596
> % <KBD
15597
CLASS="userinput"
15598
>scons -Q</KBD
15599
>
15600
cc -o hello.o -c hello.c
15601
cc -o hello hello.o
15602
% <KBD
15603
CLASS="userinput"
15604
>scons -Q install</KBD
15605
>
15606
Install file: "hello" as "/usr/bin/hello"
15607
</PRE
15608
><DIV
15609
CLASS="section"
15610
><HR><H2
15611
CLASS="section"
15612
><A
15613
NAME="AEN2869"
15614
>13.1. Installing Multiple Files in a Directory</A
15615
></H2
15616
><P
15617
>
15618
You can install multiple files into a directory
15619
simply by calling the <CODE
15620
CLASS="function"
15621
>Install</CODE
15622
> function multiple times:
15623
15624
</P
15625
><PRE
15626
CLASS="programlisting"
15627
> env = Environment()
15628
hello = env.Program('hello.c')
15629
goodbye = env.Program('goodbye.c')
15630
env.Install('/usr/bin', hello)
15631
env.Install('/usr/bin', goodbye)
15632
env.Alias('install', '/usr/bin')
15633
</PRE
15634
><P
15635
>
15636
Or, more succinctly, listing the multiple input
15637
files in a list
15638
(just like you can do with any other builder):
15639
15640
</P
15641
><PRE
15642
CLASS="programlisting"
15643
> env = Environment()
15644
hello = env.Program('hello.c')
15645
goodbye = env.Program('goodbye.c')
15646
env.Install('/usr/bin', [hello, goodbye])
15647
env.Alias('install', '/usr/bin')
15648
</PRE
15649
><P
15650
>
15651
Either of these two examples yields:
15652
15653
</P
15654
><PRE
15655
CLASS="screen"
15656
> % <KBD
15657
CLASS="userinput"
15658
>scons -Q install</KBD
15659
>
15660
cc -o goodbye.o -c goodbye.c
15661
cc -o goodbye goodbye.o
15662
Install file: "goodbye" as "/usr/bin/goodbye"
15663
cc -o hello.o -c hello.c
15664
cc -o hello hello.o
15665
Install file: "hello" as "/usr/bin/hello"
15666
</PRE
15667
></DIV
15668
><DIV
15669
CLASS="section"
15670
><HR><H2
15671
CLASS="section"
15672
><A
15673
NAME="AEN2879"
15674
>13.2. Installing a File Under a Different Name</A
15675
></H2
15676
><P
15677
>
15678
The <CODE
15679
CLASS="function"
15680
>Install</CODE
15681
> method preserves the name
15682
of the file when it is copied into the
15683
destination directory.
15684
If you need to change the name of the file
15685
when you copy it, use the <CODE
15686
CLASS="function"
15687
>InstallAs</CODE
15688
> function:
15689
15690
</P
15691
><PRE
15692
CLASS="programlisting"
15693
> env = Environment()
15694
hello = env.Program('hello.c')
15695
env.InstallAs('/usr/bin/hello-new', hello)
15696
env.Alias('install', '/usr/bin')
15697
</PRE
15698
><P
15699
>
15700
This installs the <TT
15701
CLASS="literal"
15702
>hello</TT
15703
>
15704
program with the name <TT
15705
CLASS="literal"
15706
>hello-new</TT
15707
>
15708
as follows:
15709
15710
</P
15711
><PRE
15712
CLASS="screen"
15713
> % <KBD
15714
CLASS="userinput"
15715
>scons -Q install</KBD
15716
>
15717
cc -o hello.o -c hello.c
15718
cc -o hello hello.o
15719
Install file: "hello" as "/usr/bin/hello-new"
15720
</PRE
15721
></DIV
15722
><DIV
15723
CLASS="section"
15724
><HR><H2
15725
CLASS="section"
15726
><A
15727
NAME="AEN2890"
15728
>13.3. Installing Multiple Files Under Different Names</A
15729
></H2
15730
><P
15731
>
15732
Lastly, if you have multiple files that all
15733
need to be installed with different file names,
15734
you can either call the <CODE
15735
CLASS="function"
15736
>InstallAs</CODE
15737
> function
15738
multiple times, or as a shorthand,
15739
you can supply same-length lists
15740
for both the target and source arguments:
15741
15742
</P
15743
><PRE
15744
CLASS="programlisting"
15745
> env = Environment()
15746
hello = env.Program('hello.c')
15747
goodbye = env.Program('goodbye.c')
15748
env.InstallAs(['/usr/bin/hello-new',
15749
'/usr/bin/goodbye-new'],
15750
[hello, goodbye])
15751
env.Alias('install', '/usr/bin')
15752
</PRE
15753
><P
15754
>
15755
In this case, the <CODE
15756
CLASS="function"
15757
>InstallAs</CODE
15758
> function
15759
loops through both lists simultaneously,
15760
and copies each source file into its corresponding
15761
target file name:
15762
15763
</P
15764
><PRE
15765
CLASS="screen"
15766
> % <KBD
15767
CLASS="userinput"
15768
>scons -Q install</KBD
15769
>
15770
cc -o goodbye.o -c goodbye.c
15771
cc -o goodbye goodbye.o
15772
Install file: "goodbye" as "/usr/bin/goodbye-new"
15773
cc -o hello.o -c hello.c
15774
cc -o hello hello.o
15775
Install file: "hello" as "/usr/bin/hello-new"
15776
</PRE
15777
></DIV
15778
></DIV
15779
><DIV
15780
CLASS="chapter"
15781
><HR><H1
15782
><A
15783
NAME="chap-factories"
15784
></A
15785
>Chapter 14. Platform-Independent File System Manipulation</H1
15786
><P
15787
>
15788
<SPAN
15789
CLASS="application"
15790
>SCons</SPAN
15791
> provides a number of platform-independent functions,
15792
called <TT
15793
CLASS="literal"
15794
>factories</TT
15795
>,
15796
that perform common file system manipulations
15797
like copying, moving or deleting files and directories,
15798
or making directories.
15799
These functions are <TT
15800
CLASS="literal"
15801
>factories</TT
15802
>
15803
because they don't perform the action
15804
at the time they're called,
15805
they each return an <CODE
15806
CLASS="classname"
15807
>Action</CODE
15808
> object
15809
that can be executed at the appropriate time.
15810
15811
</P
15812
><DIV
15813
CLASS="section"
15814
><HR><H2
15815
CLASS="section"
15816
><A
15817
NAME="AEN2906"
15818
>14.1. Copying Files or Directories: The <CODE
15819
CLASS="function"
15820
>Copy</CODE
15821
> Factory</A
15822
></H2
15823
><P
15824
>
15825
Suppose you want to arrange to make a copy of a file,
15826
and don't have a suitable pre-existing builder.
15827
<A
15828
NAME="AEN2910"
15829
HREF="#FTN.AEN2910"
15830
><SPAN
15831
CLASS="footnote"
15832
>[4]</SPAN
15833
></A
15834
>
15835
One way would be to use the <CODE
15836
CLASS="function"
15837
>Copy</CODE
15838
> action factory
15839
in conjunction with the <CODE
15840
CLASS="function"
15841
>Command</CODE
15842
> builder:
15843
15844
</P
15845
><PRE
15846
CLASS="programlisting"
15847
> Command("file.out", "file.in", Copy("$TARGET", "$SOURCE"))
15848
</PRE
15849
><P
15850
>
15851
Notice that the action returned by the <CODE
15852
CLASS="function"
15853
>Copy</CODE
15854
> factory
15855
will expand the <A
15856
HREF="#cv-TARGET"
15857
><CODE
15858
CLASS="envar"
15859
>$TARGET</CODE
15860
></A
15861
> and <A
15862
HREF="#cv-SOURCE"
15863
><CODE
15864
CLASS="envar"
15865
>$SOURCE</CODE
15866
></A
15867
> strings
15868
at the time <TT
15869
CLASS="filename"
15870
>file.out</TT
15871
> is built,
15872
and that the order of the arguments
15873
is the same as that of a builder itself--that is,
15874
target first, followed by source:
15875
15876
</P
15877
><PRE
15878
CLASS="screen"
15879
> % <KBD
15880
CLASS="userinput"
15881
>scons -Q</KBD
15882
>
15883
Copy("file.out", "file.in")
15884
</PRE
15885
><P
15886
>
15887
You can, of course, name a file explicitly
15888
instead of using <CODE
15889
CLASS="envar"
15890
>$TARGET</CODE
15891
> or <CODE
15892
CLASS="envar"
15893
>$SOURCE</CODE
15894
>:
15895
15896
</P
15897
><PRE
15898
CLASS="programlisting"
15899
> Command("file.out", [], Copy("$TARGET", "file.in"))
15900
</PRE
15901
><P
15902
>
15903
Which executes as:
15904
15905
</P
15906
><PRE
15907
CLASS="screen"
15908
> % <KBD
15909
CLASS="userinput"
15910
>scons -Q</KBD
15911
>
15912
Copy("file.out", "file.in")
15913
</PRE
15914
><P
15915
>
15916
The usefulness of the <CODE
15917
CLASS="function"
15918
>Copy</CODE
15919
> factory
15920
becomes more apparent when
15921
you use it in a list of actions
15922
passed to the <CODE
15923
CLASS="function"
15924
>Command</CODE
15925
> builder.
15926
For example, suppose you needed to run a
15927
file through a utility that only modifies files in-place,
15928
and can't "pipe" input to output.
15929
One solution is to copy the source file
15930
to a temporary file name,
15931
run the utility,
15932
and then copy the modified temporary file to the target,
15933
which the <CODE
15934
CLASS="function"
15935
>Copy</CODE
15936
> factory makes extremely easy:
15937
15938
</P
15939
><PRE
15940
CLASS="programlisting"
15941
> Command("file.out", "file.in",
15942
[
15943
Copy("tempfile", "$SOURCE"),
15944
"modify tempfile",
15945
Copy("$TARGET", "tempfile"),
15946
])
15947
</PRE
15948
><P
15949
>
15950
The output then looks like:
15951
15952
</P
15953
><PRE
15954
CLASS="screen"
15955
> % <KBD
15956
CLASS="userinput"
15957
>scons -Q</KBD
15958
>
15959
Copy("tempfile", "file.in")
15960
modify tempfile
15961
Copy("file.out", "tempfile")
15962
</PRE
15963
></DIV
15964
><DIV
15965
CLASS="section"
15966
><HR><H2
15967
CLASS="section"
15968
><A
15969
NAME="AEN2940"
15970
>14.2. Deleting Files or Directories: The <CODE
15971
CLASS="function"
15972
>Delete</CODE
15973
> Factory</A
15974
></H2
15975
><P
15976
>
15977
If you need to delete a file,
15978
then the <CODE
15979
CLASS="function"
15980
>Delete</CODE
15981
> factory
15982
can be used in much the same way as
15983
the <CODE
15984
CLASS="function"
15985
>Copy</CODE
15986
> factory.
15987
For example, if we want to make sure that
15988
the temporary file
15989
in our last example doesn't exist before
15990
we copy to it,
15991
we could add <CODE
15992
CLASS="function"
15993
>Delete</CODE
15994
> to the beginning
15995
of the command list:
15996
15997
</P
15998
><PRE
15999
CLASS="programlisting"
16000
> Command("file.out", "file.in",
16001
[
16002
Delete("tempfile"),
16003
Copy("tempfile", "$SOURCE"),
16004
"modify tempfile",
16005
Copy("$TARGET", "tempfile"),
16006
])
16007
</PRE
16008
><P
16009
>
16010
When then executes as follows:
16011
16012
</P
16013
><PRE
16014
CLASS="screen"
16015
> % <KBD
16016
CLASS="userinput"
16017
>scons -Q</KBD
16018
>
16019
Delete("tempfile")
16020
Copy("tempfile", "file.in")
16021
modify tempfile
16022
Copy("file.out", "tempfile")
16023
</PRE
16024
><P
16025
>
16026
Of course, like all of these <CODE
16027
CLASS="classname"
16028
>Action</CODE
16029
> factories,
16030
the <CODE
16031
CLASS="function"
16032
>Delete</CODE
16033
> factory also expands
16034
<A
16035
HREF="#cv-TARGET"
16036
><CODE
16037
CLASS="envar"
16038
>$TARGET</CODE
16039
></A
16040
> and <A
16041
HREF="#cv-SOURCE"
16042
><CODE
16043
CLASS="envar"
16044
>$SOURCE</CODE
16045
></A
16046
> variables appropriately.
16047
For example:
16048
16049
</P
16050
><PRE
16051
CLASS="programlisting"
16052
> Command("file.out", "file.in",
16053
[
16054
Delete("$TARGET"),
16055
Copy("$TARGET", "$SOURCE")
16056
])
16057
</PRE
16058
><P
16059
>
16060
Executes as:
16061
16062
</P
16063
><PRE
16064
CLASS="screen"
16065
> % <KBD
16066
CLASS="userinput"
16067
>scons -Q</KBD
16068
>
16069
Delete("file.out")
16070
Copy("file.out", "file.in")
16071
</PRE
16072
><P
16073
>
16074
Note, however, that you typically don't need to
16075
call the <CODE
16076
CLASS="function"
16077
>Delete</CODE
16078
> factory explicitly in this way;
16079
by default, <SPAN
16080
CLASS="application"
16081
>SCons</SPAN
16082
> deletes its target(s)
16083
for you before executing any action.
16084
16085
</P
16086
><P
16087
>
16088
One word of caution about using the <CODE
16089
CLASS="function"
16090
>Delete</CODE
16091
> factory:
16092
it has the same variable expansions available
16093
as any other factory, including the <CODE
16094
CLASS="envar"
16095
>$SOURCE</CODE
16096
> variable.
16097
Specifying <TT
16098
CLASS="literal"
16099
>Delete("$SOURCE")</TT
16100
>
16101
is not something you usually want to do!
16102
16103
</P
16104
></DIV
16105
><DIV
16106
CLASS="section"
16107
><HR><H2
16108
CLASS="section"
16109
><A
16110
NAME="AEN2969"
16111
>14.3. Moving (Renaming) Files or Directories: The <CODE
16112
CLASS="function"
16113
>Move</CODE
16114
> Factory</A
16115
></H2
16116
><P
16117
>
16118
The <CODE
16119
CLASS="function"
16120
>Move</CODE
16121
> factory
16122
allows you to rename a file or directory.
16123
For example, if we don't want to copy the temporary file,
16124
we could use:
16125
16126
</P
16127
><PRE
16128
CLASS="programlisting"
16129
> Command("file.out", "file.in",
16130
[
16131
Copy("tempfile", "$SOURCE"),
16132
"modify tempfile",
16133
Move("$TARGET", "tempfile"),
16134
])
16135
</PRE
16136
><P
16137
>
16138
Which would execute as:
16139
16140
</P
16141
><PRE
16142
CLASS="screen"
16143
> % <KBD
16144
CLASS="userinput"
16145
>scons -Q</KBD
16146
>
16147
Copy("tempfile", "file.in")
16148
modify tempfile
16149
Move("file.out", "tempfile")
16150
</PRE
16151
></DIV
16152
><DIV
16153
CLASS="section"
16154
><HR><H2
16155
CLASS="section"
16156
><A
16157
NAME="AEN2978"
16158
>14.4. Updating the Modification Time of a File: The <CODE
16159
CLASS="function"
16160
>Touch</CODE
16161
> Factory</A
16162
></H2
16163
><P
16164
>
16165
If you just need to update the
16166
recorded modification time for a file,
16167
use the <CODE
16168
CLASS="function"
16169
>Touch</CODE
16170
> factory:
16171
16172
</P
16173
><PRE
16174
CLASS="programlisting"
16175
> Command("file.out", "file.in",
16176
[
16177
Copy("$TARGET", "$SOURCE"),
16178
Touch("$TARGET"),
16179
])
16180
</PRE
16181
><P
16182
>
16183
Which executes as:
16184
16185
</P
16186
><PRE
16187
CLASS="screen"
16188
> % <KBD
16189
CLASS="userinput"
16190
>scons -Q</KBD
16191
>
16192
Copy("file.out", "file.in")
16193
Touch("file.out")
16194
</PRE
16195
></DIV
16196
><DIV
16197
CLASS="section"
16198
><HR><H2
16199
CLASS="section"
16200
><A
16201
NAME="AEN2987"
16202
>14.5. Creating a Directory: The <CODE
16203
CLASS="function"
16204
>Mkdir</CODE
16205
> Factory</A
16206
></H2
16207
><P
16208
>
16209
If you need to create a directory,
16210
use the <CODE
16211
CLASS="function"
16212
>Mkdir</CODE
16213
> factory.
16214
For example, if we need to process
16215
a file in a temporary directory
16216
in which the processing tool
16217
will create other files that we don't care about,
16218
you could use:
16219
16220
</P
16221
><PRE
16222
CLASS="programlisting"
16223
> Command("file.out", "file.in",
16224
[
16225
Delete("tempdir"),
16226
Mkdir("tempdir"),
16227
Copy("tempdir/${SOURCE.file}", "$SOURCE"),
16228
"process tempdir",
16229
Move("$TARGET", "tempdir/output_file"),
16230
Delete("tempdir"),
16231
])
16232
</PRE
16233
><P
16234
>
16235
Which executes as:
16236
16237
</P
16238
><PRE
16239
CLASS="screen"
16240
> % <KBD
16241
CLASS="userinput"
16242
>scons -Q</KBD
16243
>
16244
Delete("tempdir")
16245
Mkdir("tempdir")
16246
Copy("tempdir/file.in", "file.in")
16247
process tempdir
16248
Move("file.out", "tempdir/output_file")
16249
scons: *** [file.out] No such file or directory
16250
</PRE
16251
></DIV
16252
><DIV
16253
CLASS="section"
16254
><HR><H2
16255
CLASS="section"
16256
><A
16257
NAME="AEN2996"
16258
>14.6. Changing File or Directory Permissions: The <CODE
16259
CLASS="function"
16260
>Chmod</CODE
16261
> Factory</A
16262
></H2
16263
><P
16264
>
16265
To change permissions on a file or directory,
16266
use the <CODE
16267
CLASS="function"
16268
>Chmod</CODE
16269
> factory.
16270
The permission argument uses POSIX-style
16271
permission bits and should typically
16272
be expressed as an octal,
16273
not decimal, number:
16274
16275
</P
16276
><PRE
16277
CLASS="programlisting"
16278
> Command("file.out", "file.in",
16279
[
16280
Copy("$TARGET", "$SOURCE"),
16281
Chmod("$TARGET", 0755),
16282
])
16283
</PRE
16284
><P
16285
>
16286
Which executes:
16287
16288
</P
16289
><PRE
16290
CLASS="screen"
16291
> % <KBD
16292
CLASS="userinput"
16293
>scons -Q</KBD
16294
>
16295
Copy("file.out", "file.in")
16296
Chmod("file.out", 0755)
16297
</PRE
16298
></DIV
16299
><DIV
16300
CLASS="section"
16301
><HR><H2
16302
CLASS="section"
16303
><A
16304
NAME="AEN3005"
16305
>14.7. Executing an action immediately: the <CODE
16306
CLASS="function"
16307
>Execute</CODE
16308
> Function</A
16309
></H2
16310
><P
16311
>
16312
We've been showing you how to use <CODE
16313
CLASS="classname"
16314
>Action</CODE
16315
> factories
16316
in the <CODE
16317
CLASS="function"
16318
>Command</CODE
16319
> function.
16320
You can also execute an <CODE
16321
CLASS="classname"
16322
>Action</CODE
16323
> returned by a factory
16324
(or actually, any <CODE
16325
CLASS="classname"
16326
>Action</CODE
16327
>)
16328
at the time the <TT
16329
CLASS="filename"
16330
>SConscript</TT
16331
> file is read
16332
by using the <CODE
16333
CLASS="function"
16334
>Execute</CODE
16335
> function.
16336
For example, if we need to make sure that
16337
a directory exists before we build any targets,
16338
16339
</P
16340
><PRE
16341
CLASS="programlisting"
16342
> Execute(Mkdir('/tmp/my_temp_directory'))
16343
</PRE
16344
><P
16345
>
16346
Notice that this will
16347
create the directory while
16348
the <TT
16349
CLASS="filename"
16350
>SConscript</TT
16351
> file is being read:
16352
16353
</P
16354
><PRE
16355
CLASS="screen"
16356
> % <KBD
16357
CLASS="userinput"
16358
>scons</KBD
16359
>
16360
scons: Reading SConscript files ...
16361
Mkdir("/tmp/my_temp_directory")
16362
scons: done reading SConscript files.
16363
scons: Building targets ...
16364
scons: `.' is up to date.
16365
scons: done building targets.
16366
</PRE
16367
><P
16368
>
16369
If you're familiar with Python,
16370
you may wonder why you would want to use this
16371
instead of just calling the native Python
16372
<CODE
16373
CLASS="function"
16374
>os.mkdir()</CODE
16375
> function.
16376
The advantage here is that the <CODE
16377
CLASS="function"
16378
>Mkdir</CODE
16379
>
16380
action will behave appropriately if the user
16381
specifies the <SPAN
16382
CLASS="application"
16383
>SCons</SPAN
16384
> <CODE
16385
CLASS="option"
16386
>-n</CODE
16387
> or
16388
<CODE
16389
CLASS="option"
16390
>-q</CODE
16391
> options--that is,
16392
it will print the action but not actually
16393
make the directory when <CODE
16394
CLASS="option"
16395
>-n</CODE
16396
> is specified,
16397
or make the directory but not print the action
16398
when <CODE
16399
CLASS="option"
16400
>-q</CODE
16401
> is specified.
16402
16403
</P
16404
><P
16405
>
16406
The <CODE
16407
CLASS="function"
16408
>Execute</CODE
16409
> function returns the exit status
16410
or return value of the underlying action being executed.
16411
It will also print an error message if the action
16412
fails and returns a non-zero value.
16413
<SPAN
16414
CLASS="application"
16415
>SCons</SPAN
16416
> will <SPAN
16417
CLASS="emphasis"
16418
><I
16419
CLASS="emphasis"
16420
>not</I
16421
></SPAN
16422
>, however,
16423
actually stop the build if the action fails.
16424
If you want the build to stop
16425
in response to a failure in an action called by <CODE
16426
CLASS="function"
16427
>Execute</CODE
16428
>,
16429
you must do so by explicitly
16430
checking the return value
16431
and calling the <CODE
16432
CLASS="function"
16433
>Exit</CODE
16434
> function
16435
(or a Python equivalent):
16436
16437
</P
16438
><PRE
16439
CLASS="programlisting"
16440
> if Execute(Mkdir('/tmp/my_temp_directory')):
16441
# A problem occurred while making the temp directory.
16442
Exit(1)
16443
</PRE
16444
></DIV
16445
></DIV
16446
><DIV
16447
CLASS="chapter"
16448
><HR><H1
16449
><A
16450
NAME="chap-file-removal"
16451
></A
16452
>Chapter 15. Controlling Removal of Targets</H1
16453
><P
16454
>
16455
There are two occasions when <SPAN
16456
CLASS="application"
16457
>SCons</SPAN
16458
> will,
16459
by default, remove target files.
16460
The first is when <SPAN
16461
CLASS="application"
16462
>SCons</SPAN
16463
> determines that
16464
an target file needs to be rebuilt
16465
and removes the existing version of the target
16466
before executing
16467
The second is when <SPAN
16468
CLASS="application"
16469
>SCons</SPAN
16470
> is invoked with the
16471
<TT
16472
CLASS="literal"
16473
>-c</TT
16474
> option to "clean"
16475
a tree of its built targets.
16476
16477
These behaviours can be suppressed with the
16478
<CODE
16479
CLASS="function"
16480
>Precious</CODE
16481
> and <CODE
16482
CLASS="function"
16483
>NoClean</CODE
16484
> functions, respectively.
16485
16486
</P
16487
><DIV
16488
CLASS="section"
16489
><HR><H2
16490
CLASS="section"
16491
><A
16492
NAME="AEN3044"
16493
>15.1. Preventing target removal during build: the <CODE
16494
CLASS="function"
16495
>Precious</CODE
16496
> Function</A
16497
></H2
16498
><P
16499
>
16500
By default, <SPAN
16501
CLASS="application"
16502
>SCons</SPAN
16503
> removes targets before building them.
16504
Sometimes, however, this is not what you want.
16505
For example, you may want to update a library incrementally,
16506
not by having it deleted and then rebuilt from all
16507
of the constituent object files.
16508
In such cases, you can use the
16509
<CODE
16510
CLASS="function"
16511
>Precious</CODE
16512
> method to prevent
16513
<SPAN
16514
CLASS="application"
16515
>SCons</SPAN
16516
> from removing the target before it is built:
16517
16518
</P
16519
><PRE
16520
CLASS="programlisting"
16521
> env = Environment(RANLIBCOM='')
16522
lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
16523
env.Precious(lib)
16524
</PRE
16525
><P
16526
>
16527
Although the output doesn't look any different,
16528
<SPAN
16529
CLASS="application"
16530
>SCons</SPAN
16531
> does not, in fact,
16532
delete the target library before rebuilding it:
16533
16534
</P
16535
><PRE
16536
CLASS="screen"
16537
> % <KBD
16538
CLASS="userinput"
16539
>scons -Q</KBD
16540
>
16541
cc -o f1.o -c f1.c
16542
cc -o f2.o -c f2.c
16543
cc -o f3.o -c f3.c
16544
ar rc libfoo.a f1.o f2.o f3.o
16545
</PRE
16546
><P
16547
>
16548
<SPAN
16549
CLASS="application"
16550
>SCons</SPAN
16551
> will, however, still delete files marked as <CODE
16552
CLASS="function"
16553
>Precious</CODE
16554
>
16555
when the <TT
16556
CLASS="literal"
16557
>-c</TT
16558
> option is used.
16559
16560
</P
16561
></DIV
16562
><DIV
16563
CLASS="section"
16564
><HR><H2
16565
CLASS="section"
16566
><A
16567
NAME="AEN3060"
16568
>15.2. Preventing target removal during clean: the <CODE
16569
CLASS="function"
16570
>NoClean</CODE
16571
> Function</A
16572
></H2
16573
><P
16574
>
16575
By default, <SPAN
16576
CLASS="application"
16577
>SCons</SPAN
16578
> removes all built targets when invoked
16579
with the <TT
16580
CLASS="literal"
16581
>-c</TT
16582
> option to clean a source tree
16583
of built targets.
16584
Sometimes, however, this is not what you want.
16585
For example, you may want to remove only intermediate generated files
16586
(such as object files),
16587
but leave the final targets
16588
(the libraries)
16589
untouched.
16590
16591
In such cases, you can use the <CODE
16592
CLASS="function"
16593
>NoClean</CODE
16594
> method to prevent <SPAN
16595
CLASS="application"
16596
>SCons</SPAN
16597
>
16598
from removing a target during a clean:
16599
16600
</P
16601
><PRE
16602
CLASS="programlisting"
16603
> env = Environment(RANLIBCOM='')
16604
lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
16605
env.NoClean(lib)
16606
</PRE
16607
><P
16608
>
16609
Notice that the <TT
16610
CLASS="filename"
16611
>libfoo.a</TT
16612
>
16613
is not listed as a removed file:
16614
16615
</P
16616
><PRE
16617
CLASS="screen"
16618
> % <KBD
16619
CLASS="userinput"
16620
>scons -Q</KBD
16621
>
16622
cc -o f1.o -c f1.c
16623
cc -o f2.o -c f2.c
16624
cc -o f3.o -c f3.c
16625
ar rc libfoo.a f1.o f2.o f3.o
16626
% <KBD
16627
CLASS="userinput"
16628
>scons -c</KBD
16629
>
16630
scons: Reading SConscript files ...
16631
scons: done reading SConscript files.
16632
scons: Cleaning targets ...
16633
Removed f1.o
16634
Removed f2.o
16635
Removed f3.o
16636
scons: done cleaning targets.
16637
</PRE
16638
></DIV
16639
><DIV
16640
CLASS="section"
16641
><HR><H2
16642
CLASS="section"
16643
><A
16644
NAME="AEN3074"
16645
>15.3. Removing additional files during clean: the <CODE
16646
CLASS="function"
16647
>Clean</CODE
16648
> Function</A
16649
></H2
16650
><P
16651
>
16652
There may be additional files that you want removed
16653
when the <TT
16654
CLASS="literal"
16655
>-c</TT
16656
> option is used,
16657
but which <SPAN
16658
CLASS="application"
16659
>SCons</SPAN
16660
> doesn't know about
16661
because they're not normal target files.
16662
For example, perhaps a command you invoke
16663
creates a log file as
16664
part of building the target file you want.
16665
You would like the log file cleaned,
16666
but you don't want to have to teach
16667
SCons that the command
16668
"builds" two files.
16669
16670
</P
16671
><P
16672
>
16673
You can use the <CODE
16674
CLASS="function"
16675
>Clean</CODE
16676
> function to arrange for additional files
16677
to be removed when the <TT
16678
CLASS="literal"
16679
>-c</TT
16680
> option is used.
16681
Notice, however, that the <CODE
16682
CLASS="function"
16683
>Clean</CODE
16684
> function takes two arguments,
16685
and the <SPAN
16686
CLASS="emphasis"
16687
><I
16688
CLASS="emphasis"
16689
>second</I
16690
></SPAN
16691
> argument
16692
is the name of the additional file you want cleaned
16693
(<TT
16694
CLASS="filename"
16695
>foo.log</TT
16696
> in this example):
16697
16698
</P
16699
><PRE
16700
CLASS="programlisting"
16701
> t = Command('foo.out', 'foo.in', 'build -o $TARGET $SOURCE')
16702
Clean(t, 'foo.log')
16703
</PRE
16704
><P
16705
>
16706
The first argument is the target with which you want
16707
the cleaning of this additional file associated.
16708
In the above example,
16709
we've used the return value from the
16710
<CODE
16711
CLASS="function"
16712
>Command</CODE
16713
> function,
16714
which represents the
16715
<TT
16716
CLASS="filename"
16717
>foo.out</TT
16718
>
16719
target.
16720
Now whenever the
16721
<TT
16722
CLASS="filename"
16723
>foo.out</TT
16724
> target is cleaned
16725
by the <TT
16726
CLASS="literal"
16727
>-c</TT
16728
> option,
16729
the <TT
16730
CLASS="filename"
16731
>foo.log</TT
16732
> file
16733
will be removed as well:
16734
16735
</P
16736
><PRE
16737
CLASS="screen"
16738
> % <KBD
16739
CLASS="userinput"
16740
>scons -Q</KBD
16741
>
16742
build -o foo.out foo.in
16743
% <KBD
16744
CLASS="userinput"
16745
>scons -Q -c</KBD
16746
>
16747
Removed foo.out
16748
Removed foo.log
16749
</PRE
16750
></DIV
16751
></DIV
16752
><DIV
16753
CLASS="chapter"
16754
><HR><H1
16755
><A
16756
NAME="chap-hierarchical"
16757
></A
16758
>Chapter 16. Hierarchical Builds</H1
16759
><P
16760
>
16761
The source code for large software projects
16762
rarely stays in a single directory,
16763
but is nearly always divided into a
16764
hierarchy of directories.
16765
Organizing a large software build using <SPAN
16766
CLASS="application"
16767
>SCons</SPAN
16768
>
16769
involves creating a hierarchy of build scripts
16770
using the <TT
16771
CLASS="filename"
16772
>SConscript</TT
16773
> function.
16774
16775
</P
16776
><DIV
16777
CLASS="section"
16778
><HR><H2
16779
CLASS="section"
16780
><A
16781
NAME="AEN3101"
16782
>16.1. <TT
16783
CLASS="filename"
16784
>SConscript</TT
16785
> Files</A
16786
></H2
16787
><P
16788
>
16789
As we've already seen,
16790
the build script at the top of the tree is called <TT
16791
CLASS="filename"
16792
>SConstruct</TT
16793
>.
16794
The top-level <TT
16795
CLASS="filename"
16796
>SConstruct</TT
16797
> file can
16798
use the <TT
16799
CLASS="filename"
16800
>SConscript</TT
16801
> function to
16802
include other subsidiary scripts in the build.
16803
These subsidiary scripts can, in turn,
16804
use the <TT
16805
CLASS="filename"
16806
>SConscript</TT
16807
> function
16808
to include still other scripts in the build.
16809
By convention, these subsidiary scripts are usually
16810
named <TT
16811
CLASS="filename"
16812
>SConscript</TT
16813
>.
16814
For example, a top-level <TT
16815
CLASS="filename"
16816
>SConstruct</TT
16817
> file might
16818
arrange for four subsidiary scripts to be included
16819
in the build as follows:
16820
16821
</P
16822
><PRE
16823
CLASS="programlisting"
16824
> SConscript(['drivers/display/SConscript',
16825
'drivers/mouse/SConscript',
16826
'parser/SConscript',
16827
'utilities/SConscript'])
16828
</PRE
16829
><P
16830
>
16831
In this case, the <TT
16832
CLASS="filename"
16833
>SConstruct</TT
16834
> file
16835
lists all of the <TT
16836
CLASS="filename"
16837
>SConscript</TT
16838
> files in the build explicitly.
16839
(Note, however, that not every directory in the tree
16840
necessarily has an <TT
16841
CLASS="filename"
16842
>SConscript</TT
16843
> file.)
16844
Alternatively, the <TT
16845
CLASS="literal"
16846
>drivers</TT
16847
>
16848
subdirectory might contain an intermediate
16849
<TT
16850
CLASS="filename"
16851
>SConscript</TT
16852
> file,
16853
in which case the <TT
16854
CLASS="filename"
16855
>SConscript</TT
16856
> call in
16857
the top-level <TT
16858
CLASS="filename"
16859
>SConstruct</TT
16860
> file
16861
would look like:
16862
16863
</P
16864
><PRE
16865
CLASS="programlisting"
16866
> SConscript(['drivers/SConscript',
16867
'parser/SConscript',
16868
'utilities/SConscript'])
16869
</PRE
16870
><P
16871
>
16872
And the subsidiary <TT
16873
CLASS="filename"
16874
>SConscript</TT
16875
> file in the
16876
<TT
16877
CLASS="literal"
16878
>drivers</TT
16879
> subdirectory
16880
would look like:
16881
16882
</P
16883
><PRE
16884
CLASS="programlisting"
16885
> SConscript(['display/SConscript',
16886
'mouse/SConscript'])
16887
</PRE
16888
><P
16889
>
16890
Whether you list all of the <TT
16891
CLASS="filename"
16892
>SConscript</TT
16893
> files in the
16894
top-level <TT
16895
CLASS="filename"
16896
>SConstruct</TT
16897
> file,
16898
or place a subsidiary <TT
16899
CLASS="filename"
16900
>SConscript</TT
16901
> file in
16902
intervening directories,
16903
or use some mix of the two schemes,
16904
is up to you and the needs of your software.
16905
16906
</P
16907
></DIV
16908
><DIV
16909
CLASS="section"
16910
><HR><H2
16911
CLASS="section"
16912
><A
16913
NAME="AEN3129"
16914
>16.2. Path Names Are Relative to the <TT
16915
CLASS="filename"
16916
>SConscript</TT
16917
> Directory</A
16918
></H2
16919
><P
16920
>
16921
Subsidiary <TT
16922
CLASS="filename"
16923
>SConscript</TT
16924
> files make it easy to create a build
16925
hierarchy because all of the file and directory names
16926
in a subsidiary <TT
16927
CLASS="filename"
16928
>SConscript</TT
16929
> files are interpreted
16930
relative to the directory in which the <TT
16931
CLASS="filename"
16932
>SConscript</TT
16933
> file lives.
16934
Typically, this allows the <TT
16935
CLASS="filename"
16936
>SConscript</TT
16937
> file containing the
16938
instructions to build a target file
16939
to live in the same directory as the source files
16940
from which the target will be built,
16941
making it easy to update how the software is built
16942
whenever files are added or deleted
16943
(or other changes are made).
16944
16945
</P
16946
><P
16947
>
16948
For example, suppose we want to build two programs
16949
<TT
16950
CLASS="filename"
16951
>prog1</TT
16952
> and <TT
16953
CLASS="filename"
16954
>prog2</TT
16955
> in two separate directories
16956
with the same names as the programs.
16957
One typical way to do this would be
16958
with a top-level <TT
16959
CLASS="filename"
16960
>SConstruct</TT
16961
> file like this:
16962
16963
</P
16964
><PRE
16965
CLASS="programlisting"
16966
> SConscript(['prog1/SConscript',
16967
'prog2/SConscript'])
16968
</PRE
16969
><P
16970
>
16971
And subsidiary <TT
16972
CLASS="filename"
16973
>SConscript</TT
16974
> files that look like this:
16975
16976
</P
16977
><PRE
16978
CLASS="programlisting"
16979
> env = Environment()
16980
env.Program('prog1', ['main.c', 'foo1.c', 'foo2.c'])
16981
</PRE
16982
><P
16983
>
16984
And this:
16985
16986
</P
16987
><PRE
16988
CLASS="programlisting"
16989
> env = Environment()
16990
env.Program('prog2', ['main.c', 'bar1.c', 'bar2.c'])
16991
</PRE
16992
><P
16993
>
16994
Then, when we run <SPAN
16995
CLASS="application"
16996
>SCons</SPAN
16997
> in the top-level directory,
16998
our build looks like:
16999
17000
</P
17001
><PRE
17002
CLASS="screen"
17003
> % <KBD
17004
CLASS="userinput"
17005
>scons -Q</KBD
17006
>
17007
cc -o prog1/foo1.o -c prog1/foo1.c
17008
cc -o prog1/foo2.o -c prog1/foo2.c
17009
cc -o prog1/main.o -c prog1/main.c
17010
cc -o prog1/prog1 prog1/main.o prog1/foo1.o prog1/foo2.o
17011
cc -o prog2/bar1.o -c prog2/bar1.c
17012
cc -o prog2/bar2.o -c prog2/bar2.c
17013
cc -o prog2/main.o -c prog2/main.c
17014
cc -o prog2/prog2 prog2/main.o prog2/bar1.o prog2/bar2.o
17015
</PRE
17016
><P
17017
>
17018
Notice the following:
17019
17020
First, you can have files with the same names
17021
in multiple directories, like main.c in the above example.
17022
17023
Second, unlike standard recursive use of <SPAN
17024
CLASS="application"
17025
>Make</SPAN
17026
>,
17027
<SPAN
17028
CLASS="application"
17029
>SCons</SPAN
17030
> stays in the top-level directory
17031
(where the <TT
17032
CLASS="filename"
17033
>SConstruct</TT
17034
> file lives)
17035
and issues commands that use the path names
17036
from the top-level directory to the
17037
target and source files within the hierarchy.
17038
17039
</P
17040
></DIV
17041
><DIV
17042
CLASS="section"
17043
><HR><H2
17044
CLASS="section"
17045
><A
17046
NAME="AEN3155"
17047
>16.3. Top-Level Path Names in Subsidiary <TT
17048
CLASS="filename"
17049
>SConscript</TT
17050
> Files</A
17051
></H2
17052
><P
17053
>
17054
If you need to use a file from another directory,
17055
it's sometimes more convenient to specify
17056
the path to a file in another directory
17057
from the top-level <TT
17058
CLASS="filename"
17059
>SConstruct</TT
17060
> directory,
17061
even when you're using that file in
17062
a subsidiary <TT
17063
CLASS="filename"
17064
>SConscript</TT
17065
> file in a subdirectory.
17066
You can tell <SPAN
17067
CLASS="application"
17068
>SCons</SPAN
17069
> to interpret a path name
17070
as relative to the top-level <TT
17071
CLASS="filename"
17072
>SConstruct</TT
17073
> directory,
17074
not the local directory of the <TT
17075
CLASS="filename"
17076
>SConscript</TT
17077
> file,
17078
by appending a <TT
17079
CLASS="literal"
17080
>#</TT
17081
> (hash mark)
17082
to the beginning of the path name:
17083
17084
</P
17085
><PRE
17086
CLASS="programlisting"
17087
> env = Environment()
17088
env.Program('prog', ['main.c', '#lib/foo1.c', 'foo2.c'])
17089
</PRE
17090
><P
17091
>
17092
In this example,
17093
the <TT
17094
CLASS="literal"
17095
>lib</TT
17096
> directory is
17097
directly underneath the top-level <TT
17098
CLASS="filename"
17099
>SConstruct</TT
17100
> directory.
17101
If the above <TT
17102
CLASS="filename"
17103
>SConscript</TT
17104
> file is in a subdirectory
17105
named <TT
17106
CLASS="literal"
17107
>src/prog</TT
17108
>,
17109
the output would look like:
17110
17111
</P
17112
><PRE
17113
CLASS="screen"
17114
> % <KBD
17115
CLASS="userinput"
17116
>scons -Q</KBD
17117
>
17118
cc -o lib/foo1.o -c lib/foo1.c
17119
cc -o src/prog/foo2.o -c src/prog/foo2.c
17120
cc -o src/prog/main.o -c src/prog/main.c
17121
cc -o src/prog/prog src/prog/main.o lib/foo1.o src/prog/foo2.o
17122
</PRE
17123
><P
17124
>
17125
(Notice that the <TT
17126
CLASS="literal"
17127
>lib/foo1.o</TT
17128
> object file
17129
is built in the same directory as its source file.
17130
See <A
17131
HREF="#chap-separate"
17132
>Chapter 17</A
17133
>, below,
17134
for information about
17135
how to build the object file in a different subdirectory.)
17136
17137
</P
17138
></DIV
17139
><DIV
17140
CLASS="section"
17141
><HR><H2
17142
CLASS="section"
17143
><A
17144
NAME="AEN3176"
17145
>16.4. Absolute Path Names</A
17146
></H2
17147
><P
17148
>
17149
Of course, you can always specify
17150
an absolute path name for a file--for example:
17151
17152
</P
17153
><PRE
17154
CLASS="programlisting"
17155
> env = Environment()
17156
env.Program('prog', ['main.c', '/usr/joe/lib/foo1.c', 'foo2.c'])
17157
</PRE
17158
><P
17159
>
17160
Which, when executed, would yield:
17161
17162
</P
17163
><PRE
17164
CLASS="screen"
17165
> % <KBD
17166
CLASS="userinput"
17167
>scons -Q</KBD
17168
>
17169
cc -o src/prog/foo2.o -c src/prog/foo2.c
17170
cc -o src/prog/main.o -c src/prog/main.c
17171
cc -o /usr/joe/lib/foo1.o -c /usr/joe/lib/foo1.c
17172
cc -o src/prog/prog src/prog/main.o /usr/joe/lib/foo1.o src/prog/foo2.o
17173
</PRE
17174
><P
17175
>
17176
(As was the case with top-relative path names,
17177
notice that the <TT
17178
CLASS="literal"
17179
>/usr/joe/lib/foo1.o</TT
17180
> object file
17181
is built in the same directory as its source file.
17182
See <A
17183
HREF="#chap-separate"
17184
>Chapter 17</A
17185
>, below,
17186
for information about
17187
how to build the object file in a different subdirectory.)
17188
17189
</P
17190
></DIV
17191
><DIV
17192
CLASS="section"
17193
><HR><H2
17194
CLASS="section"
17195
><A
17196
NAME="AEN3186"
17197
>16.5. Sharing Environments (and Other Variables) Between <TT
17198
CLASS="filename"
17199
>SConscript</TT
17200
> Files</A
17201
></H2
17202
><P
17203
>
17204
In the previous example,
17205
each of the subsidiary <TT
17206
CLASS="filename"
17207
>SConscript</TT
17208
> files
17209
created its own construction environment
17210
by calling <CODE
17211
CLASS="function"
17212
>Environment</CODE
17213
> separately.
17214
This obviously works fine,
17215
but if each program must be built
17216
with the same construction variables,
17217
it's cumbersome and error-prone to initialize
17218
separate construction environments
17219
in the same way over and over in each subsidiary
17220
<TT
17221
CLASS="filename"
17222
>SConscript</TT
17223
> file.
17224
17225
</P
17226
><P
17227
>
17228
<SPAN
17229
CLASS="application"
17230
>SCons</SPAN
17231
> supports the ability to <SPAN
17232
CLASS="emphasis"
17233
><I
17234
CLASS="emphasis"
17235
>export</I
17236
></SPAN
17237
> variables
17238
from a parent <TT
17239
CLASS="filename"
17240
>SConscript</TT
17241
> file
17242
to its subsidiary <TT
17243
CLASS="filename"
17244
>SConscript</TT
17245
> files,
17246
which allows you to share common initialized
17247
values throughout your build hierarchy.
17248
17249
</P
17250
><DIV
17251
CLASS="section"
17252
><HR><H3
17253
CLASS="section"
17254
><A
17255
NAME="AEN3198"
17256
>16.5.1. Exporting Variables</A
17257
></H3
17258
><P
17259
>
17260
There are two ways to export a variable,
17261
such as a construction environment,
17262
from an <TT
17263
CLASS="filename"
17264
>SConscript</TT
17265
> file,
17266
so that it may be used by other <TT
17267
CLASS="filename"
17268
>SConscript</TT
17269
> files.
17270
First, you can call the <CODE
17271
CLASS="function"
17272
>Export</CODE
17273
>
17274
function with a list of variables,
17275
or a string of white-space separated variable names.
17276
Each call to <CODE
17277
CLASS="function"
17278
>Export</CODE
17279
> adds one
17280
or more variables to a global list
17281
of variables that are available for import
17282
by other <TT
17283
CLASS="filename"
17284
>SConscript</TT
17285
> files.
17286
17287
</P
17288
><PRE
17289
CLASS="programlisting"
17290
> env = Environment()
17291
Export('env')
17292
</PRE
17293
><P
17294
>
17295
You may export more than one variable name at a time:
17296
17297
</P
17298
><PRE
17299
CLASS="programlisting"
17300
> env = Environment()
17301
debug = ARGUMENTS['debug']
17302
Export('env', 'debug')
17303
</PRE
17304
><P
17305
>
17306
Because white space is not legal in Python variable names,
17307
the <CODE
17308
CLASS="function"
17309
>Export</CODE
17310
> function will even automatically split
17311
a string into separate names for you:
17312
17313
</P
17314
><PRE
17315
CLASS="programlisting"
17316
> Export('env debug')
17317
</PRE
17318
><P
17319
>
17320
Second, you can specify a list of
17321
variables to export as a second argument
17322
to the <TT
17323
CLASS="filename"
17324
>SConscript</TT
17325
> function call:
17326
17327
</P
17328
><PRE
17329
CLASS="programlisting"
17330
> SConscript('src/SConscript', 'env')
17331
</PRE
17332
><P
17333
>
17334
Or as the <CODE
17335
CLASS="varname"
17336
>exports</CODE
17337
> keyword argument:
17338
17339
</P
17340
><PRE
17341
CLASS="programlisting"
17342
> SConscript('src/SConscript', exports='env')
17343
</PRE
17344
><P
17345
>
17346
These calls export the specified variables
17347
to only the listed <TT
17348
CLASS="filename"
17349
>SConscript</TT
17350
> files.
17351
You may, however, specify more than one
17352
<TT
17353
CLASS="filename"
17354
>SConscript</TT
17355
> file in a list:
17356
17357
</P
17358
><PRE
17359
CLASS="programlisting"
17360
> SConscript(['src1/SConscript',
17361
'src2/SConscript'], exports='env')
17362
</PRE
17363
><P
17364
>
17365
This is functionally equivalent to
17366
calling the <TT
17367
CLASS="filename"
17368
>SConscript</TT
17369
> function
17370
multiple times with the same <CODE
17371
CLASS="varname"
17372
>exports</CODE
17373
> argument,
17374
one per <TT
17375
CLASS="filename"
17376
>SConscript</TT
17377
> file.
17378
17379
</P
17380
></DIV
17381
><DIV
17382
CLASS="section"
17383
><HR><H3
17384
CLASS="section"
17385
><A
17386
NAME="AEN3226"
17387
>16.5.2. Importing Variables</A
17388
></H3
17389
><P
17390
>
17391
Once a variable has been exported from a calling
17392
<TT
17393
CLASS="filename"
17394
>SConscript</TT
17395
> file,
17396
it may be used in other <TT
17397
CLASS="filename"
17398
>SConscript</TT
17399
> files
17400
by calling the <CODE
17401
CLASS="function"
17402
>Import</CODE
17403
> function:
17404
17405
</P
17406
><PRE
17407
CLASS="programlisting"
17408
> Import('env')
17409
env.Program('prog', ['prog.c'])
17410
</PRE
17411
><P
17412
>
17413
The <CODE
17414
CLASS="function"
17415
>Import</CODE
17416
> call makes the <TT
17417
CLASS="literal"
17418
>env</TT
17419
> construction
17420
environment available to the <TT
17421
CLASS="filename"
17422
>SConscript</TT
17423
> file,
17424
after which the variable can be used to build
17425
programs, libraries, etc.
17426
17427
</P
17428
><P
17429
>
17430
Like the <CODE
17431
CLASS="function"
17432
>Export</CODE
17433
> function,
17434
the <CODE
17435
CLASS="function"
17436
>Import</CODE
17437
> function can be used
17438
with multiple variable names:
17439
17440
</P
17441
><PRE
17442
CLASS="programlisting"
17443
> Import('env', 'debug')
17444
env = env.Clone(DEBUG = debug)
17445
env.Program('prog', ['prog.c'])
17446
</PRE
17447
><P
17448
>
17449
And the <CODE
17450
CLASS="function"
17451
>Import</CODE
17452
> function will similarly
17453
split a string along white-space
17454
into separate variable names:
17455
17456
</P
17457
><PRE
17458
CLASS="programlisting"
17459
> Import('env debug')
17460
env = env.Clone(DEBUG = debug)
17461
env.Program('prog', ['prog.c'])
17462
</PRE
17463
><P
17464
>
17465
Lastly, as a special case,
17466
you may import all of the variables that
17467
have been exported by supplying an asterisk
17468
to the <CODE
17469
CLASS="function"
17470
>Import</CODE
17471
> function:
17472
17473
</P
17474
><PRE
17475
CLASS="programlisting"
17476
> Import('*')
17477
env = env.Clone(DEBUG = debug)
17478
env.Program('prog', ['prog.c'])
17479
</PRE
17480
><P
17481
>
17482
If you're dealing with a lot of <TT
17483
CLASS="filename"
17484
>SConscript</TT
17485
> files,
17486
this can be a lot simpler than keeping
17487
arbitrary lists of imported variables in each file.
17488
17489
</P
17490
></DIV
17491
><DIV
17492
CLASS="section"
17493
><HR><H3
17494
CLASS="section"
17495
><A
17496
NAME="AEN3249"
17497
>16.5.3. Returning Values From an <TT
17498
CLASS="filename"
17499
>SConscript</TT
17500
> File</A
17501
></H3
17502
><P
17503
>
17504
Sometimes, you would like to be able to
17505
use information from a subsidiary
17506
<TT
17507
CLASS="filename"
17508
>SConscript</TT
17509
> file in some way.
17510
For example,
17511
suppose that you want to create one
17512
library from source files
17513
scattered throughout a number
17514
of subsidiary <TT
17515
CLASS="filename"
17516
>SConscript</TT
17517
> files.
17518
You can do this by using the <CODE
17519
CLASS="function"
17520
>Return</CODE
17521
>
17522
function to return values
17523
from the subsidiary <TT
17524
CLASS="filename"
17525
>SConscript</TT
17526
> files
17527
to the calling file.
17528
17529
</P
17530
><P
17531
>
17532
If, for example, we have two subdirectories
17533
<SPAN
17534
CLASS="application"
17535
>foo</SPAN
17536
> and <SPAN
17537
CLASS="application"
17538
>bar</SPAN
17539
>
17540
that should each contribute a source
17541
file to a Library,
17542
what we'd like to be able to do is
17543
collect the object files
17544
from the subsidiary <TT
17545
CLASS="filename"
17546
>SConscript</TT
17547
> calls
17548
like this:
17549
17550
</P
17551
><PRE
17552
CLASS="programlisting"
17553
> env = Environment()
17554
Export('env')
17555
objs = []
17556
for subdir in ['foo', 'bar']:
17557
o = SConscript('%s/SConscript' % subdir)
17558
objs.append(o)
17559
env.Library('prog', objs)
17560
</PRE
17561
><P
17562
>
17563
We can do this by using the <CODE
17564
CLASS="function"
17565
>Return</CODE
17566
>
17567
function in the
17568
<TT
17569
CLASS="literal"
17570
>foo/SConscript</TT
17571
> file like this:
17572
17573
</P
17574
><PRE
17575
CLASS="programlisting"
17576
> Import('env')
17577
obj = env.Object('foo.c')
17578
Return('obj')
17579
</PRE
17580
><P
17581
>
17582
(The corresponding
17583
<TT
17584
CLASS="literal"
17585
>bar/SConscript</TT
17586
>
17587
file should be pretty obvious.)
17588
Then when we run <SPAN
17589
CLASS="application"
17590
>SCons</SPAN
17591
>,
17592
the object files from the subsidiary subdirectories
17593
are all correctly archived in the desired library:
17594
17595
</P
17596
><PRE
17597
CLASS="screen"
17598
> % <KBD
17599
CLASS="userinput"
17600
>scons -Q</KBD
17601
>
17602
cc -o bar/bar.o -c bar/bar.c
17603
cc -o foo/foo.o -c foo/foo.c
17604
ar rc libprog.a foo/foo.o bar/bar.o
17605
ranlib libprog.a
17606
</PRE
17607
></DIV
17608
></DIV
17609
></DIV
17610
><DIV
17611
CLASS="chapter"
17612
><HR><H1
17613
><A
17614
NAME="chap-separate"
17615
></A
17616
>Chapter 17. Separating Source and Build Directories</H1
17617
><P
17618
>
17619
It's often useful to keep any built files completely
17620
separate from the source files.
17621
In <SPAN
17622
CLASS="application"
17623
>SCons</SPAN
17624
>, this is usually done by creating one or more separate
17625
<SPAN
17626
CLASS="emphasis"
17627
><I
17628
CLASS="emphasis"
17629
>variant directory trees</I
17630
></SPAN
17631
>
17632
that are used to hold the built objects files, libraries,
17633
and executable programs, etc.
17634
for a specific flavor, or variant, of build.
17635
<SPAN
17636
CLASS="application"
17637
>SCons</SPAN
17638
> provides two ways to do this,
17639
one through the <TT
17640
CLASS="filename"
17641
>SConscript</TT
17642
> function that we've already seen,
17643
and the second through a more flexible <CODE
17644
CLASS="function"
17645
>VariantDir</CODE
17646
> function.
17647
17648
</P
17649
><P
17650
>
17651
One historical note: the <CODE
17652
CLASS="function"
17653
>VariantDir</CODE
17654
> function
17655
used to be called <CODE
17656
CLASS="function"
17657
>BuildDir</CODE
17658
>.
17659
That name is still supported
17660
but has been deprecated
17661
because the <SPAN
17662
CLASS="application"
17663
>SCons</SPAN
17664
> functionality
17665
differs from the model of a "build directory"
17666
implemented by other build systems like the GNU Autotools.
17667
17668
</P
17669
><DIV
17670
CLASS="section"
17671
><HR><H2
17672
CLASS="section"
17673
><A
17674
NAME="AEN3283"
17675
>17.1. Specifying a Variant Directory Tree as Part of an <TT
17676
CLASS="filename"
17677
>SConscript</TT
17678
> Call</A
17679
></H2
17680
><P
17681
>
17682
The most straightforward way to establish a variant directory tree
17683
uses the fact that the usual way to
17684
set up a build hierarchy is to have an
17685
<TT
17686
CLASS="filename"
17687
>SConscript</TT
17688
> file in the source subdirectory.
17689
If you then pass a <CODE
17690
CLASS="varname"
17691
>variant_dir</CODE
17692
> argument to the
17693
<TT
17694
CLASS="filename"
17695
>SConscript</TT
17696
> function call:
17697
17698
</P
17699
><PRE
17700
CLASS="programlisting"
17701
> SConscript('src/SConscript', variant_dir='build')
17702
</PRE
17703
><P
17704
>
17705
<SPAN
17706
CLASS="application"
17707
>SCons</SPAN
17708
> will then build all of the files in
17709
the <TT
17710
CLASS="filename"
17711
>build</TT
17712
> subdirectory:
17713
17714
</P
17715
><PRE
17716
CLASS="screen"
17717
> % <KBD
17718
CLASS="userinput"
17719
>ls src</KBD
17720
>
17721
SConscript hello.c
17722
% <KBD
17723
CLASS="userinput"
17724
>scons -Q</KBD
17725
>
17726
cc -o build/hello.o -c build/hello.c
17727
cc -o build/hello build/hello.o
17728
% <KBD
17729
CLASS="userinput"
17730
>ls build</KBD
17731
>
17732
SConscript hello hello.c hello.o
17733
</PRE
17734
><P
17735
>
17736
But wait a minute--what's going on here?
17737
<SPAN
17738
CLASS="application"
17739
>SCons</SPAN
17740
> created the object file
17741
<TT
17742
CLASS="filename"
17743
>build/hello.o</TT
17744
>
17745
in the <TT
17746
CLASS="filename"
17747
>build</TT
17748
> subdirectory,
17749
as expected.
17750
But even though our <TT
17751
CLASS="filename"
17752
>hello.c</TT
17753
> file lives in the <TT
17754
CLASS="filename"
17755
>src</TT
17756
> subdirectory,
17757
<SPAN
17758
CLASS="application"
17759
>SCons</SPAN
17760
> has actually compiled a
17761
<TT
17762
CLASS="filename"
17763
>build/hello.c</TT
17764
> file
17765
to create the object file.
17766
17767
</P
17768
><P
17769
>
17770
What's happened is that <SPAN
17771
CLASS="application"
17772
>SCons</SPAN
17773
> has <SPAN
17774
CLASS="emphasis"
17775
><I
17776
CLASS="emphasis"
17777
>duplicated</I
17778
></SPAN
17779
>
17780
the <TT
17781
CLASS="filename"
17782
>hello.c</TT
17783
> file from the <TT
17784
CLASS="filename"
17785
>src</TT
17786
> subdirectory
17787
to the <TT
17788
CLASS="filename"
17789
>build</TT
17790
> subdirectory,
17791
and built the program from there.
17792
The next section explains why <SPAN
17793
CLASS="application"
17794
>SCons</SPAN
17795
> does this.
17796
17797
</P
17798
></DIV
17799
><DIV
17800
CLASS="section"
17801
><HR><H2
17802
CLASS="section"
17803
><A
17804
NAME="AEN3313"
17805
>17.2. Why <SPAN
17806
CLASS="application"
17807
>SCons</SPAN
17808
> Duplicates Source Files in a Variant Directory Tree</A
17809
></H2
17810
><P
17811
>
17812
<SPAN
17813
CLASS="application"
17814
>SCons</SPAN
17815
> duplicates source files in variant directory trees
17816
because it's the most straightforward way to guarantee a correct build
17817
<SPAN
17818
CLASS="emphasis"
17819
><I
17820
CLASS="emphasis"
17821
>regardless of include-file directory paths,
17822
relative references between files,
17823
or tool support for putting files in different locations</I
17824
></SPAN
17825
>,
17826
and the <SPAN
17827
CLASS="application"
17828
>SCons</SPAN
17829
> philosophy is to, by default,
17830
guarantee a correct build in all cases.
17831
17832
</P
17833
><P
17834
>
17835
The most direct reason to duplicate source files
17836
in variant directories
17837
is simply that some tools (mostly older vesions)
17838
are written to only build their output files
17839
in the same directory as the source files.
17840
In this case, the choices are either
17841
to build the output file in the source directory
17842
and move it to the variant directory,
17843
or to duplicate the source files in the variant directory.
17844
17845
</P
17846
><P
17847
>
17848
Additionally,
17849
relative references between files
17850
can cause problems if we don't
17851
just duplicate the hierarchy of source files
17852
in the variant directory.
17853
You can see this at work in
17854
use of the C preprocessor <TT
17855
CLASS="literal"
17856
>#include</TT
17857
>
17858
mechanism with double quotes, not angle brackets:
17859
17860
</P
17861
><PRE
17862
CLASS="programlisting"
17863
> #include "file.h"
17864
</PRE
17865
><P
17866
>
17867
The <SPAN
17868
CLASS="emphasis"
17869
><I
17870
CLASS="emphasis"
17871
>de facto</I
17872
></SPAN
17873
> standard behavior
17874
for most C compilers in this case
17875
is to first look in the same directory
17876
as the source file that contains the <TT
17877
CLASS="literal"
17878
>#include</TT
17879
> line,
17880
then to look in the directories in the preprocessor search path.
17881
Add to this that the <SPAN
17882
CLASS="application"
17883
>SCons</SPAN
17884
> implementation of
17885
support for code repositories
17886
(described below)
17887
means not all of the files
17888
will be found in the same directory hierarchy,
17889
and the simplest way to make sure
17890
that the right include file is found
17891
is to duplicate the source files into the variant directory,
17892
which provides a correct build
17893
regardless of the original location(s) of the source files.
17894
17895
</P
17896
><P
17897
>
17898
Although source-file duplication guarantees a correct build
17899
even in these end-cases,
17900
it <SPAN
17901
CLASS="emphasis"
17902
><I
17903
CLASS="emphasis"
17904
>can</I
17905
></SPAN
17906
> usually be safely disabled.
17907
The next section describes
17908
how you can disable the duplication of source files
17909
in the variant directory.
17910
17911
</P
17912
></DIV
17913
><DIV
17914
CLASS="section"
17915
><HR><H2
17916
CLASS="section"
17917
><A
17918
NAME="AEN3330"
17919
>17.3. Telling <SPAN
17920
CLASS="application"
17921
>SCons</SPAN
17922
> to Not Duplicate Source Files in the Variant Directory Tree</A
17923
></H2
17924
><P
17925
>
17926
In most cases and with most tool sets,
17927
<SPAN
17928
CLASS="application"
17929
>SCons</SPAN
17930
> can place its target files in a build subdirectory
17931
<SPAN
17932
CLASS="emphasis"
17933
><I
17934
CLASS="emphasis"
17935
>without</I
17936
></SPAN
17937
>
17938
duplicating the source files
17939
and everything will work just fine.
17940
You can disable the default <SPAN
17941
CLASS="application"
17942
>SCons</SPAN
17943
> behavior
17944
by specifying <TT
17945
CLASS="literal"
17946
>duplicate=0</TT
17947
>
17948
when you call the <TT
17949
CLASS="filename"
17950
>SConscript</TT
17951
> function:
17952
17953
</P
17954
><PRE
17955
CLASS="programlisting"
17956
> SConscript('src/SConscript', variant_dir='build', duplicate=0)
17957
</PRE
17958
><P
17959
>
17960
When this flag is specified,
17961
<SPAN
17962
CLASS="application"
17963
>SCons</SPAN
17964
> uses the variant directory
17965
like most people expect--that is,
17966
the output files are placed in the variant directory
17967
while the source files stay in the source directory:
17968
17969
</P
17970
><PRE
17971
CLASS="screen"
17972
> % <KBD
17973
CLASS="userinput"
17974
>ls src</KBD
17975
>
17976
SConscript
17977
hello.c
17978
% <KBD
17979
CLASS="userinput"
17980
>scons -Q</KBD
17981
>
17982
cc -c src/hello.c -o build/hello.o
17983
cc -o build/hello build/hello.o
17984
% <KBD
17985
CLASS="userinput"
17986
>ls build</KBD
17987
>
17988
hello
17989
hello.o
17990
</PRE
17991
></DIV
17992
><DIV
17993
CLASS="section"
17994
><HR><H2
17995
CLASS="section"
17996
><A
17997
NAME="AEN3346"
17998
>17.4. The <CODE
17999
CLASS="function"
18000
>VariantDir</CODE
18001
> Function</A
18002
></H2
18003
><P
18004
>
18005
Use the <CODE
18006
CLASS="function"
18007
>VariantDir</CODE
18008
> function to establish that target
18009
files should be built in a separate directory
18010
from the source files:
18011
18012
</P
18013
><PRE
18014
CLASS="programlisting"
18015
> VariantDir('build', 'src')
18016
env = Environment()
18017
env.Program('build/hello.c')
18018
</PRE
18019
><P
18020
>
18021
Note that when you're not using
18022
an <TT
18023
CLASS="filename"
18024
>SConscript</TT
18025
> file in the <TT
18026
CLASS="filename"
18027
>src</TT
18028
> subdirectory,
18029
you must actually specify that
18030
the program must be built from
18031
the <TT
18032
CLASS="filename"
18033
>build/hello.c</TT
18034
>
18035
file that <SPAN
18036
CLASS="application"
18037
>SCons</SPAN
18038
> will duplicate in the
18039
<TT
18040
CLASS="filename"
18041
>build</TT
18042
> subdirectory.
18043
18044
</P
18045
><P
18046
>
18047
When using the <CODE
18048
CLASS="function"
18049
>VariantDir</CODE
18050
> function directly,
18051
<SPAN
18052
CLASS="application"
18053
>SCons</SPAN
18054
> still duplicates the source files
18055
in the variant directory by default:
18056
18057
</P
18058
><PRE
18059
CLASS="screen"
18060
> % <KBD
18061
CLASS="userinput"
18062
>ls src</KBD
18063
>
18064
hello.c
18065
% <KBD
18066
CLASS="userinput"
18067
>scons -Q</KBD
18068
>
18069
cc -o build/hello.o -c build/hello.c
18070
cc -o build/hello build/hello.o
18071
% <KBD
18072
CLASS="userinput"
18073
>ls build</KBD
18074
>
18075
hello hello.c hello.o
18076
</PRE
18077
><P
18078
>
18079
You can specify the same <TT
18080
CLASS="literal"
18081
>duplicate=0</TT
18082
> argument
18083
that you can specify for an <TT
18084
CLASS="filename"
18085
>SConscript</TT
18086
> call:
18087
18088
</P
18089
><PRE
18090
CLASS="programlisting"
18091
> VariantDir('build', 'src', duplicate=0)
18092
env = Environment()
18093
env.Program('build/hello.c')
18094
</PRE
18095
><P
18096
>
18097
In which case <SPAN
18098
CLASS="application"
18099
>SCons</SPAN
18100
>
18101
will disable duplication of the source files:
18102
18103
</P
18104
><PRE
18105
CLASS="screen"
18106
> % <KBD
18107
CLASS="userinput"
18108
>ls src</KBD
18109
>
18110
hello.c
18111
% <KBD
18112
CLASS="userinput"
18113
>scons -Q</KBD
18114
>
18115
cc -o build/hello.o -c src/hello.c
18116
cc -o build/hello build/hello.o
18117
% <KBD
18118
CLASS="userinput"
18119
>ls build</KBD
18120
>
18121
hello hello.o
18122
</PRE
18123
></DIV
18124
><DIV
18125
CLASS="section"
18126
><HR><H2
18127
CLASS="section"
18128
><A
18129
NAME="AEN3375"
18130
>17.5. Using <CODE
18131
CLASS="function"
18132
>VariantDir</CODE
18133
> With an <TT
18134
CLASS="filename"
18135
>SConscript</TT
18136
> File</A
18137
></H2
18138
><P
18139
>
18140
Even when using the <CODE
18141
CLASS="function"
18142
>VariantDir</CODE
18143
> function,
18144
it's much more natural to use it with
18145
a subsidiary <TT
18146
CLASS="filename"
18147
>SConscript</TT
18148
> file.
18149
For example, if the
18150
<TT
18151
CLASS="filename"
18152
>src/SConscript</TT
18153
>
18154
looks like this:
18155
18156
</P
18157
><PRE
18158
CLASS="programlisting"
18159
> env = Environment()
18160
env.Program('hello.c')
18161
</PRE
18162
><P
18163
>
18164
Then our <TT
18165
CLASS="filename"
18166
>SConstruct</TT
18167
> file could look like:
18168
18169
</P
18170
><PRE
18171
CLASS="programlisting"
18172
> VariantDir('build', 'src')
18173
SConscript('build/SConscript')
18174
</PRE
18175
><P
18176
>
18177
Yielding the following output:
18178
18179
</P
18180
><PRE
18181
CLASS="screen"
18182
> % <KBD
18183
CLASS="userinput"
18184
>ls src</KBD
18185
>
18186
SConscript hello.c
18187
% <KBD
18188
CLASS="userinput"
18189
>scons -Q</KBD
18190
>
18191
cc -o build/hello.o -c build/hello.c
18192
cc -o build/hello build/hello.o
18193
% <KBD
18194
CLASS="userinput"
18195
>ls build</KBD
18196
>
18197
SConscript hello hello.c hello.o
18198
</PRE
18199
><P
18200
>
18201
Notice that this is completely equivalent
18202
to the use of <TT
18203
CLASS="filename"
18204
>SConscript</TT
18205
> that we
18206
learned about in the previous section.
18207
18208
</P
18209
></DIV
18210
><DIV
18211
CLASS="section"
18212
><HR><H2
18213
CLASS="section"
18214
><A
18215
NAME="AEN3394"
18216
>17.6. Using <CODE
18217
CLASS="function"
18218
>Glob</CODE
18219
> with <CODE
18220
CLASS="function"
18221
>VariantDir</CODE
18222
></A
18223
></H2
18224
><P
18225
>
18226
The <CODE
18227
CLASS="function"
18228
>Glob</CODE
18229
> file name pattern matching function
18230
works just as usual when using <CODE
18231
CLASS="function"
18232
>VariantDir</CODE
18233
>.
18234
For example, if the
18235
<TT
18236
CLASS="filename"
18237
>src/SConscript</TT
18238
>
18239
looks like this:
18240
18241
</P
18242
><PRE
18243
CLASS="programlisting"
18244
> env = Environment()
18245
env.Program('hello', Glob('*.c'))
18246
</PRE
18247
><P
18248
>
18249
Then with the same <TT
18250
CLASS="filename"
18251
>SConstruct</TT
18252
> file as in the previous section,
18253
and source files <TT
18254
CLASS="filename"
18255
>f1.c</TT
18256
>
18257
and <TT
18258
CLASS="filename"
18259
>f2.c</TT
18260
> in src,
18261
we would see the following output:
18262
18263
</P
18264
><PRE
18265
CLASS="screen"
18266
> % <KBD
18267
CLASS="userinput"
18268
>ls src</KBD
18269
>
18270
SConscript f1.c f2.c f2.h
18271
% <KBD
18272
CLASS="userinput"
18273
>scons -Q</KBD
18274
>
18275
cc -o build/f1.o -c build/f1.c
18276
cc -o build/f2.o -c build/f2.c
18277
cc -o build/hello build/f1.o build/f2.o
18278
% <KBD
18279
CLASS="userinput"
18280
>ls build</KBD
18281
>
18282
SConscript f1.c f1.o f2.c f2.h f2.o hello
18283
</PRE
18284
><P
18285
>
18286
The <CODE
18287
CLASS="function"
18288
>Glob</CODE
18289
> function returns Nodes in the
18290
<TT
18291
CLASS="filename"
18292
>build/</TT
18293
> tree, as you'd expect.
18294
18295
</P
18296
></DIV
18297
></DIV
18298
><DIV
18299
CLASS="chapter"
18300
><HR><H1
18301
><A
18302
NAME="chap-variants"
18303
></A
18304
>Chapter 18. Variant Builds</H1
18305
><P
18306
>
18307
The <CODE
18308
CLASS="varname"
18309
>variant_dir</CODE
18310
> keyword argument of
18311
the <TT
18312
CLASS="filename"
18313
>SConscript</TT
18314
> function provides everything
18315
we need to show how easy it is to create
18316
variant builds using <SPAN
18317
CLASS="application"
18318
>SCons</SPAN
18319
>.
18320
Suppose, for example, that we want to
18321
build a program for both Windows and Linux platforms,
18322
but that we want to build it in a shared directory
18323
with separate side-by-side build directories
18324
for the Windows and Linux versions of the program.
18325
18326
</P
18327
><PRE
18328
CLASS="programlisting"
18329
> platform = ARGUMENTS.get('OS', Platform())
18330
18331
include = "#export/$PLATFORM/include"
18332
lib = "#export/$PLATFORM/lib"
18333
bin = "#export/$PLATFORM/bin"
18334
18335
env = Environment(PLATFORM = platform,
18336
BINDIR = bin,
18337
INCDIR = include,
18338
LIBDIR = lib,
18339
CPPPATH = [include],
18340
LIBPATH = [lib],
18341
LIBS = 'world')
18342
18343
Export('env')
18344
18345
env.SConscript('src/SConscript', variant_dir='build/$PLATFORM')
18346
</PRE
18347
><P
18348
>
18349
This SConstruct file,
18350
when run on a Linux system, yields:
18351
18352
</P
18353
><PRE
18354
CLASS="screen"
18355
> % <KBD
18356
CLASS="userinput"
18357
>scons -Q OS=linux</KBD
18358
>
18359
Install file: "build/linux/world/world.h" as "export/linux/include/world.h"
18360
cc -o build/linux/hello/hello.o -c -Iexport/linux/include build/linux/hello/hello.c
18361
cc -o build/linux/world/world.o -c -Iexport/linux/include build/linux/world/world.c
18362
ar rc build/linux/world/libworld.a build/linux/world/world.o
18363
ranlib build/linux/world/libworld.a
18364
Install file: "build/linux/world/libworld.a" as "export/linux/lib/libworld.a"
18365
cc -o build/linux/hello/hello build/linux/hello/hello.o -Lexport/linux/lib -lworld
18366
Install file: "build/linux/hello/hello" as "export/linux/bin/hello"
18367
</PRE
18368
><P
18369
>
18370
The same SConstruct file on Windows would build:
18371
18372
</P
18373
><PRE
18374
CLASS="screen"
18375
> C:\><KBD
18376
CLASS="userinput"
18377
>scons -Q OS=windows</KBD
18378
>
18379
Install file: "build/windows/world/world.h" as "export/windows/include/world.h"
18380
cl /nologo /Iexport\windows\include /c build\windows\hello\hello.c /Fobuild\windows\hello\hello.obj
18381
cl /nologo /Iexport\windows\include /c build\windows\world\world.c /Fobuild\windows\world\world.obj
18382
lib /nologo /OUT:build\windows\world\world.lib build\windows\world\world.obj
18383
Install file: "build/windows/world/world.lib" as "export/windows/lib/world.lib"
18384
link /nologo /OUT:build\windows\hello\hello.exe /LIBPATH:export\windows\lib world.lib build\windows\hello\hello.obj
18385
Install file: "build/windows/hello/hello.exe" as "export/windows/bin/hello.exe"
18386
</PRE
18387
></DIV
18388
><DIV
18389
CLASS="chapter"
18390
><HR><H1
18391
><A
18392
NAME="chap-builders-writing"
18393
></A
18394
>Chapter 19. Writing Your Own Builders</H1
18395
><P
18396
>
18397
Although <SPAN
18398
CLASS="application"
18399
>SCons</SPAN
18400
> provides many useful methods
18401
for building common software products:
18402
programs, libraries, documents.
18403
you frequently want to be
18404
able to build some other type of file
18405
not supported directly by <SPAN
18406
CLASS="application"
18407
>SCons</SPAN
18408
>
18409
Fortunately, <SPAN
18410
CLASS="application"
18411
>SCons</SPAN
18412
> makes it very easy
18413
to define your own <CODE
18414
CLASS="classname"
18415
>Builder</CODE
18416
> objects
18417
for any custom file types you want to build.
18418
(In fact, the <SPAN
18419
CLASS="application"
18420
>SCons</SPAN
18421
> interfaces for creating
18422
<CODE
18423
CLASS="classname"
18424
>Builder</CODE
18425
> objects are flexible enough and easy enough to use
18426
that all of the the <SPAN
18427
CLASS="application"
18428
>SCons</SPAN
18429
> built-in <CODE
18430
CLASS="classname"
18431
>Builder</CODE
18432
> objects
18433
are created the mechanisms described in this section.)
18434
18435
</P
18436
><DIV
18437
CLASS="section"
18438
><HR><H2
18439
CLASS="section"
18440
><A
18441
NAME="AEN3438"
18442
>19.1. Writing Builders That Execute External Commands</A
18443
></H2
18444
><P
18445
>
18446
The simplest <CODE
18447
CLASS="classname"
18448
>Builder</CODE
18449
> to create is
18450
one that executes an external command.
18451
For example, if we want to build
18452
an output file by running the contents
18453
of the input file through a command named
18454
<TT
18455
CLASS="literal"
18456
>foobuild</TT
18457
>,
18458
creating that <CODE
18459
CLASS="classname"
18460
>Builder</CODE
18461
> might look like:
18462
18463
</P
18464
><PRE
18465
CLASS="programlisting"
18466
> bld = Builder(action = 'foobuild < $SOURCE > $TARGET')
18467
</PRE
18468
><P
18469
>
18470
All the above line does is create a free-standing
18471
<CODE
18472
CLASS="classname"
18473
>Builder</CODE
18474
> object.
18475
The next section will show us how to actually use it.
18476
18477
</P
18478
></DIV
18479
><DIV
18480
CLASS="section"
18481
><HR><H2
18482
CLASS="section"
18483
><A
18484
NAME="AEN3447"
18485
>19.2. Attaching a Builder to a <TT
18486
CLASS="literal"
18487
>Construction Environment</TT
18488
></A
18489
></H2
18490
><P
18491
>
18492
A <CODE
18493
CLASS="classname"
18494
>Builder</CODE
18495
> object isn't useful
18496
until it's attached to a <TT
18497
CLASS="literal"
18498
>construction environment</TT
18499
>
18500
so that we can call it to arrange
18501
for files to be built.
18502
This is done through the <A
18503
HREF="#cv-BUILDERS"
18504
><CODE
18505
CLASS="envar"
18506
>$BUILDERS</CODE
18507
></A
18508
>
18509
<TT
18510
CLASS="literal"
18511
>construction variable</TT
18512
> in an environment.
18513
The <CODE
18514
CLASS="envar"
18515
>$BUILDERS</CODE
18516
> variable is a Python dictionary
18517
that maps the names by which you want to call
18518
various <CODE
18519
CLASS="classname"
18520
>Builder</CODE
18521
> objects to the objects themselves.
18522
For example, if we want to call the
18523
<CODE
18524
CLASS="classname"
18525
>Builder</CODE
18526
> we just defined by the name
18527
<CODE
18528
CLASS="function"
18529
>Foo</CODE
18530
>,
18531
our <TT
18532
CLASS="filename"
18533
>SConstruct</TT
18534
> file might look like:
18535
18536
</P
18537
><PRE
18538
CLASS="programlisting"
18539
> bld = Builder(action = 'foobuild < $SOURCE > $TARGET')
18540
env = Environment(BUILDERS = {'Foo' : bld})
18541
</PRE
18542
><P
18543
>
18544
With the <CODE
18545
CLASS="classname"
18546
>Builder</CODE
18547
> so attached to our <TT
18548
CLASS="literal"
18549
>construction environment</TT
18550
>
18551
we can now actually call it like so:
18552
18553
</P
18554
><PRE
18555
CLASS="programlisting"
18556
> env.Foo('file.foo', 'file.input')
18557
</PRE
18558
><P
18559
>
18560
Then when we run <SPAN
18561
CLASS="application"
18562
>SCons</SPAN
18563
> it looks like:
18564
18565
</P
18566
><PRE
18567
CLASS="screen"
18568
> % <KBD
18569
CLASS="userinput"
18570
>scons -Q</KBD
18571
>
18572
foobuild < file.input > file.foo
18573
</PRE
18574
><P
18575
>
18576
Note, however, that the default <CODE
18577
CLASS="envar"
18578
>$BUILDERS</CODE
18579
>
18580
variable in a <TT
18581
CLASS="literal"
18582
>construction environment</TT
18583
>
18584
comes with a default set of <CODE
18585
CLASS="classname"
18586
>Builder</CODE
18587
> objects
18588
already defined:
18589
<A
18590
HREF="#b-Program"
18591
><CODE
18592
CLASS="function"
18593
>Program</CODE
18594
></A
18595
>, <A
18596
HREF="#b-Library"
18597
><CODE
18598
CLASS="function"
18599
>Library</CODE
18600
></A
18601
>, etc.
18602
And when we explicitly set the <CODE
18603
CLASS="envar"
18604
>$BUILDERS</CODE
18605
> variable
18606
when we create the <TT
18607
CLASS="literal"
18608
>construction environment</TT
18609
>,
18610
the default <CODE
18611
CLASS="classname"
18612
>Builder</CODE
18613
>s are no longer part of
18614
the environment:
18615
18616
</P
18617
><PRE
18618
CLASS="programlisting"
18619
> bld = Builder(action = 'foobuild < $SOURCE > $TARGET')
18620
env = Environment(BUILDERS = {'Foo' : bld})
18621
env.Foo('file.foo', 'file.input')
18622
env.Program('hello.c')
18623
</PRE
18624
><PRE
18625
CLASS="screen"
18626
> % <KBD
18627
CLASS="userinput"
18628
>scons -Q</KBD
18629
>
18630
AttributeError: SConsEnvironment instance has no attribute 'Program':
18631
File "/home/my/project/SConstruct", line 4:
18632
env.Program('hello.c')
18633
</PRE
18634
><P
18635
>
18636
To be able to use both our own defined <CODE
18637
CLASS="classname"
18638
>Builder</CODE
18639
> objects
18640
and the default <CODE
18641
CLASS="classname"
18642
>Builder</CODE
18643
> objects in the same <TT
18644
CLASS="literal"
18645
>construction environment</TT
18646
>,
18647
you can either add to the <CODE
18648
CLASS="envar"
18649
>$BUILDERS</CODE
18650
> variable
18651
using the <CODE
18652
CLASS="function"
18653
>Append</CODE
18654
> function:
18655
18656
</P
18657
><PRE
18658
CLASS="programlisting"
18659
> env = Environment()
18660
bld = Builder(action = 'foobuild < $SOURCE > $TARGET')
18661
env.Append(BUILDERS = {'Foo' : bld})
18662
env.Foo('file.foo', 'file.input')
18663
env.Program('hello.c')
18664
</PRE
18665
><P
18666
>
18667
Or you can explicitly set the appropriately-named
18668
key in the <CODE
18669
CLASS="envar"
18670
>$BUILDERS</CODE
18671
> dictionary:
18672
18673
</P
18674
><PRE
18675
CLASS="programlisting"
18676
> env = Environment()
18677
bld = Builder(action = 'foobuild < $SOURCE > $TARGET')
18678
env['BUILDERS']['Foo'] = bld
18679
env.Foo('file.foo', 'file.input')
18680
env.Program('hello.c')
18681
</PRE
18682
><P
18683
>
18684
Either way, the same <TT
18685
CLASS="literal"
18686
>construction environment</TT
18687
>
18688
can then use both the newly-defined
18689
<CODE
18690
CLASS="function"
18691
>Foo</CODE
18692
> <CODE
18693
CLASS="classname"
18694
>Builder</CODE
18695
>
18696
and the default <A
18697
HREF="#b-Program"
18698
><CODE
18699
CLASS="function"
18700
>Program</CODE
18701
></A
18702
> <CODE
18703
CLASS="classname"
18704
>Builder</CODE
18705
>:
18706
18707
</P
18708
><PRE
18709
CLASS="screen"
18710
> % <KBD
18711
CLASS="userinput"
18712
>scons -Q</KBD
18713
>
18714
foobuild < file.input > file.foo
18715
cc -o hello.o -c hello.c
18716
cc -o hello hello.o
18717
</PRE
18718
></DIV
18719
><DIV
18720
CLASS="section"
18721
><HR><H2
18722
CLASS="section"
18723
><A
18724
NAME="AEN3503"
18725
>19.3. Letting <SPAN
18726
CLASS="application"
18727
>SCons</SPAN
18728
> Handle The File Suffixes</A
18729
></H2
18730
><P
18731
>
18732
By supplying additional information
18733
when you create a <CODE
18734
CLASS="classname"
18735
>Builder</CODE
18736
>,
18737
you can let <SPAN
18738
CLASS="application"
18739
>SCons</SPAN
18740
> add appropriate file
18741
suffixes to the target and/or the source file.
18742
For example, rather than having to specify
18743
explicitly that you want the <TT
18744
CLASS="literal"
18745
>Foo</TT
18746
>
18747
<CODE
18748
CLASS="classname"
18749
>Builder</CODE
18750
> to build the <TT
18751
CLASS="literal"
18752
>file.foo</TT
18753
>
18754
target file from the <TT
18755
CLASS="literal"
18756
>file.input</TT
18757
> source file,
18758
you can give the <TT
18759
CLASS="literal"
18760
>.foo</TT
18761
>
18762
and <TT
18763
CLASS="literal"
18764
>.input</TT
18765
> suffixes to the <CODE
18766
CLASS="classname"
18767
>Builder</CODE
18768
>,
18769
making for more compact and readable calls to
18770
the <TT
18771
CLASS="literal"
18772
>Foo</TT
18773
> <CODE
18774
CLASS="classname"
18775
>Builder</CODE
18776
>:
18777
18778
</P
18779
><PRE
18780
CLASS="programlisting"
18781
> bld = Builder(action = 'foobuild < $SOURCE > $TARGET',
18782
suffix = '.foo',
18783
src_suffix = '.input')
18784
env = Environment(BUILDERS = {'Foo' : bld})
18785
env.Foo('file1')
18786
env.Foo('file2')
18787
</PRE
18788
><PRE
18789
CLASS="screen"
18790
> % <KBD
18791
CLASS="userinput"
18792
>scons -Q</KBD
18793
>
18794
foobuild < file1.input > file1.foo
18795
foobuild < file2.input > file2.foo
18796
</PRE
18797
><P
18798
>
18799
You can also supply a <TT
18800
CLASS="literal"
18801
>prefix</TT
18802
> keyword argument
18803
if it's appropriate to have <SPAN
18804
CLASS="application"
18805
>SCons</SPAN
18806
> append a prefix
18807
to the beginning of target file names.
18808
18809
</P
18810
></DIV
18811
><DIV
18812
CLASS="section"
18813
><HR><H2
18814
CLASS="section"
18815
><A
18816
NAME="AEN3524"
18817
>19.4. Builders That Execute Python Functions</A
18818
></H2
18819
><P
18820
>
18821
In <SPAN
18822
CLASS="application"
18823
>SCons</SPAN
18824
>, you don't have to call an external command
18825
to build a file.
18826
You can, instead, define a Python function
18827
that a <CODE
18828
CLASS="classname"
18829
>Builder</CODE
18830
> object can invoke
18831
to build your target file (or files).
18832
Such a <TT
18833
CLASS="literal"
18834
>builder function</TT
18835
> definition looks like:
18836
18837
</P
18838
><PRE
18839
CLASS="programlisting"
18840
> def build_function(target, source, env):
18841
# Code to build "target" from "source"
18842
return None
18843
</PRE
18844
><P
18845
>
18846
The arguments of a <TT
18847
CLASS="literal"
18848
>builder function</TT
18849
> are:
18850
18851
</P
18852
><P
18853
></P
18854
><DIV
18855
CLASS="variablelist"
18856
><DL
18857
><DT
18858
>target</DT
18859
><DD
18860
><P
18861
>
18862
A list of Node objects representing
18863
the target or targets to be
18864
built by this builder function.
18865
The file names of these target(s)
18866
may be extracted using the Python <CODE
18867
CLASS="function"
18868
>str</CODE
18869
> function.
18870
18871
</P
18872
></DD
18873
><DT
18874
>source</DT
18875
><DD
18876
><P
18877
>
18878
A list of Node objects representing
18879
the sources to be
18880
used by this builder function to build the targets.
18881
The file names of these source(s)
18882
may be extracted using the Python <CODE
18883
CLASS="function"
18884
>str</CODE
18885
> function.
18886
18887
</P
18888
></DD
18889
><DT
18890
>env</DT
18891
><DD
18892
><P
18893
>
18894
The <TT
18895
CLASS="literal"
18896
>construction environment</TT
18897
> used for building the target(s).
18898
The builder function may use any of the
18899
environment's construction variables
18900
in any way to affect how it builds the targets.
18901
18902
</P
18903
></DD
18904
></DL
18905
></DIV
18906
><P
18907
>
18908
The builder function must
18909
return a <TT
18910
CLASS="literal"
18911
>0</TT
18912
> or <TT
18913
CLASS="literal"
18914
>None</TT
18915
> value
18916
if the target(s) are built successfully.
18917
The builder function
18918
may raise an exception
18919
or return any non-zero value
18920
to indicate that the build is unsuccessful,
18921
18922
</P
18923
><P
18924
>
18925
Once you've defined the Python function
18926
that will build your target file,
18927
defining a <CODE
18928
CLASS="classname"
18929
>Builder</CODE
18930
> object for it is as
18931
simple as specifying the name of the function,
18932
instead of an external command,
18933
as the <CODE
18934
CLASS="classname"
18935
>Builder</CODE
18936
>'s
18937
<TT
18938
CLASS="literal"
18939
>action</TT
18940
>
18941
argument:
18942
18943
</P
18944
><PRE
18945
CLASS="programlisting"
18946
> def build_function(target, source, env):
18947
# Code to build "target" from "source"
18948
return None
18949
bld = Builder(action = build_function,
18950
suffix = '.foo',
18951
src_suffix = '.input')
18952
env = Environment(BUILDERS = {'Foo' : bld})
18953
env.Foo('file')
18954
</PRE
18955
><P
18956
>
18957
And notice that the output changes slightly,
18958
reflecting the fact that a Python function,
18959
not an external command,
18960
is now called to build the target file:
18961
18962
</P
18963
><PRE
18964
CLASS="screen"
18965
> % <KBD
18966
CLASS="userinput"
18967
>scons -Q</KBD
18968
>
18969
build_function(["file.foo"], ["file.input"])
18970
</PRE
18971
></DIV
18972
><DIV
18973
CLASS="section"
18974
><HR><H2
18975
CLASS="section"
18976
><A
18977
NAME="AEN3560"
18978
>19.5. Builders That Create Actions Using a <TT
18979
CLASS="literal"
18980
>Generator</TT
18981
></A
18982
></H2
18983
><P
18984
>
18985
<SPAN
18986
CLASS="application"
18987
>SCons</SPAN
18988
> Builder objects can create an action "on the fly"
18989
by using a function called a <TT
18990
CLASS="literal"
18991
>generator</TT
18992
>.
18993
This provides a great deal of flexibility to
18994
construct just the right list of commands
18995
to build your target.
18996
A <TT
18997
CLASS="literal"
18998
>generator</TT
18999
> looks like:
19000
19001
</P
19002
><PRE
19003
CLASS="programlisting"
19004
> def generate_actions(source, target, env, for_signature):
19005
return 'foobuild < %s > %s' % (target[0], source[0])
19006
</PRE
19007
><P
19008
>
19009
The arguments of a <TT
19010
CLASS="literal"
19011
>generator</TT
19012
> are:
19013
19014
</P
19015
><P
19016
></P
19017
><DIV
19018
CLASS="variablelist"
19019
><DL
19020
><DT
19021
>source</DT
19022
><DD
19023
><P
19024
>
19025
A list of Node objects representing
19026
the sources to be built
19027
by the command or other action
19028
generated by this function.
19029
The file names of these source(s)
19030
may be extracted using the Python <CODE
19031
CLASS="function"
19032
>str</CODE
19033
> function.
19034
19035
</P
19036
></DD
19037
><DT
19038
>target</DT
19039
><DD
19040
><P
19041
>
19042
A list of Node objects representing
19043
the target or targets to be built
19044
by the command or other action
19045
generated by this function.
19046
The file names of these target(s)
19047
may be extracted using the Python <CODE
19048
CLASS="function"
19049
>str</CODE
19050
> function.
19051
19052
</P
19053
></DD
19054
><DT
19055
>env</DT
19056
><DD
19057
><P
19058
>
19059
The <TT
19060
CLASS="literal"
19061
>construction environment</TT
19062
> used for building the target(s).
19063
The generator may use any of the
19064
environment's construction variables
19065
in any way to determine what command
19066
or other action to return.
19067
19068
</P
19069
></DD
19070
><DT
19071
>for_signature</DT
19072
><DD
19073
><P
19074
>
19075
A flag that specifies whether the
19076
generator is being called to contribute to a build signature,
19077
as opposed to actually executing the command.
19078
19079
19080
19081
</P
19082
></DD
19083
></DL
19084
></DIV
19085
><P
19086
>
19087
The <TT
19088
CLASS="literal"
19089
>generator</TT
19090
> must return a
19091
command string or other action that will be used to
19092
build the specified target(s) from the specified source(s).
19093
19094
</P
19095
><P
19096
>
19097
Once you've defined a <TT
19098
CLASS="literal"
19099
>generator</TT
19100
>,
19101
you create a <CODE
19102
CLASS="classname"
19103
>Builder</CODE
19104
> to use it
19105
by specifying the generator keyword argument
19106
instead of <TT
19107
CLASS="literal"
19108
>action</TT
19109
>.
19110
19111
</P
19112
><PRE
19113
CLASS="programlisting"
19114
> def generate_actions(source, target, env, for_signature):
19115
return 'foobuild < %s > %s' % (source[0], target[0])
19116
bld = Builder(generator = generate_actions,
19117
suffix = '.foo',
19118
src_suffix = '.input')
19119
env = Environment(BUILDERS = {'Foo' : bld})
19120
env.Foo('file')
19121
</PRE
19122
><PRE
19123
CLASS="screen"
19124
> % <KBD
19125
CLASS="userinput"
19126
>scons -Q</KBD
19127
>
19128
foobuild < file.input > file.foo
19129
</PRE
19130
><P
19131
>
19132
Note that it's illegal to specify both an
19133
<TT
19134
CLASS="literal"
19135
>action</TT
19136
>
19137
and a
19138
<TT
19139
CLASS="literal"
19140
>generator</TT
19141
>
19142
for a <CODE
19143
CLASS="classname"
19144
>Builder</CODE
19145
>.
19146
19147
</P
19148
></DIV
19149
><DIV
19150
CLASS="section"
19151
><HR><H2
19152
CLASS="section"
19153
><A
19154
NAME="AEN3603"
19155
>19.6. Builders That Modify the Target or Source Lists Using an <TT
19156
CLASS="literal"
19157
>Emitter</TT
19158
></A
19159
></H2
19160
><P
19161
>
19162
<SPAN
19163
CLASS="application"
19164
>SCons</SPAN
19165
> supports the ability for a Builder to modify the
19166
lists of target(s) from the specified source(s).
19167
You do this by defining an <TT
19168
CLASS="literal"
19169
>emitter</TT
19170
> function
19171
that takes as its arguments
19172
the list of the targets passed to the builder,
19173
the list of the sources passed to the builder,
19174
and the construction environment.
19175
The emitter function should return the modified
19176
lists of targets that should be built
19177
and sources from which the targets will be built.
19178
19179
</P
19180
><P
19181
>
19182
For example, suppose you want to define a Builder
19183
that always calls a <TT
19184
CLASS="filename"
19185
>foobuild</TT
19186
> program,
19187
and you want to automatically add
19188
a new target file named
19189
<TT
19190
CLASS="filename"
19191
>new_target</TT
19192
>
19193
and a new source file named
19194
<TT
19195
CLASS="filename"
19196
>new_source</TT
19197
>
19198
whenever it's called.
19199
The <TT
19200
CLASS="filename"
19201
>SConstruct</TT
19202
> file might look like this:
19203
19204
</P
19205
><PRE
19206
CLASS="programlisting"
19207
> def modify_targets(target, source, env):
19208
target.append('new_target')
19209
source.append('new_source')
19210
return target, source
19211
bld = Builder(action = 'foobuild $TARGETS - $SOURCES',
19212
suffix = '.foo',
19213
src_suffix = '.input',
19214
emitter = modify_targets)
19215
env = Environment(BUILDERS = {'Foo' : bld})
19216
env.Foo('file')
19217
</PRE
19218
><P
19219
>
19220
And would yield the following output:
19221
19222
</P
19223
><PRE
19224
CLASS="screen"
19225
> % <KBD
19226
CLASS="userinput"
19227
>scons -Q</KBD
19228
>
19229
foobuild file.foo new_target - file.input new_source
19230
</PRE
19231
><P
19232
>
19233
One very flexible thing that you can is specify
19234
use a construction variable to specify
19235
different emitter functions for different
19236
construction variable.
19237
To do this, specify a string
19238
containing a construction variable
19239
expansion as the emitter when you call
19240
the <CODE
19241
CLASS="classname"
19242
>Builder</CODE
19243
> function,
19244
and set that construction variable to
19245
the desired emitter function
19246
in different construction environments:
19247
19248
</P
19249
><PRE
19250
CLASS="programlisting"
19251
> bld = Builder(action = 'my_command $SOURCES > $TARGET',
19252
suffix = '.foo',
19253
src_suffix = '.input',
19254
emitter = '$MY_EMITTER')
19255
def modify1(target, source, env):
19256
return target, source + ['modify1.in']
19257
def modify2(target, source, env):
19258
return target, source + ['modify2.in']
19259
env1 = Environment(BUILDERS = {'Foo' : bld},
19260
MY_EMITTER = modify1)
19261
env2 = Environment(BUILDERS = {'Foo' : bld},
19262
MY_EMITTER = modify2)
19263
env1.Foo('file1')
19264
env2.Foo('file2')
19265
import os
19266
env1['ENV']['PATH'] = env2['ENV']['PATH'] + os.pathsep + os.getcwd()
19267
env2['ENV']['PATH'] = env2['ENV']['PATH'] + os.pathsep + os.getcwd()
19268
19269
19270
</PRE
19271
><PRE
19272
CLASS="programlisting"
19273
> bld = Builder(action = 'my_command $SOURCES > $TARGET',
19274
suffix = '.foo',
19275
src_suffix = '.input',
19276
emitter = '$MY_EMITTER')
19277
def modify1(target, source, env):
19278
return target, source + ['modify1.in']
19279
def modify2(target, source, env):
19280
return target, source + ['modify2.in']
19281
env1 = Environment(BUILDERS = {'Foo' : bld},
19282
MY_EMITTER = modify1)
19283
env2 = Environment(BUILDERS = {'Foo' : bld},
19284
MY_EMITTER = modify2)
19285
env1.Foo('file1')
19286
env2.Foo('file2')
19287
19288
</PRE
19289
><P
19290
>
19291
In this example, the <TT
19292
CLASS="filename"
19293
>modify1.in</TT
19294
>
19295
and <TT
19296
CLASS="filename"
19297
>modify2.in</TT
19298
> files
19299
get added to the source lists
19300
of the different commands:
19301
19302
</P
19303
><PRE
19304
CLASS="screen"
19305
> % <KBD
19306
CLASS="userinput"
19307
>scons -Q</KBD
19308
>
19309
my_command file1.input modify1.in > file1.foo
19310
my_command file2.input modify2.in > file2.foo
19311
</PRE
19312
></DIV
19313
><DIV
19314
CLASS="section"
19315
><HR><H2
19316
CLASS="section"
19317
><A
19318
NAME="AEN3627"
19319
>19.7. Where To Put Your Custom Builders and Tools</A
19320
></H2
19321
><P
19322
>
19323
The <TT
19324
CLASS="filename"
19325
>site_scons</TT
19326
> directory gives you a place to
19327
put Python modules you can import into your SConscripts
19328
(site_scons), add-on tools that can integrate into <SPAN
19329
CLASS="application"
19330
>SCons</SPAN
19331
>
19332
(site_scons/site_tools), and a site_scons/site_init.py file that
19333
gets read before any <TT
19334
CLASS="filename"
19335
>SConstruct</TT
19336
> or <TT
19337
CLASS="filename"
19338
>SConscript</TT
19339
>, allowing you to
19340
change <SPAN
19341
CLASS="application"
19342
>SCons</SPAN
19343
>'s default behavior.
19344
19345
</P
19346
><P
19347
>
19348
If you get a tool from somewhere (the <SPAN
19349
CLASS="application"
19350
>SCons</SPAN
19351
> wiki or a third party,
19352
for instance) and you'd like to use it in your project, the
19353
<TT
19354
CLASS="filename"
19355
>site_scons</TT
19356
> dir is the simplest place to put it.
19357
Tools come in two flavors; either a Python function that operates on
19358
an <CODE
19359
CLASS="function"
19360
>Environment</CODE
19361
> or a Python file containing two functions, exists()
19362
and generate().
19363
19364
</P
19365
><P
19366
>
19367
A single-function Tool can just be included in your
19368
<TT
19369
CLASS="filename"
19370
>site_scons/site_init.py</TT
19371
> file where it will be
19372
parsed and made available for use. For instance, you could have a
19373
<TT
19374
CLASS="filename"
19375
>site_scons/site_init.py</TT
19376
> file like this:
19377
19378
</P
19379
><PRE
19380
CLASS="programlisting"
19381
> def TOOL_ADD_HEADER(env):
19382
"""A Tool to add a header from $HEADER to the source file"""
19383
add_header = Builder(action=['echo "$HEADER" > $TARGET',
19384
'cat $SOURCE >> $TARGET'])
19385
env.Append(BUILDERS = {'AddHeader' : add_header})
19386
env['HEADER'] = '' # set default value
19387
</PRE
19388
><P
19389
>
19390
and a <TT
19391
CLASS="filename"
19392
>SConstruct</TT
19393
> like this:
19394
19395
</P
19396
><PRE
19397
CLASS="programlisting"
19398
> # Use TOOL_ADD_HEADER from site_scons/site_init.py
19399
env=Environment(tools=['default', TOOL_ADD_HEADER], HEADER="=====")
19400
env.AddHeader('tgt', 'src')
19401
</PRE
19402
><P
19403
>
19404
The <CODE
19405
CLASS="function"
19406
>TOOL_ADD_HEADER</CODE
19407
> tool method will be
19408
called to add the <CODE
19409
CLASS="function"
19410
>AddHeader</CODE
19411
> tool to the
19412
environment.
19413
19414
</P
19415
><P
19416
> Similarly, a more full-fledged tool with
19417
<CODE
19418
CLASS="function"
19419
>exists()</CODE
19420
> and <CODE
19421
CLASS="function"
19422
>generate()</CODE
19423
>
19424
methods can be installed in
19425
<TT
19426
CLASS="filename"
19427
>site_scons/site_tools/toolname.py</TT
19428
>. Since
19429
<TT
19430
CLASS="filename"
19431
>site_scons/site_tools</TT
19432
> is automatically added
19433
to the head of the tool search path, any tool found there will be
19434
available to all environments. Furthermore, a tool found there
19435
will override a built-in tool of the same name, so if you need to
19436
change the behavior of a built-in tool, site_scons gives you the
19437
hook you need.
19438
</P
19439
><P
19440
> Many people have a library of utility Python functions they'd like
19441
to include in <TT
19442
CLASS="filename"
19443
>SConscript</TT
19444
>s; just put that module in
19445
<TT
19446
CLASS="filename"
19447
>site_scons/my_utils.py</TT
19448
> or any valid Python module name of your
19449
choice. For instance you can do something like this in
19450
<TT
19451
CLASS="filename"
19452
>site_scons/my_utils.py</TT
19453
> to add a build_id method:
19454
</P
19455
><PRE
19456
CLASS="programlisting"
19457
> def build_id():
19458
"""Return a build ID (stub version)"""
19459
return "100"
19460
</PRE
19461
><P
19462
>
19463
And then in your <TT
19464
CLASS="filename"
19465
>SConscript</TT
19466
> or any sub-<TT
19467
CLASS="filename"
19468
>SConscript</TT
19469
> anywhere in
19470
your build, you can import <TT
19471
CLASS="filename"
19472
>my_utils</TT
19473
> and use it:
19474
19475
</P
19476
><PRE
19477
CLASS="programlisting"
19478
> import my_utils
19479
print "build_id=" + my_utils.build_id()
19480
</PRE
19481
><P
19482
>
19483
If you have a machine-wide site dir you'd like to use instead of
19484
<TT
19485
CLASS="filename"
19486
>./site_scons</TT
19487
>, use the
19488
<TT
19489
CLASS="literal"
19490
>--site-dir</TT
19491
> option to point to your dir.
19492
<TT
19493
CLASS="filename"
19494
>site_init.py</TT
19495
> and
19496
<TT
19497
CLASS="filename"
19498
>site_tools</TT
19499
> will be located under that dir.
19500
To avoid using a <TT
19501
CLASS="filename"
19502
>site_scons</TT
19503
> dir at all, even
19504
if it exists, use the <TT
19505
CLASS="literal"
19506
>--no-site-dir</TT
19507
> option.
19508
19509
</P
19510
></DIV
19511
></DIV
19512
><DIV
19513
CLASS="chapter"
19514
><HR><H1
19515
><A
19516
NAME="chap-builders-commands"
19517
></A
19518
>Chapter 20. Not Writing a Builder: the <CODE
19519
CLASS="function"
19520
>Command</CODE
19521
> Builder</H1
19522
><P
19523
>
19524
Creating a <CODE
19525
CLASS="classname"
19526
>Builder</CODE
19527
> and attaching it to a <TT
19528
CLASS="literal"
19529
>construction environment</TT
19530
>
19531
allows for a lot of flexibility when you
19532
want to re-use actions
19533
to build multiple files of the same type.
19534
This can, however, be cumbersome
19535
if you only need to execute one specific command
19536
to build a single file (or group of files).
19537
For these situations, <SPAN
19538
CLASS="application"
19539
>SCons</SPAN
19540
> supports a
19541
<CODE
19542
CLASS="function"
19543
>Command</CODE
19544
> <CODE
19545
CLASS="classname"
19546
>Builder</CODE
19547
> that arranges
19548
for a specific action to be executed
19549
to build a specific file or files.
19550
This looks a lot like the other builders
19551
(like <A
19552
HREF="#b-Program"
19553
><CODE
19554
CLASS="function"
19555
>Program</CODE
19556
></A
19557
>, <A
19558
HREF="#b-Object"
19559
><CODE
19560
CLASS="function"
19561
>Object</CODE
19562
></A
19563
>, etc.),
19564
but takes as an additional argument
19565
the command to be executed to build the file:
19566
19567
</P
19568
><PRE
19569
CLASS="programlisting"
19570
> env = Environment()
19571
env.Command('foo.out', 'foo.in', "sed 's/x/y/' < $SOURCE > $TARGET")
19572
</PRE
19573
><P
19574
>
19575
When executed,
19576
<SPAN
19577
CLASS="application"
19578
>SCons</SPAN
19579
> runs the specified command,
19580
substituting <A
19581
HREF="#cv-SOURCE"
19582
><CODE
19583
CLASS="envar"
19584
>$SOURCE</CODE
19585
></A
19586
> and <A
19587
HREF="#cv-TARGET"
19588
><CODE
19589
CLASS="envar"
19590
>$TARGET</CODE
19591
></A
19592
>
19593
as expected:
19594
19595
</P
19596
><PRE
19597
CLASS="screen"
19598
> % <KBD
19599
CLASS="userinput"
19600
>scons -Q</KBD
19601
>
19602
sed 's/x/y/' < foo.in > foo.out
19603
</PRE
19604
><P
19605
>
19606
This is often more convenient than
19607
creating a <CODE
19608
CLASS="classname"
19609
>Builder</CODE
19610
> object
19611
and adding it to the <A
19612
HREF="#cv-BUILDERS"
19613
><CODE
19614
CLASS="envar"
19615
>$BUILDERS</CODE
19616
></A
19617
> variable
19618
of a <TT
19619
CLASS="literal"
19620
>construction environment</TT
19621
>
19622
19623
</P
19624
><P
19625
>
19626
Note that the action you specify to the
19627
<CODE
19628
CLASS="function"
19629
>Command</CODE
19630
> <CODE
19631
CLASS="classname"
19632
>Builder</CODE
19633
> can be any legal <SPAN
19634
CLASS="application"
19635
>SCons</SPAN
19636
> <CODE
19637
CLASS="classname"
19638
>Action</CODE
19639
>,
19640
such as a Python function:
19641
19642
</P
19643
><PRE
19644
CLASS="programlisting"
19645
> env = Environment()
19646
def build(target, source, env):
19647
# Whatever it takes to build
19648
return None
19649
env.Command('foo.out', 'foo.in', build)
19650
</PRE
19651
><P
19652
>
19653
Which executes as follows:
19654
19655
</P
19656
><PRE
19657
CLASS="screen"
19658
> % <KBD
19659
CLASS="userinput"
19660
>scons -Q</KBD
19661
>
19662
build(["foo.out"], ["foo.in"])
19663
</PRE
19664
></DIV
19665
><DIV
19666
CLASS="chapter"
19667
><HR><H1
19668
><A
19669
NAME="chap-add-method"
19670
></A
19671
>Chapter 21. Pseudo-Builders: the AddMethod function</H1
19672
><P
19673
>
19674
The <CODE
19675
CLASS="function"
19676
>AddMethod</CODE
19677
> function is used to add a method
19678
to an environment. It's typically used to add a "pseudo-builder,"
19679
a function that looks like a <CODE
19680
CLASS="classname"
19681
>Builder</CODE
19682
> but
19683
wraps up calls to multiple other <CODE
19684
CLASS="classname"
19685
>Builder</CODE
19686
>s
19687
or otherwise processes its arguments
19688
before calling one or more <CODE
19689
CLASS="classname"
19690
>Builder</CODE
19691
>s.
19692
In the following example,
19693
we want to install the program into the standard
19694
<TT
19695
CLASS="filename"
19696
>/usr/bin</TT
19697
> directory hierarchy,
19698
but also copy it into a local <TT
19699
CLASS="filename"
19700
>install/bin</TT
19701
>
19702
directory from which a package might be built:
19703
19704
</P
19705
><PRE
19706
CLASS="programlisting"
19707
> def install_in_bin_dirs(env, source):
19708
"""Install source in both bin dirs"""
19709
i1 = env.Install("$BIN", source)
19710
i2 = env.Install("$LOCALBIN", source)
19711
return [i1[0], i2[0]] # Return a list, like a normal builder
19712
env = Environment(BIN='/usr/bin', LOCALBIN='#install/bin')
19713
env.AddMethod(install_in_bin_dirs, "InstallInBinDirs")
19714
env.InstallInBinDirs(Program('hello.c')) # installs hello in both bin dirs
19715
</PRE
19716
><P
19717
> This produces the following:
19718
</P
19719
><PRE
19720
CLASS="screen"
19721
> % <KBD
19722
CLASS="userinput"
19723
>scons -Q /</KBD
19724
>
19725
cc -o hello.o -c hello.c
19726
cc -o hello hello.o
19727
Install file: "hello" as "/usr/bin/hello"
19728
Install file: "hello" as "install/bin/hello"
19729
</PRE
19730
><P
19731
>
19732
As mentioned, a psuedo-builder also provides more flexibility
19733
in parsing arguments than you can get with a <CODE
19734
CLASS="classname"
19735
>Builder</CODE
19736
>.
19737
The next example shows a pseudo-builder with a
19738
named argument that modifies the filename, and a separate argument
19739
for the resource file (rather than having the builder figure it out
19740
by file extension). This example also demonstrates using the global
19741
<CODE
19742
CLASS="function"
19743
>AddMethod</CODE
19744
> function to add a method to the global Environment class,
19745
so it will be used in all subsequently created environments.
19746
19747
</P
19748
><PRE
19749
CLASS="programlisting"
19750
> def BuildTestProg(env, testfile, resourcefile, testdir="tests"):
19751
"""Build the test program;
19752
prepends "test_" to src and target,
19753
and puts target into testdir."""
19754
srcfile = "test_%s.c" % testfile
19755
target = "%s/test_%s" % (testdir, testfile)
19756
if env['PLATFORM'] == 'win32':
19757
resfile = env.RES(resourcefile)
19758
p = env.Program(target, [srcfile, resfile])
19759
else:
19760
p = env.Program(target, srcfile)
19761
return p
19762
AddMethod(Environment, BuildTestProg)
19763
19764
env = Environment()
19765
env.BuildTestProg('stuff', resourcefile='res.rc')
19766
</PRE
19767
><P
19768
> This produces the following on Linux:
19769
</P
19770
><PRE
19771
CLASS="screen"
19772
> % <KBD
19773
CLASS="userinput"
19774
>scons -Q</KBD
19775
>
19776
cc -o test_stuff.o -c test_stuff.c
19777
cc -o tests/test_stuff test_stuff.o
19778
</PRE
19779
><P
19780
> And the following on Windows:
19781
</P
19782
><PRE
19783
CLASS="screen"
19784
> C:\><KBD
19785
CLASS="userinput"
19786
>scons -Q</KBD
19787
>
19788
rc /fores.res res.rc
19789
cl /nologo /c test_stuff.c /Fotest_stuff.obj
19790
link /nologo /OUT:tests\test_stuff.exe test_stuff.obj res.res
19791
</PRE
19792
><P
19793
> Using <CODE
19794
CLASS="function"
19795
>AddMethod</CODE
19796
> is better than just adding an instance method
19797
to a <TT
19798
CLASS="literal"
19799
>construction environment</TT
19800
> because it gets called as a proper method,
19801
and because <CODE
19802
CLASS="function"
19803
>AddMethod</CODE
19804
> provides for copying the method
19805
to any clones of the <TT
19806
CLASS="literal"
19807
>construction environment</TT
19808
> instance.
19809
</P
19810
></DIV
19811
><DIV
19812
CLASS="chapter"
19813
><HR><H1
19814
><A
19815
NAME="chap-scanners"
19816
></A
19817
>Chapter 22. Writing Scanners</H1
19818
><P
19819
>
19820
<SPAN
19821
CLASS="application"
19822
>SCons</SPAN
19823
> has built-in scanners that know how to look in
19824
C, Fortran and IDL source files for information about
19825
other files that targets built from those files depend on--for example,
19826
in the case of files that use the C preprocessor,
19827
the <TT
19828
CLASS="filename"
19829
>.h</TT
19830
> files that are specified
19831
using <TT
19832
CLASS="literal"
19833
>#include</TT
19834
> lines in the source.
19835
You can use the same mechanisms that <SPAN
19836
CLASS="application"
19837
>SCons</SPAN
19838
> uses to create
19839
its built-in scanners to write scanners of your own for file types
19840
that <SPAN
19841
CLASS="application"
19842
>SCons</SPAN
19843
> does not know how to scan "out of the box."
19844
19845
</P
19846
><DIV
19847
CLASS="section"
19848
><HR><H2
19849
CLASS="section"
19850
><A
19851
NAME="AEN3743"
19852
>22.1. A Simple Scanner Example</A
19853
></H2
19854
><P
19855
>
19856
Suppose, for example, that we want to create a simple scanner
19857
for <TT
19858
CLASS="filename"
19859
>.foo</TT
19860
> files.
19861
A <TT
19862
CLASS="filename"
19863
>.foo</TT
19864
> file contains some text that
19865
will be processed,
19866
and can include other files on lines that begin
19867
with <TT
19868
CLASS="literal"
19869
>include</TT
19870
>
19871
followed by a file name:
19872
19873
</P
19874
><PRE
19875
CLASS="programlisting"
19876
> include filename.foo
19877
</PRE
19878
><P
19879
>
19880
Scanning a file will be handled by a Python function
19881
that you must supply.
19882
Here is a function that will use the Python
19883
<TT
19884
CLASS="filename"
19885
>re</TT
19886
> module
19887
to scan for the <TT
19888
CLASS="literal"
19889
>include</TT
19890
> lines in our example:
19891
19892
</P
19893
><PRE
19894
CLASS="programlisting"
19895
> import re
19896
19897
include_re = re.compile(r'^include\s+(\S+)$', re.M)
19898
19899
def kfile_scan(node, env, path, arg):
19900
contents = node.get_contents()
19901
return include_re.findall(contents)
19902
</PRE
19903
><P
19904
>
19905
The scanner function must
19906
accept the four specified arguments
19907
and return a list of implicit dependencies.
19908
Presumably, these would be dependencies found
19909
from examining the contents of the file,
19910
although the function can perform any
19911
manipulation at all to generate the list of
19912
dependencies.
19913
19914
</P
19915
><P
19916
></P
19917
><DIV
19918
CLASS="variablelist"
19919
><DL
19920
><DT
19921
>node</DT
19922
><DD
19923
><P
19924
>
19925
An <SPAN
19926
CLASS="application"
19927
>SCons</SPAN
19928
> node object representing the file being scanned.
19929
The path name to the file can be
19930
used by converting the node to a string
19931
using the <TT
19932
CLASS="literal"
19933
>str()</TT
19934
> function,
19935
or an internal <SPAN
19936
CLASS="application"
19937
>SCons</SPAN
19938
> <TT
19939
CLASS="literal"
19940
>get_contents()</TT
19941
>
19942
object method can be used to fetch the contents.
19943
19944
</P
19945
></DD
19946
><DT
19947
>env</DT
19948
><DD
19949
><P
19950
>
19951
The construction environment in effect for this scan.
19952
The scanner function may choose to use construction
19953
variables from this environment to affect its behavior.
19954
19955
</P
19956
></DD
19957
><DT
19958
>path</DT
19959
><DD
19960
><P
19961
>
19962
A list of directories that form the search path for included files
19963
for this scanner.
19964
This is how <SPAN
19965
CLASS="application"
19966
>SCons</SPAN
19967
> handles the <A
19968
HREF="#cv-CPPPATH"
19969
><CODE
19970
CLASS="envar"
19971
>$CPPPATH</CODE
19972
></A
19973
> and <A
19974
HREF="#cv-LIBPATH"
19975
><CODE
19976
CLASS="envar"
19977
>$LIBPATH</CODE
19978
></A
19979
>
19980
variables.
19981
19982
</P
19983
></DD
19984
><DT
19985
>arg</DT
19986
><DD
19987
><P
19988
>
19989
An optional argument that you can choose to
19990
have passed to this scanner function by
19991
various scanner instances.
19992
19993
</P
19994
></DD
19995
></DL
19996
></DIV
19997
><P
19998
>
19999
A Scanner object is created using the <CODE
20000
CLASS="classname"
20001
>Scanner</CODE
20002
> function,
20003
which typically takes an <TT
20004
CLASS="literal"
20005
>skeys</TT
20006
> argument
20007
to associate the type of file suffix with this scanner.
20008
The Scanner object must then be associated with the
20009
<A
20010
HREF="#cv-SCANNERS"
20011
><CODE
20012
CLASS="envar"
20013
>$SCANNERS</CODE
20014
></A
20015
> construction variable of a construction environment,
20016
typically by using the <CODE
20017
CLASS="function"
20018
>Append</CODE
20019
> method:
20020
20021
</P
20022
><PRE
20023
CLASS="programlisting"
20024
> kscan = Scanner(function = kfile_scan,
20025
skeys = ['.k'])
20026
env.Append(SCANNERS = kscan)
20027
</PRE
20028
><P
20029
>
20030
When we put it all together, it looks like:
20031
20032
</P
20033
><PRE
20034
CLASS="programlisting"
20035
> import re
20036
20037
include_re = re.compile(r'^include\s+(\S+)$', re.M)
20038
20039
def kfile_scan(node, env, path):
20040
contents = node.get_contents()
20041
includes = include_re.findall(contents)
20042
return includes
20043
20044
kscan = Scanner(function = kfile_scan,
20045
skeys = ['.k'])
20046
20047
env = Environment(ENV = {'PATH' : '/usr/local/bin'})
20048
env.Append(SCANNERS = kscan)
20049
20050
env.Command('foo', 'foo.k', 'kprocess < $SOURCES > $TARGET')
20051
</PRE
20052
></DIV
20053
></DIV
20054
><DIV
20055
CLASS="chapter"
20056
><HR><H1
20057
><A
20058
NAME="chap-repositories"
20059
></A
20060
>Chapter 23. Building From Code Repositories</H1
20061
><P
20062
>
20063
Often, a software project will have
20064
one or more central repositories,
20065
directory trees that contain
20066
source code, or derived files, or both.
20067
You can eliminate additional unnecessary
20068
rebuilds of files by having <SPAN
20069
CLASS="application"
20070
>SCons</SPAN
20071
>
20072
use files from one or more code repositories
20073
to build files in your local build tree.
20074
20075
</P
20076
><DIV
20077
CLASS="section"
20078
><HR><H2
20079
CLASS="section"
20080
><A
20081
NAME="AEN3794"
20082
>23.1. The <CODE
20083
CLASS="function"
20084
>Repository</CODE
20085
> Method</A
20086
></H2
20087
><P
20088
>
20089
It's often useful to allow multiple programmers working
20090
on a project to build software from
20091
source files and/or derived files that
20092
are stored in a centrally-accessible repository,
20093
a directory copy of the source code tree.
20094
(Note that this is not the sort of repository
20095
maintained by a source code management system
20096
like BitKeeper, CVS, or Subversion.)
20097
20098
You use the <CODE
20099
CLASS="function"
20100
>Repository</CODE
20101
> method
20102
to tell <SPAN
20103
CLASS="application"
20104
>SCons</SPAN
20105
> to search one or more
20106
central code repositories (in order)
20107
for any source files and derived files
20108
that are not present in the local build tree:
20109
20110
</P
20111
><PRE
20112
CLASS="programlisting"
20113
> env = Environment()
20114
env.Program('hello.c')
20115
Repository('/usr/repository1', '/usr/repository2')
20116
</PRE
20117
><P
20118
>
20119
Multiple calls to the <CODE
20120
CLASS="function"
20121
>Repository</CODE
20122
> method
20123
will simply add repositories to the global list
20124
that <SPAN
20125
CLASS="application"
20126
>SCons</SPAN
20127
> maintains,
20128
with the exception that <SPAN
20129
CLASS="application"
20130
>SCons</SPAN
20131
> will automatically eliminate
20132
the current directory and any non-existent
20133
directories from the list.
20134
20135
</P
20136
></DIV
20137
><DIV
20138
CLASS="section"
20139
><HR><H2
20140
CLASS="section"
20141
><A
20142
NAME="AEN3805"
20143
>23.2. Finding source files in repositories</A
20144
></H2
20145
><P
20146
>
20147
The above example
20148
specifies that <SPAN
20149
CLASS="application"
20150
>SCons</SPAN
20151
>
20152
will first search for files under
20153
the <TT
20154
CLASS="filename"
20155
>/usr/repository1</TT
20156
> tree
20157
and next under the <TT
20158
CLASS="filename"
20159
>/usr/repository2</TT
20160
> tree.
20161
<SPAN
20162
CLASS="application"
20163
>SCons</SPAN
20164
> expects that any files it searches
20165
for will be found in the same position
20166
relative to the top-level directory.
20167
In the above example, if the <TT
20168
CLASS="filename"
20169
>hello.c</TT
20170
> file is not
20171
found in the local build tree,
20172
<SPAN
20173
CLASS="application"
20174
>SCons</SPAN
20175
> will search first for
20176
a <TT
20177
CLASS="filename"
20178
>/usr/repository1/hello.c</TT
20179
> file
20180
and then for a <TT
20181
CLASS="filename"
20182
>/usr/repository2/hello.c</TT
20183
> file
20184
to use in its place.
20185
20186
</P
20187
><P
20188
>
20189
So given the <TT
20190
CLASS="filename"
20191
>SConstruct</TT
20192
> file above,
20193
if the <TT
20194
CLASS="filename"
20195
>hello.c</TT
20196
> file exists in the local
20197
build directory,
20198
<SPAN
20199
CLASS="application"
20200
>SCons</SPAN
20201
> will rebuild the <SPAN
20202
CLASS="application"
20203
>hello</SPAN
20204
> program
20205
as normal:
20206
20207
</P
20208
><PRE
20209
CLASS="screen"
20210
> % <KBD
20211
CLASS="userinput"
20212
>scons -Q</KBD
20213
>
20214
cc -o hello.o -c hello.c
20215
cc -o hello hello.o
20216
</PRE
20217
><P
20218
>
20219
If, however, there is no local <TT
20220
CLASS="filename"
20221
>hello.c</TT
20222
> file,
20223
but one exists in <TT
20224
CLASS="filename"
20225
>/usr/repository1</TT
20226
>,
20227
<SPAN
20228
CLASS="application"
20229
>SCons</SPAN
20230
> will recompile the <SPAN
20231
CLASS="application"
20232
>hello</SPAN
20233
> program
20234
from the source file it finds in the repository:
20235
20236
</P
20237
><PRE
20238
CLASS="screen"
20239
> % <KBD
20240
CLASS="userinput"
20241
>scons -Q</KBD
20242
>
20243
cc -o hello.o -c /usr/repository1/hello.c
20244
cc -o hello hello.o
20245
</PRE
20246
><P
20247
>
20248
And similarly, if there is no local <TT
20249
CLASS="filename"
20250
>hello.c</TT
20251
> file
20252
and no <TT
20253
CLASS="filename"
20254
>/usr/repository1/hello.c</TT
20255
>,
20256
but one exists in <TT
20257
CLASS="filename"
20258
>/usr/repository2</TT
20259
>:
20260
20261
</P
20262
><PRE
20263
CLASS="screen"
20264
> % <KBD
20265
CLASS="userinput"
20266
>scons -Q</KBD
20267
>
20268
cc -o hello.o -c /usr/repository2/hello.c
20269
cc -o hello hello.o
20270
</PRE
20271
><P
20272
>
20273
</P
20274
></DIV
20275
><DIV
20276
CLASS="section"
20277
><HR><H2
20278
CLASS="section"
20279
><A
20280
NAME="AEN3837"
20281
>23.3. Finding <TT
20282
CLASS="literal"
20283
>#include</TT
20284
> files in repositories</A
20285
></H2
20286
><P
20287
>
20288
We've already seen that SCons will scan the contents of
20289
a source file for <TT
20290
CLASS="literal"
20291
>#include</TT
20292
> file names
20293
and realize that targets built from that source file
20294
also depend on the <TT
20295
CLASS="literal"
20296
>#include</TT
20297
> file(s).
20298
For each directory in the <A
20299
HREF="#cv-CPPPATH"
20300
><CODE
20301
CLASS="envar"
20302
>$CPPPATH</CODE
20303
></A
20304
> list,
20305
<SPAN
20306
CLASS="application"
20307
>SCons</SPAN
20308
> will actually search the corresponding directories
20309
in any repository trees and establish the
20310
correct dependencies on any
20311
<TT
20312
CLASS="literal"
20313
>#include</TT
20314
> files that it finds
20315
in repository directory.
20316
20317
</P
20318
><P
20319
>
20320
Unless the C compiler also knows about these directories
20321
in the repository trees, though,
20322
it will be unable to find the <TT
20323
CLASS="literal"
20324
>#include</TT
20325
> files.
20326
If, for example, the <TT
20327
CLASS="filename"
20328
>hello.c</TT
20329
> file in
20330
our previous example includes the <SPAN
20331
CLASS="application"
20332
>hello</SPAN
20333
>.h;
20334
in its current directory,
20335
and the <SPAN
20336
CLASS="application"
20337
>hello</SPAN
20338
>.h; only exists in the repository:
20339
20340
</P
20341
><PRE
20342
CLASS="screen"
20343
> % <KBD
20344
CLASS="userinput"
20345
>scons -Q</KBD
20346
>
20347
cc -o hello.o -c hello.c
20348
hello.c:1: hello.h: No such file or directory
20349
</PRE
20350
><P
20351
>
20352
In order to inform the C compiler about the repositories,
20353
<SPAN
20354
CLASS="application"
20355
>SCons</SPAN
20356
> will add appropriate
20357
<TT
20358
CLASS="literal"
20359
>-I</TT
20360
> flags to the compilation commands
20361
for each directory in the <CODE
20362
CLASS="envar"
20363
>$CPPPATH</CODE
20364
> list.
20365
So if we add the current directory to the
20366
construction environment <CODE
20367
CLASS="envar"
20368
>$CPPPATH</CODE
20369
> like so:
20370
20371
</P
20372
><PRE
20373
CLASS="programlisting"
20374
> env = Environment(CPPPATH = ['.'])
20375
env.Program('hello.c')
20376
Repository('/usr/repository1')
20377
</PRE
20378
><P
20379
>
20380
Then re-executing <SPAN
20381
CLASS="application"
20382
>SCons</SPAN
20383
> yields:
20384
20385
</P
20386
><PRE
20387
CLASS="screen"
20388
> % <KBD
20389
CLASS="userinput"
20390
>scons -Q</KBD
20391
>
20392
cc -o hello.o -c -I. -I/usr/repository1 hello.c
20393
cc -o hello hello.o
20394
</PRE
20395
><P
20396
>
20397
The order of the <TT
20398
CLASS="literal"
20399
>-I</TT
20400
> options replicates,
20401
for the C preprocessor,
20402
the same repository-directory search path
20403
that <SPAN
20404
CLASS="application"
20405
>SCons</SPAN
20406
> uses for its own dependency analysis.
20407
If there are multiple repositories and multiple <CODE
20408
CLASS="envar"
20409
>$CPPPATH</CODE
20410
>
20411
directories, <SPAN
20412
CLASS="application"
20413
>SCons</SPAN
20414
> will add the repository directories
20415
to the beginning of each <CODE
20416
CLASS="envar"
20417
>$CPPPATH</CODE
20418
> directory,
20419
rapidly multiplying the number of <TT
20420
CLASS="literal"
20421
>-I</TT
20422
> flags.
20423
If, for example, the <CODE
20424
CLASS="envar"
20425
>$CPPPATH</CODE
20426
> contains three directories
20427
(and shorter repository path names!):
20428
20429
</P
20430
><PRE
20431
CLASS="programlisting"
20432
> env = Environment(CPPPATH = ['dir1', 'dir2', 'dir3'])
20433
env.Program('hello.c')
20434
Repository('/r1', '/r2')
20435
</PRE
20436
><P
20437
>
20438
Then we'll end up with nine <TT
20439
CLASS="literal"
20440
>-I</TT
20441
> options
20442
on the command line,
20443
three (for each of the <CODE
20444
CLASS="envar"
20445
>$CPPPATH</CODE
20446
> directories)
20447
times three (for the local directory plus the two repositories):
20448
20449
</P
20450
><PRE
20451
CLASS="screen"
20452
> % <KBD
20453
CLASS="userinput"
20454
>scons -Q</KBD
20455
>
20456
cc -o hello.o -c -Idir1 -I/r1/dir1 -I/r2/dir1 -Idir2 -I/r1/dir2 -I/r2/dir2 -Idir3 -I/r1/dir3 -I/r2/dir3 hello.c
20457
cc -o hello hello.o
20458
</PRE
20459
><DIV
20460
CLASS="section"
20461
><HR><H3
20462
CLASS="section"
20463
><A
20464
NAME="AEN3878"
20465
>23.3.1. Limitations on <TT
20466
CLASS="literal"
20467
>#include</TT
20468
> files in repositories</A
20469
></H3
20470
><P
20471
>
20472
<SPAN
20473
CLASS="application"
20474
>SCons</SPAN
20475
> relies on the C compiler's
20476
<TT
20477
CLASS="literal"
20478
>-I</TT
20479
> options to control the order in which
20480
the preprocessor will search the repository directories
20481
for <TT
20482
CLASS="literal"
20483
>#include</TT
20484
> files.
20485
This causes a problem, however, with how the C preprocessor
20486
handles <TT
20487
CLASS="literal"
20488
>#include</TT
20489
> lines with
20490
the file name included in double-quotes.
20491
20492
</P
20493
><P
20494
>
20495
As we've seen,
20496
<SPAN
20497
CLASS="application"
20498
>SCons</SPAN
20499
> will compile the <TT
20500
CLASS="filename"
20501
>hello.c</TT
20502
> file from
20503
the repository if it doesn't exist in
20504
the local directory.
20505
If, however, the <TT
20506
CLASS="filename"
20507
>hello.c</TT
20508
> file in the repository contains
20509
a <TT
20510
CLASS="literal"
20511
>#include</TT
20512
> line with the file name in
20513
double quotes:
20514
20515
</P
20516
><PRE
20517
CLASS="programlisting"
20518
> #include "hello.h"
20519
int
20520
main(int argc, char *argv[])
20521
{
20522
printf(HELLO_MESSAGE);
20523
return (0);
20524
}
20525
</PRE
20526
><P
20527
>
20528
Then the C preprocessor will <SPAN
20529
CLASS="emphasis"
20530
><I
20531
CLASS="emphasis"
20532
>always</I
20533
></SPAN
20534
>
20535
use a <TT
20536
CLASS="filename"
20537
>hello.h</TT
20538
> file from the repository directory first,
20539
even if there is a <TT
20540
CLASS="filename"
20541
>hello.h</TT
20542
> file in the local directory,
20543
despite the fact that the command line specifies
20544
<TT
20545
CLASS="literal"
20546
>-I</TT
20547
> as the first option:
20548
20549
</P
20550
><PRE
20551
CLASS="screen"
20552
> % <KBD
20553
CLASS="userinput"
20554
>scons -Q</KBD
20555
>
20556
cc -o hello.o -c -I. -I/usr/repository1 /usr/repository1/hello.c
20557
cc -o hello hello.o
20558
</PRE
20559
><P
20560
>
20561
This behavior of the C preprocessor--always search
20562
for a <TT
20563
CLASS="literal"
20564
>#include</TT
20565
> file in double-quotes
20566
first in the same directory as the source file,
20567
and only then search the <TT
20568
CLASS="literal"
20569
>-I</TT
20570
>--can
20571
not, in general, be changed.
20572
In other words, it's a limitation
20573
that must be lived with if you want to use
20574
code repositories in this way.
20575
There are three ways you can possibly
20576
work around this C preprocessor behavior:
20577
20578
</P
20579
><P
20580
></P
20581
><OL
20582
TYPE="1"
20583
><LI
20584
><P
20585
>
20586
Some modern versions of C compilers do have an option
20587
to disable or control this behavior.
20588
If so, add that option to <A
20589
HREF="#cv-CFLAGS"
20590
><CODE
20591
CLASS="envar"
20592
>$CFLAGS</CODE
20593
></A
20594
>
20595
(or <A
20596
HREF="#cv-CXXFLAGS"
20597
><CODE
20598
CLASS="envar"
20599
>$CXXFLAGS</CODE
20600
></A
20601
> or both) in your construction environment(s).
20602
Make sure the option is used for all construction
20603
environments that use C preprocessing!
20604
20605
</P
20606
></LI
20607
><LI
20608
><P
20609
>
20610
Change all occurrences of <TT
20611
CLASS="literal"
20612
>#include "file.h"</TT
20613
>
20614
to <TT
20615
CLASS="literal"
20616
>#include <file.h></TT
20617
>.
20618
Use of <TT
20619
CLASS="literal"
20620
>#include</TT
20621
> with angle brackets
20622
does not have the same behavior--the <TT
20623
CLASS="literal"
20624
>-I</TT
20625
>
20626
directories are searched first
20627
for <TT
20628
CLASS="literal"
20629
>#include</TT
20630
> files--which
20631
gives <SPAN
20632
CLASS="application"
20633
>SCons</SPAN
20634
> direct control over the list of
20635
directories the C preprocessor will search.
20636
20637
</P
20638
></LI
20639
><LI
20640
><P
20641
>
20642
Require that everyone working with compilation from
20643
repositories check out and work on entire directories of files,
20644
not individual files.
20645
(If you use local wrapper scripts around
20646
your source code control system's command,
20647
you could add logic to enforce this restriction there.
20648
20649
</P
20650
></LI
20651
></OL
20652
></DIV
20653
></DIV
20654
><DIV
20655
CLASS="section"
20656
><HR><H2
20657
CLASS="section"
20658
><A
20659
NAME="AEN3919"
20660
>23.4. Finding the <TT
20661
CLASS="filename"
20662
>SConstruct</TT
20663
> file in repositories</A
20664
></H2
20665
><P
20666
>
20667
<SPAN
20668
CLASS="application"
20669
>SCons</SPAN
20670
> will also search in repositories
20671
for the <TT
20672
CLASS="filename"
20673
>SConstruct</TT
20674
> file and any specified <TT
20675
CLASS="filename"
20676
>SConscript</TT
20677
> files.
20678
This poses a problem, though: how can <SPAN
20679
CLASS="application"
20680
>SCons</SPAN
20681
> search a
20682
repository tree for an <TT
20683
CLASS="filename"
20684
>SConstruct</TT
20685
> file
20686
if the <TT
20687
CLASS="filename"
20688
>SConstruct</TT
20689
> file itself contains the information
20690
about the pathname of the repository?
20691
To solve this problem, <SPAN
20692
CLASS="application"
20693
>SCons</SPAN
20694
> allows you
20695
to specify repository directories
20696
on the command line using the <TT
20697
CLASS="literal"
20698
>-Y</TT
20699
> option:
20700
20701
</P
20702
><PRE
20703
CLASS="screen"
20704
> % <KBD
20705
CLASS="userinput"
20706
>scons -Q -Y /usr/repository1 -Y /usr/repository2</KBD
20707
>
20708
</PRE
20709
><P
20710
>
20711
When looking for source or derived files,
20712
<SPAN
20713
CLASS="application"
20714
>SCons</SPAN
20715
> will first search the repositories
20716
specified on the command line,
20717
and then search the repositories
20718
specified in the <TT
20719
CLASS="filename"
20720
>SConstruct</TT
20721
> or <TT
20722
CLASS="filename"
20723
>SConscript</TT
20724
> files.
20725
20726
</P
20727
></DIV
20728
><DIV
20729
CLASS="section"
20730
><HR><H2
20731
CLASS="section"
20732
><A
20733
NAME="AEN3937"
20734
>23.5. Finding derived files in repositories</A
20735
></H2
20736
><P
20737
>
20738
If a repository contains not only source files,
20739
but also derived files (such as object files,
20740
libraries, or executables), <SPAN
20741
CLASS="application"
20742
>SCons</SPAN
20743
> will perform
20744
its normal MD5 signature calculation to
20745
decide if a derived file in a repository is up-to-date,
20746
or the derived file must be rebuilt in the local build directory.
20747
For the <SPAN
20748
CLASS="application"
20749
>SCons</SPAN
20750
> signature calculation to work correctly,
20751
a repository tree must contain the <TT
20752
CLASS="filename"
20753
>.sconsign</TT
20754
> files
20755
that <SPAN
20756
CLASS="application"
20757
>SCons</SPAN
20758
> uses to keep track of signature information.
20759
20760
</P
20761
><P
20762
>
20763
Usually, this would be done by a build integrator
20764
who would run <SPAN
20765
CLASS="application"
20766
>SCons</SPAN
20767
> in the repository
20768
to create all of its derived files and <TT
20769
CLASS="filename"
20770
>.sconsign</TT
20771
> files,
20772
or who would run <SPAN
20773
CLASS="application"
20774
>SCons</SPAN
20775
> in a separate build directory
20776
and copy the resulting tree to the desired repository:
20777
20778
</P
20779
><PRE
20780
CLASS="screen"
20781
> % <KBD
20782
CLASS="userinput"
20783
>cd /usr/repository1</KBD
20784
>
20785
% <KBD
20786
CLASS="userinput"
20787
>scons -Q</KBD
20788
>
20789
cc -o file1.o -c file1.c
20790
cc -o file2.o -c file2.c
20791
cc -o hello.o -c hello.c
20792
cc -o hello hello.o file1.o file2.o
20793
</PRE
20794
><P
20795
>
20796
(Note that this is safe even if the <TT
20797
CLASS="filename"
20798
>SConstruct</TT
20799
> file
20800
lists <TT
20801
CLASS="filename"
20802
>/usr/repository1</TT
20803
> as a repository,
20804
because <SPAN
20805
CLASS="application"
20806
>SCons</SPAN
20807
> will remove the current build directory
20808
from its repository list for that invocation.)
20809
20810
</P
20811
><P
20812
>
20813
Now, with the repository populated,
20814
we only need to create the one local source file
20815
we're interested in working with at the moment,
20816
and use the <TT
20817
CLASS="literal"
20818
>-Y</TT
20819
> option to
20820
tell <SPAN
20821
CLASS="application"
20822
>SCons</SPAN
20823
> to fetch any other files it needs
20824
from the repository:
20825
20826
</P
20827
><PRE
20828
CLASS="screen"
20829
> % <KBD
20830
CLASS="userinput"
20831
>cd $HOME/build</KBD
20832
>
20833
% <KBD
20834
CLASS="userinput"
20835
>edit hello.c</KBD
20836
>
20837
% <KBD
20838
CLASS="userinput"
20839
>scons -Q -Y /usr/repository1</KBD
20840
>
20841
cc -c -o hello.o hello.c
20842
cc -o hello hello.o /usr/repository1/file1.o /usr/repository1/file2.o
20843
</PRE
20844
><P
20845
>
20846
Notice that <SPAN
20847
CLASS="application"
20848
>SCons</SPAN
20849
> realizes that it does not need to
20850
rebuild local copies <TT
20851
CLASS="filename"
20852
>file1.o</TT
20853
> and <TT
20854
CLASS="filename"
20855
>file2.o</TT
20856
> files,
20857
but instead uses the already-compiled files
20858
from the repository.
20859
20860
</P
20861
></DIV
20862
><DIV
20863
CLASS="section"
20864
><HR><H2
20865
CLASS="section"
20866
><A
20867
NAME="AEN3966"
20868
>23.6. Guaranteeing local copies of files</A
20869
></H2
20870
><P
20871
>
20872
If the repository tree contains the complete results of a build,
20873
and we try to build from the repository
20874
without any files in our local tree,
20875
something moderately surprising happens:
20876
20877
</P
20878
><PRE
20879
CLASS="screen"
20880
> % <KBD
20881
CLASS="userinput"
20882
>mkdir $HOME/build2</KBD
20883
>
20884
% <KBD
20885
CLASS="userinput"
20886
>cd $HOME/build2</KBD
20887
>
20888
% <KBD
20889
CLASS="userinput"
20890
>scons -Q -Y /usr/all/repository hello</KBD
20891
>
20892
scons: `hello' is up-to-date.
20893
</PRE
20894
><P
20895
>
20896
Why does <SPAN
20897
CLASS="application"
20898
>SCons</SPAN
20899
> say that the <SPAN
20900
CLASS="application"
20901
>hello</SPAN
20902
> program
20903
is up-to-date when there is no <SPAN
20904
CLASS="application"
20905
>hello</SPAN
20906
> program
20907
in the local build directory?
20908
Because the repository (not the local directory)
20909
contains the up-to-date <SPAN
20910
CLASS="application"
20911
>hello</SPAN
20912
> program,
20913
and <SPAN
20914
CLASS="application"
20915
>SCons</SPAN
20916
> correctly determines that nothing
20917
needs to be done to rebuild that
20918
up-to-date copy of the file.
20919
20920
</P
20921
><P
20922
>
20923
There are, however, many times when you want to ensure that a
20924
local copy of a file always exists.
20925
A packaging or testing script, for example,
20926
may assume that certain generated files exist locally.
20927
To tell <SPAN
20928
CLASS="application"
20929
>SCons</SPAN
20930
> to make a copy of any up-to-date repository
20931
file in the local build directory,
20932
use the <CODE
20933
CLASS="function"
20934
>Local</CODE
20935
> function:
20936
20937
</P
20938
><PRE
20939
CLASS="programlisting"
20940
> env = Environment()
20941
hello = env.Program('hello.c')
20942
Local(hello)
20943
</PRE
20944
><P
20945
>
20946
If we then run the same command,
20947
<SPAN
20948
CLASS="application"
20949
>SCons</SPAN
20950
> will make a local copy of the program
20951
from the repository copy,
20952
and tell you that it is doing so:
20953
20954
</P
20955
><PRE
20956
CLASS="screen"
20957
> % <KBD
20958
CLASS="userinput"
20959
>scons -Y /usr/all/repository hello</KBD
20960
>
20961
Local copy of hello from /usr/all/repository/hello
20962
scons: `hello' is up-to-date.
20963
</PRE
20964
><P
20965
>
20966
(Notice that, because the act of making the local copy
20967
is not considered a "build" of the <SPAN
20968
CLASS="application"
20969
>hello</SPAN
20970
> file,
20971
<SPAN
20972
CLASS="application"
20973
>SCons</SPAN
20974
> still reports that it is up-to-date.)
20975
20976
</P
20977
></DIV
20978
></DIV
20979
><DIV
20980
CLASS="chapter"
20981
><HR><H1
20982
><A
20983
NAME="chap-sconf"
20984
></A
20985
>Chapter 24. Multi-Platform Configuration (<SPAN
20986
CLASS="application"
20987
>Autoconf</SPAN
20988
> Functionality)</H1
20989
><P
20990
>
20991
<SPAN
20992
CLASS="application"
20993
>SCons</SPAN
20994
> has integrated support for multi-platform build configuration
20995
similar to that offered by GNU <SPAN
20996
CLASS="application"
20997
>Autoconf</SPAN
20998
>,
20999
such as
21000
figuring out what libraries or header files
21001
are available on the local system.
21002
This section describes how to use
21003
this <SPAN
21004
CLASS="application"
21005
>SCons</SPAN
21006
> feature.
21007
21008
</P
21009
><DIV
21010
CLASS="note"
21011
><P
21012
></P
21013
><TABLE
21014
CLASS="note"
21015
WIDTH="100%"
21016
BORDER="0"
21017
><TR
21018
><TD
21019
WIDTH="25"
21020
ALIGN="CENTER"
21021
VALIGN="TOP"
21022
><IMG
21023
SRC="../images/note.gif"
21024
HSPACE="5"
21025
ALT="Note"></TD
21026
><TD
21027
ALIGN="LEFT"
21028
VALIGN="TOP"
21029
><P
21030
> This chapter is still under development,
21031
so not everything is explained as well as it should be.
21032
See the <SPAN
21033
CLASS="application"
21034
>SCons</SPAN
21035
> man page for additional information.
21036
</P
21037
></TD
21038
></TR
21039
></TABLE
21040
></DIV
21041
><DIV
21042
CLASS="section"
21043
><HR><H2
21044
CLASS="section"
21045
><A
21046
NAME="AEN4000"
21047
>24.1. <TT
21048
CLASS="literal"
21049
>Configure Contexts</TT
21050
></A
21051
></H2
21052
><P
21053
>
21054
The basic framework for multi-platform build configuration
21055
in <SPAN
21056
CLASS="application"
21057
>SCons</SPAN
21058
> is to attach a <TT
21059
CLASS="literal"
21060
>configure context</TT
21061
> to a
21062
construction environment by calling the <CODE
21063
CLASS="function"
21064
>Configure</CODE
21065
> function,
21066
perform a number of checks for
21067
libraries, functions, header files, etc.,
21068
and to then call the configure context's <CODE
21069
CLASS="function"
21070
>Finish</CODE
21071
> method
21072
to finish off the configuration:
21073
21074
</P
21075
><PRE
21076
CLASS="programlisting"
21077
> env = Environment()
21078
conf = Configure(env)
21079
# Checks for libraries, header files, etc. go here!
21080
env = conf.Finish()
21081
</PRE
21082
><P
21083
>
21084
<SPAN
21085
CLASS="application"
21086
>SCons</SPAN
21087
> provides a number of basic checks,
21088
as well as a mechanism for adding your own custom checks.
21089
21090
</P
21091
><P
21092
>
21093
Note that <SPAN
21094
CLASS="application"
21095
>SCons</SPAN
21096
> uses its own dependency
21097
mechanism to determine when a check
21098
needs to be run--that is,
21099
<SPAN
21100
CLASS="application"
21101
>SCons</SPAN
21102
> does not run the checks
21103
every time it is invoked,
21104
but caches the values returned by previous checks
21105
and uses the cached values unless something has changed.
21106
This saves a tremendous amount
21107
of developer time while working on
21108
cross-platform build issues.
21109
21110
</P
21111
><P
21112
>
21113
The next sections describe
21114
the basic checks that <SPAN
21115
CLASS="application"
21116
>SCons</SPAN
21117
> supports,
21118
as well as how to add your own custom checks.
21119
21120
</P
21121
></DIV
21122
><DIV
21123
CLASS="section"
21124
><HR><H2
21125
CLASS="section"
21126
><A
21127
NAME="AEN4016"
21128
>24.2. Checking for the Existence of Header Files</A
21129
></H2
21130
><P
21131
>
21132
Testing the existence of a header file
21133
requires knowing what language the header file is.
21134
A configure context has a <CODE
21135
CLASS="function"
21136
>CheckCHeader</CODE
21137
> method
21138
that checks for the existence of a C header file:
21139
21140
</P
21141
><PRE
21142
CLASS="programlisting"
21143
> env = Environment()
21144
conf = Configure(env)
21145
if not conf.CheckCHeader('math.h'):
21146
print 'Math.h must be installed!'
21147
Exit(1)
21148
if conf.CheckCHeader('foo.h'):
21149
conf.env.Append('-DHAS_FOO_H')
21150
env = conf.Finish()
21151
</PRE
21152
><P
21153
>
21154
Note that you can choose to terminate
21155
the build if a given header file doesn't exist,
21156
or you can modify the construction environment
21157
based on the existence of a header file.
21158
21159
</P
21160
><P
21161
>
21162
If you need to check for the existence
21163
a C++ header file,
21164
use the <CODE
21165
CLASS="function"
21166
>CheckCXXHeader</CODE
21167
> method:
21168
21169
</P
21170
><PRE
21171
CLASS="programlisting"
21172
> env = Environment()
21173
conf = Configure(env)
21174
if not conf.CheckCXXHeader('vector.h'):
21175
print 'vector.h must be installed!'
21176
Exit(1)
21177
env = conf.Finish()
21178
</PRE
21179
></DIV
21180
><DIV
21181
CLASS="section"
21182
><HR><H2
21183
CLASS="section"
21184
><A
21185
NAME="AEN4025"
21186
>24.3. Checking for the Availability of a Function</A
21187
></H2
21188
><P
21189
>
21190
Check for the availability of a specific function
21191
using the <CODE
21192
CLASS="function"
21193
>CheckFunc</CODE
21194
> method:
21195
21196
</P
21197
><PRE
21198
CLASS="programlisting"
21199
> env = Environment()
21200
conf = Configure(env)
21201
if not conf.CheckFunc('strcpy'):
21202
print 'Did not find strcpy(), using local version'
21203
conf.env.Append('-Dstrcpy=my_local_strcpy')
21204
env = conf.Finish()
21205
</PRE
21206
></DIV
21207
><DIV
21208
CLASS="section"
21209
><HR><H2
21210
CLASS="section"
21211
><A
21212
NAME="AEN4030"
21213
>24.4. Checking for the Availability of a Library</A
21214
></H2
21215
><P
21216
>
21217
Check for the availability of a library
21218
using the <CODE
21219
CLASS="function"
21220
>CheckLib</CODE
21221
> method.
21222
You only specify the basename of the library,
21223
you don't need to add a <TT
21224
CLASS="literal"
21225
>lib</TT
21226
>
21227
prefix or a <TT
21228
CLASS="literal"
21229
>.a</TT
21230
> or <TT
21231
CLASS="literal"
21232
>.lib</TT
21233
> suffix:
21234
21235
</P
21236
><PRE
21237
CLASS="programlisting"
21238
> env = Environment()
21239
conf = Configure(env)
21240
if not conf.CheckLib('m'):
21241
print 'Did not find libm.a or m.lib, exiting!'
21242
Exit(1)
21243
env = conf.Finish()
21244
</PRE
21245
><P
21246
>
21247
Because the ability to use a library successfully
21248
often depends on having access to a header file
21249
that describes the library's interface,
21250
you can check for a library
21251
<SPAN
21252
CLASS="emphasis"
21253
><I
21254
CLASS="emphasis"
21255
>and</I
21256
></SPAN
21257
> a header file
21258
at the same time by using the
21259
<CODE
21260
CLASS="function"
21261
>CheckLibWithHeader</CODE
21262
> method:
21263
21264
</P
21265
><PRE
21266
CLASS="programlisting"
21267
> env = Environment()
21268
conf = Configure(env)
21269
if not conf.CheckLibWithHeader('m', 'math.h', 'c'):
21270
print 'Did not find libm.a or m.lib, exiting!'
21271
Exit(1)
21272
env = conf.Finish()
21273
</PRE
21274
><P
21275
>
21276
This is essentially shorthand for
21277
separate calls to the <CODE
21278
CLASS="function"
21279
>CheckHeader</CODE
21280
> and <CODE
21281
CLASS="function"
21282
>CheckLib</CODE
21283
>
21284
functions.
21285
21286
</P
21287
></DIV
21288
><DIV
21289
CLASS="section"
21290
><HR><H2
21291
CLASS="section"
21292
><A
21293
NAME="AEN4045"
21294
>24.5. Checking for the Availability of a <TT
21295
CLASS="literal"
21296
>typedef</TT
21297
></A
21298
></H2
21299
><P
21300
>
21301
Check for the availability of a <TT
21302
CLASS="literal"
21303
>typedef</TT
21304
>
21305
by using the <CODE
21306
CLASS="function"
21307
>CheckType</CODE
21308
> method:
21309
21310
</P
21311
><PRE
21312
CLASS="programlisting"
21313
> env = Environment()
21314
conf = Configure(env)
21315
if not conf.CheckType('off_t'):
21316
print 'Did not find off_t typedef, assuming int'
21317
conf.env.Append(CCFLAGS = '-Doff_t=int')
21318
env = conf.Finish()
21319
</PRE
21320
><P
21321
>
21322
You can also add a string that will be
21323
placed at the beginning of the test file
21324
that will be used to check for the <TT
21325
CLASS="literal"
21326
>typedef</TT
21327
>.
21328
This provide a way to specify
21329
files that must be included to find the <TT
21330
CLASS="literal"
21331
>typedef</TT
21332
>:
21333
21334
</P
21335
><PRE
21336
CLASS="programlisting"
21337
> env = Environment()
21338
conf = Configure(env)
21339
if not conf.CheckType('off_t', '#include <sys/types.h>\n'):
21340
print 'Did not find off_t typedef, assuming int'
21341
conf.env.Append(CCFLAGS = '-Doff_t=int')
21342
env = conf.Finish()
21343
</PRE
21344
></DIV
21345
><DIV
21346
CLASS="section"
21347
><HR><H2
21348
CLASS="section"
21349
><A
21350
NAME="AEN4056"
21351
>24.6. Adding Your Own Custom Checks</A
21352
></H2
21353
><P
21354
>
21355
A custom check is a Python function
21356
that checks for a certain condition to exist
21357
on the running system,
21358
usually using methods that <SPAN
21359
CLASS="application"
21360
>SCons</SPAN
21361
>
21362
supplies to take care of the details
21363
of checking whether a compilation succeeds,
21364
a link succeeds,
21365
a program is runnable,
21366
etc.
21367
A simple custom check for the existence of
21368
a specific library might look as follows:
21369
21370
</P
21371
><PRE
21372
CLASS="programlisting"
21373
> mylib_test_source_file = """
21374
#include <mylib.h>
21375
int main(int argc, char **argv)
21376
{
21377
MyLibrary mylib(argc, argv);
21378
return 0;
21379
}
21380
"""
21381
21382
def CheckMyLibrary(context):
21383
context.Message('Checking for MyLibrary...')
21384
result = context.TryLink(mylib_test_source_file, '.c')
21385
context.Result(result)
21386
return result
21387
</PRE
21388
><P
21389
>
21390
The <CODE
21391
CLASS="function"
21392
>Message</CODE
21393
> and <CODE
21394
CLASS="function"
21395
>Result</CODE
21396
> methods
21397
should typically begin and end a custom check to
21398
let the user know what's going on:
21399
the <CODE
21400
CLASS="function"
21401
>Message</CODE
21402
> call prints the
21403
specified message (with no trailing newline)
21404
and the <CODE
21405
CLASS="function"
21406
>Result</CODE
21407
> call prints
21408
<TT
21409
CLASS="literal"
21410
>ok</TT
21411
> if the check succeeds and
21412
<TT
21413
CLASS="literal"
21414
>failed</TT
21415
> if it doesn't.
21416
The <CODE
21417
CLASS="function"
21418
>TryLink</CODE
21419
> method
21420
actually tests for whether the
21421
specified program text
21422
will successfully link.
21423
21424
</P
21425
><P
21426
>
21427
(Note that a custom check can modify
21428
its check based on any arguments you
21429
choose to pass it,
21430
or by using or modifying the configure context environment
21431
in the <TT
21432
CLASS="literal"
21433
>context.env</TT
21434
> attribute.)
21435
21436
</P
21437
><P
21438
>
21439
This custom check function is
21440
then attached to the <TT
21441
CLASS="literal"
21442
>configure context</TT
21443
>
21444
by passing a dictionary
21445
to the <CODE
21446
CLASS="function"
21447
>Configure</CODE
21448
> call
21449
that maps a name of the check
21450
to the underlying function:
21451
21452
</P
21453
><PRE
21454
CLASS="programlisting"
21455
> env = Environment()
21456
conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary})
21457
</PRE
21458
><P
21459
>
21460
You'll typically want to make
21461
the check and the function name the same,
21462
as we've done here,
21463
to avoid potential confusion.
21464
21465
</P
21466
><P
21467
>
21468
We can then put these pieces together
21469
and actually call the <TT
21470
CLASS="literal"
21471
>CheckMyLibrary</TT
21472
> check
21473
as follows:
21474
21475
</P
21476
><PRE
21477
CLASS="programlisting"
21478
> mylib_test_source_file = """
21479
#include <mylib.h>
21480
int main(int argc, char **argv)
21481
{
21482
MyLibrary mylib(argc, argv);
21483
return 0;
21484
}
21485
"""
21486
21487
def CheckMyLibrary(context):
21488
context.Message('Checking for MyLibrary... ')
21489
result = context.TryLink(mylib_test_source_file, '.c')
21490
context.Result(result)
21491
return result
21492
21493
env = Environment()
21494
conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary})
21495
if not conf.CheckMyLibrary():
21496
print 'MyLibrary is not installed!'
21497
Exit(1)
21498
env = conf.Finish()
21499
21500
# We would then add actual calls like Program() to build
21501
# something using the "env" construction environment.
21502
</PRE
21503
><P
21504
>
21505
If MyLibrary is not installed on the system,
21506
the output will look like:
21507
21508
</P
21509
><PRE
21510
CLASS="screen"
21511
> % <KBD
21512
CLASS="userinput"
21513
>scons</KBD
21514
>
21515
scons: Reading SConscript file ...
21516
Checking for MyLibrary... failed
21517
MyLibrary is not installed!
21518
</PRE
21519
><P
21520
>
21521
If MyLibrary is installed,
21522
the output will look like:
21523
21524
</P
21525
><PRE
21526
CLASS="screen"
21527
> % <KBD
21528
CLASS="userinput"
21529
>scons</KBD
21530
>
21531
scons: Reading SConscript file ...
21532
Checking for MyLibrary... failed
21533
scons: done reading SConscript
21534
scons: Building targets ...
21535
.
21536
.
21537
.
21538
</PRE
21539
></DIV
21540
><DIV
21541
CLASS="section"
21542
><HR><H2
21543
CLASS="section"
21544
><A
21545
NAME="AEN4085"
21546
>24.7. Not Configuring When Cleaning Targets</A
21547
></H2
21548
><P
21549
>
21550
Using multi-platform configuration
21551
as described in the previous sections
21552
will run the configuration commands
21553
even when invoking
21554
<KBD
21555
CLASS="userinput"
21556
>scons -c</KBD
21557
>
21558
to clean targets:
21559
21560
</P
21561
><PRE
21562
CLASS="screen"
21563
> % <KBD
21564
CLASS="userinput"
21565
>scons -Q -c</KBD
21566
>
21567
Checking for MyLibrary... ok
21568
Removed foo.o
21569
Removed foo
21570
</PRE
21571
><P
21572
>
21573
Although running the platform checks
21574
when removing targets doesn't hurt anything,
21575
it's usually unnecessary.
21576
You can avoid this by using the
21577
<CODE
21578
CLASS="function"
21579
>GetOption</CODE
21580
>(); method to
21581
check whether the <CODE
21582
CLASS="option"
21583
>-c</CODE
21584
> (clean)
21585
option has been invoked on the command line:
21586
21587
</P
21588
><PRE
21589
CLASS="programlisting"
21590
> env = Environment()
21591
if not env.GetOption('clean'):
21592
conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary})
21593
if not conf.CheckMyLibrary():
21594
print 'MyLibrary is not installed!'
21595
Exit(1)
21596
env = conf.Finish()
21597
</PRE
21598
><PRE
21599
CLASS="screen"
21600
> % <KBD
21601
CLASS="userinput"
21602
>scons -Q -c</KBD
21603
>
21604
Removed foo.o
21605
Removed foo
21606
</PRE
21607
></DIV
21608
></DIV
21609
><DIV
21610
CLASS="chapter"
21611
><HR><H1
21612
><A
21613
NAME="chap-caching"
21614
></A
21615
>Chapter 25. Caching Built Files</H1
21616
><P
21617
>
21618
On multi-developer software projects,
21619
you can sometimes speed up every developer's builds a lot by
21620
allowing them to share the derived files that they build.
21621
<SPAN
21622
CLASS="application"
21623
>SCons</SPAN
21624
> makes this easy, as well as reliable.
21625
21626
</P
21627
><DIV
21628
CLASS="section"
21629
><HR><H2
21630
CLASS="section"
21631
><A
21632
NAME="AEN4101"
21633
>25.1. Specifying the Shared Cache Directory</A
21634
></H2
21635
><P
21636
>
21637
To enable sharing of derived files,
21638
use the <CODE
21639
CLASS="function"
21640
>CacheDir</CODE
21641
> function
21642
in any <TT
21643
CLASS="filename"
21644
>SConscript</TT
21645
> file:
21646
21647
</P
21648
><PRE
21649
CLASS="programlisting"
21650
> CacheDir('/usr/local/build_cache')
21651
</PRE
21652
><P
21653
>
21654
Note that the directory you specify must already exist
21655
and be readable and writable by all developers
21656
who will be sharing derived files.
21657
It should also be in some central location
21658
that all builds will be able to access.
21659
In environments where developers are using separate systems
21660
(like individual workstations) for builds,
21661
this directory would typically be
21662
on a shared or NFS-mounted file system.
21663
21664
</P
21665
><P
21666
>
21667
Here's what happens:
21668
When a build has a <CODE
21669
CLASS="function"
21670
>CacheDir</CODE
21671
> specified,
21672
every time a file is built,
21673
it is stored in the shared cache directory
21674
along with its MD5 build signature.
21675
<A
21676
NAME="AEN4110"
21677
HREF="#FTN.AEN4110"
21678
><SPAN
21679
CLASS="footnote"
21680
>[5]</SPAN
21681
></A
21682
>
21683
On subsequent builds,
21684
before an action is invoked to build a file,
21685
<SPAN
21686
CLASS="application"
21687
>SCons</SPAN
21688
> will check the shared cache directory
21689
to see if a file with the exact same build
21690
signature already exists.
21691
If so, the derived file will not be built locally,
21692
but will be copied into the local build directory
21693
from the shared cache directory,
21694
like so:
21695
21696
</P
21697
><PRE
21698
CLASS="screen"
21699
> % <KBD
21700
CLASS="userinput"
21701
>scons -Q</KBD
21702
>
21703
cc -o hello.o -c hello.c
21704
cc -o hello hello.o
21705
% <KBD
21706
CLASS="userinput"
21707
>scons -Q -c</KBD
21708
>
21709
Removed hello.o
21710
Removed hello
21711
% <KBD
21712
CLASS="userinput"
21713
>scons -Q</KBD
21714
>
21715
Retrieved `hello.o' from cache
21716
Retrieved `hello' from cache
21717
</PRE
21718
><P
21719
>
21720
Note that the <CODE
21721
CLASS="function"
21722
>CacheDir</CODE
21723
> feature still calculates
21724
MD5 build sigantures for the shared cache file names
21725
even if you configure <SPAN
21726
CLASS="application"
21727
>SCons</SPAN
21728
> to use timestamps
21729
to decide if files are up to date.
21730
(See the <A
21731
HREF="#chap-depends"
21732
>Chapter 6</A
21733
>
21734
chapter for information about the <CODE
21735
CLASS="function"
21736
>Decider</CODE
21737
> function.)
21738
Consequently, using <CODE
21739
CLASS="function"
21740
>CacheDir</CODE
21741
> may reduce or eliminate any
21742
potential performance improvements
21743
from using timestamps for up-to-date decisions.
21744
21745
</P
21746
></DIV
21747
><DIV
21748
CLASS="section"
21749
><HR><H2
21750
CLASS="section"
21751
><A
21752
NAME="AEN4123"
21753
>25.2. Keeping Build Output Consistent</A
21754
></H2
21755
><P
21756
>
21757
One potential drawback to using a shared cache
21758
is that the output printed by <SPAN
21759
CLASS="application"
21760
>SCons</SPAN
21761
>
21762
can be inconsistent from invocation to invocation,
21763
because any given file may be rebuilt one time
21764
and retrieved from the shared cache the next time.
21765
This can make analyzing build output more difficult,
21766
especially for automated scripts that
21767
expect consistent output each time.
21768
21769
</P
21770
><P
21771
>
21772
If, however, you use the <TT
21773
CLASS="literal"
21774
>--cache-show</TT
21775
> option,
21776
<SPAN
21777
CLASS="application"
21778
>SCons</SPAN
21779
> will print the command line that it
21780
<SPAN
21781
CLASS="emphasis"
21782
><I
21783
CLASS="emphasis"
21784
>would</I
21785
></SPAN
21786
> have executed
21787
to build the file,
21788
even when it is retrieving the file from the shared cache.
21789
This makes the build output consistent
21790
every time the build is run:
21791
21792
</P
21793
><PRE
21794
CLASS="screen"
21795
> % <KBD
21796
CLASS="userinput"
21797
>scons -Q</KBD
21798
>
21799
cc -o hello.o -c hello.c
21800
cc -o hello hello.o
21801
% <KBD
21802
CLASS="userinput"
21803
>scons -Q -c</KBD
21804
>
21805
Removed hello.o
21806
Removed hello
21807
% <KBD
21808
CLASS="userinput"
21809
>scons -Q --cache-show</KBD
21810
>
21811
cc -o hello.o -c hello.c
21812
cc -o hello hello.o
21813
</PRE
21814
><P
21815
>
21816
The trade-off, of course, is that you no longer
21817
know whether or not <SPAN
21818
CLASS="application"
21819
>SCons</SPAN
21820
>
21821
has retrieved a derived file from cache
21822
or has rebuilt it locally.
21823
21824
</P
21825
></DIV
21826
><DIV
21827
CLASS="section"
21828
><HR><H2
21829
CLASS="section"
21830
><A
21831
NAME="AEN4137"
21832
>25.3. Not Using the Shared Cache for Specific Files</A
21833
></H2
21834
><P
21835
>
21836
You may want to disable caching for certain
21837
specific files in your configuration.
21838
For example, if you only want to put
21839
executable files in a central cache,
21840
but not the intermediate object files,
21841
you can use the <CODE
21842
CLASS="function"
21843
>NoCache</CODE
21844
>
21845
function to specify that the
21846
object files should not be cached:
21847
21848
</P
21849
><PRE
21850
CLASS="programlisting"
21851
> env = Environment()
21852
obj = env.Object('hello.c')
21853
env.Program('hello.c')
21854
CacheDir('cache')
21855
NoCache('hello.o')
21856
</PRE
21857
><P
21858
>
21859
Then when you run <SPAN
21860
CLASS="application"
21861
>scons</SPAN
21862
> after cleaning
21863
the built targets,
21864
it will recompile the object file locally
21865
(since it doesn't exist in the shared cache directory),
21866
but still realize that the shared cache directory
21867
contains an up-to-date executable program
21868
that can be retrieved instead of re-linking:
21869
21870
</P
21871
><PRE
21872
CLASS="screen"
21873
> % <KBD
21874
CLASS="userinput"
21875
>scons -Q</KBD
21876
>
21877
cc -o hello.o -c hello.c
21878
cc -o hello hello.o
21879
% <KBD
21880
CLASS="userinput"
21881
>scons -Q -c</KBD
21882
>
21883
Removed hello.o
21884
Removed hello
21885
% <KBD
21886
CLASS="userinput"
21887
>scons -Q</KBD
21888
>
21889
cc -o hello.o -c hello.c
21890
Retrieved `hello' from cache
21891
</PRE
21892
></DIV
21893
><DIV
21894
CLASS="section"
21895
><HR><H2
21896
CLASS="section"
21897
><A
21898
NAME="AEN4148"
21899
>25.4. Disabling the Shared Cache</A
21900
></H2
21901
><P
21902
>
21903
Retrieving an already-built file
21904
from the shared cache
21905
is usually a significant time-savings
21906
over rebuilding the file,
21907
but how much of a savings
21908
(or even whether it saves time at all)
21909
can depend a great deal on your
21910
system or network configuration.
21911
For example, retrieving cached files
21912
from a busy server over a busy network
21913
might end up being slower than
21914
rebuilding the files locally.
21915
21916
</P
21917
><P
21918
>
21919
In these cases, you can specify
21920
the <TT
21921
CLASS="literal"
21922
>--cache-disable</TT
21923
>
21924
command-line option to tell <SPAN
21925
CLASS="application"
21926
>SCons</SPAN
21927
>
21928
to not retrieve already-built files from the
21929
shared cache directory:
21930
21931
</P
21932
><PRE
21933
CLASS="screen"
21934
> % <KBD
21935
CLASS="userinput"
21936
>scons -Q</KBD
21937
>
21938
cc -o hello.o -c hello.c
21939
cc -o hello hello.o
21940
% <KBD
21941
CLASS="userinput"
21942
>scons -Q -c</KBD
21943
>
21944
Removed hello.o
21945
Removed hello
21946
% <KBD
21947
CLASS="userinput"
21948
>scons -Q</KBD
21949
>
21950
Retrieved `hello.o' from cache
21951
Retrieved `hello' from cache
21952
% <KBD
21953
CLASS="userinput"
21954
>scons -Q -c</KBD
21955
>
21956
Removed hello.o
21957
Removed hello
21958
% <KBD
21959
CLASS="userinput"
21960
>scons -Q --cache-disable</KBD
21961
>
21962
cc -o hello.o -c hello.c
21963
cc -o hello hello.o
21964
</PRE
21965
></DIV
21966
><DIV
21967
CLASS="section"
21968
><HR><H2
21969
CLASS="section"
21970
><A
21971
NAME="AEN4160"
21972
>25.5. Populating a Shared Cache With Already-Built Files</A
21973
></H2
21974
><P
21975
>
21976
Sometimes, you may have one or more derived files
21977
already built in your local build tree
21978
that you wish to make available to other people doing builds.
21979
For example, you may find it more effective to perform
21980
integration builds with the cache disabled
21981
(per the previous section)
21982
and only populate the shared cache directory
21983
with the built files after the integration build
21984
has completed successfully.
21985
This way, the cache will only get filled up
21986
with derived files that are part of a complete, successful build
21987
not with files that might be later overwritten
21988
while you debug integration problems.
21989
21990
</P
21991
><P
21992
>
21993
In this case, you can use the
21994
the <TT
21995
CLASS="literal"
21996
>--cache-force</TT
21997
> option
21998
to tell <SPAN
21999
CLASS="application"
22000
>SCons</SPAN
22001
> to put all derived files in the cache,
22002
even if the files already exist in your local tree
22003
from having been built by a previous invocation:
22004
22005
</P
22006
><PRE
22007
CLASS="screen"
22008
> % <KBD
22009
CLASS="userinput"
22010
>scons -Q --cache-disable</KBD
22011
>
22012
cc -o hello.o -c hello.c
22013
cc -o hello hello.o
22014
% <KBD
22015
CLASS="userinput"
22016
>scons -Q -c</KBD
22017
>
22018
Removed hello.o
22019
Removed hello
22020
% <KBD
22021
CLASS="userinput"
22022
>scons -Q --cache-disable</KBD
22023
>
22024
cc -o hello.o -c hello.c
22025
cc -o hello hello.o
22026
% <KBD
22027
CLASS="userinput"
22028
>scons -Q --cache-force</KBD
22029
>
22030
scons: `.' is up to date.
22031
% <KBD
22032
CLASS="userinput"
22033
>scons -Q</KBD
22034
>
22035
scons: `.' is up to date.
22036
</PRE
22037
><P
22038
>
22039
Notice how the above sample run
22040
demonstrates that the <TT
22041
CLASS="literal"
22042
>--cache-disable</TT
22043
>
22044
option avoids putting the built
22045
<TT
22046
CLASS="filename"
22047
>hello.o</TT
22048
>
22049
and
22050
<TT
22051
CLASS="filename"
22052
>hello</TT
22053
> files in the cache,
22054
but after using the <TT
22055
CLASS="literal"
22056
>--cache-force</TT
22057
> option,
22058
the files have been put in the cache
22059
for the next invocation to retrieve.
22060
22061
</P
22062
></DIV
22063
><DIV
22064
CLASS="section"
22065
><HR><H2
22066
CLASS="section"
22067
><A
22068
NAME="AEN4177"
22069
>25.6. Minimizing Cache Contention: the <TT
22070
CLASS="literal"
22071
>--random</TT
22072
> Option</A
22073
></H2
22074
><P
22075
>
22076
If you allow multiple builds to update the
22077
shared cache directory simultaneously,
22078
two builds that occur at the same time
22079
can sometimes start "racing"
22080
with one another to build the same files
22081
in the same order.
22082
If, for example,
22083
you are linking multiple files into an executable program:
22084
22085
</P
22086
><PRE
22087
CLASS="programlisting"
22088
> Program('prog',
22089
['f1.c', 'f2.c', 'f3.c', 'f4.c', 'f5.c'])
22090
</PRE
22091
><P
22092
>
22093
<SPAN
22094
CLASS="application"
22095
>SCons</SPAN
22096
> will normally build the input object files
22097
on which the program depends in their normal, sorted order:
22098
22099
</P
22100
><PRE
22101
CLASS="screen"
22102
> % <KBD
22103
CLASS="userinput"
22104
>scons -Q</KBD
22105
>
22106
cc -o f1.o -c f1.c
22107
cc -o f2.o -c f2.c
22108
cc -o f3.o -c f3.c
22109
cc -o f4.o -c f4.c
22110
cc -o f5.o -c f5.c
22111
cc -o prog f1.o f2.o f3.o f4.o f5.o
22112
</PRE
22113
><P
22114
>
22115
But if two such builds take place simultaneously,
22116
they may each look in the cache at nearly the same
22117
time and both decide that <TT
22118
CLASS="filename"
22119
>f1.o</TT
22120
>
22121
must be rebuilt and pushed into the shared cache directory,
22122
then both decide that <TT
22123
CLASS="filename"
22124
>f2.o</TT
22125
>
22126
must be rebuilt (and pushed into the shared cache directory),
22127
then both decide that <TT
22128
CLASS="filename"
22129
>f3.o</TT
22130
>
22131
must be rebuilt...
22132
This won't cause any actual build problems--both
22133
builds will succeed,
22134
generate correct output files,
22135
and populate the cache--but
22136
it does represent wasted effort.
22137
22138
</P
22139
><P
22140
>
22141
To alleviate such contention for the cache,
22142
you can use the <TT
22143
CLASS="literal"
22144
>--random</TT
22145
> command-line option
22146
to tell <SPAN
22147
CLASS="application"
22148
>SCons</SPAN
22149
> to build dependencies
22150
in a random order:
22151
22152
</P
22153
><PRE
22154
CLASS="screen"
22155
> % <KBD
22156
CLASS="userinput"
22157
>scons -Q --random</KBD
22158
>
22159
cc -o f3.o -c f3.c
22160
cc -o f1.o -c f1.c
22161
cc -o f5.o -c f5.c
22162
cc -o f2.o -c f2.c
22163
cc -o f4.o -c f4.c
22164
cc -o prog f1.o f2.o f3.o f4.o f5.o
22165
</PRE
22166
><P
22167
>
22168
Multiple builds using the <TT
22169
CLASS="literal"
22170
>--random</TT
22171
> option
22172
will usually build their dependencies in different,
22173
random orders,
22174
which minimizes the chances for a lot of
22175
contention for same-named files
22176
in the shared cache directory.
22177
Multiple simultaneous builds might still race to try to build
22178
the same target file on occasion,
22179
but long sequences of inefficient contention
22180
should be rare.
22181
22182
</P
22183
><P
22184
>
22185
Note, of course,
22186
the <TT
22187
CLASS="literal"
22188
>--random</TT
22189
> option
22190
will cause the output that <SPAN
22191
CLASS="application"
22192
>SCons</SPAN
22193
> prints
22194
to be inconsistent from invocation to invocation,
22195
which may be an issue when
22196
trying to compare output from different build runs.
22197
22198
</P
22199
><P
22200
>
22201
If you want to make sure dependencies will be built
22202
in a random order without having to specify
22203
the <TT
22204
CLASS="literal"
22205
>--random</TT
22206
> on very command line,
22207
you can use the <CODE
22208
CLASS="function"
22209
>SetOption</CODE
22210
> function to
22211
set the <TT
22212
CLASS="literal"
22213
>random</TT
22214
> option
22215
within any <TT
22216
CLASS="filename"
22217
>SConscript</TT
22218
> file:
22219
22220
</P
22221
><PRE
22222
CLASS="programlisting"
22223
> Program('prog',
22224
['f1.c', 'f2.c', 'f3.c', 'f4.c', 'f5.c'])
22225
22226
SetOption('random', 1)
22227
Program('prog',
22228
['f1.c', 'f2.c', 'f3.c', 'f4.c', 'f5.c'])
22229
</PRE
22230
></DIV
22231
></DIV
22232
><DIV
22233
CLASS="chapter"
22234
><HR><H1
22235
><A
22236
NAME="chap-alias"
22237
></A
22238
>Chapter 26. Alias Targets</H1
22239
><P
22240
>
22241
We've already seen how you can use the <CODE
22242
CLASS="function"
22243
>Alias</CODE
22244
>
22245
function to create a target named <TT
22246
CLASS="literal"
22247
>install</TT
22248
>:
22249
22250
</P
22251
><PRE
22252
CLASS="programlisting"
22253
> env = Environment()
22254
hello = env.Program('hello.c')
22255
env.Install('/usr/bin', hello)
22256
env.Alias('install', '/usr/bin')
22257
</PRE
22258
><P
22259
>
22260
You can then use this alias on the command line
22261
to tell <SPAN
22262
CLASS="application"
22263
>SCons</SPAN
22264
> more naturally that you want to install files:
22265
22266
</P
22267
><PRE
22268
CLASS="screen"
22269
> % <KBD
22270
CLASS="userinput"
22271
>scons -Q install</KBD
22272
>
22273
cc -o hello.o -c hello.c
22274
cc -o hello hello.o
22275
Install file: "hello" as "/usr/bin/hello"
22276
</PRE
22277
><P
22278
>
22279
Like other <CODE
22280
CLASS="classname"
22281
>Builder</CODE
22282
> methods, though,
22283
the <CODE
22284
CLASS="function"
22285
>Alias</CODE
22286
> method returns an object
22287
representing the alias being built.
22288
You can then use this object as input to anothother <CODE
22289
CLASS="classname"
22290
>Builder</CODE
22291
>.
22292
This is especially useful if you use such an object
22293
as input to another call to the <CODE
22294
CLASS="function"
22295
>Alias</CODE
22296
> <CODE
22297
CLASS="classname"
22298
>Builder</CODE
22299
>,
22300
allowing you to create a hierarchy
22301
of nested aliases:
22302
22303
</P
22304
><PRE
22305
CLASS="programlisting"
22306
> env = Environment()
22307
p = env.Program('foo.c')
22308
l = env.Library('bar.c')
22309
env.Install('/usr/bin', p)
22310
env.Install('/usr/lib', l)
22311
ib = env.Alias('install-bin', '/usr/bin')
22312
il = env.Alias('install-lib', '/usr/lib')
22313
env.Alias('install', [ib, il])
22314
</PRE
22315
><P
22316
>
22317
This example defines separate <TT
22318
CLASS="literal"
22319
>install</TT
22320
>,
22321
<TT
22322
CLASS="literal"
22323
>install-bin</TT
22324
>,
22325
and <TT
22326
CLASS="literal"
22327
>install-lib</TT
22328
> aliases,
22329
allowing you finer control over what gets installed:
22330
22331
</P
22332
><PRE
22333
CLASS="screen"
22334
> % <KBD
22335
CLASS="userinput"
22336
>scons -Q install-bin</KBD
22337
>
22338
cc -o foo.o -c foo.c
22339
cc -o foo foo.o
22340
Install file: "foo" as "/usr/bin/foo"
22341
% <KBD
22342
CLASS="userinput"
22343
>scons -Q install-lib</KBD
22344
>
22345
cc -o bar.o -c bar.c
22346
ar rc libbar.a bar.o
22347
ranlib libbar.a
22348
Install file: "libbar.a" as "/usr/lib/libbar.a"
22349
% <KBD
22350
CLASS="userinput"
22351
>scons -Q -c /</KBD
22352
>
22353
Removed foo.o
22354
Removed foo
22355
Removed /usr/bin/foo
22356
Removed bar.o
22357
Removed libbar.a
22358
Removed /usr/lib/libbar.a
22359
% <KBD
22360
CLASS="userinput"
22361
>scons -Q install</KBD
22362
>
22363
cc -o foo.o -c foo.c
22364
cc -o foo foo.o
22365
Install file: "foo" as "/usr/bin/foo"
22366
cc -o bar.o -c bar.c
22367
ar rc libbar.a bar.o
22368
ranlib libbar.a
22369
Install file: "libbar.a" as "/usr/lib/libbar.a"
22370
</PRE
22371
></DIV
22372
><DIV
22373
CLASS="chapter"
22374
><HR><H1
22375
><A
22376
NAME="chap-java"
22377
></A
22378
>Chapter 27. Java Builds</H1
22379
><P
22380
>
22381
So far, we've been using examples of
22382
building C and C++ programs
22383
to demonstrate the features of <SPAN
22384
CLASS="application"
22385
>SCons</SPAN
22386
>.
22387
<SPAN
22388
CLASS="application"
22389
>SCons</SPAN
22390
> also supports building Java programs,
22391
but Java builds are handled slightly differently,
22392
which reflects the ways in which
22393
the Java compiler and tools
22394
build programs differently than
22395
other languages' tool chains.
22396
22397
</P
22398
><DIV
22399
CLASS="section"
22400
><HR><H2
22401
CLASS="section"
22402
><A
22403
NAME="AEN4237"
22404
>27.1. Building Java Class Files: the <CODE
22405
CLASS="function"
22406
>Java</CODE
22407
> Builder</A
22408
></H2
22409
><P
22410
>
22411
The basic activity when programming in Java,
22412
of course, is to take one or more <TT
22413
CLASS="filename"
22414
>.java</TT
22415
> files
22416
containing Java source code
22417
and to call the Java compiler
22418
to turn them into one or more
22419
<TT
22420
CLASS="filename"
22421
>.class</TT
22422
> files.
22423
In <SPAN
22424
CLASS="application"
22425
>SCons</SPAN
22426
>, you do this
22427
by giving the <A
22428
HREF="#b-Java"
22429
><CODE
22430
CLASS="function"
22431
>Java</CODE
22432
></A
22433
> Builder
22434
a target directory in which
22435
to put the <TT
22436
CLASS="filename"
22437
>.class</TT
22438
> files,
22439
and a source directory that contains
22440
the <TT
22441
CLASS="filename"
22442
>.java</TT
22443
> files:
22444
22445
</P
22446
><PRE
22447
CLASS="programlisting"
22448
> Java('classes', 'src')
22449
</PRE
22450
><P
22451
>
22452
If the <TT
22453
CLASS="filename"
22454
>src</TT
22455
> directory contains
22456
three <TT
22457
CLASS="filename"
22458
>.java</TT
22459
> source files,
22460
then running <SPAN
22461
CLASS="application"
22462
>SCons</SPAN
22463
> might look like this:
22464
22465
</P
22466
><PRE
22467
CLASS="screen"
22468
> % <KBD
22469
CLASS="userinput"
22470
>scons -Q</KBD
22471
>
22472
javac -d classes -sourcepath src src/Example1.java src/Example2.java src/Example3.java
22473
</PRE
22474
><P
22475
>
22476
<SPAN
22477
CLASS="application"
22478
>SCons</SPAN
22479
> will actually search the <TT
22480
CLASS="filename"
22481
>src</TT
22482
>
22483
directory tree for all of the <TT
22484
CLASS="filename"
22485
>.java</TT
22486
> files.
22487
The Java compiler will then create the
22488
necessary class files in the <TT
22489
CLASS="filename"
22490
>classes</TT
22491
> subdirectory,
22492
based on the class names found in the <TT
22493
CLASS="filename"
22494
>.java</TT
22495
> files.
22496
22497
</P
22498
></DIV
22499
><DIV
22500
CLASS="section"
22501
><HR><H2
22502
CLASS="section"
22503
><A
22504
NAME="AEN4261"
22505
>27.2. How <SPAN
22506
CLASS="application"
22507
>SCons</SPAN
22508
> Handles Java Dependencies</A
22509
></H2
22510
><P
22511
>
22512
In addition to searching the source directory for
22513
<TT
22514
CLASS="filename"
22515
>.java</TT
22516
> files,
22517
<SPAN
22518
CLASS="application"
22519
>SCons</SPAN
22520
> actually runs the <TT
22521
CLASS="filename"
22522
>.java</TT
22523
> files
22524
through a stripped-down Java parser that figures out
22525
what classes are defined.
22526
In other words, <SPAN
22527
CLASS="application"
22528
>SCons</SPAN
22529
> knows,
22530
without you having to tell it,
22531
what <TT
22532
CLASS="filename"
22533
>.class</TT
22534
> files
22535
will be produced by the <SPAN
22536
CLASS="application"
22537
>javac</SPAN
22538
> call.
22539
So our one-liner example from the preceding section:
22540
22541
</P
22542
><PRE
22543
CLASS="programlisting"
22544
> Java('classes', 'src')
22545
</PRE
22546
><P
22547
>
22548
Will not only tell you reliably
22549
that the <TT
22550
CLASS="filename"
22551
>.class</TT
22552
> files
22553
in the <TT
22554
CLASS="filename"
22555
>classes</TT
22556
> subdirectory
22557
are up-to-date:
22558
22559
</P
22560
><PRE
22561
CLASS="screen"
22562
> % <KBD
22563
CLASS="userinput"
22564
>scons -Q</KBD
22565
>
22566
javac -d classes -sourcepath src src/Example1.java src/Example2.java src/Example3.java
22567
% <KBD
22568
CLASS="userinput"
22569
>scons -Q classes</KBD
22570
>
22571
scons: `classes' is up to date.
22572
</PRE
22573
><P
22574
>
22575
But it will also remove all of the generated
22576
<TT
22577
CLASS="filename"
22578
>.class</TT
22579
> files,
22580
even for inner classes,
22581
without you having to specify them manually.
22582
For example, if our
22583
<TT
22584
CLASS="filename"
22585
>Example1.java</TT
22586
>
22587
and
22588
<TT
22589
CLASS="filename"
22590
>Example3.java</TT
22591
>
22592
files both define additional classes,
22593
and the class defined in <TT
22594
CLASS="filename"
22595
>Example2.java</TT
22596
>
22597
has an inner class,
22598
running <KBD
22599
CLASS="userinput"
22600
>scons -c</KBD
22601
>
22602
will clean up all of those <TT
22603
CLASS="filename"
22604
>.class</TT
22605
> files
22606
as well:
22607
22608
</P
22609
><PRE
22610
CLASS="screen"
22611
> % <KBD
22612
CLASS="userinput"
22613
>scons -Q</KBD
22614
>
22615
javac -d classes -sourcepath src src/Example1.java src/Example2.java src/Example3.java
22616
% <KBD
22617
CLASS="userinput"
22618
>scons -Q -c classes</KBD
22619
>
22620
Removed classes/Example1.class
22621
Removed classes/AdditionalClass1.class
22622
Removed classes/Example2$Inner2.class
22623
Removed classes/Example2.class
22624
Removed classes/Example3.class
22625
Removed classes/AdditionalClass3.class
22626
</PRE
22627
></DIV
22628
><DIV
22629
CLASS="section"
22630
><HR><H2
22631
CLASS="section"
22632
><A
22633
NAME="AEN4288"
22634
>27.3. Building Java Archive (<TT
22635
CLASS="filename"
22636
>.jar</TT
22637
>) Files: the <CODE
22638
CLASS="function"
22639
>Jar</CODE
22640
> Builder</A
22641
></H2
22642
><P
22643
>
22644
After building the class files,
22645
it's common to collect them into
22646
a Java archive (<TT
22647
CLASS="filename"
22648
>.jar</TT
22649
>) file,
22650
which you do by calling the <A
22651
HREF="#b-Jar"
22652
><CODE
22653
CLASS="function"
22654
>Jar</CODE
22655
></A
22656
> Builder method.
22657
If you want to just collect all of the
22658
class files within a subdirectory,
22659
you can just specify that subdirectory
22660
as the <CODE
22661
CLASS="function"
22662
>Jar</CODE
22663
> source:
22664
22665
</P
22666
><PRE
22667
CLASS="programlisting"
22668
> Java(target = 'classes', source = 'src')
22669
Jar(target = 'test.jar', source = 'classes')
22670
</PRE
22671
><P
22672
>
22673
<SPAN
22674
CLASS="application"
22675
>SCons</SPAN
22676
> will then pass that directory
22677
to the <SPAN
22678
CLASS="application"
22679
>jar</SPAN
22680
> command,
22681
which will collect all of the underlying
22682
<TT
22683
CLASS="filename"
22684
>.class</TT
22685
> files:
22686
22687
</P
22688
><PRE
22689
CLASS="screen"
22690
> % <KBD
22691
CLASS="userinput"
22692
>scons -Q</KBD
22693
>
22694
javac -d classes -sourcepath src src/Example1.java src/Example2.java src/Example3.java
22695
jar cf test.jar classes
22696
</PRE
22697
><P
22698
>
22699
If you want to keep all of the
22700
<TT
22701
CLASS="filename"
22702
>.class</TT
22703
> files
22704
for multiple programs in one location,
22705
and only archive some of them in
22706
each <TT
22707
CLASS="filename"
22708
>.jar</TT
22709
> file,
22710
you can pass the <CODE
22711
CLASS="function"
22712
>Jar</CODE
22713
> builder a
22714
list of files as its source.
22715
It's extremely simple to create multiple
22716
<TT
22717
CLASS="filename"
22718
>.jar</TT
22719
> files this way,
22720
using the lists of target class files created
22721
by calls to the <A
22722
HREF="#b-Java"
22723
><CODE
22724
CLASS="function"
22725
>Java</CODE
22726
></A
22727
> builder
22728
as sources to the various <CODE
22729
CLASS="function"
22730
>Jar</CODE
22731
> calls:
22732
22733
</P
22734
><PRE
22735
CLASS="programlisting"
22736
> prog1_class_files = Java(target = 'classes', source = 'prog1')
22737
prog2_class_files = Java(target = 'classes', source = 'prog2')
22738
Jar(target = 'prog1.jar', source = prog1_class_files)
22739
Jar(target = 'prog2.jar', source = prog2_class_files)
22740
</PRE
22741
><P
22742
>
22743
This will then create
22744
<TT
22745
CLASS="filename"
22746
>prog1.jar</TT
22747
>
22748
and <TT
22749
CLASS="filename"
22750
>prog2.jar</TT
22751
>
22752
next to the subdirectories
22753
that contain their <TT
22754
CLASS="filename"
22755
>.java</TT
22756
> files:
22757
22758
</P
22759
><PRE
22760
CLASS="screen"
22761
> % <KBD
22762
CLASS="userinput"
22763
>scons -Q</KBD
22764
>
22765
javac -d classes -sourcepath prog1 prog1/Example1.java prog1/Example2.java
22766
javac -d classes -sourcepath prog2 prog2/Example3.java prog2/Example4.java
22767
jar cf prog1.jar -C classes Example1.class -C classes Example2.class
22768
jar cf prog2.jar -C classes Example3.class -C classes Example4.class
22769
</PRE
22770
></DIV
22771
><DIV
22772
CLASS="section"
22773
><HR><H2
22774
CLASS="section"
22775
><A
22776
NAME="AEN4319"
22777
>27.4. Building C Header and Stub Files: the <CODE
22778
CLASS="function"
22779
>JavaH</CODE
22780
> Builder</A
22781
></H2
22782
><P
22783
>
22784
You can generate C header and source files
22785
for implementing native methods,
22786
by using the <A
22787
HREF="#b-JavaH"
22788
><CODE
22789
CLASS="function"
22790
>JavaH</CODE
22791
></A
22792
> Builder.
22793
There are several ways of using the <CODE
22794
CLASS="function"
22795
>JavaH</CODE
22796
> Builder.
22797
One typical invocation might look like:
22798
22799
</P
22800
><PRE
22801
CLASS="programlisting"
22802
> classes = Java(target = 'classes', source = 'src/pkg/sub')
22803
JavaH(target = 'native', source = classes)
22804
</PRE
22805
><P
22806
>
22807
The source is a list of class files generated by the
22808
call to the <A
22809
HREF="#b-Java"
22810
><CODE
22811
CLASS="function"
22812
>Java</CODE
22813
></A
22814
> Builder,
22815
and the target is the output directory in
22816
which we want the C header files placed.
22817
The target
22818
gets converted into the <CODE
22819
CLASS="option"
22820
>-d</CODE
22821
>
22822
when <SPAN
22823
CLASS="application"
22824
>SCons</SPAN
22825
> runs <SPAN
22826
CLASS="application"
22827
>javah</SPAN
22828
>:
22829
22830
</P
22831
><PRE
22832
CLASS="screen"
22833
> % <KBD
22834
CLASS="userinput"
22835
>scons -Q</KBD
22836
>
22837
javac -d classes -sourcepath src/pkg/sub src/pkg/sub/Example1.java src/pkg/sub/Example2.java src/pkg/sub/Example3.java
22838
javah -d native -classpath classes pkg.sub.Example1 pkg.sub.Example2 pkg.sub.Example3
22839
</PRE
22840
><P
22841
>
22842
In this case,
22843
the call to <SPAN
22844
CLASS="application"
22845
>javah</SPAN
22846
>
22847
will generate the header files
22848
<TT
22849
CLASS="filename"
22850
>native/pkg_sub_Example1.h</TT
22851
>,
22852
<TT
22853
CLASS="filename"
22854
>native/pkg_sub_Example2.h</TT
22855
>
22856
and
22857
<TT
22858
CLASS="filename"
22859
>native/pkg_sub_Example3.h</TT
22860
>.
22861
Notice that <SPAN
22862
CLASS="application"
22863
>SCons</SPAN
22864
> remembered that the class
22865
files were generated with a target directory of
22866
<TT
22867
CLASS="filename"
22868
>classes</TT
22869
>,
22870
and that it then specified that target directory
22871
as the <CODE
22872
CLASS="option"
22873
>-classpath</CODE
22874
> option
22875
to the call to <SPAN
22876
CLASS="application"
22877
>javah</SPAN
22878
>.
22879
22880
</P
22881
><P
22882
>
22883
Although it's more convenient to use
22884
the list of class files returned by
22885
the <CODE
22886
CLASS="function"
22887
>Java</CODE
22888
> Builder
22889
as the source of a call to the <CODE
22890
CLASS="function"
22891
>JavaH</CODE
22892
> Builder,
22893
you <SPAN
22894
CLASS="emphasis"
22895
><I
22896
CLASS="emphasis"
22897
>can</I
22898
></SPAN
22899
>
22900
specify the list of class files
22901
by hand, if you prefer.
22902
If you do,
22903
you need to set the
22904
<A
22905
HREF="#cv-JAVACLASSDIR"
22906
><CODE
22907
CLASS="envar"
22908
>$JAVACLASSDIR</CODE
22909
></A
22910
> construction variable
22911
when calling <CODE
22912
CLASS="function"
22913
>JavaH</CODE
22914
>:
22915
22916
</P
22917
><PRE
22918
CLASS="programlisting"
22919
> Java(target = 'classes', source = 'src/pkg/sub')
22920
class_file_list = ['classes/pkg/sub/Example1.class',
22921
'classes/pkg/sub/Example2.class',
22922
'classes/pkg/sub/Example3.class']
22923
JavaH(target = 'native', source = class_file_list, JAVACLASSDIR = 'classes')
22924
</PRE
22925
><P
22926
>
22927
The <CODE
22928
CLASS="envar"
22929
>$JAVACLASSDIR</CODE
22930
> value then
22931
gets converted into the <CODE
22932
CLASS="option"
22933
>-classpath</CODE
22934
>
22935
when <SPAN
22936
CLASS="application"
22937
>SCons</SPAN
22938
> runs <SPAN
22939
CLASS="application"
22940
>javah</SPAN
22941
>:
22942
22943
</P
22944
><PRE
22945
CLASS="screen"
22946
> % <KBD
22947
CLASS="userinput"
22948
>scons -Q</KBD
22949
>
22950
javac -d classes -sourcepath src/pkg/sub src/pkg/sub/Example1.java src/pkg/sub/Example2.java src/pkg/sub/Example3.java
22951
javah -d native -classpath classes pkg.sub.Example1 pkg.sub.Example2 pkg.sub.Example3
22952
</PRE
22953
><P
22954
>
22955
Lastly, if you don't want a separate header file
22956
generated for each source file,
22957
you can specify an explicit File Node
22958
as the target of the <CODE
22959
CLASS="function"
22960
>JavaH</CODE
22961
> Builder:
22962
22963
</P
22964
><PRE
22965
CLASS="programlisting"
22966
> classes = Java(target = 'classes', source = 'src/pkg/sub')
22967
JavaH(target = File('native.h'), source = classes)
22968
</PRE
22969
><P
22970
>
22971
Because <SPAN
22972
CLASS="application"
22973
>SCons</SPAN
22974
> assumes by default
22975
that the target of the <CODE
22976
CLASS="function"
22977
>JavaH</CODE
22978
> builder is a directory,
22979
you need to use the <CODE
22980
CLASS="function"
22981
>File</CODE
22982
> function
22983
to make sure that <SPAN
22984
CLASS="application"
22985
>SCons</SPAN
22986
> doesn't
22987
create a directory named <TT
22988
CLASS="filename"
22989
>native.h</TT
22990
>.
22991
When a file is used, though,
22992
<SPAN
22993
CLASS="application"
22994
>SCons</SPAN
22995
> correctly converts the file name
22996
into the <SPAN
22997
CLASS="application"
22998
>javah</SPAN
22999
> <CODE
23000
CLASS="option"
23001
>-o</CODE
23002
> option:
23003
23004
</P
23005
><PRE
23006
CLASS="screen"
23007
> % <KBD
23008
CLASS="userinput"
23009
>scons -Q</KBD
23010
>
23011
javac -d classes -sourcepath src/pkg/sub src/pkg/sub/Example1.java src/pkg/sub/Example2.java src/pkg/sub/Example3.java
23012
javah -o native.h -classpath classes pkg.sub.Example1 pkg.sub.Example2 pkg.sub.Example3
23013
</PRE
23014
></DIV
23015
><DIV
23016
CLASS="section"
23017
><HR><H2
23018
CLASS="section"
23019
><A
23020
NAME="AEN4373"
23021
>27.5. Building RMI Stub and Skeleton Class Files: the <CODE
23022
CLASS="function"
23023
>RMIC</CODE
23024
> Builder</A
23025
></H2
23026
><P
23027
>
23028
You can generate Remote Method Invocation stubs
23029
by using the <A
23030
HREF="#b-RMIC"
23031
><CODE
23032
CLASS="function"
23033
>RMIC</CODE
23034
></A
23035
> Builder.
23036
The source is a list of directories,
23037
typically returned by a call to the <A
23038
HREF="#b-Java"
23039
><CODE
23040
CLASS="function"
23041
>Java</CODE
23042
></A
23043
> Builder,
23044
and the target is an output directory
23045
where the <TT
23046
CLASS="filename"
23047
>_Stub.class</TT
23048
>
23049
and <TT
23050
CLASS="filename"
23051
>_Skel.class</TT
23052
> files will
23053
be placed:
23054
23055
</P
23056
><PRE
23057
CLASS="programlisting"
23058
> classes = Java(target = 'classes', source = 'src/pkg/sub')
23059
RMIC(target = 'outdir', source = classes)
23060
</PRE
23061
><P
23062
>
23063
As it did with the <A
23064
HREF="#b-JavaH"
23065
><CODE
23066
CLASS="function"
23067
>JavaH</CODE
23068
></A
23069
> Builder,
23070
<SPAN
23071
CLASS="application"
23072
>SCons</SPAN
23073
> remembers the class directory
23074
and passes it as the <CODE
23075
CLASS="option"
23076
>-classpath</CODE
23077
> option
23078
to <SPAN
23079
CLASS="application"
23080
>rmic</SPAN
23081
>:
23082
23083
</P
23084
><PRE
23085
CLASS="screen"
23086
> % <KBD
23087
CLASS="userinput"
23088
>scons -Q</KBD
23089
>
23090
javac -d classes -sourcepath src/pkg/sub src/pkg/sub/Example1.java src/pkg/sub/Example2.java
23091
rmic -d outdir -classpath classes pkg.sub.Example1 pkg.sub.Example2
23092
</PRE
23093
><P
23094
>
23095
This example would generate the files
23096
<TT
23097
CLASS="filename"
23098
>outdir/pkg/sub/Example1_Skel.class</TT
23099
>,
23100
<TT
23101
CLASS="filename"
23102
>outdir/pkg/sub/Example1_Stub.class</TT
23103
>,
23104
<TT
23105
CLASS="filename"
23106
>outdir/pkg/sub/Example2_Skel.class</TT
23107
> and
23108
<TT
23109
CLASS="filename"
23110
>outdir/pkg/sub/Example2_Stub.class</TT
23111
>.
23112
23113
</P
23114
></DIV
23115
></DIV
23116
><DIV
23117
CLASS="chapter"
23118
><HR><H1
23119
><A
23120
NAME="chap-misc"
23121
></A
23122
>Chapter 28. Miscellaneous Functionality</H1
23123
><P
23124
>
23125
<SPAN
23126
CLASS="application"
23127
>SCons</SPAN
23128
> supports a lot of additional functionality
23129
that doesn't readily fit into the other chapters.
23130
23131
</P
23132
><DIV
23133
CLASS="section"
23134
><HR><H2
23135
CLASS="section"
23136
><A
23137
NAME="AEN4401"
23138
>28.1. Verifying the Python Version: the <CODE
23139
CLASS="function"
23140
>EnsurePythonVersion</CODE
23141
> Function</A
23142
></H2
23143
><P
23144
>
23145
Although the <SPAN
23146
CLASS="application"
23147
>SCons</SPAN
23148
> code itself will run
23149
on any Python version 1.5.2 or later,
23150
you are perfectly free to make use of
23151
Python syntax and modules from more modern versions
23152
(for example, Python 2.4 or 2.5)
23153
when writing your <TT
23154
CLASS="filename"
23155
>SConscript</TT
23156
> files
23157
or your own local modules.
23158
If you do this, it's usually helpful to
23159
configure <SPAN
23160
CLASS="application"
23161
>SCons</SPAN
23162
> to exit gracefully with an error message
23163
if it's being run with a version of Python
23164
that simply won't work with your code.
23165
This is especially true if you're going to use <SPAN
23166
CLASS="application"
23167
>SCons</SPAN
23168
>
23169
to build source code that you plan to distribute publicly,
23170
where you can't be sure of the Python version
23171
that an anonymous remote user might use
23172
to try to build your software.
23173
23174
</P
23175
><P
23176
>
23177
<SPAN
23178
CLASS="application"
23179
>SCons</SPAN
23180
> provides an <CODE
23181
CLASS="function"
23182
>EnsurePythonVersion</CODE
23183
> function for this.
23184
You simply pass it the major and minor versions
23185
numbers of the version of Python you require:
23186
23187
</P
23188
><PRE
23189
CLASS="programlisting"
23190
> EnsurePythonVersion(2, 5)
23191
</PRE
23192
><P
23193
>
23194
And then <SPAN
23195
CLASS="application"
23196
>SCons</SPAN
23197
> will exit with the following error
23198
message when a user runs it with an unsupported
23199
earlier version of Python:
23200
23201
</P
23202
><PRE
23203
CLASS="screen"
23204
> % <KBD
23205
CLASS="userinput"
23206
>scons -Q</KBD
23207
>
23208
Python 2.5 or greater required, but you have Python 2.3.6
23209
</PRE
23210
></DIV
23211
><DIV
23212
CLASS="section"
23213
><HR><H2
23214
CLASS="section"
23215
><A
23216
NAME="AEN4417"
23217
>28.2. Verifying the SCons Version: the <CODE
23218
CLASS="function"
23219
>EnsureSConsVersion</CODE
23220
> Function</A
23221
></H2
23222
><P
23223
>
23224
You may, of course, write your <TT
23225
CLASS="filename"
23226
>SConscript</TT
23227
> files
23228
to use features that were only added in
23229
recent versions of <SPAN
23230
CLASS="application"
23231
>SCons</SPAN
23232
>.
23233
When you publicly distribute software that is built using <SPAN
23234
CLASS="application"
23235
>SCons</SPAN
23236
>,
23237
it's helpful to have <SPAN
23238
CLASS="application"
23239
>SCons</SPAN
23240
>
23241
verify the version being used and
23242
exit gracefully with an error message
23243
if the user's version of <SPAN
23244
CLASS="application"
23245
>SCons</SPAN
23246
> won't work
23247
with your <TT
23248
CLASS="filename"
23249
>SConscript</TT
23250
> files.
23251
<SPAN
23252
CLASS="application"
23253
>SCons</SPAN
23254
> provides an <CODE
23255
CLASS="function"
23256
>EnsureSConsVersion</CODE
23257
> function
23258
that verifies the version of <SPAN
23259
CLASS="application"
23260
>SCons</SPAN
23261
>
23262
in the same
23263
the <CODE
23264
CLASS="function"
23265
>EnsurePythonVersion</CODE
23266
> function
23267
verifies the version of Python,
23268
by passing in the major and minor versions
23269
numbers of the version of SCons you require:
23270
23271
</P
23272
><PRE
23273
CLASS="programlisting"
23274
> EnsureSConsVersion(1, 0)
23275
</PRE
23276
><P
23277
>
23278
And then <SPAN
23279
CLASS="application"
23280
>SCons</SPAN
23281
> will exit with the following error
23282
message when a user runs it with an unsupported
23283
earlier version of <SPAN
23284
CLASS="application"
23285
>SCons</SPAN
23286
>:
23287
23288
</P
23289
><PRE
23290
CLASS="screen"
23291
> % <KBD
23292
CLASS="userinput"
23293
>scons -Q</KBD
23294
>
23295
SCons 1.0 or greater required, but you have SCons 0.98.5
23296
</PRE
23297
></DIV
23298
><DIV
23299
CLASS="section"
23300
><HR><H2
23301
CLASS="section"
23302
><A
23303
NAME="AEN4437"
23304
>28.3. Explicitly Terminating <SPAN
23305
CLASS="application"
23306
>SCons</SPAN
23307
> While Reading <TT
23308
CLASS="filename"
23309
>SConscript</TT
23310
> Files: the <CODE
23311
CLASS="function"
23312
>Exit</CODE
23313
> Function</A
23314
></H2
23315
><P
23316
>
23317
<SPAN
23318
CLASS="application"
23319
>SCons</SPAN
23320
> supports an <CODE
23321
CLASS="function"
23322
>Exit</CODE
23323
> function
23324
which can be used to terminate <SPAN
23325
CLASS="application"
23326
>SCons</SPAN
23327
>
23328
while reading the <TT
23329
CLASS="filename"
23330
>SConscript</TT
23331
> files,
23332
usually because you've detected a condition
23333
under which it doesn't make sense to proceed:
23334
23335
</P
23336
><PRE
23337
CLASS="programlisting"
23338
> if ARGUMENTS.get('FUTURE'):
23339
print "The FUTURE option is not supported yet!"
23340
Exit(2)
23341
env = Environment()
23342
env.Program('hello.c')
23343
</PRE
23344
><PRE
23345
CLASS="screen"
23346
> % <KBD
23347
CLASS="userinput"
23348
>scons -Q FUTURE=1</KBD
23349
>
23350
The FUTURE option is not supported yet!
23351
% <KBD
23352
CLASS="userinput"
23353
>scons -Q</KBD
23354
>
23355
cc -o hello.o -c hello.c
23356
cc -o hello hello.o
23357
</PRE
23358
><P
23359
>
23360
The <CODE
23361
CLASS="function"
23362
>Exit</CODE
23363
> function takes as an argument
23364
the (numeric) exit status that you want <SPAN
23365
CLASS="application"
23366
>SCons</SPAN
23367
> to exit with.
23368
If you don't specify a value,
23369
the default is to exit with <TT
23370
CLASS="literal"
23371
>0</TT
23372
>,
23373
which indicates successful execution.
23374
23375
</P
23376
><P
23377
>
23378
Note that the <CODE
23379
CLASS="function"
23380
>Exit</CODE
23381
> function
23382
is equivalent to calling the Python
23383
<CODE
23384
CLASS="function"
23385
>sys.exit</CODE
23386
> function
23387
(which the it actually calls),
23388
but because <CODE
23389
CLASS="function"
23390
>Exit</CODE
23391
> is a <SPAN
23392
CLASS="application"
23393
>SCons</SPAN
23394
> function,
23395
you don't have to import the Python
23396
<TT
23397
CLASS="literal"
23398
>sys</TT
23399
> module to use it.
23400
23401
</P
23402
></DIV
23403
><DIV
23404
CLASS="section"
23405
><HR><H2
23406
CLASS="section"
23407
><A
23408
NAME="AEN4461"
23409
>28.4. Searching for Files: the <CODE
23410
CLASS="function"
23411
>FindFile</CODE
23412
> Function</A
23413
></H2
23414
><P
23415
>
23416
The <CODE
23417
CLASS="function"
23418
>FindFile</CODE
23419
> function searches for a file in a list of directories.
23420
If there is only one directory, it can be given as a simple string.
23421
The function returns a File node if a matching file exists,
23422
or None if no file is found.
23423
(See the documentation for the <CODE
23424
CLASS="function"
23425
>Glob</CODE
23426
> function for an alternative way
23427
of searching for entries in a directory.)
23428
23429
</P
23430
><PRE
23431
CLASS="programlisting"
23432
> # one directory
23433
print FindFile('missing', '.')
23434
t = FindFile('exists', '.')
23435
print t.__class__, t
23436
</PRE
23437
><PRE
23438
CLASS="screen"
23439
> % <KBD
23440
CLASS="userinput"
23441
>scons -Q</KBD
23442
>
23443
None
23444
SCons.Node.FS.File exists
23445
scons: `.' is up to date.
23446
</PRE
23447
><PRE
23448
CLASS="programlisting"
23449
> # several directories
23450
includes = [ '.', 'include', 'src/include']
23451
headers = [ 'nonesuch.h', 'config.h', 'private.h', 'dist.h']
23452
for hdr in headers:
23453
print '%-12s' % ('%s:' % hdr), FindFile(hdr, includes)
23454
</PRE
23455
><PRE
23456
CLASS="screen"
23457
> % <KBD
23458
CLASS="userinput"
23459
>scons -Q</KBD
23460
>
23461
nonesuch.h: None
23462
config.h: config.h
23463
private.h: src/include/private.h
23464
dist.h: include/dist.h
23465
scons: `.' is up to date.
23466
</PRE
23467
><P
23468
>
23469
If the file exists in more than one directory,
23470
only the first occurrence is returned.
23471
23472
</P
23473
><PRE
23474
CLASS="programlisting"
23475
> print FindFile('multiple', ['sub1', 'sub2', 'sub3'])
23476
print FindFile('multiple', ['sub2', 'sub3', 'sub1'])
23477
print FindFile('multiple', ['sub3', 'sub1', 'sub2'])
23478
</PRE
23479
><PRE
23480
CLASS="screen"
23481
> % <KBD
23482
CLASS="userinput"
23483
>scons -Q</KBD
23484
>
23485
sub1/multiple
23486
sub2/multiple
23487
sub3/multiple
23488
scons: `.' is up to date.
23489
</PRE
23490
><P
23491
>
23492
In addition to existing files, <CODE
23493
CLASS="function"
23494
>FindFile</CODE
23495
> will also find derived files
23496
(that is, non-leaf files) that haven't been built yet.
23497
(Leaf files should already exist, or the build will fail!)
23498
23499
</P
23500
><PRE
23501
CLASS="programlisting"
23502
> # Neither file exists, so build will fail
23503
Command('derived', 'leaf', 'cat >$TARGET $SOURCE')
23504
print FindFile('leaf', '.')
23505
print FindFile('derived', '.')
23506
</PRE
23507
><PRE
23508
CLASS="screen"
23509
> % <KBD
23510
CLASS="userinput"
23511
>scons -Q</KBD
23512
>
23513
None
23514
derived
23515
scons: *** Source `leaf' not found, needed by target `derived'. Stop.
23516
</PRE
23517
><PRE
23518
CLASS="programlisting"
23519
> # Neither file exists, so build will fail
23520
Command('derived', 'leaf', 'cat >$TARGET $SOURCE')
23521
print FindFile('leaf', '.')
23522
print FindFile('derived', '.')
23523
23524
# Only 'leaf' exists
23525
Command('derived', 'leaf', 'cat >$TARGET $SOURCE')
23526
print FindFile('leaf', '.')
23527
print FindFile('derived', '.')
23528
</PRE
23529
><PRE
23530
CLASS="screen"
23531
> % <KBD
23532
CLASS="userinput"
23533
>scons -Q</KBD
23534
>
23535
leaf
23536
derived
23537
cat > derived leaf
23538
</PRE
23539
><P
23540
>
23541
If a source file exists, <CODE
23542
CLASS="function"
23543
>FindFile</CODE
23544
> will correctly return the name
23545
in the build directory.
23546
23547
</P
23548
><PRE
23549
CLASS="programlisting"
23550
> # Only 'src/leaf' exists
23551
VariantDir('build', 'src')
23552
print FindFile('leaf', 'build')
23553
</PRE
23554
><PRE
23555
CLASS="screen"
23556
> % <KBD
23557
CLASS="userinput"
23558
>scons -Q</KBD
23559
>
23560
build/leaf
23561
scons: `.' is up to date.
23562
</PRE
23563
></DIV
23564
><DIV
23565
CLASS="section"
23566
><HR><H2
23567
CLASS="section"
23568
><A
23569
NAME="AEN4490"
23570
>28.5. Handling Nested Lists: the <CODE
23571
CLASS="function"
23572
>Flatten</CODE
23573
> Function</A
23574
></H2
23575
><P
23576
>
23577
<SPAN
23578
CLASS="application"
23579
>SCons</SPAN
23580
> supports a <CODE
23581
CLASS="function"
23582
>Flatten</CODE
23583
> function
23584
which takes an input Python sequence
23585
(list or tuple)
23586
and returns a flattened list
23587
containing just the individual elements of
23588
the sequence.
23589
This can be handy when trying to examine
23590
a list composed of the lists
23591
returned by calls to various Builders.
23592
For example, you might collect
23593
object files built in different ways
23594
into one call to the <CODE
23595
CLASS="function"
23596
>Program</CODE
23597
> Builder
23598
by just enclosing them in a list, as follows:
23599
23600
</P
23601
><PRE
23602
CLASS="programlisting"
23603
> objects = [
23604
Object('prog1.c'),
23605
Object('prog2.c', CCFLAGS='-DFOO'),
23606
]
23607
Program(objects)
23608
</PRE
23609
><P
23610
>
23611
Because the Builder calls in <SPAN
23612
CLASS="application"
23613
>SCons</SPAN
23614
>
23615
flatten their input lists,
23616
this works just fine to build the program:
23617
23618
</P
23619
><PRE
23620
CLASS="screen"
23621
> % <KBD
23622
CLASS="userinput"
23623
>scons -Q</KBD
23624
>
23625
cc -o prog1.o -c prog1.c
23626
cc -o prog2.o -c -DFOO prog2.c
23627
cc -o prog1 prog1.o prog2.o
23628
</PRE
23629
><P
23630
>
23631
But if you were debugging your build
23632
and wanted to print the absolute path
23633
of each object file in the
23634
<CODE
23635
CLASS="varname"
23636
>objects</CODE
23637
> list,
23638
you might try the following simple approach,
23639
trying to print each Node's
23640
<TT
23641
CLASS="literal"
23642
>abspath</TT
23643
>
23644
attribute:
23645
23646
</P
23647
><PRE
23648
CLASS="programlisting"
23649
> objects = [
23650
Object('prog1.c'),
23651
Object('prog2.c', CCFLAGS='-DFOO'),
23652
]
23653
Program(objects)
23654
23655
for object_file in objects:
23656
print object_file.abspath
23657
</PRE
23658
><P
23659
>
23660
This does not work as expected
23661
because each call to <CODE
23662
CLASS="function"
23663
>str</CODE
23664
>
23665
is operating an embedded list returned by
23666
each <CODE
23667
CLASS="function"
23668
>Object</CODE
23669
> call,
23670
not on the underlying Nodes within those lists:
23671
23672
</P
23673
><PRE
23674
CLASS="screen"
23675
> % <KBD
23676
CLASS="userinput"
23677
>scons -Q</KBD
23678
>
23679
AttributeError: NodeList instance has no attribute 'abspath':
23680
File "/home/my/project/SConstruct", line 8:
23681
print object_file.abspath
23682
</PRE
23683
><P
23684
>
23685
The solution is to use the <CODE
23686
CLASS="function"
23687
>Flatten</CODE
23688
> function
23689
so that you can pass each Node to
23690
the <CODE
23691
CLASS="function"
23692
>str</CODE
23693
> separately:
23694
23695
</P
23696
><PRE
23697
CLASS="programlisting"
23698
> objects = [
23699
Object('prog1.c'),
23700
Object('prog2.c', CCFLAGS='-DFOO'),
23701
]
23702
Program(objects)
23703
23704
for object_file in Flatten(objects):
23705
print object_file.abspath
23706
</PRE
23707
><PRE
23708
CLASS="screen"
23709
> % <KBD
23710
CLASS="userinput"
23711
>scons -Q</KBD
23712
>
23713
/home/me/project/prog1.o
23714
/home/me/project/prog2.o
23715
cc -o prog1.o -c prog1.c
23716
cc -o prog2.o -c -DFOO prog2.c
23717
cc -o prog1 prog1.o prog2.o
23718
</PRE
23719
></DIV
23720
><DIV
23721
CLASS="section"
23722
><HR><H2
23723
CLASS="section"
23724
><A
23725
NAME="AEN4517"
23726
>28.6. Finding the Invocation Directory: the <CODE
23727
CLASS="function"
23728
>GetLaunchDir</CODE
23729
> Function</A
23730
></H2
23731
><P
23732
>
23733
If you need to find the directory from
23734
which the user invoked the <SPAN
23735
CLASS="application"
23736
>scons</SPAN
23737
> command,
23738
you can use the <CODE
23739
CLASS="function"
23740
>GetLaunchDir</CODE
23741
> function:
23742
23743
</P
23744
><PRE
23745
CLASS="programlisting"
23746
> env = Environment(
23747
LAUNCHDIR = GetLaunchDir(),
23748
)
23749
env.Command('directory_build_info',
23750
'$LAUNCHDIR/build_info'
23751
Copy('$TARGET', '$SOURCE'))
23752
</PRE
23753
><P
23754
>
23755
Because <SPAN
23756
CLASS="application"
23757
>SCons</SPAN
23758
> is usually invoked from the top-level
23759
directory in which the <TT
23760
CLASS="filename"
23761
>SConstruct</TT
23762
> file lives,
23763
the Python <CODE
23764
CLASS="function"
23765
>os.getcwd()</CODE
23766
>
23767
is often equivalent.
23768
However, the <SPAN
23769
CLASS="application"
23770
>SCons</SPAN
23771
>
23772
<TT
23773
CLASS="literal"
23774
>-u</TT
23775
>,
23776
<TT
23777
CLASS="literal"
23778
>-U</TT
23779
>
23780
and
23781
<TT
23782
CLASS="literal"
23783
>-D</TT
23784
>
23785
command-line options,
23786
when invoked from a subdirectory,
23787
will cause <SPAN
23788
CLASS="application"
23789
>SCons</SPAN
23790
> to change to the directory
23791
in which the <TT
23792
CLASS="filename"
23793
>SConstruct</TT
23794
> file is found.
23795
When those options are used,
23796
<CODE
23797
CLASS="function"
23798
>GetLaunchDir</CODE
23799
> will still return the path to the
23800
user's invoking subdirectory,
23801
allowing the <TT
23802
CLASS="filename"
23803
>SConscript</TT
23804
> configuration
23805
to still get at configuration (or other) files
23806
from the originating directory.
23807
23808
</P
23809
></DIV
23810
></DIV
23811
><DIV
23812
CLASS="chapter"
23813
><HR><H1
23814
><A
23815
NAME="chap-troubleshooting"
23816
></A
23817
>Chapter 29. Troubleshooting</H1
23818
><P
23819
>
23820
The experience of configuring any
23821
software build tool to build a large code base
23822
usually, at some point,
23823
involves trying to figure out why
23824
the tool is behaving a certain way,
23825
and how to get it to behave the way you want.
23826
<SPAN
23827
CLASS="application"
23828
>SCons</SPAN
23829
> is no different.
23830
This appendix contains a number of
23831
different ways in which you can
23832
get some additional insight into <SPAN
23833
CLASS="application"
23834
>SCons</SPAN
23835
>' behavior.
23836
23837
</P
23838
><P
23839
>
23840
Note that we're always interested in trying to
23841
improve how you can troubleshoot configuration problems.
23842
If you run into a problem that has
23843
you scratching your head,
23844
and which there just doesn't seem to be a good way to debug,
23845
odds are pretty good that someone else will run into
23846
the same problem, too.
23847
If so, please let the SCons development team know
23848
(preferably by filing a bug report
23849
or feature request at our project pages at tigris.org)
23850
so that we can use your feedback
23851
to try to come up with a better way to help you,
23852
and others, get the necessary insight into <SPAN
23853
CLASS="application"
23854
>SCons</SPAN
23855
> behavior
23856
to help identify and fix configuration issues.
23857
23858
</P
23859
><DIV
23860
CLASS="section"
23861
><HR><H2
23862
CLASS="section"
23863
><A
23864
NAME="AEN4543"
23865
>29.1. Why is That Target Being Rebuilt? the <TT
23866
CLASS="literal"
23867
>--debug=explain</TT
23868
> Option</A
23869
></H2
23870
><P
23871
>
23872
Let's look at a simple example of
23873
a misconfigured build
23874
that causes a target to be rebuilt
23875
every time <SPAN
23876
CLASS="application"
23877
>SCons</SPAN
23878
> is run:
23879
23880
</P
23881
><PRE
23882
CLASS="programlisting"
23883
> # Intentionally misspell the output file name in the
23884
# command used to create the file:
23885
Command('file.out', 'file.in', 'cp $SOURCE file.oout')
23886
</PRE
23887
><P
23888
>
23889
(Note to Windows users: The POSIX <SPAN
23890
CLASS="application"
23891
>cp</SPAN
23892
> command
23893
copies the first file named on the command line
23894
to the second file.
23895
In our example, it copies the <TT
23896
CLASS="filename"
23897
>file.in</TT
23898
> file
23899
to the <TT
23900
CLASS="filename"
23901
>file.out</TT
23902
> file.)
23903
23904
</P
23905
><P
23906
>
23907
Now if we run <SPAN
23908
CLASS="application"
23909
>SCons</SPAN
23910
> multiple times on this example,
23911
we see that it re-runs the <SPAN
23912
CLASS="application"
23913
>cp</SPAN
23914
>
23915
command every time:
23916
23917
</P
23918
><PRE
23919
CLASS="screen"
23920
> % <KBD
23921
CLASS="userinput"
23922
>scons -Q</KBD
23923
>
23924
cp file.in file.oout
23925
% <KBD
23926
CLASS="userinput"
23927
>scons -Q</KBD
23928
>
23929
cp file.in file.oout
23930
% <KBD
23931
CLASS="userinput"
23932
>scons -Q</KBD
23933
>
23934
cp file.in file.oout
23935
</PRE
23936
><P
23937
>
23938
In this example,
23939
the underlying cause is obvious:
23940
we've intentionally misspelled the output file name
23941
in the <SPAN
23942
CLASS="application"
23943
>cp</SPAN
23944
> command,
23945
so the command doesn't actually
23946
build the <TT
23947
CLASS="filename"
23948
>file.out</TT
23949
> file that we've told <SPAN
23950
CLASS="application"
23951
>SCons</SPAN
23952
> to expect.
23953
But if the problem weren't obvious,
23954
it would be helpful
23955
to specify the <TT
23956
CLASS="literal"
23957
>--debug=explain</TT
23958
> option
23959
on the command line
23960
to have <SPAN
23961
CLASS="application"
23962
>SCons</SPAN
23963
> tell us very specifically
23964
why it's decided to rebuild the target:
23965
23966
</P
23967
><PRE
23968
CLASS="screen"
23969
> % <KBD
23970
CLASS="userinput"
23971
>scons -Q --debug=explain</KBD
23972
>
23973
scons: building `file.out' because it doesn't exist
23974
cp file.in file.oout
23975
</PRE
23976
><P
23977
>
23978
If this had been a more complicated example
23979
involving a lot of build output,
23980
having <SPAN
23981
CLASS="application"
23982
>SCons</SPAN
23983
> tell us that
23984
it's trying to rebuild the target file
23985
because it doesn't exist
23986
would be an important clue
23987
that something was wrong with
23988
the command that we invoked to build it.
23989
23990
</P
23991
><P
23992
>
23993
The <TT
23994
CLASS="literal"
23995
>--debug=explain</TT
23996
> option also comes in handy
23997
to help figure out what input file changed.
23998
Given a simple configuration that builds
23999
a program from three source files,
24000
changing one of the source files
24001
and rebuilding with the <TT
24002
CLASS="literal"
24003
>--debug=explain</TT
24004
>
24005
option shows very specifically
24006
why <SPAN
24007
CLASS="application"
24008
>SCons</SPAN
24009
> rebuilds the files that it does:
24010
24011
</P
24012
><PRE
24013
CLASS="screen"
24014
> % <KBD
24015
CLASS="userinput"
24016
>scons -Q</KBD
24017
>
24018
cc -o file1.o -c file1.c
24019
cc -o file2.o -c file2.c
24020
cc -o file3.o -c file3.c
24021
cc -o prog file1.o file2.o file3.o
24022
% <KBD
24023
CLASS="userinput"
24024
>edit file2.c</KBD
24025
>
24026
[CHANGE THE CONTENTS OF file2.c]
24027
% <KBD
24028
CLASS="userinput"
24029
>scons -Q --debug=explain</KBD
24030
>
24031
scons: rebuilding `file2.o' because `file2.c' changed
24032
cc -o file2.o -c file2.c
24033
scons: rebuilding `prog' because `file2.o' changed
24034
cc -o prog file1.o file2.o file3.o
24035
</PRE
24036
><P
24037
>
24038
This becomes even more helpful
24039
in identifying when a file is rebuilt
24040
due to a change in an implicit dependency,
24041
such as an incuded <TT
24042
CLASS="filename"
24043
>.h</TT
24044
> file.
24045
If the <TT
24046
CLASS="filename"
24047
>file1.c</TT
24048
>
24049
and <TT
24050
CLASS="filename"
24051
>file3.c</TT
24052
> files
24053
in our example
24054
both included a <TT
24055
CLASS="filename"
24056
>hello.h</TT
24057
> file,
24058
then changing that included file
24059
and re-running <SPAN
24060
CLASS="application"
24061
>SCons</SPAN
24062
> with the <TT
24063
CLASS="literal"
24064
>--debug=explain</TT
24065
> option
24066
will pinpoint that it's the change to the included file
24067
that starts the chain of rebuilds:
24068
24069
</P
24070
><PRE
24071
CLASS="screen"
24072
> % <KBD
24073
CLASS="userinput"
24074
>scons -Q</KBD
24075
>
24076
cc -o file1.o -c -I. file1.c
24077
cc -o file2.o -c -I. file2.c
24078
cc -o file3.o -c -I. file3.c
24079
cc -o prog file1.o file2.o file3.o
24080
% <KBD
24081
CLASS="userinput"
24082
>edit hello.h</KBD
24083
>
24084
[CHANGE THE CONTENTS OF hello.h]
24085
% <KBD
24086
CLASS="userinput"
24087
>scons -Q --debug=explain</KBD
24088
>
24089
scons: rebuilding `file1.o' because `hello.h' changed
24090
cc -o file1.o -c -I. file1.c
24091
scons: rebuilding `file3.o' because `hello.h' changed
24092
cc -o file3.o -c -I. file3.c
24093
scons: rebuilding `prog' because:
24094
`file1.o' changed
24095
`file3.o' changed
24096
cc -o prog file1.o file2.o file3.o
24097
</PRE
24098
><P
24099
>
24100
(Note that the <TT
24101
CLASS="literal"
24102
>--debug=explain</TT
24103
> option will only tell you
24104
why <SPAN
24105
CLASS="application"
24106
>SCons</SPAN
24107
> decided to rebuild necessary targets.
24108
It does not tell you what files it examined
24109
when deciding <SPAN
24110
CLASS="emphasis"
24111
><I
24112
CLASS="emphasis"
24113
>not</I
24114
></SPAN
24115
>
24116
to rebuild a target file,
24117
which is often a more valuable question to answer.)
24118
24119
</P
24120
></DIV
24121
><DIV
24122
CLASS="section"
24123
><HR><H2
24124
CLASS="section"
24125
><A
24126
NAME="AEN4593"
24127
>29.2. What's in That Construction Environment? the <CODE
24128
CLASS="function"
24129
>Dump</CODE
24130
> Method</A
24131
></H2
24132
><P
24133
>
24134
When you create a construction environment,
24135
<SPAN
24136
CLASS="application"
24137
>SCons</SPAN
24138
> populates it
24139
with construction variables that are set up
24140
for various compilers, linkers and utilities
24141
that it finds on your system.
24142
Although this is usually helpful and what you want,
24143
it might be frustrating if <SPAN
24144
CLASS="application"
24145
>SCons</SPAN
24146
>
24147
doesn't set certain variables that you
24148
expect to be set.
24149
In situations like this,
24150
it's sometimes helpful to use the
24151
construction environment <CODE
24152
CLASS="function"
24153
>Dump</CODE
24154
> method
24155
to print all or some of
24156
the construction variables.
24157
Note that the <CODE
24158
CLASS="function"
24159
>Dump</CODE
24160
> method
24161
<SPAN
24162
CLASS="emphasis"
24163
><I
24164
CLASS="emphasis"
24165
>returns</I
24166
></SPAN
24167
>
24168
the representation of the variables
24169
in the environment
24170
for you to print (or otherwise manipulate):
24171
24172
</P
24173
><PRE
24174
CLASS="programlisting"
24175
> env = Environment()
24176
print env.Dump()
24177
</PRE
24178
><P
24179
>
24180
On a POSIX system with gcc installed,
24181
this might generate:
24182
24183
</P
24184
><PRE
24185
CLASS="screen"
24186
> % <KBD
24187
CLASS="userinput"
24188
>scons</KBD
24189
>
24190
scons: Reading SConscript files ...
24191
{ 'BUILDERS': {'_InternalInstall': <function InstallBuilderWrapper at 0x700000>, '_InternalInstallAs': <function InstallAsBuilderWrapper at 0x700000>},
24192
'CONFIGUREDIR': '#/.sconf_temp',
24193
'CONFIGURELOG': '#/config.log',
24194
'CPPSUFFIXES': [ '.c',
24195
'.C',
24196
'.cxx',
24197
'.cpp',
24198
'.c++',
24199
'.cc',
24200
'.h',
24201
'.H',
24202
'.hxx',
24203
'.hpp',
24204
'.hh',
24205
'.F',
24206
'.fpp',
24207
'.FPP',
24208
'.m',
24209
'.mm',
24210
'.S',
24211
'.spp',
24212
'.SPP'],
24213
'DSUFFIXES': ['.d'],
24214
'Dir': <SCons.Defaults.Variable_Method_Caller instance at 0x700000>,
24215
'Dirs': <SCons.Defaults.Variable_Method_Caller instance at 0x700000>,
24216
'ENV': {'PATH': '/usr/local/bin:/opt/bin:/bin:/usr/bin'},
24217
'ESCAPE': <function escape at 0x700000>,
24218
'File': <SCons.Defaults.Variable_Method_Caller instance at 0x700000>,
24219
'IDLSUFFIXES': ['.idl', '.IDL'],
24220
'INSTALL': <function copyFunc at 0x700000>,
24221
'LATEXSUFFIXES': ['.tex', '.ltx', '.latex'],
24222
'LIBPREFIX': 'lib',
24223
'LIBPREFIXES': ['$LIBPREFIX'],
24224
'LIBSUFFIX': '.a',
24225
'LIBSUFFIXES': ['$LIBSUFFIX', '$SHLIBSUFFIX'],
24226
'MAXLINELENGTH': 128072,
24227
'OBJPREFIX': '',
24228
'OBJSUFFIX': '.o',
24229
'PLATFORM': 'posix',
24230
'PROGPREFIX': '',
24231
'PROGSUFFIX': '',
24232
'PSPAWN': <function piped_env_spawn at 0x700000>,
24233
'RDirs': <SCons.Defaults.Variable_Method_Caller instance at 0x700000>,
24234
'SCANNERS': [],
24235
'SHELL': 'sh',
24236
'SHLIBPREFIX': '$LIBPREFIX',
24237
'SHLIBSUFFIX': '.so',
24238
'SHOBJPREFIX': '$OBJPREFIX',
24239
'SHOBJSUFFIX': '$OBJSUFFIX',
24240
'SPAWN': <function spawnvpe_spawn at 0x700000>,
24241
'TEMPFILE': <class SCons.Platform.TempFileMunge at 0x700000>,
24242
'TEMPFILEPREFIX': '@',
24243
'TOOLS': ['install', 'install'],
24244
'_CPPDEFFLAGS': '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}',
24245
'_CPPINCFLAGS': '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)',
24246
'_LIBDIRFLAGS': '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)',
24247
'_LIBFLAGS': '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}',
24248
'__RPATH': '$_RPATH',
24249
'_concat': <function _concat at 0x700000>,
24250
'_defines': <function _defines at 0x700000>,
24251
'_stripixes': <function _stripixes at 0x700000>}
24252
scons: done reading SConscript files.
24253
scons: Building targets ...
24254
scons: `.' is up to date.
24255
scons: done building targets.
24256
</PRE
24257
><P
24258
>
24259
On a Windows system with Visual C++
24260
the output might look like:
24261
24262
</P
24263
><PRE
24264
CLASS="screen"
24265
> C:\><KBD
24266
CLASS="userinput"
24267
>scons</KBD
24268
>
24269
scons: Reading SConscript files ...
24270
{ 'BUILDERS': {'_InternalInstall': <function InstallBuilderWrapper at 0x700000>, 'Object': <SCons.Builder.CompositeBuilder instance at 0x700000>, 'PCH': <SCons.Builder.BuilderBase instance at 0x700000>, 'RES': <SCons.Builder.BuilderBase instance at 0x700000>, 'SharedObject': <SCons.Builder.CompositeBuilder instance at 0x700000>, 'StaticObject': <SCons.Builder.CompositeBuilder instance at 0x700000>, '_InternalInstallAs': <function InstallAsBuilderWrapper at 0x700000>},
24271
'CC': 'cl',
24272
'CCCOM': <SCons.Action.FunctionAction instance at 0x700000>,
24273
'CCCOMFLAGS': '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET $CCPCHFLAGS $CCPDBFLAGS',
24274
'CCFLAGS': ['/nologo'],
24275
'CCPCHFLAGS': ['${(PCH and "/Yu%s /Fp%s"%(PCHSTOP or "",File(PCH))) or ""}'],
24276
'CCPDBFLAGS': ['${(PDB and "/Z7") or ""}'],
24277
'CFILESUFFIX': '.c',
24278
'CFLAGS': [],
24279
'CONFIGUREDIR': '#/.sconf_temp',
24280
'CONFIGURELOG': '#/config.log',
24281
'CPPDEFPREFIX': '/D',
24282
'CPPDEFSUFFIX': '',
24283
'CPPSUFFIXES': [ '.c',
24284
'.C',
24285
'.cxx',
24286
'.cpp',
24287
'.c++',
24288
'.cc',
24289
'.h',
24290
'.H',
24291
'.hxx',
24292
'.hpp',
24293
'.hh',
24294
'.F',
24295
'.fpp',
24296
'.FPP',
24297
'.m',
24298
'.mm',
24299
'.S',
24300
'.spp',
24301
'.SPP'],
24302
'CXX': '$CC',
24303
'CXXCOM': '$CXX $CXXFLAGS $CCCOMFLAGS',
24304
'CXXFILESUFFIX': '.cc',
24305
'CXXFLAGS': ['$CCFLAGS', '$(', '/TP', '$)'],
24306
'DSUFFIXES': ['.d'],
24307
'Dir': <SCons.Defaults.Variable_Method_Caller instance at 0x700000>,
24308
'Dirs': <SCons.Defaults.Variable_Method_Caller instance at 0x700000>,
24309
'ENV': { 'INCLUDE': 'C:\\Program Files\\Microsoft Visual Studio/VC98\\include',
24310
'LIB': 'C:\\Program Files\\Microsoft Visual Studio/VC98\\lib',
24311
'PATH': 'C:\\Program Files\\Microsoft Visual Studio\\Common\\tools\\WIN95;C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\bin;C:\\Program Files\\Microsoft Visual Studio\\Common\\tools;C:\\Program Files\\Microsoft Visual Studio/VC98\\bin',
24312
'PATHEXT': '.COM;.EXE;.BAT;.CMD',
24313
'SystemRoot': 'C:/WINDOWS'},
24314
'ESCAPE': <function escape at 0x700000>,
24315
'File': <SCons.Defaults.Variable_Method_Caller instance at 0x700000>,
24316
'IDLSUFFIXES': ['.idl', '.IDL'],
24317
'INCPREFIX': '/I',
24318
'INCSUFFIX': '',
24319
'INSTALL': <function copyFunc at 0x700000>,
24320
'LATEXSUFFIXES': ['.tex', '.ltx', '.latex'],
24321
'LIBPREFIX': '',
24322
'LIBPREFIXES': ['$LIBPREFIX'],
24323
'LIBSUFFIX': '.lib',
24324
'LIBSUFFIXES': ['$LIBSUFFIX'],
24325
'MAXLINELENGTH': 2048,
24326
'MSVS': {'VERSION': '6.0', 'VERSIONS': ['6.0']},
24327
'MSVS_VERSION': '6.0',
24328
'OBJPREFIX': '',
24329
'OBJSUFFIX': '.obj',
24330
'PCHCOM': '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo${TARGETS[1]} /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS',
24331
'PCHPDBFLAGS': ['${(PDB and "/Yd") or ""}'],
24332
'PLATFORM': 'win32',
24333
'PROGPREFIX': '',
24334
'PROGSUFFIX': '.exe',
24335
'PSPAWN': <function piped_spawn at 0x700000>,
24336
'RC': 'rc',
24337
'RCCOM': <SCons.Action.FunctionAction instance at 0x700000>,
24338
'RCFLAGS': [],
24339
'RDirs': <SCons.Defaults.Variable_Method_Caller instance at 0x700000>,
24340
'SCANNERS': [],
24341
'SHCC': '$CC',
24342
'SHCCCOM': <SCons.Action.FunctionAction instance at 0x700000>,
24343
'SHCCFLAGS': ['$CCFLAGS'],
24344
'SHCFLAGS': ['$CFLAGS'],
24345
'SHCXX': '$CXX',
24346
'SHCXXCOM': '$SHCXX $SHCXXFLAGS $CCCOMFLAGS',
24347
'SHCXXFLAGS': ['$CXXFLAGS'],
24348
'SHELL': None,
24349
'SHLIBPREFIX': '',
24350
'SHLIBSUFFIX': '.dll',
24351
'SHOBJPREFIX': '$OBJPREFIX',
24352
'SHOBJSUFFIX': '$OBJSUFFIX',
24353
'SPAWN': <function spawn at 0x700000>,
24354
'STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME': 1,
24355
'TEMPFILE': <class SCons.Platform.TempFileMunge at 0x700000>,
24356
'TEMPFILEPREFIX': '@',
24357
'TOOLS': ['msvc', 'install', 'install'],
24358
'_CPPDEFFLAGS': '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}',
24359
'_CPPINCFLAGS': '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)',
24360
'_LIBDIRFLAGS': '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)',
24361
'_LIBFLAGS': '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}',
24362
'_concat': <function _concat at 0x700000>,
24363
'_defines': <function _defines at 0x700000>,
24364
'_stripixes': <function _stripixes at 0x700000>}
24365
scons: done reading SConscript files.
24366
scons: Building targets ...
24367
scons: `.' is up to date.
24368
scons: done building targets.
24369
</PRE
24370
><P
24371
>
24372
The construction environments in these examples have
24373
actually been restricted to just gcc and Visual C++,
24374
respectively.
24375
In a real-life situation,
24376
the construction environments will
24377
likely contain a great many more variables.
24378
Also note that we've massaged the example output above
24379
to make the memory address of all objects a constant 0x700000.
24380
In reality, you would see a different hexadecimal
24381
number for each object.
24382
24383
</P
24384
><P
24385
>
24386
To make it easier to see just what you're
24387
interested in,
24388
the <CODE
24389
CLASS="function"
24390
>Dump</CODE
24391
> method allows you to
24392
specify a specific constrcution variable
24393
that you want to disply.
24394
For example,
24395
it's not unusual to want to verify
24396
the external environment used to execute build commands,
24397
to make sure that the PATH and other
24398
environment variables are set up the way they should be.
24399
You can do this as follows:
24400
24401
</P
24402
><PRE
24403
CLASS="programlisting"
24404
> env = Environment()
24405
print env.Dump('ENV')
24406
</PRE
24407
><P
24408
>
24409
Which might display the following when executed on a POSIX system:
24410
24411
</P
24412
><PRE
24413
CLASS="screen"
24414
> % <KBD
24415
CLASS="userinput"
24416
>scons</KBD
24417
>
24418
scons: Reading SConscript files ...
24419
{'PATH': '/usr/local/bin:/opt/bin:/bin:/usr/bin'}
24420
scons: done reading SConscript files.
24421
scons: Building targets ...
24422
scons: `.' is up to date.
24423
scons: done building targets.
24424
</PRE
24425
><P
24426
>
24427
And the following when executed on a Windows system:
24428
24429
</P
24430
><PRE
24431
CLASS="screen"
24432
> C:\><KBD
24433
CLASS="userinput"
24434
>scons</KBD
24435
>
24436
scons: Reading SConscript files ...
24437
{ 'INCLUDE': 'C:\\Program Files\\Microsoft Visual Studio/VC98\\include',
24438
'LIB': 'C:\\Program Files\\Microsoft Visual Studio/VC98\\lib',
24439
'PATH': 'C:\\Program Files\\Microsoft Visual Studio\\Common\\tools\\WIN95;C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\bin;C:\\Program Files\\Microsoft Visual Studio\\Common\\tools;C:\\Program Files\\Microsoft Visual Studio/VC98\\bin',
24440
'PATHEXT': '.COM;.EXE;.BAT;.CMD',
24441
'SystemRoot': 'C:/WINDOWS'}
24442
scons: done reading SConscript files.
24443
scons: Building targets ...
24444
scons: `.' is up to date.
24445
scons: done building targets.
24446
</PRE
24447
></DIV
24448
><DIV
24449
CLASS="section"
24450
><HR><H2
24451
CLASS="section"
24452
><A
24453
NAME="AEN4619"
24454
>29.3. What Dependencies Does <SPAN
24455
CLASS="application"
24456
>SCons</SPAN
24457
> Know About? the <TT
24458
CLASS="literal"
24459
>--tree</TT
24460
> Option</A
24461
></H2
24462
><P
24463
>
24464
Sometimes the best way to try to figure out what
24465
<SPAN
24466
CLASS="application"
24467
>SCons</SPAN
24468
> is doing is simply to take a look at the
24469
dependency graph that it constructs
24470
based on your <TT
24471
CLASS="filename"
24472
>SConscript</TT
24473
> files.
24474
The <TT
24475
CLASS="literal"
24476
>--tree</TT
24477
> option
24478
will display all or part of the
24479
<SPAN
24480
CLASS="application"
24481
>SCons</SPAN
24482
> dependency graph in an
24483
"ASCII art" graphical format
24484
that shows the dependency hierarchy.
24485
24486
</P
24487
><P
24488
>
24489
For example, given the following input <TT
24490
CLASS="filename"
24491
>SConstruct</TT
24492
> file:
24493
24494
</P
24495
><PRE
24496
CLASS="programlisting"
24497
> env = Environment(CPPPATH = ['.'])
24498
env.Program('prog', ['f1.c', 'f2.c', 'f3.c'])
24499
</PRE
24500
><P
24501
>
24502
Running <SPAN
24503
CLASS="application"
24504
>SCons</SPAN
24505
> with the <TT
24506
CLASS="literal"
24507
>--tree=all</TT
24508
>
24509
option yields:
24510
24511
</P
24512
><PRE
24513
CLASS="screen"
24514
> % <KBD
24515
CLASS="userinput"
24516
>scons -Q --tree=all</KBD
24517
>
24518
cc -o f1.o -c -I. f1.c
24519
cc -o f2.o -c -I. f2.c
24520
cc -o f3.o -c -I. f3.c
24521
cc -o prog f1.o f2.o f3.o
24522
+-.
24523
+-SConstruct
24524
+-f1.c
24525
+-f1.o
24526
| +-f1.c
24527
| +-inc.h
24528
+-f2.c
24529
+-f2.o
24530
| +-f2.c
24531
| +-inc.h
24532
+-f3.c
24533
+-f3.o
24534
| +-f3.c
24535
| +-inc.h
24536
+-inc.h
24537
+-prog
24538
+-f1.o
24539
| +-f1.c
24540
| +-inc.h
24541
+-f2.o
24542
| +-f2.c
24543
| +-inc.h
24544
+-f3.o
24545
+-f3.c
24546
+-inc.h
24547
</PRE
24548
><P
24549
>
24550
The tree will also be printed when the
24551
<TT
24552
CLASS="literal"
24553
>-n</TT
24554
> (no execute) option is used,
24555
which allows you to examine the dependency graph
24556
for a configuration without actually
24557
rebuilding anything in the tree.
24558
24559
</P
24560
><P
24561
>
24562
The <TT
24563
CLASS="literal"
24564
>--tree</TT
24565
> option only prints
24566
the dependency graph for the specified targets
24567
(or the default target(s) if none are specified on the command line).
24568
So if you specify a target like <TT
24569
CLASS="filename"
24570
>f2.o</TT
24571
>
24572
on the command line,
24573
the <TT
24574
CLASS="literal"
24575
>--tree</TT
24576
> option will only
24577
print the dependency graph for that file:
24578
24579
</P
24580
><PRE
24581
CLASS="screen"
24582
> % <KBD
24583
CLASS="userinput"
24584
>scons -Q --tree=all f2.o</KBD
24585
>
24586
cc -o f2.o -c -I. f2.c
24587
+-f2.o
24588
+-f2.c
24589
+-inc.h
24590
</PRE
24591
><P
24592
>
24593
This is, of course, useful for
24594
restricting the output from a very large
24595
build configuration to just a
24596
portion in which you're interested.
24597
Multiple targets are fine,
24598
in which case a tree will be printed
24599
for each specified target:
24600
24601
</P
24602
><PRE
24603
CLASS="screen"
24604
> % <KBD
24605
CLASS="userinput"
24606
>scons -Q --tree=all f1.o f3.o</KBD
24607
>
24608
cc -o f1.o -c -I. f1.c
24609
+-f1.o
24610
+-f1.c
24611
+-inc.h
24612
cc -o f3.o -c -I. f3.c
24613
+-f3.o
24614
+-f3.c
24615
+-inc.h
24616
</PRE
24617
><P
24618
>
24619
The <TT
24620
CLASS="literal"
24621
>status</TT
24622
> argument may be used
24623
to tell <SPAN
24624
CLASS="application"
24625
>SCons</SPAN
24626
> to print status information about
24627
each file in the dependency graph:
24628
24629
</P
24630
><PRE
24631
CLASS="screen"
24632
> % <KBD
24633
CLASS="userinput"
24634
>scons -Q --tree=status</KBD
24635
>
24636
cc -o f1.o -c -I. f1.c
24637
cc -o f2.o -c -I. f2.c
24638
cc -o f3.o -c -I. f3.c
24639
cc -o prog f1.o f2.o f3.o
24640
E = exists
24641
R = exists in repository only
24642
b = implicit builder
24643
B = explicit builder
24644
S = side effect
24645
P = precious
24646
A = always build
24647
C = current
24648
N = no clean
24649
H = no cache
24650
24651
[E b ]+-.
24652
[E C ] +-SConstruct
24653
[E C ] +-f1.c
24654
[E B C ] +-f1.o
24655
[E C ] | +-f1.c
24656
[E C ] | +-inc.h
24657
[E C ] +-f2.c
24658
[E B C ] +-f2.o
24659
[E C ] | +-f2.c
24660
[E C ] | +-inc.h
24661
[E C ] +-f3.c
24662
[E B C ] +-f3.o
24663
[E C ] | +-f3.c
24664
[E C ] | +-inc.h
24665
[E C ] +-inc.h
24666
[E B C ] +-prog
24667
[E B C ] +-f1.o
24668
[E C ] | +-f1.c
24669
[E C ] | +-inc.h
24670
[E B C ] +-f2.o
24671
[E C ] | +-f2.c
24672
[E C ] | +-inc.h
24673
[E B C ] +-f3.o
24674
[E C ] +-f3.c
24675
[E C ] +-inc.h
24676
</PRE
24677
><P
24678
>
24679
Note that <TT
24680
CLASS="literal"
24681
>--tree=all,status</TT
24682
> is equivalent;
24683
the <TT
24684
CLASS="literal"
24685
>all</TT
24686
>
24687
is assumed if only <TT
24688
CLASS="literal"
24689
>status</TT
24690
> is present.
24691
As an alternative to <TT
24692
CLASS="literal"
24693
>all</TT
24694
>,
24695
you can specify <TT
24696
CLASS="literal"
24697
>--tree=derived</TT
24698
>
24699
to have <SPAN
24700
CLASS="application"
24701
>SCons</SPAN
24702
> only print derived targets
24703
in the tree output,
24704
skipping source files
24705
(like <TT
24706
CLASS="filename"
24707
>.c</TT
24708
> and <TT
24709
CLASS="filename"
24710
>.h</TT
24711
> files):
24712
24713
</P
24714
><PRE
24715
CLASS="screen"
24716
> % <KBD
24717
CLASS="userinput"
24718
>scons -Q --tree=derived</KBD
24719
>
24720
cc -o f1.o -c -I. f1.c
24721
cc -o f2.o -c -I. f2.c
24722
cc -o f3.o -c -I. f3.c
24723
cc -o prog f1.o f2.o f3.o
24724
+-.
24725
+-f1.o
24726
+-f2.o
24727
+-f3.o
24728
+-prog
24729
+-f1.o
24730
+-f2.o
24731
+-f3.o
24732
</PRE
24733
><P
24734
>
24735
You can use the <TT
24736
CLASS="literal"
24737
>status</TT
24738
>
24739
modifier with <TT
24740
CLASS="literal"
24741
>derived</TT
24742
> as well:
24743
24744
</P
24745
><PRE
24746
CLASS="screen"
24747
> % <KBD
24748
CLASS="userinput"
24749
>scons -Q --tree=derived,status</KBD
24750
>
24751
cc -o f1.o -c -I. f1.c
24752
cc -o f2.o -c -I. f2.c
24753
cc -o f3.o -c -I. f3.c
24754
cc -o prog f1.o f2.o f3.o
24755
E = exists
24756
R = exists in repository only
24757
b = implicit builder
24758
B = explicit builder
24759
S = side effect
24760
P = precious
24761
A = always build
24762
C = current
24763
N = no clean
24764
H = no cache
24765
24766
[E b ]+-.
24767
[E B C ] +-f1.o
24768
[E B C ] +-f2.o
24769
[E B C ] +-f3.o
24770
[E B C ] +-prog
24771
[E B C ] +-f1.o
24772
[E B C ] +-f2.o
24773
[E B C ] +-f3.o
24774
</PRE
24775
><P
24776
>
24777
Note that the order of the <TT
24778
CLASS="literal"
24779
>--tree=</TT
24780
>
24781
arguments doesn't matter;
24782
<TT
24783
CLASS="literal"
24784
>--tree=status,derived</TT
24785
> is
24786
completely equivalent.
24787
24788
</P
24789
><P
24790
>
24791
The default behavior of the <TT
24792
CLASS="literal"
24793
>--tree</TT
24794
> option
24795
is to repeat all of the dependencies each time the library dependency
24796
(or any other dependency file) is encountered in the tree.
24797
If certain target files share other target files,
24798
such as two programs that use the same library:
24799
24800
</P
24801
><PRE
24802
CLASS="programlisting"
24803
> env = Environment(CPPPATH = ['.'],
24804
LIBS = ['foo'],
24805
LIBPATH = ['.'])
24806
env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
24807
env.Program('prog1.c')
24808
env.Program('prog2.c')
24809
</PRE
24810
><P
24811
>
24812
Then there can be a <SPAN
24813
CLASS="emphasis"
24814
><I
24815
CLASS="emphasis"
24816
>lot</I
24817
></SPAN
24818
> of repetition in the
24819
<TT
24820
CLASS="literal"
24821
>--tree=</TT
24822
> output:
24823
24824
</P
24825
><PRE
24826
CLASS="screen"
24827
> % <KBD
24828
CLASS="userinput"
24829
>scons -Q --tree=all</KBD
24830
>
24831
cc -o f1.o -c -I. f1.c
24832
cc -o f2.o -c -I. f2.c
24833
cc -o f3.o -c -I. f3.c
24834
ar rc libfoo.a f1.o f2.o f3.o
24835
ranlib libfoo.a
24836
cc -o prog1.o -c -I. prog1.c
24837
cc -o prog1 prog1.o -L. -lfoo
24838
cc -o prog2.o -c -I. prog2.c
24839
cc -o prog2 prog2.o -L. -lfoo
24840
+-.
24841
+-SConstruct
24842
+-f1.c
24843
+-f1.o
24844
| +-f1.c
24845
| +-inc.h
24846
+-f2.c
24847
+-f2.o
24848
| +-f2.c
24849
| +-inc.h
24850
+-f3.c
24851
+-f3.o
24852
| +-f3.c
24853
| +-inc.h
24854
+-inc.h
24855
+-libfoo.a
24856
| +-f1.o
24857
| | +-f1.c
24858
| | +-inc.h
24859
| +-f2.o
24860
| | +-f2.c
24861
| | +-inc.h
24862
| +-f3.o
24863
| +-f3.c
24864
| +-inc.h
24865
+-prog1
24866
| +-prog1.o
24867
| | +-prog1.c
24868
| | +-inc.h
24869
| +-libfoo.a
24870
| +-f1.o
24871
| | +-f1.c
24872
| | +-inc.h
24873
| +-f2.o
24874
| | +-f2.c
24875
| | +-inc.h
24876
| +-f3.o
24877
| +-f3.c
24878
| +-inc.h
24879
+-prog1.c
24880
+-prog1.o
24881
| +-prog1.c
24882
| +-inc.h
24883
+-prog2
24884
| +-prog2.o
24885
| | +-prog2.c
24886
| | +-inc.h
24887
| +-libfoo.a
24888
| +-f1.o
24889
| | +-f1.c
24890
| | +-inc.h
24891
| +-f2.o
24892
| | +-f2.c
24893
| | +-inc.h
24894
| +-f3.o
24895
| +-f3.c
24896
| +-inc.h
24897
+-prog2.c
24898
+-prog2.o
24899
+-prog2.c
24900
+-inc.h
24901
</PRE
24902
><P
24903
>
24904
In a large configuration with many internal libraries
24905
and include files,
24906
this can very quickly lead to huge output trees.
24907
To help make this more manageable,
24908
a <TT
24909
CLASS="literal"
24910
>prune</TT
24911
> modifier may
24912
be added to the option list,
24913
in which case <SPAN
24914
CLASS="application"
24915
>SCons</SPAN
24916
>
24917
will print the name of a target that has
24918
already been visited during the tree-printing
24919
in <TT
24920
CLASS="literal"
24921
>[square brackets]</TT
24922
>
24923
as an indication that the dependencies
24924
of the target file may be found
24925
by looking farther up the tree:
24926
24927
</P
24928
><PRE
24929
CLASS="screen"
24930
> % <KBD
24931
CLASS="userinput"
24932
>scons -Q --tree=prune</KBD
24933
>
24934
cc -o f1.o -c -I. f1.c
24935
cc -o f2.o -c -I. f2.c
24936
cc -o f3.o -c -I. f3.c
24937
ar rc libfoo.a f1.o f2.o f3.o
24938
ranlib libfoo.a
24939
cc -o prog1.o -c -I. prog1.c
24940
cc -o prog1 prog1.o -L. -lfoo
24941
cc -o prog2.o -c -I. prog2.c
24942
cc -o prog2 prog2.o -L. -lfoo
24943
+-.
24944
+-SConstruct
24945
+-f1.c
24946
+-f1.o
24947
| +-f1.c
24948
| +-inc.h
24949
+-f2.c
24950
+-f2.o
24951
| +-f2.c
24952
| +-inc.h
24953
+-f3.c
24954
+-f3.o
24955
| +-f3.c
24956
| +-inc.h
24957
+-inc.h
24958
+-libfoo.a
24959
| +-[f1.o]
24960
| +-[f2.o]
24961
| +-[f3.o]
24962
+-prog1
24963
| +-prog1.o
24964
| | +-prog1.c
24965
| | +-inc.h
24966
| +-[libfoo.a]
24967
+-prog1.c
24968
+-[prog1.o]
24969
+-prog2
24970
| +-prog2.o
24971
| | +-prog2.c
24972
| | +-inc.h
24973
| +-[libfoo.a]
24974
+-prog2.c
24975
+-[prog2.o]
24976
</PRE
24977
><P
24978
>
24979
Like the <TT
24980
CLASS="literal"
24981
>status</TT
24982
> keyword,
24983
the <TT
24984
CLASS="literal"
24985
>prune</TT
24986
> argument by itself
24987
is equivalent to <TT
24988
CLASS="literal"
24989
>--tree=all,prune</TT
24990
>.
24991
24992
</P
24993
></DIV
24994
><DIV
24995
CLASS="section"
24996
><HR><H2
24997
CLASS="section"
24998
><A
24999
NAME="AEN4689"
25000
>29.4. How is <SPAN
25001
CLASS="application"
25002
>SCons</SPAN
25003
> Constructing the Command Lines It Executes? the <TT
25004
CLASS="literal"
25005
>--debug=presub</TT
25006
> Option</A
25007
></H2
25008
><P
25009
>
25010
Sometimes it's useful to look at the
25011
pre-substitution string
25012
that <SPAN
25013
CLASS="application"
25014
>SCons</SPAN
25015
> uses to generate
25016
the command lines it executes.
25017
This can be done with the <TT
25018
CLASS="literal"
25019
>--debug=presub</TT
25020
> option:
25021
25022
</P
25023
><PRE
25024
CLASS="screen"
25025
> % <KBD
25026
CLASS="userinput"
25027
>scons -Q --debug=presub</KBD
25028
>
25029
Building prog.o with action:
25030
$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCOMCOM $SOURCES
25031
cc -o prog.o -c -I. prog.c
25032
Building prog with action:
25033
$SMART_LINKCOM
25034
cc -o prog prog.o
25035
</PRE
25036
></DIV
25037
><DIV
25038
CLASS="section"
25039
><HR><H2
25040
CLASS="section"
25041
><A
25042
NAME="AEN4698"
25043
>29.5. Where is <SPAN
25044
CLASS="application"
25045
>SCons</SPAN
25046
> Searching for Libraries? the <TT
25047
CLASS="literal"
25048
>--debug=findlibs</TT
25049
> Option</A
25050
></H2
25051
><P
25052
>
25053
To get some insight into what library names
25054
<SPAN
25055
CLASS="application"
25056
>SCons</SPAN
25057
> is searching for,
25058
and in which directories it is searching,
25059
Use the <TT
25060
CLASS="literal"
25061
>--debug=findlibs</TT
25062
> option.
25063
Given the following input <TT
25064
CLASS="filename"
25065
>SConstruct</TT
25066
> file:
25067
25068
</P
25069
><PRE
25070
CLASS="programlisting"
25071
> env = Environment(LIBPATH = ['libs1', 'libs2'])
25072
env.Program('prog.c', LIBS=['foo', 'bar'])
25073
</PRE
25074
><P
25075
>
25076
And the libraries <TT
25077
CLASS="filename"
25078
>libfoo.a</TT
25079
>
25080
and <TT
25081
CLASS="filename"
25082
>libbar.a</TT
25083
>
25084
in <TT
25085
CLASS="filename"
25086
>libs1</TT
25087
> and <TT
25088
CLASS="filename"
25089
>libs2</TT
25090
>,
25091
respectively,
25092
use of the <TT
25093
CLASS="literal"
25094
>--debug=findlibs</TT
25095
> option yields:
25096
25097
</P
25098
><PRE
25099
CLASS="screen"
25100
> % <KBD
25101
CLASS="userinput"
25102
>scons -Q --debug=findlibs</KBD
25103
>
25104
findlibs: looking for 'libfoo.a' in 'libs1' ...
25105
findlibs: ... FOUND 'libfoo.a' in 'libs1'
25106
findlibs: looking for 'libfoo.so' in 'libs1' ...
25107
findlibs: looking for 'libfoo.so' in 'libs2' ...
25108
findlibs: looking for 'libbar.a' in 'libs1' ...
25109
findlibs: looking for 'libbar.a' in 'libs2' ...
25110
findlibs: ... FOUND 'libbar.a' in 'libs2'
25111
findlibs: looking for 'libbar.so' in 'libs1' ...
25112
findlibs: looking for 'libbar.so' in 'libs2' ...
25113
cc -o prog.o -c prog.c
25114
cc -o prog prog.o -Llibs1 -Llibs2 -lfoo -lbar
25115
</PRE
25116
></DIV
25117
><DIV
25118
CLASS="section"
25119
><HR><H2
25120
CLASS="section"
25121
><A
25122
NAME="AEN4715"
25123
>29.6. Where is <SPAN
25124
CLASS="application"
25125
>SCons</SPAN
25126
> Blowing Up? the <TT
25127
CLASS="literal"
25128
>--debug=stacktrace</TT
25129
> Option</A
25130
></H2
25131
><P
25132
>
25133
In general, <SPAN
25134
CLASS="application"
25135
>SCons</SPAN
25136
> tries to keep its error
25137
messages short and informative.
25138
That means we usually try to avoid showing
25139
the stack traces that are familiar
25140
to experienced Python programmers,
25141
since they usually contain much more
25142
information than is useful to most people.
25143
25144
</P
25145
><P
25146
>
25147
For example, the following <TT
25148
CLASS="filename"
25149
>SConstruct</TT
25150
> file:
25151
25152
</P
25153
><PRE
25154
CLASS="programlisting"
25155
> Program('prog.c')
25156
</PRE
25157
><P
25158
>
25159
Generates the following error if the
25160
<TT
25161
CLASS="filename"
25162
>prog.c</TT
25163
> file
25164
does not exist:
25165
25166
</P
25167
><PRE
25168
CLASS="screen"
25169
> % <KBD
25170
CLASS="userinput"
25171
>scons -Q</KBD
25172
>
25173
scons: *** Source `prog.c' not found, needed by target `prog.o'. Stop.
25174
</PRE
25175
><P
25176
>
25177
In this case,
25178
the error is pretty obvious.
25179
But if it weren't,
25180
and you wanted to try to get more information
25181
about the error,
25182
the <TT
25183
CLASS="literal"
25184
>--debug=stacktrace</TT
25185
> option
25186
would show you exactly where in the <SPAN
25187
CLASS="application"
25188
>SCons</SPAN
25189
> source code
25190
the problem occurs:
25191
25192
</P
25193
><PRE
25194
CLASS="screen"
25195
> % <KBD
25196
CLASS="userinput"
25197
>scons -Q --debug=stacktrace</KBD
25198
>
25199
scons: *** Source `prog.c' not found, needed by target `prog.o'. Stop.
25200
scons: internal stack trace:
25201
File "bootstrap/src/engine/SCons/Job.py", line 198, in start
25202
File "bootstrap/src/engine/SCons/Script/Main.py", line 169, in prepare
25203
File "bootstrap/src/engine/SCons/Taskmaster.py", line 184, in prepare
25204
File "bootstrap/src/engine/SCons/Executor.py", line 171, in prepare
25205
</PRE
25206
><P
25207
>
25208
Of course, if you do need to dive into the <SPAN
25209
CLASS="application"
25210
>SCons</SPAN
25211
> source code,
25212
we'd like to know if, or how,
25213
the error messages or troubleshooting options
25214
could have been improved to avoid that.
25215
Not everyone has the necessary time or
25216
Python skill to dive into the source code,
25217
and we'd like to improve <SPAN
25218
CLASS="application"
25219
>SCons</SPAN
25220
>
25221
for those people as well...
25222
25223
</P
25224
></DIV
25225
><DIV
25226
CLASS="section"
25227
><HR><H2
25228
CLASS="section"
25229
><A
25230
NAME="AEN4736"
25231
>29.7. How is <SPAN
25232
CLASS="application"
25233
>SCons</SPAN
25234
> Making Its Decisions? the <TT
25235
CLASS="literal"
25236
>--taskmastertrace</TT
25237
> Option</A
25238
></H2
25239
><P
25240
>
25241
The internal <SPAN
25242
CLASS="application"
25243
>SCons</SPAN
25244
> subsystem that handles walking
25245
the dependency graph
25246
and controls the decision-making about what to rebuild
25247
is the <TT
25248
CLASS="literal"
25249
>Taskmaster</TT
25250
>.
25251
<SPAN
25252
CLASS="application"
25253
>SCons</SPAN
25254
> supports a <TT
25255
CLASS="literal"
25256
>--taskmastertrace</TT
25257
>
25258
option that tells the Taskmaster to print
25259
information about the children (dependencies)
25260
of the various Nodes on its walk down the graph,
25261
which specific dependent Nodes are being evaluated,
25262
and in what order.
25263
25264
</P
25265
><P
25266
>
25267
The <TT
25268
CLASS="literal"
25269
>--taskmastertrace</TT
25270
> option
25271
takes as an argument the name of a file in
25272
which to put the trace output,
25273
with <TT
25274
CLASS="filename"
25275
>-</TT
25276
> (a single hyphen)
25277
indicating that the trace messages
25278
should be printed to the standard output:
25279
25280
</P
25281
><PRE
25282
CLASS="programlisting"
25283
> env = Environment(CPPPATH = ['.'])
25284
env.Program('prog.c')
25285
</PRE
25286
><PRE
25287
CLASS="screen"
25288
> % <KBD
25289
CLASS="userinput"
25290
>scons -Q --taskmastertrace=- prog</KBD
25291
>
25292
25293
Taskmaster: Looking for a node to evaluate
25294
Taskmaster: Considering node <no_state 0 'prog'> and its children:
25295
Taskmaster: <no_state 0 'prog.o'>
25296
Taskmaster: adjusting ref count: <pending 1 'prog'>
25297
Taskmaster: Considering node <no_state 0 'prog.o'> and its children:
25298
Taskmaster: <no_state 0 'prog.c'>
25299
Taskmaster: <no_state 0 'inc.h'>
25300
Taskmaster: adjusting ref count: <pending 1 'prog.o'>
25301
Taskmaster: adjusting ref count: <pending 2 'prog.o'>
25302
Taskmaster: Considering node <no_state 0 'prog.c'> and its children:
25303
Taskmaster: Evaluating <pending 0 'prog.c'>
25304
25305
Taskmaster: Looking for a node to evaluate
25306
Taskmaster: Considering node <no_state 0 'inc.h'> and its children:
25307
Taskmaster: Evaluating <pending 0 'inc.h'>
25308
25309
Taskmaster: Looking for a node to evaluate
25310
Taskmaster: Considering node <pending 0 'prog.o'> and its children:
25311
Taskmaster: <up_to_date 0 'prog.c'>
25312
Taskmaster: <up_to_date 0 'inc.h'>
25313
Taskmaster: Evaluating <pending 0 'prog.o'>
25314
cc -o prog.o -c -I. prog.c
25315
25316
Taskmaster: Looking for a node to evaluate
25317
Taskmaster: Considering node <pending 0 'prog'> and its children:
25318
Taskmaster: <executed 0 'prog.o'>
25319
Taskmaster: Evaluating <pending 0 'prog'>
25320
cc -o prog prog.o
25321
25322
Taskmaster: Looking for a node to evaluate
25323
Taskmaster: No candidate anymore.
25324
</PRE
25325
><P
25326
>
25327
The <TT
25328
CLASS="literal"
25329
>--taskmastertrace</TT
25330
> option
25331
doesn't provide information about the actual
25332
calculations involved in deciding if a file is up-to-date,
25333
but it does show all of the dependencies
25334
it knows about for each Node,
25335
and the order in which those dependencies are evaluated.
25336
This can be useful as an alternate way to determine
25337
whether or not your <SPAN
25338
CLASS="application"
25339
>SCons</SPAN
25340
> configuration,
25341
or the implicit dependency scan,
25342
has actually identified all the correct dependencies
25343
you want it to.
25344
25345
</P
25346
></DIV
25347
></DIV
25348
><DIV
25349
CLASS="appendix"
25350
><HR><H1
25351
><A
25352
NAME="app-variables"
25353
></A
25354
>Appendix A. Construction Variables</H1
25355
><P
25356
>
25357
This appendix contains descriptions of all of the
25358
construction variables that are <SPAN
25359
CLASS="emphasis"
25360
><I
25361
CLASS="emphasis"
25362
>potentially</I
25363
></SPAN
25364
>
25365
available "out of the box" in this version of SCons.
25366
Whether or not setting a construction variable
25367
in a construction environment
25368
will actually have an effect depends on
25369
whether any of the Tools and/or Builders
25370
that use the variable have been
25371
included in the construction environment.
25372
25373
</P
25374
><P
25375
>
25376
In this appendix, we have
25377
appended the initial <CODE
25378
CLASS="envar"
25379
>$</CODE
25380
>
25381
(dollar sign) to the beginning of each
25382
variable name when it appears in the text,
25383
but left off the dollar sign
25384
in the left-hand column
25385
where the name appears for each entry.
25386
25387
</P
25388
><P
25389
></P
25390
><DIV
25391
CLASS="variablelist"
25392
><DL
25393
><DT
25394
><A
25395
NAME="cv-AR"
25396
></A
25397
><CODE
25398
CLASS="envar"
25399
>AR</CODE
25400
></DT
25401
><DD
25402
><P
25403
> The static library archiver.
25404
</P
25405
></DD
25406
><DT
25407
><A
25408
NAME="cv-ARCHITECTURE"
25409
></A
25410
><CODE
25411
CLASS="envar"
25412
>ARCHITECTURE</CODE
25413
></DT
25414
><DD
25415
><P
25416
> Specifies the system architecture for which
25417
the package is being built.
25418
The default is the system architecture
25419
of the machine on which SCons is running.
25420
This is used to fill in the
25421
<TT
25422
CLASS="literal"
25423
>Architecture:</TT
25424
>
25425
field in an Ipkg
25426
<TT
25427
CLASS="filename"
25428
>control</TT
25429
> file,
25430
and as part of the name of a generated RPM file.
25431
</P
25432
></DD
25433
><DT
25434
><A
25435
NAME="cv-ARCOM"
25436
></A
25437
><CODE
25438
CLASS="envar"
25439
>ARCOM</CODE
25440
></DT
25441
><DD
25442
><P
25443
> The command line used to generate a static library from object files.
25444
</P
25445
></DD
25446
><DT
25447
><A
25448
NAME="cv-ARCOMSTR"
25449
></A
25450
><CODE
25451
CLASS="envar"
25452
>ARCOMSTR</CODE
25453
></DT
25454
><DD
25455
><P
25456
> The string displayed when an object file
25457
is generated from an assembly-language source file.
25458
If this is not set, then <A
25459
HREF="#cv-ARCOM"
25460
><CODE
25461
CLASS="envar"
25462
>$ARCOM</CODE
25463
></A
25464
> (the command line) is displayed.
25465
</P
25466
><PRE
25467
CLASS="programlisting"
25468
> env = Environment(ARCOMSTR = "Archiving $TARGET")
25469
</PRE
25470
></DD
25471
><DT
25472
><A
25473
NAME="cv-ARFLAGS"
25474
></A
25475
><CODE
25476
CLASS="envar"
25477
>ARFLAGS</CODE
25478
></DT
25479
><DD
25480
><P
25481
> General options passed to the static library archiver.
25482
</P
25483
></DD
25484
><DT
25485
><A
25486
NAME="cv-AS"
25487
></A
25488
><CODE
25489
CLASS="envar"
25490
>AS</CODE
25491
></DT
25492
><DD
25493
><P
25494
> The assembler.
25495
</P
25496
></DD
25497
><DT
25498
><A
25499
NAME="cv-ASCOM"
25500
></A
25501
><CODE
25502
CLASS="envar"
25503
>ASCOM</CODE
25504
></DT
25505
><DD
25506
><P
25507
> The command line used to generate an object file
25508
from an assembly-language source file.
25509
</P
25510
></DD
25511
><DT
25512
><A
25513
NAME="cv-ASCOMSTR"
25514
></A
25515
><CODE
25516
CLASS="envar"
25517
>ASCOMSTR</CODE
25518
></DT
25519
><DD
25520
><P
25521
> The string displayed when an object file
25522
is generated from an assembly-language source file.
25523
If this is not set, then <A
25524
HREF="#cv-ASCOM"
25525
><CODE
25526
CLASS="envar"
25527
>$ASCOM</CODE
25528
></A
25529
> (the command line) is displayed.
25530
</P
25531
><PRE
25532
CLASS="programlisting"
25533
> env = Environment(ASCOMSTR = "Assembling $TARGET")
25534
</PRE
25535
></DD
25536
><DT
25537
><A
25538
NAME="cv-ASFLAGS"
25539
></A
25540
><CODE
25541
CLASS="envar"
25542
>ASFLAGS</CODE
25543
></DT
25544
><DD
25545
><P
25546
> General options passed to the assembler.
25547
</P
25548
></DD
25549
><DT
25550
><A
25551
NAME="cv-ASPPCOM"
25552
></A
25553
><CODE
25554
CLASS="envar"
25555
>ASPPCOM</CODE
25556
></DT
25557
><DD
25558
><P
25559
> The command line used to assemble an assembly-language
25560
source file into an object file
25561
after first running the file through the C preprocessor.
25562
Any options specified
25563
in the <A
25564
HREF="#cv-ASFLAGS"
25565
><CODE
25566
CLASS="envar"
25567
>$ASFLAGS</CODE
25568
></A
25569
> and <A
25570
HREF="#cv-CPPFLAGS"
25571
><CODE
25572
CLASS="envar"
25573
>$CPPFLAGS</CODE
25574
></A
25575
> construction variables
25576
are included on this command line.
25577
</P
25578
></DD
25579
><DT
25580
><A
25581
NAME="cv-ASPPCOMSTR"
25582
></A
25583
><CODE
25584
CLASS="envar"
25585
>ASPPCOMSTR</CODE
25586
></DT
25587
><DD
25588
><P
25589
> The string displayed when an object file
25590
is generated from an assembly-language source file
25591
after first running the file through the C preprocessor.
25592
If this is not set, then <A
25593
HREF="#cv-ASPPCOM"
25594
><CODE
25595
CLASS="envar"
25596
>$ASPPCOM</CODE
25597
></A
25598
> (the command line) is displayed.
25599
</P
25600
><PRE
25601
CLASS="programlisting"
25602
> env = Environment(ASPPCOMSTR = "Assembling $TARGET")
25603
</PRE
25604
></DD
25605
><DT
25606
><A
25607
NAME="cv-ASPPFLAGS"
25608
></A
25609
><CODE
25610
CLASS="envar"
25611
>ASPPFLAGS</CODE
25612
></DT
25613
><DD
25614
><P
25615
> General options when an assembling an assembly-language
25616
source file into an object file
25617
after first running the file through the C preprocessor.
25618
The default is to use the value of <A
25619
HREF="#cv-ASFLAGS"
25620
><CODE
25621
CLASS="envar"
25622
>$ASFLAGS</CODE
25623
></A
25624
>.
25625
</P
25626
></DD
25627
><DT
25628
><A
25629
NAME="cv-BIBTEX"
25630
></A
25631
><CODE
25632
CLASS="envar"
25633
>BIBTEX</CODE
25634
></DT
25635
><DD
25636
><P
25637
> The bibliography generator for the TeX formatter and typesetter and the
25638
LaTeX structured formatter and typesetter.
25639
</P
25640
></DD
25641
><DT
25642
><A
25643
NAME="cv-BIBTEXCOM"
25644
></A
25645
><CODE
25646
CLASS="envar"
25647
>BIBTEXCOM</CODE
25648
></DT
25649
><DD
25650
><P
25651
> The command line used to call the bibliography generator for the
25652
TeX formatter and typesetter and the LaTeX structured formatter and
25653
typesetter.
25654
</P
25655
></DD
25656
><DT
25657
><A
25658
NAME="cv-BIBTEXCOMSTR"
25659
></A
25660
><CODE
25661
CLASS="envar"
25662
>BIBTEXCOMSTR</CODE
25663
></DT
25664
><DD
25665
><P
25666
> The string displayed when generating a bibliography
25667
for TeX or LaTeX.
25668
If this is not set, then <A
25669
HREF="#cv-BIBTEXCOM"
25670
><CODE
25671
CLASS="envar"
25672
>$BIBTEXCOM</CODE
25673
></A
25674
> (the command line) is displayed.
25675
</P
25676
><PRE
25677
CLASS="programlisting"
25678
> env = Environment(BIBTEXCOMSTR = "Generating bibliography $TARGET")
25679
</PRE
25680
></DD
25681
><DT
25682
><A
25683
NAME="cv-BIBTEXFLAGS"
25684
></A
25685
><CODE
25686
CLASS="envar"
25687
>BIBTEXFLAGS</CODE
25688
></DT
25689
><DD
25690
><P
25691
> General options passed to the bibliography generator for the TeX formatter
25692
and typesetter and the LaTeX structured formatter and typesetter.
25693
</P
25694
></DD
25695
><DT
25696
><A
25697
NAME="cv-BITKEEPER"
25698
></A
25699
><CODE
25700
CLASS="envar"
25701
>BITKEEPER</CODE
25702
></DT
25703
><DD
25704
><P
25705
> The BitKeeper executable.
25706
</P
25707
></DD
25708
><DT
25709
><A
25710
NAME="cv-BITKEEPERCOM"
25711
></A
25712
><CODE
25713
CLASS="envar"
25714
>BITKEEPERCOM</CODE
25715
></DT
25716
><DD
25717
><P
25718
> The command line for
25719
fetching source files using BitKeeper.
25720
</P
25721
></DD
25722
><DT
25723
><A
25724
NAME="cv-BITKEEPERCOMSTR"
25725
></A
25726
><CODE
25727
CLASS="envar"
25728
>BITKEEPERCOMSTR</CODE
25729
></DT
25730
><DD
25731
><P
25732
> The string displayed when fetching
25733
a source file using BitKeeper.
25734
If this is not set, then <A
25735
HREF="#cv-BITKEEPERCOM"
25736
><CODE
25737
CLASS="envar"
25738
>$BITKEEPERCOM</CODE
25739
></A
25740
>
25741
(the command line) is displayed.
25742
</P
25743
></DD
25744
><DT
25745
><A
25746
NAME="cv-BITKEEPERGET"
25747
></A
25748
><CODE
25749
CLASS="envar"
25750
>BITKEEPERGET</CODE
25751
></DT
25752
><DD
25753
><P
25754
> The command (<A
25755
HREF="#cv-BITKEEPER"
25756
><CODE
25757
CLASS="envar"
25758
>$BITKEEPER</CODE
25759
></A
25760
>) and subcommand
25761
for fetching source files using BitKeeper.
25762
</P
25763
></DD
25764
><DT
25765
><A
25766
NAME="cv-BITKEEPERGETFLAGS"
25767
></A
25768
><CODE
25769
CLASS="envar"
25770
>BITKEEPERGETFLAGS</CODE
25771
></DT
25772
><DD
25773
><P
25774
> Options that are passed to the BitKeeper
25775
<B
25776
CLASS="command"
25777
>get</B
25778
>
25779
subcommand.
25780
</P
25781
></DD
25782
><DT
25783
><A
25784
NAME="cv-BUILDERS"
25785
></A
25786
><CODE
25787
CLASS="envar"
25788
>BUILDERS</CODE
25789
></DT
25790
><DD
25791
><P
25792
> A dictionary mapping the names of the builders
25793
available through this environment
25794
to underlying Builder objects.
25795
Builders named
25796
Alias, CFile, CXXFile, DVI, Library, Object, PDF, PostScript, and Program
25797
are available by default.
25798
If you initialize this variable when an
25799
Environment is created:
25800
</P
25801
><PRE
25802
CLASS="programlisting"
25803
> env = Environment(BUILDERS = {'NewBuilder' : foo})
25804
</PRE
25805
><P
25806
> the default Builders will no longer be available.
25807
To use a new Builder object in addition to the default Builders,
25808
add your new Builder object like this:
25809
</P
25810
><PRE
25811
CLASS="programlisting"
25812
> env = Environment()
25813
env.Append(BUILDERS = {'NewBuilder' : foo})
25814
</PRE
25815
><P
25816
> or this:
25817
</P
25818
><PRE
25819
CLASS="programlisting"
25820
> env = Environment()
25821
env['BUILDERS]['NewBuilder'] = foo
25822
</PRE
25823
></DD
25824
><DT
25825
><A
25826
NAME="cv-CC"
25827
></A
25828
><CODE
25829
CLASS="envar"
25830
>CC</CODE
25831
></DT
25832
><DD
25833
><P
25834
> The C compiler.
25835
</P
25836
></DD
25837
><DT
25838
><A
25839
NAME="cv-CCCOM"
25840
></A
25841
><CODE
25842
CLASS="envar"
25843
>CCCOM</CODE
25844
></DT
25845
><DD
25846
><P
25847
> The command line used to compile a C source file to a (static) object
25848
file. Any options specified in the <A
25849
HREF="#cv-CFLAGS"
25850
><CODE
25851
CLASS="envar"
25852
>$CFLAGS</CODE
25853
></A
25854
>, <A
25855
HREF="#cv-CCFLAGS"
25856
><CODE
25857
CLASS="envar"
25858
>$CCFLAGS</CODE
25859
></A
25860
> and
25861
<A
25862
HREF="#cv-CPPFLAGS"
25863
><CODE
25864
CLASS="envar"
25865
>$CPPFLAGS</CODE
25866
></A
25867
> construction variables are included on this command
25868
line.
25869
</P
25870
></DD
25871
><DT
25872
><A
25873
NAME="cv-CCCOMSTR"
25874
></A
25875
><CODE
25876
CLASS="envar"
25877
>CCCOMSTR</CODE
25878
></DT
25879
><DD
25880
><P
25881
> The string displayed when a C source file
25882
is compiled to a (static) object file.
25883
If this is not set, then <A
25884
HREF="#cv-CCCOM"
25885
><CODE
25886
CLASS="envar"
25887
>$CCCOM</CODE
25888
></A
25889
> (the command line) is displayed.
25890
</P
25891
><PRE
25892
CLASS="programlisting"
25893
> env = Environment(CCCOMSTR = "Compiling static object $TARGET")
25894
</PRE
25895
></DD
25896
><DT
25897
><A
25898
NAME="cv-CCFLAGS"
25899
></A
25900
><CODE
25901
CLASS="envar"
25902
>CCFLAGS</CODE
25903
></DT
25904
><DD
25905
><P
25906
> General options that are passed to the C and C++ compilers.
25907
</P
25908
></DD
25909
><DT
25910
><A
25911
NAME="cv-CCPCHFLAGS"
25912
></A
25913
><CODE
25914
CLASS="envar"
25915
>CCPCHFLAGS</CODE
25916
></DT
25917
><DD
25918
><P
25919
> Options added to the compiler command line
25920
to support building with precompiled headers.
25921
The default value expands expands to the appropriate
25922
Microsoft Visual C++ command-line options
25923
when the <A
25924
HREF="#cv-PCH"
25925
><CODE
25926
CLASS="envar"
25927
>$PCH</CODE
25928
></A
25929
> construction variable is set.
25930
</P
25931
></DD
25932
><DT
25933
><A
25934
NAME="cv-CCPDBFLAGS"
25935
></A
25936
><CODE
25937
CLASS="envar"
25938
>CCPDBFLAGS</CODE
25939
></DT
25940
><DD
25941
><P
25942
> Options added to the compiler command line
25943
to support storing debugging information in a
25944
Microsoft Visual C++ PDB file.
25945
The default value expands expands to appropriate
25946
Microsoft Visual C++ command-line options
25947
when the <A
25948
HREF="#cv-PDB"
25949
><CODE
25950
CLASS="envar"
25951
>$PDB</CODE
25952
></A
25953
> construction variable is set.</P
25954
><P
25955
>The Visual C++ compiler option that SCons uses by default
25956
to generate PDB information is <CODE
25957
CLASS="option"
25958
>/Z7</CODE
25959
>.
25960
This works correctly with parallel (<CODE
25961
CLASS="option"
25962
>-j</CODE
25963
>) builds
25964
because it embeds the debug information in the intermediate object files,
25965
as opposed to sharing a single PDB file between multiple object files.
25966
This is also the only way to get debug information
25967
embedded into a static library.
25968
Using the <CODE
25969
CLASS="option"
25970
>/Zi</CODE
25971
> instead may yield improved
25972
link-time performance,
25973
although parallel builds will no longer work.</P
25974
><P
25975
>You can generate PDB files with the <CODE
25976
CLASS="option"
25977
>/Zi</CODE
25978
>
25979
switch by overriding the default <A
25980
HREF="#cv-CCPDBFLAGS"
25981
><CODE
25982
CLASS="envar"
25983
>$CCPDBFLAGS</CODE
25984
></A
25985
> variable as follows:
25986
</P
25987
><PRE
25988
CLASS="programlisting"
25989
> env['CCPDBFLAGS'] = ['${(PDB and "/Zi /Fd%s" % File(PDB)) or ""}']
25990
</PRE
25991
><P
25992
> An alternative would be to use the <CODE
25993
CLASS="option"
25994
>/Zi</CODE
25995
>
25996
to put the debugging information in a separate <TT
25997
CLASS="filename"
25998
>.pdb</TT
25999
>
26000
file for each object file by overriding
26001
the <A
26002
HREF="#cv-CCPDBFLAGS"
26003
><CODE
26004
CLASS="envar"
26005
>$CCPDBFLAGS</CODE
26006
></A
26007
> variable as follows:
26008
</P
26009
><PRE
26010
CLASS="programlisting"
26011
> env['CCPDBFLAGS'] = '/Zi /Fd${TARGET}.pdb'
26012
</PRE
26013
></DD
26014
><DT
26015
><A
26016
NAME="cv-CCVERSION"
26017
></A
26018
><CODE
26019
CLASS="envar"
26020
>CCVERSION</CODE
26021
></DT
26022
><DD
26023
><P
26024
> The version number of the C compiler.
26025
This may or may not be set,
26026
depending on the specific C compiler being used.
26027
</P
26028
></DD
26029
><DT
26030
><A
26031
NAME="cv-CFILESUFFIX"
26032
></A
26033
><CODE
26034
CLASS="envar"
26035
>CFILESUFFIX</CODE
26036
></DT
26037
><DD
26038
><P
26039
> The suffix for C source files.
26040
This is used by the internal CFile builder
26041
when generating C files from Lex (.l) or YACC (.y) input files.
26042
The default suffix, of course, is
26043
<TT
26044
CLASS="filename"
26045
>.c</TT
26046
>
26047
(lower case).
26048
On case-insensitive systems (like Windows),
26049
SCons also treats
26050
<TT
26051
CLASS="filename"
26052
>.C</TT
26053
>
26054
(upper case) files
26055
as C files.
26056
</P
26057
></DD
26058
><DT
26059
><A
26060
NAME="cv-CFLAGS"
26061
></A
26062
><CODE
26063
CLASS="envar"
26064
>CFLAGS</CODE
26065
></DT
26066
><DD
26067
><P
26068
> General options that are passed to the C compiler (C only; not C++).
26069
</P
26070
></DD
26071
><DT
26072
><A
26073
NAME="cv-CHANGE_SPECFILE"
26074
></A
26075
><CODE
26076
CLASS="envar"
26077
>CHANGE_SPECFILE</CODE
26078
></DT
26079
><DD
26080
><P
26081
> A hook for modifying the file that controls the packaging build
26082
(the <TT
26083
CLASS="filename"
26084
>.spec</TT
26085
> for RPM,
26086
the <TT
26087
CLASS="filename"
26088
>control</TT
26089
> for Ipkg,
26090
the <TT
26091
CLASS="filename"
26092
>.wxs</TT
26093
> for MSI).
26094
If set, the function will be called
26095
after the SCons template for the file has been written.
26096
XXX
26097
</P
26098
></DD
26099
><DT
26100
><A
26101
NAME="cv-CHANGELOG"
26102
></A
26103
><CODE
26104
CLASS="envar"
26105
>CHANGELOG</CODE
26106
></DT
26107
><DD
26108
><P
26109
> The name of a file containing the change log text
26110
to be included in the package.
26111
This is included as the
26112
<TT
26113
CLASS="literal"
26114
>%changelog</TT
26115
>
26116
section of the RPM
26117
<TT
26118
CLASS="filename"
26119
>.spec</TT
26120
> file.
26121
</P
26122
></DD
26123
><DT
26124
><A
26125
NAME="cv-_concat"
26126
></A
26127
><CODE
26128
CLASS="envar"
26129
>_concat</CODE
26130
></DT
26131
><DD
26132
><P
26133
> A function used to produce variables like <CODE
26134
CLASS="envar"
26135
>$_CPPINCFLAGS</CODE
26136
>. It takes
26137
four or five
26138
arguments: a prefix to concatenate onto each element, a list of
26139
elements, a suffix to concatenate onto each element, an environment
26140
for variable interpolation, and an optional function that will be
26141
called to transform the list before concatenation.
26142
</P
26143
><PRE
26144
CLASS="programlisting"
26145
> env['_CPPINCFLAGS'] = '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs)} $)',
26146
</PRE
26147
></DD
26148
><DT
26149
><A
26150
NAME="cv-CONFIGUREDIR"
26151
></A
26152
><CODE
26153
CLASS="envar"
26154
>CONFIGUREDIR</CODE
26155
></DT
26156
><DD
26157
><P
26158
> The name of the directory in which
26159
Configure context test files are written.
26160
The default is
26161
<TT
26162
CLASS="filename"
26163
>.sconf_temp</TT
26164
>
26165
in the top-level directory
26166
containing the
26167
<TT
26168
CLASS="filename"
26169
>SConstruct</TT
26170
>
26171
file.
26172
</P
26173
></DD
26174
><DT
26175
><A
26176
NAME="cv-CONFIGURELOG"
26177
></A
26178
><CODE
26179
CLASS="envar"
26180
>CONFIGURELOG</CODE
26181
></DT
26182
><DD
26183
><P
26184
> The name of the Configure context log file.
26185
The default is
26186
<TT
26187
CLASS="filename"
26188
>config.log</TT
26189
>
26190
in the top-level directory
26191
containing the
26192
<TT
26193
CLASS="filename"
26194
>SConstruct</TT
26195
>
26196
file.
26197
</P
26198
></DD
26199
><DT
26200
><A
26201
NAME="cv-_CPPDEFFLAGS"
26202
></A
26203
><CODE
26204
CLASS="envar"
26205
>_CPPDEFFLAGS</CODE
26206
></DT
26207
><DD
26208
><P
26209
> An automatically-generated construction variable
26210
containing the C preprocessor command-line options
26211
to define values.
26212
The value of <CODE
26213
CLASS="envar"
26214
>$_CPPDEFFLAGS</CODE
26215
> is created
26216
by appending <CODE
26217
CLASS="envar"
26218
>$CPPDEFPREFIX</CODE
26219
> and <CODE
26220
CLASS="envar"
26221
>$CPPDEFSUFFIX</CODE
26222
>
26223
to the beginning and end
26224
of each directory in <CODE
26225
CLASS="envar"
26226
>$CPPDEFINES</CODE
26227
>.
26228
</P
26229
></DD
26230
><DT
26231
><A
26232
NAME="cv-CPPDEFINES"
26233
></A
26234
><CODE
26235
CLASS="envar"
26236
>CPPDEFINES</CODE
26237
></DT
26238
><DD
26239
><P
26240
> A platform independent specification of C preprocessor definitions.
26241
The definitions will be added to command lines
26242
through the automatically-generated
26243
<CODE
26244
CLASS="envar"
26245
>$_CPPDEFFLAGS</CODE
26246
> construction variable (see above),
26247
which is constructed according to
26248
the type of value of <CODE
26249
CLASS="envar"
26250
>$CPPDEFINES</CODE
26251
>:</P
26252
><P
26253
>If <CODE
26254
CLASS="envar"
26255
>$CPPDEFINES</CODE
26256
> is a string,
26257
the values of the
26258
<CODE
26259
CLASS="envar"
26260
>$CPPDEFPREFIX</CODE
26261
> and <CODE
26262
CLASS="envar"
26263
>$CPPDEFSUFFIX</CODE
26264
>
26265
construction variables
26266
will be added to the beginning and end.
26267
</P
26268
><PRE
26269
CLASS="programlisting"
26270
> # Will add -Dxyz to POSIX compiler command lines,
26271
# and /Dxyz to Microsoft Visual C++ command lines.
26272
env = Environment(CPPDEFINES='xyz')
26273
</PRE
26274
><P
26275
> If <CODE
26276
CLASS="envar"
26277
>$CPPDEFINES</CODE
26278
> is a list,
26279
the values of the
26280
<CODE
26281
CLASS="envar"
26282
>$CPPDEFPREFIX</CODE
26283
> and <CODE
26284
CLASS="envar"
26285
>$CPPDEFSUFFIX</CODE
26286
>
26287
construction variables
26288
will be appended to the beginning and end
26289
of each element in the list.
26290
If any element is a list or tuple,
26291
then the first item is the name being
26292
defined and the second item is its value:
26293
</P
26294
><PRE
26295
CLASS="programlisting"
26296
> # Will add -DB=2 -DA to POSIX compiler command lines,
26297
# and /DB=2 /DA to Microsoft Visual C++ command lines.
26298
env = Environment(CPPDEFINES=[('B', 2), 'A'])
26299
</PRE
26300
><P
26301
> If <CODE
26302
CLASS="envar"
26303
>$CPPDEFINES</CODE
26304
> is a dictionary,
26305
the values of the
26306
<CODE
26307
CLASS="envar"
26308
>$CPPDEFPREFIX</CODE
26309
> and <CODE
26310
CLASS="envar"
26311
>$CPPDEFSUFFIX</CODE
26312
>
26313
construction variables
26314
will be appended to the beginning and end
26315
of each item from the dictionary.
26316
The key of each dictionary item
26317
is a name being defined
26318
to the dictionary item's corresponding value;
26319
if the value is
26320
<TT
26321
CLASS="literal"
26322
>None</TT
26323
>,
26324
then the name is defined without an explicit value.
26325
Note that the resulting flags are sorted by keyword
26326
to ensure that the order of the options on the
26327
command line is consistent each time
26328
<SPAN
26329
CLASS="application"
26330
>scons</SPAN
26331
>
26332
is run.
26333
</P
26334
><PRE
26335
CLASS="programlisting"
26336
> # Will add -DA -DB=2 to POSIX compiler command lines,
26337
# and /DA /DB=2 to Microsoft Visual C++ command lines.
26338
env = Environment(CPPDEFINES={'B':2, 'A':None})
26339
</PRE
26340
></DD
26341
><DT
26342
><A
26343
NAME="cv-CPPDEFPREFIX"
26344
></A
26345
><CODE
26346
CLASS="envar"
26347
>CPPDEFPREFIX</CODE
26348
></DT
26349
><DD
26350
><P
26351
> The prefix used to specify preprocessor definitions
26352
on the C compiler command line.
26353
This will be appended to the beginning of each definition
26354
in the <CODE
26355
CLASS="envar"
26356
>$CPPDEFINES</CODE
26357
> construction variable
26358
when the <CODE
26359
CLASS="envar"
26360
>$_CPPDEFFLAGS</CODE
26361
> variable is automatically generated.
26362
</P
26363
></DD
26364
><DT
26365
><A
26366
NAME="cv-CPPDEFSUFFIX"
26367
></A
26368
><CODE
26369
CLASS="envar"
26370
>CPPDEFSUFFIX</CODE
26371
></DT
26372
><DD
26373
><P
26374
> The suffix used to specify preprocessor definitions
26375
on the C compiler command line.
26376
This will be appended to the end of each definition
26377
in the <CODE
26378
CLASS="envar"
26379
>$CPPDEFINES</CODE
26380
> construction variable
26381
when the <CODE
26382
CLASS="envar"
26383
>$_CPPDEFFLAGS</CODE
26384
> variable is automatically generated.
26385
</P
26386
></DD
26387
><DT
26388
><A
26389
NAME="cv-CPPFLAGS"
26390
></A
26391
><CODE
26392
CLASS="envar"
26393
>CPPFLAGS</CODE
26394
></DT
26395
><DD
26396
><P
26397
> User-specified C preprocessor options.
26398
These will be included in any command that uses the C preprocessor,
26399
including not just compilation of C and C++ source files
26400
via the <A
26401
HREF="#cv-CCCOM"
26402
><CODE
26403
CLASS="envar"
26404
>$CCCOM</CODE
26405
></A
26406
>,
26407
<A
26408
HREF="#cv-SHCCCOM"
26409
><CODE
26410
CLASS="envar"
26411
>$SHCCCOM</CODE
26412
></A
26413
>,
26414
<A
26415
HREF="#cv-CXXCOM"
26416
><CODE
26417
CLASS="envar"
26418
>$CXXCOM</CODE
26419
></A
26420
> and
26421
<A
26422
HREF="#cv-SHCXXCOM"
26423
><CODE
26424
CLASS="envar"
26425
>$SHCXXCOM</CODE
26426
></A
26427
> command lines,
26428
but also the <A
26429
HREF="#cv-FORTRANPPCOM"
26430
><CODE
26431
CLASS="envar"
26432
>$FORTRANPPCOM</CODE
26433
></A
26434
>,
26435
<A
26436
HREF="#cv-SHFORTRANPPCOM"
26437
><CODE
26438
CLASS="envar"
26439
>$SHFORTRANPPCOM</CODE
26440
></A
26441
>,
26442
<A
26443
HREF="#cv-F77PPCOM"
26444
><CODE
26445
CLASS="envar"
26446
>$F77PPCOM</CODE
26447
></A
26448
> and
26449
<A
26450
HREF="#cv-SHF77PPCOM"
26451
><CODE
26452
CLASS="envar"
26453
>$SHF77PPCOM</CODE
26454
></A
26455
> command lines
26456
used to compile a Fortran source file,
26457
and the <A
26458
HREF="#cv-ASPPCOM"
26459
><CODE
26460
CLASS="envar"
26461
>$ASPPCOM</CODE
26462
></A
26463
> command line
26464
used to assemble an assembly language source file,
26465
after first running each file through the C preprocessor.
26466
Note that this variable does
26467
<SPAN
26468
CLASS="emphasis"
26469
><I
26470
CLASS="emphasis"
26471
>not</I
26472
></SPAN
26473
>
26474
contain
26475
<CODE
26476
CLASS="option"
26477
>-I</CODE
26478
>
26479
(or similar) include search path options
26480
that scons generates automatically from <A
26481
HREF="#cv-CPPPATH"
26482
><CODE
26483
CLASS="envar"
26484
>$CPPPATH</CODE
26485
></A
26486
>.
26487
See <A
26488
HREF="#cv-_CPPINCFLAGS"
26489
><CODE
26490
CLASS="envar"
26491
>$_CPPINCFLAGS</CODE
26492
></A
26493
>, below,
26494
for the variable that expands to those options.
26495
</P
26496
></DD
26497
><DT
26498
><A
26499
NAME="cv-_CPPINCFLAGS"
26500
></A
26501
><CODE
26502
CLASS="envar"
26503
>_CPPINCFLAGS</CODE
26504
></DT
26505
><DD
26506
><P
26507
> An automatically-generated construction variable
26508
containing the C preprocessor command-line options
26509
for specifying directories to be searched for include files.
26510
The value of <CODE
26511
CLASS="envar"
26512
>$_CPPINCFLAGS</CODE
26513
> is created
26514
by appending <CODE
26515
CLASS="envar"
26516
>$INCPREFIX</CODE
26517
> and <CODE
26518
CLASS="envar"
26519
>$INCSUFFIX</CODE
26520
>
26521
to the beginning and end
26522
of each directory in <CODE
26523
CLASS="envar"
26524
>$CPPPATH</CODE
26525
>.
26526
</P
26527
></DD
26528
><DT
26529
><A
26530
NAME="cv-CPPPATH"
26531
></A
26532
><CODE
26533
CLASS="envar"
26534
>CPPPATH</CODE
26535
></DT
26536
><DD
26537
><P
26538
> The list of directories that the C preprocessor will search for include
26539
directories. The C/C++ implicit dependency scanner will search these
26540
directories for include files. Don't explicitly put include directory
26541
arguments in CCFLAGS or CXXFLAGS because the result will be non-portable
26542
and the directories will not be searched by the dependency scanner. Note:
26543
directory names in CPPPATH will be looked-up relative to the SConscript
26544
directory when they are used in a command. To force
26545
<SPAN
26546
CLASS="application"
26547
>scons</SPAN
26548
>
26549
to look-up a directory relative to the root of the source tree use #:
26550
</P
26551
><PRE
26552
CLASS="programlisting"
26553
> env = Environment(CPPPATH='#/include')
26554
</PRE
26555
><P
26556
> The directory look-up can also be forced using the
26557
<CODE
26558
CLASS="function"
26559
>Dir</CODE
26560
>()
26561
function:
26562
</P
26563
><PRE
26564
CLASS="programlisting"
26565
> include = Dir('include')
26566
env = Environment(CPPPATH=include)
26567
</PRE
26568
><P
26569
> The directory list will be added to command lines
26570
through the automatically-generated
26571
<CODE
26572
CLASS="envar"
26573
>$_CPPINCFLAGS</CODE
26574
>
26575
construction variable,
26576
which is constructed by
26577
appending the values of the
26578
<CODE
26579
CLASS="envar"
26580
>$INCPREFIX</CODE
26581
> and <CODE
26582
CLASS="envar"
26583
>$INCSUFFIX</CODE
26584
>
26585
construction variables
26586
to the beginning and end
26587
of each directory in <CODE
26588
CLASS="envar"
26589
>$CPPPATH</CODE
26590
>.
26591
Any command lines you define that need
26592
the CPPPATH directory list should
26593
include <CODE
26594
CLASS="envar"
26595
>$_CPPINCFLAGS</CODE
26596
>:
26597
</P
26598
><PRE
26599
CLASS="programlisting"
26600
> env = Environment(CCCOM="my_compiler $_CPPINCFLAGS -c -o $TARGET $SOURCE")
26601
</PRE
26602
></DD
26603
><DT
26604
><A
26605
NAME="cv-CPPSUFFIXES"
26606
></A
26607
><CODE
26608
CLASS="envar"
26609
>CPPSUFFIXES</CODE
26610
></DT
26611
><DD
26612
><P
26613
> The list of suffixes of files that will be scanned
26614
for C preprocessor implicit dependencies
26615
(#include lines).
26616
The default list is:
26617
</P
26618
><PRE
26619
CLASS="programlisting"
26620
> [".c", ".C", ".cxx", ".cpp", ".c++", ".cc",
26621
".h", ".H", ".hxx", ".hpp", ".hh",
26622
".F", ".fpp", ".FPP",
26623
".m", ".mm",
26624
".S", ".spp", ".SPP"]
26625
</PRE
26626
></DD
26627
><DT
26628
><A
26629
NAME="cv-CVS"
26630
></A
26631
><CODE
26632
CLASS="envar"
26633
>CVS</CODE
26634
></DT
26635
><DD
26636
><P
26637
> The CVS executable.
26638
</P
26639
></DD
26640
><DT
26641
><A
26642
NAME="cv-CVSCOFLAGS"
26643
></A
26644
><CODE
26645
CLASS="envar"
26646
>CVSCOFLAGS</CODE
26647
></DT
26648
><DD
26649
><P
26650
> Options that are passed to the CVS checkout subcommand.
26651
</P
26652
></DD
26653
><DT
26654
><A
26655
NAME="cv-CVSCOM"
26656
></A
26657
><CODE
26658
CLASS="envar"
26659
>CVSCOM</CODE
26660
></DT
26661
><DD
26662
><P
26663
> The command line used to
26664
fetch source files from a CVS repository.
26665
</P
26666
></DD
26667
><DT
26668
><A
26669
NAME="cv-CVSCOMSTR"
26670
></A
26671
><CODE
26672
CLASS="envar"
26673
>CVSCOMSTR</CODE
26674
></DT
26675
><DD
26676
><P
26677
> The string displayed when fetching
26678
a source file from a CVS repository.
26679
If this is not set, then <A
26680
HREF="#cv-CVSCOM"
26681
><CODE
26682
CLASS="envar"
26683
>$CVSCOM</CODE
26684
></A
26685
>
26686
(the command line) is displayed.
26687
</P
26688
></DD
26689
><DT
26690
><A
26691
NAME="cv-CVSFLAGS"
26692
></A
26693
><CODE
26694
CLASS="envar"
26695
>CVSFLAGS</CODE
26696
></DT
26697
><DD
26698
><P
26699
> General options that are passed to CVS.
26700
By default, this is set to
26701
<TT
26702
CLASS="literal"
26703
>-d $CVSREPOSITORY</TT
26704
>
26705
to specify from where the files must be fetched.
26706
</P
26707
></DD
26708
><DT
26709
><A
26710
NAME="cv-CVSREPOSITORY"
26711
></A
26712
><CODE
26713
CLASS="envar"
26714
>CVSREPOSITORY</CODE
26715
></DT
26716
><DD
26717
><P
26718
> The path to the CVS repository.
26719
This is referenced in the default
26720
<A
26721
HREF="#cv-CVSFLAGS"
26722
><CODE
26723
CLASS="envar"
26724
>$CVSFLAGS</CODE
26725
></A
26726
> value.
26727
</P
26728
></DD
26729
><DT
26730
><A
26731
NAME="cv-CXX"
26732
></A
26733
><CODE
26734
CLASS="envar"
26735
>CXX</CODE
26736
></DT
26737
><DD
26738
><P
26739
> The C++ compiler.
26740
</P
26741
></DD
26742
><DT
26743
><A
26744
NAME="cv-CXXCOM"
26745
></A
26746
><CODE
26747
CLASS="envar"
26748
>CXXCOM</CODE
26749
></DT
26750
><DD
26751
><P
26752
> The command line used to compile a C++ source file to an object file.
26753
Any options specified in the <A
26754
HREF="#cv-CXXFLAGS"
26755
><CODE
26756
CLASS="envar"
26757
>$CXXFLAGS</CODE
26758
></A
26759
> and
26760
<A
26761
HREF="#cv-CPPFLAGS"
26762
><CODE
26763
CLASS="envar"
26764
>$CPPFLAGS</CODE
26765
></A
26766
> construction variables
26767
are included on this command line.
26768
</P
26769
></DD
26770
><DT
26771
><A
26772
NAME="cv-CXXCOMSTR"
26773
></A
26774
><CODE
26775
CLASS="envar"
26776
>CXXCOMSTR</CODE
26777
></DT
26778
><DD
26779
><P
26780
> The string displayed when a C++ source file
26781
is compiled to a (static) object file.
26782
If this is not set, then <A
26783
HREF="#cv-CXXCOM"
26784
><CODE
26785
CLASS="envar"
26786
>$CXXCOM</CODE
26787
></A
26788
> (the command line) is displayed.
26789
</P
26790
><PRE
26791
CLASS="programlisting"
26792
> env = Environment(CXXCOMSTR = "Compiling static object $TARGET")
26793
</PRE
26794
></DD
26795
><DT
26796
><A
26797
NAME="cv-CXXFILESUFFIX"
26798
></A
26799
><CODE
26800
CLASS="envar"
26801
>CXXFILESUFFIX</CODE
26802
></DT
26803
><DD
26804
><P
26805
> The suffix for C++ source files.
26806
This is used by the internal CXXFile builder
26807
when generating C++ files from Lex (.ll) or YACC (.yy) input files.
26808
The default suffix is
26809
<TT
26810
CLASS="filename"
26811
>.cc</TT
26812
>.
26813
SCons also treats files with the suffixes
26814
<TT
26815
CLASS="filename"
26816
>.cpp</TT
26817
>,
26818
<TT
26819
CLASS="filename"
26820
>.cxx</TT
26821
>,
26822
<TT
26823
CLASS="filename"
26824
>.c++</TT
26825
>,
26826
and
26827
<TT
26828
CLASS="filename"
26829
>.C++</TT
26830
>
26831
as C++ files,
26832
and files with
26833
<TT
26834
CLASS="filename"
26835
>.mm</TT
26836
>
26837
suffixes as Objective C++ files.
26838
On case-sensitive systems (Linux, UNIX, and other POSIX-alikes),
26839
SCons also treats
26840
<TT
26841
CLASS="filename"
26842
>.C</TT
26843
>
26844
(upper case) files
26845
as C++ files.
26846
</P
26847
></DD
26848
><DT
26849
><A
26850
NAME="cv-CXXFLAGS"
26851
></A
26852
><CODE
26853
CLASS="envar"
26854
>CXXFLAGS</CODE
26855
></DT
26856
><DD
26857
><P
26858
> General options that are passed to the C++ compiler.
26859
By default, this includes the value of <A
26860
HREF="#cv-CCFLAGS"
26861
><CODE
26862
CLASS="envar"
26863
>$CCFLAGS</CODE
26864
></A
26865
>,
26866
so that setting <CODE
26867
CLASS="envar"
26868
>$CCFLAGS</CODE
26869
> affects both C and C++ compilation.
26870
If you want to add C++-specific flags,
26871
you must set or override the value of <A
26872
HREF="#cv-CXXFLAGS"
26873
><CODE
26874
CLASS="envar"
26875
>$CXXFLAGS</CODE
26876
></A
26877
>.
26878
</P
26879
></DD
26880
><DT
26881
><A
26882
NAME="cv-CXXVERSION"
26883
></A
26884
><CODE
26885
CLASS="envar"
26886
>CXXVERSION</CODE
26887
></DT
26888
><DD
26889
><P
26890
> The version number of the C++ compiler.
26891
This may or may not be set,
26892
depending on the specific C++ compiler being used.
26893
</P
26894
></DD
26895
><DT
26896
><A
26897
NAME="cv-DESCRIPTION"
26898
></A
26899
><CODE
26900
CLASS="envar"
26901
>DESCRIPTION</CODE
26902
></DT
26903
><DD
26904
><P
26905
> A long description of the project being packaged.
26906
This is included in the relevant section
26907
of the file that controls the packaging build.
26908
</P
26909
></DD
26910
><DT
26911
><A
26912
NAME="cv-DESCRIPTION_lang"
26913
></A
26914
><CODE
26915
CLASS="envar"
26916
>DESCRIPTION_lang</CODE
26917
></DT
26918
><DD
26919
><P
26920
> A language-specific long description for
26921
the specified <CODE
26922
CLASS="varname"
26923
>lang</CODE
26924
>.
26925
This is used to populate a
26926
<TT
26927
CLASS="literal"
26928
>%description -l</TT
26929
>
26930
section of an RPM
26931
<TT
26932
CLASS="filename"
26933
>.spec</TT
26934
> file.
26935
</P
26936
></DD
26937
><DT
26938
><A
26939
NAME="cv-Dir"
26940
></A
26941
><CODE
26942
CLASS="envar"
26943
>Dir</CODE
26944
></DT
26945
><DD
26946
><P
26947
> A function that converts a string
26948
into a Dir instance relative to the target being built.
26949
</P
26950
></DD
26951
><DT
26952
><A
26953
NAME="cv-Dirs"
26954
></A
26955
><CODE
26956
CLASS="envar"
26957
>Dirs</CODE
26958
></DT
26959
><DD
26960
><P
26961
> A function that converts a list of strings
26962
into a list of Dir instances relative to the target being built.
26963
</P
26964
></DD
26965
><DT
26966
><A
26967
NAME="cv-DSUFFIXES"
26968
></A
26969
><CODE
26970
CLASS="envar"
26971
>DSUFFIXES</CODE
26972
></DT
26973
><DD
26974
><P
26975
> The list of suffixes of files that will be scanned
26976
for imported D package files.
26977
The default list is:
26978
</P
26979
><PRE
26980
CLASS="programlisting"
26981
> ['.d']
26982
</PRE
26983
></DD
26984
><DT
26985
><A
26986
NAME="cv-DVIPDF"
26987
></A
26988
><CODE
26989
CLASS="envar"
26990
>DVIPDF</CODE
26991
></DT
26992
><DD
26993
><P
26994
> The TeX DVI file to PDF file converter.
26995
</P
26996
></DD
26997
><DT
26998
><A
26999
NAME="cv-DVIPDFCOM"
27000
></A
27001
><CODE
27002
CLASS="envar"
27003
>DVIPDFCOM</CODE
27004
></DT
27005
><DD
27006
><P
27007
> The command line used to convert TeX DVI files into a PDF file.
27008
</P
27009
></DD
27010
><DT
27011
><A
27012
NAME="cv-DVIPDFCOMSTR"
27013
></A
27014
><CODE
27015
CLASS="envar"
27016
>DVIPDFCOMSTR</CODE
27017
></DT
27018
><DD
27019
><P
27020
> The string displayed when a TeX DVI file
27021
is converted into a PDF file.
27022
If this is not set, then <A
27023
HREF="#cv-DVIPDFCOM"
27024
><CODE
27025
CLASS="envar"
27026
>$DVIPDFCOM</CODE
27027
></A
27028
> (the command line) is displayed.
27029
</P
27030
></DD
27031
><DT
27032
><A
27033
NAME="cv-DVIPDFFLAGS"
27034
></A
27035
><CODE
27036
CLASS="envar"
27037
>DVIPDFFLAGS</CODE
27038
></DT
27039
><DD
27040
><P
27041
> General options passed to the TeX DVI file to PDF file converter.
27042
</P
27043
></DD
27044
><DT
27045
><A
27046
NAME="cv-DVIPS"
27047
></A
27048
><CODE
27049
CLASS="envar"
27050
>DVIPS</CODE
27051
></DT
27052
><DD
27053
><P
27054
> The TeX DVI file to PostScript converter.
27055
</P
27056
></DD
27057
><DT
27058
><A
27059
NAME="cv-DVIPSFLAGS"
27060
></A
27061
><CODE
27062
CLASS="envar"
27063
>DVIPSFLAGS</CODE
27064
></DT
27065
><DD
27066
><P
27067
> General options passed to the TeX DVI file to PostScript converter.
27068
</P
27069
></DD
27070
><DT
27071
><A
27072
NAME="cv-ENV"
27073
></A
27074
><CODE
27075
CLASS="envar"
27076
>ENV</CODE
27077
></DT
27078
><DD
27079
><P
27080
> A dictionary of environment variables
27081
to use when invoking commands. When
27082
<CODE
27083
CLASS="envar"
27084
>$ENV</CODE
27085
> is used in a command all list
27086
values will be joined using the path separator and any other non-string
27087
values will simply be coerced to a string.
27088
Note that, by default,
27089
<SPAN
27090
CLASS="application"
27091
>scons</SPAN
27092
>
27093
does
27094
<SPAN
27095
CLASS="emphasis"
27096
><I
27097
CLASS="emphasis"
27098
>not</I
27099
></SPAN
27100
>
27101
propagate the environment in force when you
27102
execute
27103
<SPAN
27104
CLASS="application"
27105
>scons</SPAN
27106
>
27107
to the commands used to build target files.
27108
This is so that builds will be guaranteed
27109
repeatable regardless of the environment
27110
variables set at the time
27111
<SPAN
27112
CLASS="application"
27113
>scons</SPAN
27114
>
27115
is invoked.</P
27116
><P
27117
>If you want to propagate your
27118
environment variables
27119
to the commands executed
27120
to build target files,
27121
you must do so explicitly:
27122
</P
27123
><PRE
27124
CLASS="programlisting"
27125
> import os
27126
env = Environment(ENV = os.environ)
27127
</PRE
27128
><P
27129
> Note that you can choose only to propagate
27130
certain environment variables.
27131
A common example is
27132
the system
27133
<CODE
27134
CLASS="envar"
27135
>PATH</CODE
27136
>
27137
environment variable,
27138
so that
27139
<SPAN
27140
CLASS="application"
27141
>scons</SPAN
27142
>
27143
uses the same utilities
27144
as the invoking shell (or other process):
27145
</P
27146
><PRE
27147
CLASS="programlisting"
27148
> import os
27149
env = Environment(ENV = {'PATH' : os.environ['PATH']})
27150
</PRE
27151
></DD
27152
><DT
27153
><A
27154
NAME="cv-ESCAPE"
27155
></A
27156
><CODE
27157
CLASS="envar"
27158
>ESCAPE</CODE
27159
></DT
27160
><DD
27161
><P
27162
> A function that will be called to escape shell special characters in
27163
command lines. The function should take one argument: the command line
27164
string to escape; and should return the escaped command line.
27165
</P
27166
></DD
27167
><DT
27168
><A
27169
NAME="cv-F77"
27170
></A
27171
><CODE
27172
CLASS="envar"
27173
>F77</CODE
27174
></DT
27175
><DD
27176
><P
27177
> The Fortran 77 compiler.
27178
You should normally set the <A
27179
HREF="#cv-FORTRAN"
27180
><CODE
27181
CLASS="envar"
27182
>$FORTRAN</CODE
27183
></A
27184
> variable,
27185
which specifies the default Fortran compiler
27186
for all Fortran versions.
27187
You only need to set <A
27188
HREF="#cv-F77"
27189
><CODE
27190
CLASS="envar"
27191
>$F77</CODE
27192
></A
27193
> if you need to use a specific compiler
27194
or compiler version for Fortran 77 files.
27195
</P
27196
></DD
27197
><DT
27198
><A
27199
NAME="cv-F77COM"
27200
></A
27201
><CODE
27202
CLASS="envar"
27203
>F77COM</CODE
27204
></DT
27205
><DD
27206
><P
27207
> The command line used to compile a Fortran 77 source file to an object file.
27208
You only need to set <A
27209
HREF="#cv-F77COM"
27210
><CODE
27211
CLASS="envar"
27212
>$F77COM</CODE
27213
></A
27214
> if you need to use a specific
27215
command line for Fortran 77 files.
27216
You should normally set the <A
27217
HREF="#cv-FORTRANCOM"
27218
><CODE
27219
CLASS="envar"
27220
>$FORTRANCOM</CODE
27221
></A
27222
> variable,
27223
which specifies the default command line
27224
for all Fortran versions.
27225
</P
27226
></DD
27227
><DT
27228
><A
27229
NAME="cv-F77COMSTR"
27230
></A
27231
><CODE
27232
CLASS="envar"
27233
>F77COMSTR</CODE
27234
></DT
27235
><DD
27236
><P
27237
> The string displayed when a Fortran 77 source file
27238
is compiled to an object file.
27239
If this is not set, then <A
27240
HREF="#cv-F77COM"
27241
><CODE
27242
CLASS="envar"
27243
>$F77COM</CODE
27244
></A
27245
> or <A
27246
HREF="#cv-FORTRANCOM"
27247
><CODE
27248
CLASS="envar"
27249
>$FORTRANCOM</CODE
27250
></A
27251
>
27252
(the command line) is displayed.
27253
</P
27254
></DD
27255
><DT
27256
><A
27257
NAME="cv-F77FILESUFFIXES"
27258
></A
27259
><CODE
27260
CLASS="envar"
27261
>F77FILESUFFIXES</CODE
27262
></DT
27263
><DD
27264
><P
27265
> The list of file extensions for which the F77 dialect will be used. By
27266
default, this is ['.f77']
27267
</P
27268
></DD
27269
><DT
27270
><A
27271
NAME="cv-F77FLAGS"
27272
></A
27273
><CODE
27274
CLASS="envar"
27275
>F77FLAGS</CODE
27276
></DT
27277
><DD
27278
><P
27279
> General user-specified options that are passed to the Fortran 77 compiler.
27280
Note that this variable does
27281
<SPAN
27282
CLASS="emphasis"
27283
><I
27284
CLASS="emphasis"
27285
>not</I
27286
></SPAN
27287
>
27288
contain
27289
<CODE
27290
CLASS="option"
27291
>-I</CODE
27292
>
27293
(or similar) include search path options
27294
that scons generates automatically from <A
27295
HREF="#cv-F77PATH"
27296
><CODE
27297
CLASS="envar"
27298
>$F77PATH</CODE
27299
></A
27300
>.
27301
See
27302
<A
27303
HREF="#cv-_F77INCFLAGS"
27304
><CODE
27305
CLASS="envar"
27306
>$_F77INCFLAGS</CODE
27307
></A
27308
>
27309
below,
27310
for the variable that expands to those options.
27311
You only need to set <A
27312
HREF="#cv-F77FLAGS"
27313
><CODE
27314
CLASS="envar"
27315
>$F77FLAGS</CODE
27316
></A
27317
> if you need to define specific
27318
user options for Fortran 77 files.
27319
You should normally set the <A
27320
HREF="#cv-FORTRANFLAGS"
27321
><CODE
27322
CLASS="envar"
27323
>$FORTRANFLAGS</CODE
27324
></A
27325
> variable,
27326
which specifies the user-specified options
27327
passed to the default Fortran compiler
27328
for all Fortran versions.
27329
</P
27330
></DD
27331
><DT
27332
><A
27333
NAME="cv-_F77INCFLAGS"
27334
></A
27335
><CODE
27336
CLASS="envar"
27337
>_F77INCFLAGS</CODE
27338
></DT
27339
><DD
27340
><P
27341
> An automatically-generated construction variable
27342
containing the Fortran 77 compiler command-line options
27343
for specifying directories to be searched for include files.
27344
The value of <A
27345
HREF="#cv-_F77INCFLAGS"
27346
><CODE
27347
CLASS="envar"
27348
>$_F77INCFLAGS</CODE
27349
></A
27350
> is created
27351
by appending <A
27352
HREF="#cv-INCPREFIX"
27353
><CODE
27354
CLASS="envar"
27355
>$INCPREFIX</CODE
27356
></A
27357
> and <A
27358
HREF="#cv-INCSUFFIX"
27359
><CODE
27360
CLASS="envar"
27361
>$INCSUFFIX</CODE
27362
></A
27363
>
27364
to the beginning and end
27365
of each directory in <A
27366
HREF="#cv-F77PATH"
27367
><CODE
27368
CLASS="envar"
27369
>$F77PATH</CODE
27370
></A
27371
>.
27372
</P
27373
></DD
27374
><DT
27375
><A
27376
NAME="cv-F77PATH"
27377
></A
27378
><CODE
27379
CLASS="envar"
27380
>F77PATH</CODE
27381
></DT
27382
><DD
27383
><P
27384
> The list of directories that the Fortran 77 compiler will search for include
27385
directories. The implicit dependency scanner will search these
27386
directories for include files. Don't explicitly put include directory
27387
arguments in <A
27388
HREF="#cv-F77FLAGS"
27389
><CODE
27390
CLASS="envar"
27391
>$F77FLAGS</CODE
27392
></A
27393
> because the result will be non-portable
27394
and the directories will not be searched by the dependency scanner. Note:
27395
directory names in <A
27396
HREF="#cv-F77PATH"
27397
><CODE
27398
CLASS="envar"
27399
>$F77PATH</CODE
27400
></A
27401
> will be looked-up relative to the SConscript
27402
directory when they are used in a command. To force
27403
<SPAN
27404
CLASS="application"
27405
>scons</SPAN
27406
>
27407
to look-up a directory relative to the root of the source tree use #:
27408
You only need to set <A
27409
HREF="#cv-F77PATH"
27410
><CODE
27411
CLASS="envar"
27412
>$F77PATH</CODE
27413
></A
27414
> if you need to define a specific
27415
include path for Fortran 77 files.
27416
You should normally set the <A
27417
HREF="#cv-FORTRANPATH"
27418
><CODE
27419
CLASS="envar"
27420
>$FORTRANPATH</CODE
27421
></A
27422
> variable,
27423
which specifies the include path
27424
for the default Fortran compiler
27425
for all Fortran versions.
27426
</P
27427
><PRE
27428
CLASS="programlisting"
27429
> env = Environment(F77PATH='#/include')
27430
</PRE
27431
><P
27432
> The directory look-up can also be forced using the
27433
<CODE
27434
CLASS="function"
27435
>Dir</CODE
27436
>()
27437
function:
27438
</P
27439
><PRE
27440
CLASS="programlisting"
27441
> include = Dir('include')
27442
env = Environment(F77PATH=include)
27443
</PRE
27444
><P
27445
> The directory list will be added to command lines
27446
through the automatically-generated
27447
<A
27448
HREF="#cv-_F77INCFLAGS"
27449
><CODE
27450
CLASS="envar"
27451
>$_F77INCFLAGS</CODE
27452
></A
27453
>
27454
construction variable,
27455
which is constructed by
27456
appending the values of the
27457
<A
27458
HREF="#cv-INCPREFIX"
27459
><CODE
27460
CLASS="envar"
27461
>$INCPREFIX</CODE
27462
></A
27463
> and <A
27464
HREF="#cv-INCSUFFIX"
27465
><CODE
27466
CLASS="envar"
27467
>$INCSUFFIX</CODE
27468
></A
27469
>
27470
construction variables
27471
to the beginning and end
27472
of each directory in <A
27473
HREF="#cv-F77PATH"
27474
><CODE
27475
CLASS="envar"
27476
>$F77PATH</CODE
27477
></A
27478
>.
27479
Any command lines you define that need
27480
the F77PATH directory list should
27481
include <A
27482
HREF="#cv-_F77INCFLAGS"
27483
><CODE
27484
CLASS="envar"
27485
>$_F77INCFLAGS</CODE
27486
></A
27487
>:
27488
</P
27489
><PRE
27490
CLASS="programlisting"
27491
> env = Environment(F77COM="my_compiler $_F77INCFLAGS -c -o $TARGET $SOURCE")
27492
</PRE
27493
></DD
27494
><DT
27495
><A
27496
NAME="cv-F77PPCOM"
27497
></A
27498
><CODE
27499
CLASS="envar"
27500
>F77PPCOM</CODE
27501
></DT
27502
><DD
27503
><P
27504
> The command line used to compile a Fortran 77 source file to an object file
27505
after first running the file through the C preprocessor.
27506
Any options specified in the <A
27507
HREF="#cv-F77FLAGS"
27508
><CODE
27509
CLASS="envar"
27510
>$F77FLAGS</CODE
27511
></A
27512
> and <A
27513
HREF="#cv-CPPFLAGS"
27514
><CODE
27515
CLASS="envar"
27516
>$CPPFLAGS</CODE
27517
></A
27518
> construction variables
27519
are included on this command line.
27520
You only need to set <A
27521
HREF="#cv-F77PPCOM"
27522
><CODE
27523
CLASS="envar"
27524
>$F77PPCOM</CODE
27525
></A
27526
> if you need to use a specific
27527
C-preprocessor command line for Fortran 77 files.
27528
You should normally set the <A
27529
HREF="#cv-FORTRANPPCOM"
27530
><CODE
27531
CLASS="envar"
27532
>$FORTRANPPCOM</CODE
27533
></A
27534
> variable,
27535
which specifies the default C-preprocessor command line
27536
for all Fortran versions.
27537
</P
27538
></DD
27539
><DT
27540
><A
27541
NAME="cv-F77PPCOMSTR"
27542
></A
27543
><CODE
27544
CLASS="envar"
27545
>F77PPCOMSTR</CODE
27546
></DT
27547
><DD
27548
><P
27549
> The string displayed when a Fortran 77 source file
27550
is compiled to an object file
27551
after first running the file through the C preprocessor.
27552
If this is not set, then <A
27553
HREF="#cv-F77PPCOM"
27554
><CODE
27555
CLASS="envar"
27556
>$F77PPCOM</CODE
27557
></A
27558
> or <A
27559
HREF="#cv-FORTRANPPCOM"
27560
><CODE
27561
CLASS="envar"
27562
>$FORTRANPPCOM</CODE
27563
></A
27564
>
27565
(the command line) is displayed.
27566
</P
27567
></DD
27568
><DT
27569
><A
27570
NAME="cv-F77PPFILESUFFIXES"
27571
></A
27572
><CODE
27573
CLASS="envar"
27574
>F77PPFILESUFFIXES</CODE
27575
></DT
27576
><DD
27577
><P
27578
> The list of file extensions for which the compilation + preprocessor pass for
27579
F77 dialect will be used. By default, this is empty
27580
</P
27581
></DD
27582
><DT
27583
><A
27584
NAME="cv-F90"
27585
></A
27586
><CODE
27587
CLASS="envar"
27588
>F90</CODE
27589
></DT
27590
><DD
27591
><P
27592
> The Fortran 90 compiler.
27593
You should normally set the <A
27594
HREF="#cv-FORTRAN"
27595
><CODE
27596
CLASS="envar"
27597
>$FORTRAN</CODE
27598
></A
27599
> variable,
27600
which specifies the default Fortran compiler
27601
for all Fortran versions.
27602
You only need to set <A
27603
HREF="#cv-F90"
27604
><CODE
27605
CLASS="envar"
27606
>$F90</CODE
27607
></A
27608
> if you need to use a specific compiler
27609
or compiler version for Fortran 90 files.
27610
</P
27611
></DD
27612
><DT
27613
><A
27614
NAME="cv-F90COM"
27615
></A
27616
><CODE
27617
CLASS="envar"
27618
>F90COM</CODE
27619
></DT
27620
><DD
27621
><P
27622
> The command line used to compile a Fortran 90 source file to an object file.
27623
You only need to set <A
27624
HREF="#cv-F90COM"
27625
><CODE
27626
CLASS="envar"
27627
>$F90COM</CODE
27628
></A
27629
> if you need to use a specific
27630
command line for Fortran 90 files.
27631
You should normally set the <A
27632
HREF="#cv-FORTRANCOM"
27633
><CODE
27634
CLASS="envar"
27635
>$FORTRANCOM</CODE
27636
></A
27637
> variable,
27638
which specifies the default command line
27639
for all Fortran versions.
27640
</P
27641
></DD
27642
><DT
27643
><A
27644
NAME="cv-F90COMSTR"
27645
></A
27646
><CODE
27647
CLASS="envar"
27648
>F90COMSTR</CODE
27649
></DT
27650
><DD
27651
><P
27652
> The string displayed when a Fortran 90 source file
27653
is compiled to an object file.
27654
If this is not set, then <A
27655
HREF="#cv-F90COM"
27656
><CODE
27657
CLASS="envar"
27658
>$F90COM</CODE
27659
></A
27660
> or <A
27661
HREF="#cv-FORTRANCOM"
27662
><CODE
27663
CLASS="envar"
27664
>$FORTRANCOM</CODE
27665
></A
27666
>
27667
(the command line) is displayed.
27668
</P
27669
></DD
27670
><DT
27671
><A
27672
NAME="cv-F90FILESUFFIXES"
27673
></A
27674
><CODE
27675
CLASS="envar"
27676
>F90FILESUFFIXES</CODE
27677
></DT
27678
><DD
27679
><P
27680
> The list of file extensions for which the F90 dialect will be used. By
27681
default, this is ['.f90']
27682
</P
27683
></DD
27684
><DT
27685
><A
27686
NAME="cv-F90FLAGS"
27687
></A
27688
><CODE
27689
CLASS="envar"
27690
>F90FLAGS</CODE
27691
></DT
27692
><DD
27693
><P
27694
> General user-specified options that are passed to the Fortran 90 compiler.
27695
Note that this variable does
27696
<SPAN
27697
CLASS="emphasis"
27698
><I
27699
CLASS="emphasis"
27700
>not</I
27701
></SPAN
27702
>
27703
contain
27704
<CODE
27705
CLASS="option"
27706
>-I</CODE
27707
>
27708
(or similar) include search path options
27709
that scons generates automatically from <A
27710
HREF="#cv-F90PATH"
27711
><CODE
27712
CLASS="envar"
27713
>$F90PATH</CODE
27714
></A
27715
>.
27716
See
27717
<A
27718
HREF="#cv-_F90INCFLAGS"
27719
><CODE
27720
CLASS="envar"
27721
>$_F90INCFLAGS</CODE
27722
></A
27723
>
27724
below,
27725
for the variable that expands to those options.
27726
You only need to set <A
27727
HREF="#cv-F90FLAGS"
27728
><CODE
27729
CLASS="envar"
27730
>$F90FLAGS</CODE
27731
></A
27732
> if you need to define specific
27733
user options for Fortran 90 files.
27734
You should normally set the <A
27735
HREF="#cv-FORTRANFLAGS"
27736
><CODE
27737
CLASS="envar"
27738
>$FORTRANFLAGS</CODE
27739
></A
27740
> variable,
27741
which specifies the user-specified options
27742
passed to the default Fortran compiler
27743
for all Fortran versions.
27744
</P
27745
></DD
27746
><DT
27747
><A
27748
NAME="cv-_F90INCFLAGS"
27749
></A
27750
><CODE
27751
CLASS="envar"
27752
>_F90INCFLAGS</CODE
27753
></DT
27754
><DD
27755
><P
27756
> An automatically-generated construction variable
27757
containing the Fortran 90 compiler command-line options
27758
for specifying directories to be searched for include files.
27759
The value of <A
27760
HREF="#cv-_F90INCFLAGS"
27761
><CODE
27762
CLASS="envar"
27763
>$_F90INCFLAGS</CODE
27764
></A
27765
> is created
27766
by appending <A
27767
HREF="#cv-INCPREFIX"
27768
><CODE
27769
CLASS="envar"
27770
>$INCPREFIX</CODE
27771
></A
27772
> and <A
27773
HREF="#cv-INCSUFFIX"
27774
><CODE
27775
CLASS="envar"
27776
>$INCSUFFIX</CODE
27777
></A
27778
>
27779
to the beginning and end
27780
of each directory in <A
27781
HREF="#cv-F90PATH"
27782
><CODE
27783
CLASS="envar"
27784
>$F90PATH</CODE
27785
></A
27786
>.
27787
</P
27788
></DD
27789
><DT
27790
><A
27791
NAME="cv-F90PATH"
27792
></A
27793
><CODE
27794
CLASS="envar"
27795
>F90PATH</CODE
27796
></DT
27797
><DD
27798
><P
27799
> The list of directories that the Fortran 90 compiler will search for include
27800
directories. The implicit dependency scanner will search these
27801
directories for include files. Don't explicitly put include directory
27802
arguments in <A
27803
HREF="#cv-F90FLAGS"
27804
><CODE
27805
CLASS="envar"
27806
>$F90FLAGS</CODE
27807
></A
27808
> because the result will be non-portable
27809
and the directories will not be searched by the dependency scanner. Note:
27810
directory names in <A
27811
HREF="#cv-F90PATH"
27812
><CODE
27813
CLASS="envar"
27814
>$F90PATH</CODE
27815
></A
27816
> will be looked-up relative to the SConscript
27817
directory when they are used in a command. To force
27818
<SPAN
27819
CLASS="application"
27820
>scons</SPAN
27821
>
27822
to look-up a directory relative to the root of the source tree use #:
27823
You only need to set <A
27824
HREF="#cv-F90PATH"
27825
><CODE
27826
CLASS="envar"
27827
>$F90PATH</CODE
27828
></A
27829
> if you need to define a specific
27830
include path for Fortran 90 files.
27831
You should normally set the <A
27832
HREF="#cv-FORTRANPATH"
27833
><CODE
27834
CLASS="envar"
27835
>$FORTRANPATH</CODE
27836
></A
27837
> variable,
27838
which specifies the include path
27839
for the default Fortran compiler
27840
for all Fortran versions.
27841
</P
27842
><PRE
27843
CLASS="programlisting"
27844
> env = Environment(F90PATH='#/include')
27845
</PRE
27846
><P
27847
> The directory look-up can also be forced using the
27848
<CODE
27849
CLASS="function"
27850
>Dir</CODE
27851
>()
27852
function:
27853
</P
27854
><PRE
27855
CLASS="programlisting"
27856
> include = Dir('include')
27857
env = Environment(F90PATH=include)
27858
</PRE
27859
><P
27860
> The directory list will be added to command lines
27861
through the automatically-generated
27862
<A
27863
HREF="#cv-_F90INCFLAGS"
27864
><CODE
27865
CLASS="envar"
27866
>$_F90INCFLAGS</CODE
27867
></A
27868
>
27869
construction variable,
27870
which is constructed by
27871
appending the values of the
27872
<A
27873
HREF="#cv-INCPREFIX"
27874
><CODE
27875
CLASS="envar"
27876
>$INCPREFIX</CODE
27877
></A
27878
> and <A
27879
HREF="#cv-INCSUFFIX"
27880
><CODE
27881
CLASS="envar"
27882
>$INCSUFFIX</CODE
27883
></A
27884
>
27885
construction variables
27886
to the beginning and end
27887
of each directory in <A
27888
HREF="#cv-F90PATH"
27889
><CODE
27890
CLASS="envar"
27891
>$F90PATH</CODE
27892
></A
27893
>.
27894
Any command lines you define that need
27895
the F90PATH directory list should
27896
include <A
27897
HREF="#cv-_F90INCFLAGS"
27898
><CODE
27899
CLASS="envar"
27900
>$_F90INCFLAGS</CODE
27901
></A
27902
>:
27903
</P
27904
><PRE
27905
CLASS="programlisting"
27906
> env = Environment(F90COM="my_compiler $_F90INCFLAGS -c -o $TARGET $SOURCE")
27907
</PRE
27908
></DD
27909
><DT
27910
><A
27911
NAME="cv-F90PPCOM"
27912
></A
27913
><CODE
27914
CLASS="envar"
27915
>F90PPCOM</CODE
27916
></DT
27917
><DD
27918
><P
27919
> The command line used to compile a Fortran 90 source file to an object file
27920
after first running the file through the C preprocessor.
27921
Any options specified in the <A
27922
HREF="#cv-F90FLAGS"
27923
><CODE
27924
CLASS="envar"
27925
>$F90FLAGS</CODE
27926
></A
27927
> and <A
27928
HREF="#cv-CPPFLAGS"
27929
><CODE
27930
CLASS="envar"
27931
>$CPPFLAGS</CODE
27932
></A
27933
> construction variables
27934
are included on this command line.
27935
You only need to set <A
27936
HREF="#cv-F90PPCOM"
27937
><CODE
27938
CLASS="envar"
27939
>$F90PPCOM</CODE
27940
></A
27941
> if you need to use a specific
27942
C-preprocessor command line for Fortran 90 files.
27943
You should normally set the <A
27944
HREF="#cv-FORTRANPPCOM"
27945
><CODE
27946
CLASS="envar"
27947
>$FORTRANPPCOM</CODE
27948
></A
27949
> variable,
27950
which specifies the default C-preprocessor command line
27951
for all Fortran versions.
27952
</P
27953
></DD
27954
><DT
27955
><A
27956
NAME="cv-F90PPCOMSTR"
27957
></A
27958
><CODE
27959
CLASS="envar"
27960
>F90PPCOMSTR</CODE
27961
></DT
27962
><DD
27963
><P
27964
> The string displayed when a Fortran 90 source file
27965
is compiled after first running the file through the C preprocessor.
27966
If this is not set, then <A
27967
HREF="#cv-F90PPCOM"
27968
><CODE
27969
CLASS="envar"
27970
>$F90PPCOM</CODE
27971
></A
27972
> or <A
27973
HREF="#cv-FORTRANPPCOM"
27974
><CODE
27975
CLASS="envar"
27976
>$FORTRANPPCOM</CODE
27977
></A
27978
>
27979
(the command line) is displayed.
27980
</P
27981
></DD
27982
><DT
27983
><A
27984
NAME="cv-F90PPFILESUFFIXES"
27985
></A
27986
><CODE
27987
CLASS="envar"
27988
>F90PPFILESUFFIXES</CODE
27989
></DT
27990
><DD
27991
><P
27992
> The list of file extensions for which the compilation + preprocessor pass for
27993
F90 dialect will be used. By default, this is empty
27994
</P
27995
></DD
27996
><DT
27997
><A
27998
NAME="cv-F95"
27999
></A
28000
><CODE
28001
CLASS="envar"
28002
>F95</CODE
28003
></DT
28004
><DD
28005
><P
28006
> The Fortran 95 compiler.
28007
You should normally set the <A
28008
HREF="#cv-FORTRAN"
28009
><CODE
28010
CLASS="envar"
28011
>$FORTRAN</CODE
28012
></A
28013
> variable,
28014
which specifies the default Fortran compiler
28015
for all Fortran versions.
28016
You only need to set <A
28017
HREF="#cv-F95"
28018
><CODE
28019
CLASS="envar"
28020
>$F95</CODE
28021
></A
28022
> if you need to use a specific compiler
28023
or compiler version for Fortran 95 files.
28024
</P
28025
></DD
28026
><DT
28027
><A
28028
NAME="cv-F95COM"
28029
></A
28030
><CODE
28031
CLASS="envar"
28032
>F95COM</CODE
28033
></DT
28034
><DD
28035
><P
28036
> The command line used to compile a Fortran 95 source file to an object file.
28037
You only need to set <A
28038
HREF="#cv-F95COM"
28039
><CODE
28040
CLASS="envar"
28041
>$F95COM</CODE
28042
></A
28043
> if you need to use a specific
28044
command line for Fortran 95 files.
28045
You should normally set the <A
28046
HREF="#cv-FORTRANCOM"
28047
><CODE
28048
CLASS="envar"
28049
>$FORTRANCOM</CODE
28050
></A
28051
> variable,
28052
which specifies the default command line
28053
for all Fortran versions.
28054
</P
28055
></DD
28056
><DT
28057
><A
28058
NAME="cv-F95COMSTR"
28059
></A
28060
><CODE
28061
CLASS="envar"
28062
>F95COMSTR</CODE
28063
></DT
28064
><DD
28065
><P
28066
> The string displayed when a Fortran 95 source file
28067
is compiled to an object file.
28068
If this is not set, then <A
28069
HREF="#cv-F95COM"
28070
><CODE
28071
CLASS="envar"
28072
>$F95COM</CODE
28073
></A
28074
> or <A
28075
HREF="#cv-FORTRANCOM"
28076
><CODE
28077
CLASS="envar"
28078
>$FORTRANCOM</CODE
28079
></A
28080
>
28081
(the command line) is displayed.
28082
</P
28083
></DD
28084
><DT
28085
><A
28086
NAME="cv-F95FILESUFFIXES"
28087
></A
28088
><CODE
28089
CLASS="envar"
28090
>F95FILESUFFIXES</CODE
28091
></DT
28092
><DD
28093
><P
28094
> The list of file extensions for which the F95 dialect will be used. By
28095
default, this is ['.f95']
28096
</P
28097
></DD
28098
><DT
28099
><A
28100
NAME="cv-F95FLAGS"
28101
></A
28102
><CODE
28103
CLASS="envar"
28104
>F95FLAGS</CODE
28105
></DT
28106
><DD
28107
><P
28108
> General user-specified options that are passed to the Fortran 95 compiler.
28109
Note that this variable does
28110
<SPAN
28111
CLASS="emphasis"
28112
><I
28113
CLASS="emphasis"
28114
>not</I
28115
></SPAN
28116
>
28117
contain
28118
<CODE
28119
CLASS="option"
28120
>-I</CODE
28121
>
28122
(or similar) include search path options
28123
that scons generates automatically from <A
28124
HREF="#cv-F95PATH"
28125
><CODE
28126
CLASS="envar"
28127
>$F95PATH</CODE
28128
></A
28129
>.
28130
See
28131
<A
28132
HREF="#cv-_F95INCFLAGS"
28133
><CODE
28134
CLASS="envar"
28135
>$_F95INCFLAGS</CODE
28136
></A
28137
>
28138
below,
28139
for the variable that expands to those options.
28140
You only need to set <A
28141
HREF="#cv-F95FLAGS"
28142
><CODE
28143
CLASS="envar"
28144
>$F95FLAGS</CODE
28145
></A
28146
> if you need to define specific
28147
user options for Fortran 95 files.
28148
You should normally set the <A
28149
HREF="#cv-FORTRANFLAGS"
28150
><CODE
28151
CLASS="envar"
28152
>$FORTRANFLAGS</CODE
28153
></A
28154
> variable,
28155
which specifies the user-specified options
28156
passed to the default Fortran compiler
28157
for all Fortran versions.
28158
</P
28159
></DD
28160
><DT
28161
><A
28162
NAME="cv-_F95INCFLAGS"
28163
></A
28164
><CODE
28165
CLASS="envar"
28166
>_F95INCFLAGS</CODE
28167
></DT
28168
><DD
28169
><P
28170
> An automatically-generated construction variable
28171
containing the Fortran 95 compiler command-line options
28172
for specifying directories to be searched for include files.
28173
The value of <A
28174
HREF="#cv-_F95INCFLAGS"
28175
><CODE
28176
CLASS="envar"
28177
>$_F95INCFLAGS</CODE
28178
></A
28179
> is created
28180
by appending <A
28181
HREF="#cv-INCPREFIX"
28182
><CODE
28183
CLASS="envar"
28184
>$INCPREFIX</CODE
28185
></A
28186
> and <A
28187
HREF="#cv-INCSUFFIX"
28188
><CODE
28189
CLASS="envar"
28190
>$INCSUFFIX</CODE
28191
></A
28192
>
28193
to the beginning and end
28194
of each directory in <A
28195
HREF="#cv-F95PATH"
28196
><CODE
28197
CLASS="envar"
28198
>$F95PATH</CODE
28199
></A
28200
>.
28201
</P
28202
></DD
28203
><DT
28204
><A
28205
NAME="cv-F95PATH"
28206
></A
28207
><CODE
28208
CLASS="envar"
28209
>F95PATH</CODE
28210
></DT
28211
><DD
28212
><P
28213
> The list of directories that the Fortran 95 compiler will search for include
28214
directories. The implicit dependency scanner will search these
28215
directories for include files. Don't explicitly put include directory
28216
arguments in <A
28217
HREF="#cv-F95FLAGS"
28218
><CODE
28219
CLASS="envar"
28220
>$F95FLAGS</CODE
28221
></A
28222
> because the result will be non-portable
28223
and the directories will not be searched by the dependency scanner. Note:
28224
directory names in <A
28225
HREF="#cv-F95PATH"
28226
><CODE
28227
CLASS="envar"
28228
>$F95PATH</CODE
28229
></A
28230
> will be looked-up relative to the SConscript
28231
directory when they are used in a command. To force
28232
<SPAN
28233
CLASS="application"
28234
>scons</SPAN
28235
>
28236
to look-up a directory relative to the root of the source tree use #:
28237
You only need to set <A
28238
HREF="#cv-F95PATH"
28239
><CODE
28240
CLASS="envar"
28241
>$F95PATH</CODE
28242
></A
28243
> if you need to define a specific
28244
include path for Fortran 95 files.
28245
You should normally set the <A
28246
HREF="#cv-FORTRANPATH"
28247
><CODE
28248
CLASS="envar"
28249
>$FORTRANPATH</CODE
28250
></A
28251
> variable,
28252
which specifies the include path
28253
for the default Fortran compiler
28254
for all Fortran versions.
28255
</P
28256
><PRE
28257
CLASS="programlisting"
28258
> env = Environment(F95PATH='#/include')
28259
</PRE
28260
><P
28261
> The directory look-up can also be forced using the
28262
<CODE
28263
CLASS="function"
28264
>Dir</CODE
28265
>()
28266
function:
28267
</P
28268
><PRE
28269
CLASS="programlisting"
28270
> include = Dir('include')
28271
env = Environment(F95PATH=include)
28272
</PRE
28273
><P
28274
> The directory list will be added to command lines
28275
through the automatically-generated
28276
<A
28277
HREF="#cv-_F95INCFLAGS"
28278
><CODE
28279
CLASS="envar"
28280
>$_F95INCFLAGS</CODE
28281
></A
28282
>
28283
construction variable,
28284
which is constructed by
28285
appending the values of the
28286
<A
28287
HREF="#cv-INCPREFIX"
28288
><CODE
28289
CLASS="envar"
28290
>$INCPREFIX</CODE
28291
></A
28292
> and <A
28293
HREF="#cv-INCSUFFIX"
28294
><CODE
28295
CLASS="envar"
28296
>$INCSUFFIX</CODE
28297
></A
28298
>
28299
construction variables
28300
to the beginning and end
28301
of each directory in <A
28302
HREF="#cv-F95PATH"
28303
><CODE
28304
CLASS="envar"
28305
>$F95PATH</CODE
28306
></A
28307
>.
28308
Any command lines you define that need
28309
the F95PATH directory list should
28310
include <A
28311
HREF="#cv-_F95INCFLAGS"
28312
><CODE
28313
CLASS="envar"
28314
>$_F95INCFLAGS</CODE
28315
></A
28316
>:
28317
</P
28318
><PRE
28319
CLASS="programlisting"
28320
> env = Environment(F95COM="my_compiler $_F95INCFLAGS -c -o $TARGET $SOURCE")
28321
</PRE
28322
></DD
28323
><DT
28324
><A
28325
NAME="cv-F95PPCOM"
28326
></A
28327
><CODE
28328
CLASS="envar"
28329
>F95PPCOM</CODE
28330
></DT
28331
><DD
28332
><P
28333
> The command line used to compile a Fortran 95 source file to an object file
28334
after first running the file through the C preprocessor.
28335
Any options specified in the <A
28336
HREF="#cv-F95FLAGS"
28337
><CODE
28338
CLASS="envar"
28339
>$F95FLAGS</CODE
28340
></A
28341
> and <A
28342
HREF="#cv-CPPFLAGS"
28343
><CODE
28344
CLASS="envar"
28345
>$CPPFLAGS</CODE
28346
></A
28347
> construction variables
28348
are included on this command line.
28349
You only need to set <A
28350
HREF="#cv-F95PPCOM"
28351
><CODE
28352
CLASS="envar"
28353
>$F95PPCOM</CODE
28354
></A
28355
> if you need to use a specific
28356
C-preprocessor command line for Fortran 95 files.
28357
You should normally set the <A
28358
HREF="#cv-FORTRANPPCOM"
28359
><CODE
28360
CLASS="envar"
28361
>$FORTRANPPCOM</CODE
28362
></A
28363
> variable,
28364
which specifies the default C-preprocessor command line
28365
for all Fortran versions.
28366
</P
28367
></DD
28368
><DT
28369
><A
28370
NAME="cv-F95PPCOMSTR"
28371
></A
28372
><CODE
28373
CLASS="envar"
28374
>F95PPCOMSTR</CODE
28375
></DT
28376
><DD
28377
><P
28378
> The string displayed when a Fortran 95 source file
28379
is compiled to an object file
28380
after first running the file through the C preprocessor.
28381
If this is not set, then <A
28382
HREF="#cv-F95PPCOM"
28383
><CODE
28384
CLASS="envar"
28385
>$F95PPCOM</CODE
28386
></A
28387
> or <A
28388
HREF="#cv-FORTRANPPCOM"
28389
><CODE
28390
CLASS="envar"
28391
>$FORTRANPPCOM</CODE
28392
></A
28393
>
28394
(the command line) is displayed.
28395
</P
28396
></DD
28397
><DT
28398
><A
28399
NAME="cv-F95PPFILESUFFIXES"
28400
></A
28401
><CODE
28402
CLASS="envar"
28403
>F95PPFILESUFFIXES</CODE
28404
></DT
28405
><DD
28406
><P
28407
> The list of file extensions for which the compilation + preprocessor pass for
28408
F95 dialect will be used. By default, this is empty
28409
</P
28410
></DD
28411
><DT
28412
><A
28413
NAME="cv-File"
28414
></A
28415
><CODE
28416
CLASS="envar"
28417
>File</CODE
28418
></DT
28419
><DD
28420
><P
28421
> A function that converts a string into a File instance relative to the
28422
target being built.
28423
</P
28424
></DD
28425
><DT
28426
><A
28427
NAME="cv-FORTRAN"
28428
></A
28429
><CODE
28430
CLASS="envar"
28431
>FORTRAN</CODE
28432
></DT
28433
><DD
28434
><P
28435
> The default Fortran compiler
28436
for all versions of Fortran.
28437
</P
28438
></DD
28439
><DT
28440
><A
28441
NAME="cv-FORTRANCOM"
28442
></A
28443
><CODE
28444
CLASS="envar"
28445
>FORTRANCOM</CODE
28446
></DT
28447
><DD
28448
><P
28449
> The command line used to compile a Fortran source file to an object file.
28450
By default, any options specified
28451
in the <A
28452
HREF="#cv-FORTRANFLAGS"
28453
><CODE
28454
CLASS="envar"
28455
>$FORTRANFLAGS</CODE
28456
></A
28457
>,
28458
<A
28459
HREF="#cv-CPPFLAGS"
28460
><CODE
28461
CLASS="envar"
28462
>$CPPFLAGS</CODE
28463
></A
28464
>,
28465
<A
28466
HREF="#cv-_CPPDEFFLAGS"
28467
><CODE
28468
CLASS="envar"
28469
>$_CPPDEFFLAGS</CODE
28470
></A
28471
>,
28472
<A
28473
HREF="#cv-_FORTRANMODFLAG"
28474
><CODE
28475
CLASS="envar"
28476
>$_FORTRANMODFLAG</CODE
28477
></A
28478
>, and
28479
<A
28480
HREF="#cv-_FORTRANINCFLAGS"
28481
><CODE
28482
CLASS="envar"
28483
>$_FORTRANINCFLAGS</CODE
28484
></A
28485
> construction variables
28486
are included on this command line.
28487
</P
28488
></DD
28489
><DT
28490
><A
28491
NAME="cv-FORTRANCOMSTR"
28492
></A
28493
><CODE
28494
CLASS="envar"
28495
>FORTRANCOMSTR</CODE
28496
></DT
28497
><DD
28498
><P
28499
> The string displayed when a Fortran source file
28500
is compiled to an object file.
28501
If this is not set, then <A
28502
HREF="#cv-FORTRANCOM"
28503
><CODE
28504
CLASS="envar"
28505
>$FORTRANCOM</CODE
28506
></A
28507
>
28508
(the command line) is displayed.
28509
</P
28510
></DD
28511
><DT
28512
><A
28513
NAME="cv-FORTRANFILESUFFIXES"
28514
></A
28515
><CODE
28516
CLASS="envar"
28517
>FORTRANFILESUFFIXES</CODE
28518
></DT
28519
><DD
28520
><P
28521
> The list of file extensions for which the FORTRAN dialect will be used. By
28522
default, this is ['.f', '.for', '.ftn']
28523
</P
28524
></DD
28525
><DT
28526
><A
28527
NAME="cv-FORTRANFLAGS"
28528
></A
28529
><CODE
28530
CLASS="envar"
28531
>FORTRANFLAGS</CODE
28532
></DT
28533
><DD
28534
><P
28535
> General user-specified options that are passed to the Fortran compiler.
28536
Note that this variable does
28537
<SPAN
28538
CLASS="emphasis"
28539
><I
28540
CLASS="emphasis"
28541
>not</I
28542
></SPAN
28543
>
28544
contain
28545
<CODE
28546
CLASS="option"
28547
>-I</CODE
28548
>
28549
(or similar) include or module search path options
28550
that scons generates automatically from <A
28551
HREF="#cv-FORTRANPATH"
28552
><CODE
28553
CLASS="envar"
28554
>$FORTRANPATH</CODE
28555
></A
28556
>.
28557
See
28558
<A
28559
HREF="#cv-_FORTRANINCFLAGS"
28560
><CODE
28561
CLASS="envar"
28562
>$_FORTRANINCFLAGS</CODE
28563
></A
28564
> and <A
28565
HREF="#cv-_FORTRANMODFLAG"
28566
><CODE
28567
CLASS="envar"
28568
>$_FORTRANMODFLAG</CODE
28569
></A
28570
>,
28571
below,
28572
for the variables that expand those options.
28573
</P
28574
></DD
28575
><DT
28576
><A
28577
NAME="cv-_FORTRANINCFLAGS"
28578
></A
28579
><CODE
28580
CLASS="envar"
28581
>_FORTRANINCFLAGS</CODE
28582
></DT
28583
><DD
28584
><P
28585
> An automatically-generated construction variable
28586
containing the Fortran compiler command-line options
28587
for specifying directories to be searched for include
28588
files and module files.
28589
The value of <A
28590
HREF="#cv-_FORTRANINCFLAGS"
28591
><CODE
28592
CLASS="envar"
28593
>$_FORTRANINCFLAGS</CODE
28594
></A
28595
> is created
28596
by prepending/appending <A
28597
HREF="#cv-INCPREFIX"
28598
><CODE
28599
CLASS="envar"
28600
>$INCPREFIX</CODE
28601
></A
28602
> and <A
28603
HREF="#cv-INCSUFFIX"
28604
><CODE
28605
CLASS="envar"
28606
>$INCSUFFIX</CODE
28607
></A
28608
>
28609
to the beginning and end
28610
of each directory in <A
28611
HREF="#cv-FORTRANPATH"
28612
><CODE
28613
CLASS="envar"
28614
>$FORTRANPATH</CODE
28615
></A
28616
>.
28617
</P
28618
></DD
28619
><DT
28620
><A
28621
NAME="cv-FORTRANMODDIR"
28622
></A
28623
><CODE
28624
CLASS="envar"
28625
>FORTRANMODDIR</CODE
28626
></DT
28627
><DD
28628
><P
28629
> Directory location where the Fortran compiler should place
28630
any module files it generates. This variable is empty, by default. Some
28631
Fortran compilers will internally append this directory in the search path
28632
for module files, as well.
28633
</P
28634
></DD
28635
><DT
28636
><A
28637
NAME="cv-FORTRANMODDIRPREFIX"
28638
></A
28639
><CODE
28640
CLASS="envar"
28641
>FORTRANMODDIRPREFIX</CODE
28642
></DT
28643
><DD
28644
><P
28645
> The prefix used to specify a module directory on the Fortran compiler command
28646
line.
28647
This will be appended to the beginning of the directory
28648
in the <A
28649
HREF="#cv-FORTRANMODDIR"
28650
><CODE
28651
CLASS="envar"
28652
>$FORTRANMODDIR</CODE
28653
></A
28654
> construction variables
28655
when the <A
28656
HREF="#cv-_FORTRANMODFLAG"
28657
><CODE
28658
CLASS="envar"
28659
>$_FORTRANMODFLAG</CODE
28660
></A
28661
> variables is automatically generated.
28662
</P
28663
></DD
28664
><DT
28665
><A
28666
NAME="cv-FORTRANMODDIRSUFFIX"
28667
></A
28668
><CODE
28669
CLASS="envar"
28670
>FORTRANMODDIRSUFFIX</CODE
28671
></DT
28672
><DD
28673
><P
28674
> The suffix used to specify a module directory on the Fortran compiler command
28675
line.
28676
This will be appended to the beginning of the directory
28677
in the <A
28678
HREF="#cv-FORTRANMODDIR"
28679
><CODE
28680
CLASS="envar"
28681
>$FORTRANMODDIR</CODE
28682
></A
28683
> construction variables
28684
when the <A
28685
HREF="#cv-_FORTRANMODFLAG"
28686
><CODE
28687
CLASS="envar"
28688
>$_FORTRANMODFLAG</CODE
28689
></A
28690
> variables is automatically generated.
28691
</P
28692
></DD
28693
><DT
28694
><A
28695
NAME="cv-_FORTRANMODFLAG"
28696
></A
28697
><CODE
28698
CLASS="envar"
28699
>_FORTRANMODFLAG</CODE
28700
></DT
28701
><DD
28702
><P
28703
> An automatically-generated construction variable
28704
containing the Fortran compiler command-line option
28705
for specifying the directory location where the Fortran
28706
compiler should place any module files that happen to get
28707
generated during compilation.
28708
The value of <A
28709
HREF="#cv-_FORTRANMODFLAG"
28710
><CODE
28711
CLASS="envar"
28712
>$_FORTRANMODFLAG</CODE
28713
></A
28714
> is created
28715
by prepending/appending <A
28716
HREF="#cv-FORTRANMODDIRPREFIX"
28717
><CODE
28718
CLASS="envar"
28719
>$FORTRANMODDIRPREFIX</CODE
28720
></A
28721
> and
28722
<A
28723
HREF="#cv-FORTRANMODDIRSUFFIX"
28724
><CODE
28725
CLASS="envar"
28726
>$FORTRANMODDIRSUFFIX</CODE
28727
></A
28728
>
28729
to the beginning and end of the directory in <A
28730
HREF="#cv-FORTRANMODDIR"
28731
><CODE
28732
CLASS="envar"
28733
>$FORTRANMODDIR</CODE
28734
></A
28735
>.
28736
</P
28737
></DD
28738
><DT
28739
><A
28740
NAME="cv-FORTRANMODPREFIX"
28741
></A
28742
><CODE
28743
CLASS="envar"
28744
>FORTRANMODPREFIX</CODE
28745
></DT
28746
><DD
28747
><P
28748
> The module file prefix used by the Fortran compiler. SCons assumes that
28749
the Fortran compiler follows the quasi-standard naming convention for
28750
module files of
28751
<TT
28752
CLASS="filename"
28753
>module_name.mod</TT
28754
>.
28755
As a result, this variable is left empty, by default. For situations in
28756
which the compiler does not necessarily follow the normal convention,
28757
the user may use this variable. Its value will be appended to every
28758
module file name as scons attempts to resolve dependencies.
28759
</P
28760
></DD
28761
><DT
28762
><A
28763
NAME="cv-FORTRANMODSUFFIX"
28764
></A
28765
><CODE
28766
CLASS="envar"
28767
>FORTRANMODSUFFIX</CODE
28768
></DT
28769
><DD
28770
><P
28771
> The module file suffix used by the Fortran compiler. SCons assumes that
28772
the Fortran compiler follows the quasi-standard naming convention for
28773
module files of
28774
<TT
28775
CLASS="filename"
28776
>module_name.mod</TT
28777
>.
28778
As a result, this variable is set to ".mod", by default. For situations
28779
in which the compiler does not necessarily follow the normal convention,
28780
the user may use this variable. Its value will be appended to every
28781
module file name as scons attempts to resolve dependencies.
28782
</P
28783
></DD
28784
><DT
28785
><A
28786
NAME="cv-FORTRANPATH"
28787
></A
28788
><CODE
28789
CLASS="envar"
28790
>FORTRANPATH</CODE
28791
></DT
28792
><DD
28793
><P
28794
> The list of directories that the Fortran compiler will search for
28795
include files and (for some compilers) module files. The Fortran implicit
28796
dependency scanner will search these directories for include files (but
28797
not module files since they are autogenerated and, as such, may not
28798
actually exist at the time the scan takes place). Don't explicitly put
28799
include directory arguments in FORTRANFLAGS because the result will be
28800
non-portable and the directories will not be searched by the dependency
28801
scanner. Note: directory names in FORTRANPATH will be looked-up relative
28802
to the SConscript directory when they are used in a command. To force
28803
<SPAN
28804
CLASS="application"
28805
>scons</SPAN
28806
>
28807
to look-up a directory relative to the root of the source tree use #:
28808
</P
28809
><PRE
28810
CLASS="programlisting"
28811
> env = Environment(FORTRANPATH='#/include')
28812
</PRE
28813
><P
28814
> The directory look-up can also be forced using the
28815
<CODE
28816
CLASS="function"
28817
>Dir</CODE
28818
>()
28819
function:
28820
</P
28821
><PRE
28822
CLASS="programlisting"
28823
> include = Dir('include')
28824
env = Environment(FORTRANPATH=include)
28825
</PRE
28826
><P
28827
> The directory list will be added to command lines
28828
through the automatically-generated
28829
<A
28830
HREF="#cv-_FORTRANINCFLAGS"
28831
><CODE
28832
CLASS="envar"
28833
>$_FORTRANINCFLAGS</CODE
28834
></A
28835
>
28836
construction variable,
28837
which is constructed by
28838
appending the values of the
28839
<A
28840
HREF="#cv-INCPREFIX"
28841
><CODE
28842
CLASS="envar"
28843
>$INCPREFIX</CODE
28844
></A
28845
> and <A
28846
HREF="#cv-INCSUFFIX"
28847
><CODE
28848
CLASS="envar"
28849
>$INCSUFFIX</CODE
28850
></A
28851
>
28852
construction variables
28853
to the beginning and end
28854
of each directory in <A
28855
HREF="#cv-FORTRANPATH"
28856
><CODE
28857
CLASS="envar"
28858
>$FORTRANPATH</CODE
28859
></A
28860
>.
28861
Any command lines you define that need
28862
the FORTRANPATH directory list should
28863
include <A
28864
HREF="#cv-_FORTRANINCFLAGS"
28865
><CODE
28866
CLASS="envar"
28867
>$_FORTRANINCFLAGS</CODE
28868
></A
28869
>:
28870
</P
28871
><PRE
28872
CLASS="programlisting"
28873
> env = Environment(FORTRANCOM="my_compiler $_FORTRANINCFLAGS -c -o $TARGET $SOURCE")
28874
</PRE
28875
></DD
28876
><DT
28877
><A
28878
NAME="cv-FORTRANPPCOM"
28879
></A
28880
><CODE
28881
CLASS="envar"
28882
>FORTRANPPCOM</CODE
28883
></DT
28884
><DD
28885
><P
28886
> The command line used to compile a Fortran source file to an object file
28887
after first running the file through the C preprocessor.
28888
By default, any options specified in the <A
28889
HREF="#cv-FORTRANFLAGS"
28890
><CODE
28891
CLASS="envar"
28892
>$FORTRANFLAGS</CODE
28893
></A
28894
>,
28895
<A
28896
HREF="#cv-CPPFLAGS"
28897
><CODE
28898
CLASS="envar"
28899
>$CPPFLAGS</CODE
28900
></A
28901
>,
28902
<A
28903
HREF="#cv-_CPPDEFFLAGS"
28904
><CODE
28905
CLASS="envar"
28906
>$_CPPDEFFLAGS</CODE
28907
></A
28908
>,
28909
<A
28910
HREF="#cv-_FORTRANMODFLAG"
28911
><CODE
28912
CLASS="envar"
28913
>$_FORTRANMODFLAG</CODE
28914
></A
28915
>, and
28916
<A
28917
HREF="#cv-_FORTRANINCFLAGS"
28918
><CODE
28919
CLASS="envar"
28920
>$_FORTRANINCFLAGS</CODE
28921
></A
28922
>
28923
construction variables are included on this command line.
28924
</P
28925
></DD
28926
><DT
28927
><A
28928
NAME="cv-FORTRANPPCOMSTR"
28929
></A
28930
><CODE
28931
CLASS="envar"
28932
>FORTRANPPCOMSTR</CODE
28933
></DT
28934
><DD
28935
><P
28936
> The string displayed when a Fortran source file
28937
is compiled to an object file
28938
after first running the file throught the C preprocessor.
28939
If this is not set, then <A
28940
HREF="#cv-FORTRANPPCOM"
28941
><CODE
28942
CLASS="envar"
28943
>$FORTRANPPCOM</CODE
28944
></A
28945
>
28946
(the command line) is displayed.
28947
</P
28948
></DD
28949
><DT
28950
><A
28951
NAME="cv-FORTRANPPFILESUFFIXES"
28952
></A
28953
><CODE
28954
CLASS="envar"
28955
>FORTRANPPFILESUFFIXES</CODE
28956
></DT
28957
><DD
28958
><P
28959
> The list of file extensions for which the compilation + preprocessor pass for
28960
FORTRAN dialect will be used. By default, this is ['.fpp', '.FPP']
28961
</P
28962
></DD
28963
><DT
28964
><A
28965
NAME="cv-FORTRANSUFFIXES"
28966
></A
28967
><CODE
28968
CLASS="envar"
28969
>FORTRANSUFFIXES</CODE
28970
></DT
28971
><DD
28972
><P
28973
> The list of suffixes of files that will be scanned
28974
for Fortran implicit dependencies
28975
(INCLUDE lines and USE statements).
28976
The default list is:
28977
</P
28978
><PRE
28979
CLASS="programlisting"
28980
> [".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
28981
".f77", ".F77", ".f90", ".F90", ".f95", ".F95"]
28982
</PRE
28983
></DD
28984
><DT
28985
><A
28986
NAME="cv-FRAMEWORKPATH"
28987
></A
28988
><CODE
28989
CLASS="envar"
28990
>FRAMEWORKPATH</CODE
28991
></DT
28992
><DD
28993
><P
28994
> On Mac OS X with gcc,
28995
a list containing the paths to search for frameworks.
28996
Used by the compiler to find framework-style includes like
28997
#include <Fmwk/Header.h>.
28998
Used by the linker to find user-specified frameworks when linking (see
28999
<A
29000
HREF="#cv-FRAMEWORKS"
29001
><CODE
29002
CLASS="envar"
29003
>$FRAMEWORKS</CODE
29004
></A
29005
>).
29006
For example:
29007
</P
29008
><PRE
29009
CLASS="programlisting"
29010
> env.AppendUnique(FRAMEWORKPATH='#myframeworkdir')
29011
</PRE
29012
><P
29013
> will add
29014
</P
29015
><PRE
29016
CLASS="programlisting"
29017
> ... -Fmyframeworkdir
29018
</PRE
29019
><P
29020
> to the compiler and linker command lines.
29021
</P
29022
></DD
29023
><DT
29024
><A
29025
NAME="cv-_FRAMEWORKPATH"
29026
></A
29027
><CODE
29028
CLASS="envar"
29029
>_FRAMEWORKPATH</CODE
29030
></DT
29031
><DD
29032
><P
29033
> On Mac OS X with gcc, an automatically-generated construction variable
29034
containing the linker command-line options corresponding to
29035
<A
29036
HREF="#cv-FRAMEWORKPATH"
29037
><CODE
29038
CLASS="envar"
29039
>$FRAMEWORKPATH</CODE
29040
></A
29041
>.
29042
</P
29043
></DD
29044
><DT
29045
><A
29046
NAME="cv-FRAMEWORKPATHPREFIX"
29047
></A
29048
><CODE
29049
CLASS="envar"
29050
>FRAMEWORKPATHPREFIX</CODE
29051
></DT
29052
><DD
29053
><P
29054
> On Mac OS X with gcc, the prefix to be used for the FRAMEWORKPATH entries.
29055
(see <A
29056
HREF="#cv-FRAMEWORKPATH"
29057
><CODE
29058
CLASS="envar"
29059
>$FRAMEWORKPATH</CODE
29060
></A
29061
>).
29062
The default value is
29063
<CODE
29064
CLASS="option"
29065
>-F</CODE
29066
>.
29067
</P
29068
></DD
29069
><DT
29070
><A
29071
NAME="cv-FRAMEWORKPREFIX"
29072
></A
29073
><CODE
29074
CLASS="envar"
29075
>FRAMEWORKPREFIX</CODE
29076
></DT
29077
><DD
29078
><P
29079
> On Mac OS X with gcc,
29080
the prefix to be used for linking in frameworks
29081
(see <A
29082
HREF="#cv-FRAMEWORKS"
29083
><CODE
29084
CLASS="envar"
29085
>$FRAMEWORKS</CODE
29086
></A
29087
>).
29088
The default value is
29089
<CODE
29090
CLASS="option"
29091
>-framework</CODE
29092
>.
29093
</P
29094
></DD
29095
><DT
29096
><A
29097
NAME="cv-_FRAMEWORKS"
29098
></A
29099
><CODE
29100
CLASS="envar"
29101
>_FRAMEWORKS</CODE
29102
></DT
29103
><DD
29104
><P
29105
> On Mac OS X with gcc,
29106
an automatically-generated construction variable
29107
containing the linker command-line options
29108
for linking with FRAMEWORKS.
29109
</P
29110
></DD
29111
><DT
29112
><A
29113
NAME="cv-FRAMEWORKS"
29114
></A
29115
><CODE
29116
CLASS="envar"
29117
>FRAMEWORKS</CODE
29118
></DT
29119
><DD
29120
><P
29121
> On Mac OS X with gcc, a list of the framework names to be linked into a
29122
program or shared library or bundle.
29123
The default value is the empty list.
29124
For example:
29125
</P
29126
><PRE
29127
CLASS="programlisting"
29128
> env.AppendUnique(FRAMEWORKS=Split('System Cocoa SystemConfiguration'))
29129
</PRE
29130
><P
29131
> </P
29132
></DD
29133
><DT
29134
><A
29135
NAME="cv-FRAMEWORKSFLAGS"
29136
></A
29137
><CODE
29138
CLASS="envar"
29139
>FRAMEWORKSFLAGS</CODE
29140
></DT
29141
><DD
29142
><P
29143
> On Mac OS X with gcc,
29144
general user-supplied frameworks options to be added at
29145
the end of a command
29146
line building a loadable module.
29147
(This has been largely superceded by
29148
the <A
29149
HREF="#cv-FRAMEWORKPATH"
29150
><CODE
29151
CLASS="envar"
29152
>$FRAMEWORKPATH</CODE
29153
></A
29154
>, <A
29155
HREF="#cv-FRAMEWORKPATHPREFIX"
29156
><CODE
29157
CLASS="envar"
29158
>$FRAMEWORKPATHPREFIX</CODE
29159
></A
29160
>,
29161
<A
29162
HREF="#cv-FRAMEWORKPREFIX"
29163
><CODE
29164
CLASS="envar"
29165
>$FRAMEWORKPREFIX</CODE
29166
></A
29167
> and <A
29168
HREF="#cv-FRAMEWORKS"
29169
><CODE
29170
CLASS="envar"
29171
>$FRAMEWORKS</CODE
29172
></A
29173
> variables
29174
described above.)
29175
</P
29176
></DD
29177
><DT
29178
><A
29179
NAME="cv-GS"
29180
></A
29181
><CODE
29182
CLASS="envar"
29183
>GS</CODE
29184
></DT
29185
><DD
29186
><P
29187
> The Ghostscript program used to convert PostScript to PDF files.
29188
</P
29189
></DD
29190
><DT
29191
><A
29192
NAME="cv-GSCOM"
29193
></A
29194
><CODE
29195
CLASS="envar"
29196
>GSCOM</CODE
29197
></DT
29198
><DD
29199
><P
29200
> The Ghostscript command line used to convert PostScript to PDF files.
29201
</P
29202
></DD
29203
><DT
29204
><A
29205
NAME="cv-GSCOMSTR"
29206
></A
29207
><CODE
29208
CLASS="envar"
29209
>GSCOMSTR</CODE
29210
></DT
29211
><DD
29212
><P
29213
> The string displayed when
29214
Ghostscript is used to convert
29215
a PostScript file to a PDF file.
29216
If this is not set, then <A
29217
HREF="#cv-GSCOM"
29218
><CODE
29219
CLASS="envar"
29220
>$GSCOM</CODE
29221
></A
29222
> (the command line) is displayed.
29223
</P
29224
></DD
29225
><DT
29226
><A
29227
NAME="cv-GSFLAGS"
29228
></A
29229
><CODE
29230
CLASS="envar"
29231
>GSFLAGS</CODE
29232
></DT
29233
><DD
29234
><P
29235
> General options passed to the Ghostscript program
29236
when converting PostScript to PDF files.
29237
</P
29238
></DD
29239
><DT
29240
><A
29241
NAME="cv-IDLSUFFIXES"
29242
></A
29243
><CODE
29244
CLASS="envar"
29245
>IDLSUFFIXES</CODE
29246
></DT
29247
><DD
29248
><P
29249
> The list of suffixes of files that will be scanned
29250
for IDL implicit dependencies
29251
(#include or import lines).
29252
The default list is:
29253
</P
29254
><PRE
29255
CLASS="programlisting"
29256
> [".idl", ".IDL"]
29257
</PRE
29258
></DD
29259
><DT
29260
><A
29261
NAME="cv-IMPLICIT_COMMAND_DEPENDENCIES"
29262
></A
29263
><CODE
29264
CLASS="envar"
29265
>IMPLICIT_COMMAND_DEPENDENCIES</CODE
29266
></DT
29267
><DD
29268
><P
29269
> Controls whether or not SCons will
29270
add implicit dependencies for the commands
29271
executed to build targets.</P
29272
><P
29273
>By default, SCons will add
29274
to each target
29275
an implicit dependency on the command
29276
represented by the first argument on any
29277
command line it executes.
29278
The specific file for the dependency is
29279
found by searching the
29280
<CODE
29281
CLASS="varname"
29282
>PATH</CODE
29283
>
29284
variable in the
29285
<CODE
29286
CLASS="varname"
29287
>ENV</CODE
29288
>
29289
environment used to execute the command.</P
29290
><P
29291
>If the construction variable
29292
<CODE
29293
CLASS="envar"
29294
>$IMPLICIT_COMMAND_DEPENDENCIES</CODE
29295
>
29296
is set to a false value
29297
(<TT
29298
CLASS="literal"
29299
>None</TT
29300
>,
29301
<TT
29302
CLASS="literal"
29303
>False</TT
29304
>,
29305
<TT
29306
CLASS="literal"
29307
>0</TT
29308
>,
29309
etc.),
29310
then the implicit dependency will
29311
not be added to the targets
29312
built with that construction environment.
29313
</P
29314
><PRE
29315
CLASS="programlisting"
29316
> env = Environment(IMPLICIT_COMMAND_DEPENDENCIES = 0)
29317
</PRE
29318
></DD
29319
><DT
29320
><A
29321
NAME="cv-INCPREFIX"
29322
></A
29323
><CODE
29324
CLASS="envar"
29325
>INCPREFIX</CODE
29326
></DT
29327
><DD
29328
><P
29329
> The prefix used to specify an include directory on the C compiler command
29330
line.
29331
This will be appended to the beginning of each directory
29332
in the <CODE
29333
CLASS="envar"
29334
>$CPPPATH</CODE
29335
> and <CODE
29336
CLASS="envar"
29337
>$FORTRANPATH</CODE
29338
> construction variables
29339
when the <CODE
29340
CLASS="envar"
29341
>$_CPPINCFLAGS</CODE
29342
> and <CODE
29343
CLASS="envar"
29344
>$_FORTRANINCFLAGS</CODE
29345
>
29346
variables are automatically generated.
29347
</P
29348
></DD
29349
><DT
29350
><A
29351
NAME="cv-INCSUFFIX"
29352
></A
29353
><CODE
29354
CLASS="envar"
29355
>INCSUFFIX</CODE
29356
></DT
29357
><DD
29358
><P
29359
> The suffix used to specify an include directory on the C compiler command
29360
line.
29361
This will be appended to the end of each directory
29362
in the <CODE
29363
CLASS="envar"
29364
>$CPPPATH</CODE
29365
> and <CODE
29366
CLASS="envar"
29367
>$FORTRANPATH</CODE
29368
> construction variables
29369
when the <CODE
29370
CLASS="envar"
29371
>$_CPPINCFLAGS</CODE
29372
> and <CODE
29373
CLASS="envar"
29374
>$_FORTRANINCFLAGS</CODE
29375
>
29376
variables are automatically generated.
29377
</P
29378
></DD
29379
><DT
29380
><A
29381
NAME="cv-INSTALL"
29382
></A
29383
><CODE
29384
CLASS="envar"
29385
>INSTALL</CODE
29386
></DT
29387
><DD
29388
><P
29389
> A function to be called to install a file into a
29390
destination file name.
29391
The default function copies the file into the destination
29392
(and sets the destination file's mode and permission bits
29393
to match the source file's).
29394
The function takes the following arguments:
29395
</P
29396
><PRE
29397
CLASS="programlisting"
29398
> def install(dest, source, env):
29399
</PRE
29400
><P
29401
> <CODE
29402
CLASS="varname"
29403
>dest</CODE
29404
>
29405
is the path name of the destination file.
29406
<CODE
29407
CLASS="varname"
29408
>source</CODE
29409
>
29410
is the path name of the source file.
29411
<CODE
29412
CLASS="varname"
29413
>env</CODE
29414
>
29415
is the construction environment
29416
(a dictionary of construction values)
29417
in force for this file installation.
29418
</P
29419
></DD
29420
><DT
29421
><A
29422
NAME="cv-INSTALLSTR"
29423
></A
29424
><CODE
29425
CLASS="envar"
29426
>INSTALLSTR</CODE
29427
></DT
29428
><DD
29429
><P
29430
> The string displayed when a file is
29431
installed into a destination file name.
29432
The default is:
29433
</P
29434
><PRE
29435
CLASS="programlisting"
29436
> Install file: "$SOURCE" as "$TARGET"
29437
</PRE
29438
></DD
29439
><DT
29440
><A
29441
NAME="cv-INTEL_C_COMPILER_VERSION"
29442
></A
29443
><CODE
29444
CLASS="envar"
29445
>INTEL_C_COMPILER_VERSION</CODE
29446
></DT
29447
><DD
29448
><P
29449
> Set by the "intelc" Tool
29450
to the major version number of the Intel C compiler
29451
selected for use.
29452
</P
29453
></DD
29454
><DT
29455
><A
29456
NAME="cv-JAR"
29457
></A
29458
><CODE
29459
CLASS="envar"
29460
>JAR</CODE
29461
></DT
29462
><DD
29463
><P
29464
> The Java archive tool.
29465
</P
29466
></DD
29467
><DT
29468
><A
29469
NAME="cv-JARCHDIR"
29470
></A
29471
><CODE
29472
CLASS="envar"
29473
>JARCHDIR</CODE
29474
></DT
29475
><DD
29476
><P
29477
> The directory to which the Java archive tool should change
29478
(using the
29479
<CODE
29480
CLASS="option"
29481
>-C</CODE
29482
>
29483
option).
29484
</P
29485
></DD
29486
><DT
29487
><A
29488
NAME="cv-JARCOM"
29489
></A
29490
><CODE
29491
CLASS="envar"
29492
>JARCOM</CODE
29493
></DT
29494
><DD
29495
><P
29496
> The command line used to call the Java archive tool.
29497
</P
29498
></DD
29499
><DT
29500
><A
29501
NAME="cv-JARCOMSTR"
29502
></A
29503
><CODE
29504
CLASS="envar"
29505
>JARCOMSTR</CODE
29506
></DT
29507
><DD
29508
><P
29509
> The string displayed when the Java archive tool
29510
is called
29511
If this is not set, then <CODE
29512
CLASS="envar"
29513
>$JARCOM</CODE
29514
> (the command line) is displayed.
29515
</P
29516
><PRE
29517
CLASS="programlisting"
29518
> env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET")
29519
</PRE
29520
></DD
29521
><DT
29522
><A
29523
NAME="cv-JARFLAGS"
29524
></A
29525
><CODE
29526
CLASS="envar"
29527
>JARFLAGS</CODE
29528
></DT
29529
><DD
29530
><P
29531
> General options passed to the Java archive tool.
29532
By default this is set to
29533
<CODE
29534
CLASS="option"
29535
>cf</CODE
29536
>
29537
to create the necessary
29538
<B
29539
CLASS="command"
29540
>jar</B
29541
>
29542
file.
29543
</P
29544
></DD
29545
><DT
29546
><A
29547
NAME="cv-JARSUFFIX"
29548
></A
29549
><CODE
29550
CLASS="envar"
29551
>JARSUFFIX</CODE
29552
></DT
29553
><DD
29554
><P
29555
> The suffix for Java archives:
29556
<TT
29557
CLASS="filename"
29558
>.jar</TT
29559
>
29560
by default.
29561
</P
29562
></DD
29563
><DT
29564
><A
29565
NAME="cv-JAVABOOTCLASSPATH"
29566
></A
29567
><CODE
29568
CLASS="envar"
29569
>JAVABOOTCLASSPATH</CODE
29570
></DT
29571
><DD
29572
><P
29573
> Specifies the list of directories that
29574
will be added to the
29575
<SPAN
29576
CLASS="application"
29577
>javac</SPAN
29578
> command line
29579
via the <CODE
29580
CLASS="option"
29581
>-bootclasspath</CODE
29582
> option.
29583
The individual directory names will be
29584
separated by the operating system's path separate character
29585
(<TT
29586
CLASS="filename"
29587
>:</TT
29588
> on UNIX/Linux/POSIX,
29589
<TT
29590
CLASS="filename"
29591
>;</TT
29592
> on Windows).
29593
</P
29594
></DD
29595
><DT
29596
><A
29597
NAME="cv-JAVAC"
29598
></A
29599
><CODE
29600
CLASS="envar"
29601
>JAVAC</CODE
29602
></DT
29603
><DD
29604
><P
29605
> The Java compiler.
29606
</P
29607
></DD
29608
><DT
29609
><A
29610
NAME="cv-JAVACCOM"
29611
></A
29612
><CODE
29613
CLASS="envar"
29614
>JAVACCOM</CODE
29615
></DT
29616
><DD
29617
><P
29618
> The command line used to compile a directory tree containing
29619
Java source files to
29620
corresponding Java class files.
29621
Any options specified in the <A
29622
HREF="#cv-JAVACFLAGS"
29623
><CODE
29624
CLASS="envar"
29625
>$JAVACFLAGS</CODE
29626
></A
29627
> construction variable
29628
are included on this command line.
29629
</P
29630
></DD
29631
><DT
29632
><A
29633
NAME="cv-JAVACCOMSTR"
29634
></A
29635
><CODE
29636
CLASS="envar"
29637
>JAVACCOMSTR</CODE
29638
></DT
29639
><DD
29640
><P
29641
> The string displayed when compiling
29642
a directory tree of Java source files to
29643
corresponding Java class files.
29644
If this is not set, then <A
29645
HREF="#cv-JAVACCOM"
29646
><CODE
29647
CLASS="envar"
29648
>$JAVACCOM</CODE
29649
></A
29650
> (the command line) is displayed.
29651
</P
29652
><PRE
29653
CLASS="programlisting"
29654
> env = Environment(JAVACCOMSTR = "Compiling class files $TARGETS from $SOURCES")
29655
</PRE
29656
></DD
29657
><DT
29658
><A
29659
NAME="cv-JAVACFLAGS"
29660
></A
29661
><CODE
29662
CLASS="envar"
29663
>JAVACFLAGS</CODE
29664
></DT
29665
><DD
29666
><P
29667
> General options that are passed to the Java compiler.
29668
</P
29669
></DD
29670
><DT
29671
><A
29672
NAME="cv-JAVACLASSDIR"
29673
></A
29674
><CODE
29675
CLASS="envar"
29676
>JAVACLASSDIR</CODE
29677
></DT
29678
><DD
29679
><P
29680
> The directory in which Java class files may be found.
29681
This is stripped from the beginning of any Java .class
29682
file names supplied to the
29683
<TT
29684
CLASS="literal"
29685
>JavaH</TT
29686
>
29687
builder.
29688
</P
29689
></DD
29690
><DT
29691
><A
29692
NAME="cv-JAVACLASSPATH"
29693
></A
29694
><CODE
29695
CLASS="envar"
29696
>JAVACLASSPATH</CODE
29697
></DT
29698
><DD
29699
><P
29700
> Specifies the list of directories that
29701
will be searched for Java
29702
<TT
29703
CLASS="filename"
29704
>.class</TT
29705
> file.
29706
The directories in this list will be added to the
29707
<SPAN
29708
CLASS="application"
29709
>javac</SPAN
29710
> and <SPAN
29711
CLASS="application"
29712
>javah</SPAN
29713
> command lines
29714
via the <CODE
29715
CLASS="option"
29716
>-classpath</CODE
29717
> option.
29718
The individual directory names will be
29719
separated by the operating system's path separate character
29720
(<TT
29721
CLASS="filename"
29722
>:</TT
29723
> on UNIX/Linux/POSIX,
29724
<TT
29725
CLASS="filename"
29726
>;</TT
29727
> on Windows).</P
29728
><P
29729
>Note that this currently just adds the specified
29730
directory via the <CODE
29731
CLASS="option"
29732
>-classpath</CODE
29733
> option.
29734
<SPAN
29735
CLASS="application"
29736
>SCons</SPAN
29737
> does not currently search the
29738
<CODE
29739
CLASS="envar"
29740
>$JAVACLASSPATH</CODE
29741
> directories for dependency
29742
<TT
29743
CLASS="filename"
29744
>.class</TT
29745
> files.
29746
</P
29747
></DD
29748
><DT
29749
><A
29750
NAME="cv-JAVACLASSSUFFIX"
29751
></A
29752
><CODE
29753
CLASS="envar"
29754
>JAVACLASSSUFFIX</CODE
29755
></DT
29756
><DD
29757
><P
29758
> The suffix for Java class files;
29759
<TT
29760
CLASS="filename"
29761
>.class</TT
29762
>
29763
by default.
29764
</P
29765
></DD
29766
><DT
29767
><A
29768
NAME="cv-JAVAH"
29769
></A
29770
><CODE
29771
CLASS="envar"
29772
>JAVAH</CODE
29773
></DT
29774
><DD
29775
><P
29776
> The Java generator for C header and stub files.
29777
</P
29778
></DD
29779
><DT
29780
><A
29781
NAME="cv-JAVAHCOM"
29782
></A
29783
><CODE
29784
CLASS="envar"
29785
>JAVAHCOM</CODE
29786
></DT
29787
><DD
29788
><P
29789
> The command line used to generate C header and stub files
29790
from Java classes.
29791
Any options specified in the <A
29792
HREF="#cv-JAVAHFLAGS"
29793
><CODE
29794
CLASS="envar"
29795
>$JAVAHFLAGS</CODE
29796
></A
29797
> construction variable
29798
are included on this command line.
29799
</P
29800
></DD
29801
><DT
29802
><A
29803
NAME="cv-JAVAHCOMSTR"
29804
></A
29805
><CODE
29806
CLASS="envar"
29807
>JAVAHCOMSTR</CODE
29808
></DT
29809
><DD
29810
><P
29811
> The string displayed when C header and stub files
29812
are generated from Java classes.
29813
If this is not set, then <A
29814
HREF="#cv-JAVAHCOM"
29815
><CODE
29816
CLASS="envar"
29817
>$JAVAHCOM</CODE
29818
></A
29819
> (the command line) is displayed.
29820
</P
29821
><PRE
29822
CLASS="programlisting"
29823
> env = Environment(JAVAHCOMSTR = "Generating header/stub file(s) $TARGETS from $SOURCES")
29824
</PRE
29825
></DD
29826
><DT
29827
><A
29828
NAME="cv-JAVAHFLAGS"
29829
></A
29830
><CODE
29831
CLASS="envar"
29832
>JAVAHFLAGS</CODE
29833
></DT
29834
><DD
29835
><P
29836
> General options passed to the C header and stub file generator
29837
for Java classes.
29838
</P
29839
></DD
29840
><DT
29841
><A
29842
NAME="cv-JAVASOURCEPATH"
29843
></A
29844
><CODE
29845
CLASS="envar"
29846
>JAVASOURCEPATH</CODE
29847
></DT
29848
><DD
29849
><P
29850
> Specifies the list of directories that
29851
will be searched for input
29852
<TT
29853
CLASS="filename"
29854
>.java</TT
29855
> file.
29856
The directories in this list will be added to the
29857
<SPAN
29858
CLASS="application"
29859
>javac</SPAN
29860
> command line
29861
via the <CODE
29862
CLASS="option"
29863
>-sourcepath</CODE
29864
> option.
29865
The individual directory names will be
29866
separated by the operating system's path separate character
29867
(<TT
29868
CLASS="filename"
29869
>:</TT
29870
> on UNIX/Linux/POSIX,
29871
<TT
29872
CLASS="filename"
29873
>;</TT
29874
> on Windows).</P
29875
><P
29876
>Note that this currently just adds the specified
29877
directory via the <CODE
29878
CLASS="option"
29879
>-sourcepath</CODE
29880
> option.
29881
<SPAN
29882
CLASS="application"
29883
>SCons</SPAN
29884
> does not currently search the
29885
<CODE
29886
CLASS="envar"
29887
>$JAVASOURCEPATH</CODE
29888
> directories for dependency
29889
<TT
29890
CLASS="filename"
29891
>.java</TT
29892
> files.
29893
</P
29894
></DD
29895
><DT
29896
><A
29897
NAME="cv-JAVASUFFIX"
29898
></A
29899
><CODE
29900
CLASS="envar"
29901
>JAVASUFFIX</CODE
29902
></DT
29903
><DD
29904
><P
29905
> The suffix for Java files;
29906
<TT
29907
CLASS="filename"
29908
>.java</TT
29909
>
29910
by default.
29911
</P
29912
></DD
29913
><DT
29914
><A
29915
NAME="cv-JAVAVERSION"
29916
></A
29917
><CODE
29918
CLASS="envar"
29919
>JAVAVERSION</CODE
29920
></DT
29921
><DD
29922
><P
29923
> Specifies the Java version being used by the <CODE
29924
CLASS="function"
29925
>Java</CODE
29926
> builder.
29927
This is <SPAN
29928
CLASS="emphasis"
29929
><I
29930
CLASS="emphasis"
29931
>not</I
29932
></SPAN
29933
> currently used to select one
29934
version of the Java compiler vs. another.
29935
Instead, you should set this to specify the version of Java
29936
supported by your <SPAN
29937
CLASS="application"
29938
>javac</SPAN
29939
> compiler.
29940
The default is <TT
29941
CLASS="literal"
29942
>1.4</TT
29943
>.</P
29944
><P
29945
>This is sometimes necessary because
29946
Java 1.5 changed the file names that are created
29947
for nested anonymous inner classes,
29948
which can cause a mismatch with the files
29949
that <SPAN
29950
CLASS="application"
29951
>SCons</SPAN
29952
> expects will be generated by the <SPAN
29953
CLASS="application"
29954
>javac</SPAN
29955
> compiler.
29956
Setting <CODE
29957
CLASS="envar"
29958
>$JAVAVERSION</CODE
29959
> to <TT
29960
CLASS="literal"
29961
>1.5</TT
29962
>
29963
(or <TT
29964
CLASS="literal"
29965
>1.6</TT
29966
>, as appropriate)
29967
can make <SPAN
29968
CLASS="application"
29969
>SCons</SPAN
29970
> realize that a Java 1.5 or 1.6
29971
build is actually up to date.
29972
</P
29973
></DD
29974
><DT
29975
><A
29976
NAME="cv-LATEX"
29977
></A
29978
><CODE
29979
CLASS="envar"
29980
>LATEX</CODE
29981
></DT
29982
><DD
29983
><P
29984
> The LaTeX structured formatter and typesetter.
29985
</P
29986
></DD
29987
><DT
29988
><A
29989
NAME="cv-LATEXCOM"
29990
></A
29991
><CODE
29992
CLASS="envar"
29993
>LATEXCOM</CODE
29994
></DT
29995
><DD
29996
><P
29997
> The command line used to call the LaTeX structured formatter and typesetter.
29998
</P
29999
></DD
30000
><DT
30001
><A
30002
NAME="cv-LATEXCOMSTR"
30003
></A
30004
><CODE
30005
CLASS="envar"
30006
>LATEXCOMSTR</CODE
30007
></DT
30008
><DD
30009
><P
30010
> The string displayed when calling
30011
the LaTeX structured formatter and typesetter.
30012
If this is not set, then <A
30013
HREF="#cv-LATEXCOM"
30014
><CODE
30015
CLASS="envar"
30016
>$LATEXCOM</CODE
30017
></A
30018
> (the command line) is displayed.
30019
</P
30020
><PRE
30021
CLASS="programlisting"
30022
> env = Environment(LATEXCOMSTR = "Building $TARGET from LaTeX input $SOURCES")
30023
</PRE
30024
></DD
30025
><DT
30026
><A
30027
NAME="cv-LATEXFLAGS"
30028
></A
30029
><CODE
30030
CLASS="envar"
30031
>LATEXFLAGS</CODE
30032
></DT
30033
><DD
30034
><P
30035
> General options passed to the LaTeX structured formatter and typesetter.
30036
</P
30037
></DD
30038
><DT
30039
><A
30040
NAME="cv-LATEXRETRIES"
30041
></A
30042
><CODE
30043
CLASS="envar"
30044
>LATEXRETRIES</CODE
30045
></DT
30046
><DD
30047
><P
30048
> The maximum number of times that LaTeX
30049
will be re-run if the
30050
<TT
30051
CLASS="filename"
30052
>.log</TT
30053
>
30054
generated by the <A
30055
HREF="#cv-LATEXCOM"
30056
><CODE
30057
CLASS="envar"
30058
>$LATEXCOM</CODE
30059
></A
30060
> command
30061
indicates that there are undefined references.
30062
The default is to try to resolve undefined references
30063
by re-running LaTeX up to three times.
30064
</P
30065
></DD
30066
><DT
30067
><A
30068
NAME="cv-LATEXSUFFIXES"
30069
></A
30070
><CODE
30071
CLASS="envar"
30072
>LATEXSUFFIXES</CODE
30073
></DT
30074
><DD
30075
><P
30076
> The list of suffixes of files that will be scanned
30077
for LaTeX implicit dependencies
30078
(<TT
30079
CLASS="literal"
30080
>\include</TT
30081
> or <TT
30082
CLASS="literal"
30083
>\import</TT
30084
> files).
30085
The default list is:
30086
</P
30087
><PRE
30088
CLASS="programlisting"
30089
> [".tex", ".ltx", ".latex"]
30090
</PRE
30091
></DD
30092
><DT
30093
><A
30094
NAME="cv-LDMODULE"
30095
></A
30096
><CODE
30097
CLASS="envar"
30098
>LDMODULE</CODE
30099
></DT
30100
><DD
30101
><P
30102
> The linker for building loadable modules.
30103
By default, this is the same as <A
30104
HREF="#cv-SHLINK"
30105
><CODE
30106
CLASS="envar"
30107
>$SHLINK</CODE
30108
></A
30109
>.
30110
</P
30111
></DD
30112
><DT
30113
><A
30114
NAME="cv-LDMODULECOM"
30115
></A
30116
><CODE
30117
CLASS="envar"
30118
>LDMODULECOM</CODE
30119
></DT
30120
><DD
30121
><P
30122
> The command line for building loadable modules.
30123
On Mac OS X, this uses the <A
30124
HREF="#cv-LDMODULE"
30125
><CODE
30126
CLASS="envar"
30127
>$LDMODULE</CODE
30128
></A
30129
>,
30130
<A
30131
HREF="#cv-LDMODULEFLAGS"
30132
><CODE
30133
CLASS="envar"
30134
>$LDMODULEFLAGS</CODE
30135
></A
30136
> and
30137
<A
30138
HREF="#cv-FRAMEWORKSFLAGS"
30139
><CODE
30140
CLASS="envar"
30141
>$FRAMEWORKSFLAGS</CODE
30142
></A
30143
> variables.
30144
On other systems, this is the same as <A
30145
HREF="#cv-SHLINK"
30146
><CODE
30147
CLASS="envar"
30148
>$SHLINK</CODE
30149
></A
30150
>.
30151
</P
30152
></DD
30153
><DT
30154
><A
30155
NAME="cv-LDMODULECOMSTR"
30156
></A
30157
><CODE
30158
CLASS="envar"
30159
>LDMODULECOMSTR</CODE
30160
></DT
30161
><DD
30162
><P
30163
> The string displayed when building loadable modules.
30164
If this is not set, then <A
30165
HREF="#cv-LDMODULECOM"
30166
><CODE
30167
CLASS="envar"
30168
>$LDMODULECOM</CODE
30169
></A
30170
> (the command line) is displayed.
30171
</P
30172
></DD
30173
><DT
30174
><A
30175
NAME="cv-LDMODULEFLAGS"
30176
></A
30177
><CODE
30178
CLASS="envar"
30179
>LDMODULEFLAGS</CODE
30180
></DT
30181
><DD
30182
><P
30183
> General user options passed to the linker for building loadable modules.
30184
</P
30185
></DD
30186
><DT
30187
><A
30188
NAME="cv-LDMODULEPREFIX"
30189
></A
30190
><CODE
30191
CLASS="envar"
30192
>LDMODULEPREFIX</CODE
30193
></DT
30194
><DD
30195
><P
30196
> The prefix used for loadable module file names.
30197
On Mac OS X, this is null;
30198
on other systems, this is
30199
the same as <A
30200
HREF="#cv-SHLIBPREFIX"
30201
><CODE
30202
CLASS="envar"
30203
>$SHLIBPREFIX</CODE
30204
></A
30205
>.
30206
</P
30207
></DD
30208
><DT
30209
><A
30210
NAME="cv-LDMODULESUFFIX"
30211
></A
30212
><CODE
30213
CLASS="envar"
30214
>LDMODULESUFFIX</CODE
30215
></DT
30216
><DD
30217
><P
30218
> The suffix used for loadable module file names.
30219
On Mac OS X, this is null;
30220
on other systems, this is
30221
the same as $SHLIBSUFFIX.
30222
</P
30223
></DD
30224
><DT
30225
><A
30226
NAME="cv-LEX"
30227
></A
30228
><CODE
30229
CLASS="envar"
30230
>LEX</CODE
30231
></DT
30232
><DD
30233
><P
30234
> The lexical analyzer generator.
30235
</P
30236
></DD
30237
><DT
30238
><A
30239
NAME="cv-LEXCOM"
30240
></A
30241
><CODE
30242
CLASS="envar"
30243
>LEXCOM</CODE
30244
></DT
30245
><DD
30246
><P
30247
> The command line used to call the lexical analyzer generator
30248
to generate a source file.
30249
</P
30250
></DD
30251
><DT
30252
><A
30253
NAME="cv-LEXCOMSTR"
30254
></A
30255
><CODE
30256
CLASS="envar"
30257
>LEXCOMSTR</CODE
30258
></DT
30259
><DD
30260
><P
30261
> The string displayed when generating a source file
30262
using the lexical analyzer generator.
30263
If this is not set, then <A
30264
HREF="#cv-LEXCOM"
30265
><CODE
30266
CLASS="envar"
30267
>$LEXCOM</CODE
30268
></A
30269
> (the command line) is displayed.
30270
</P
30271
><PRE
30272
CLASS="programlisting"
30273
> env = Environment(LEXCOMSTR = "Lex'ing $TARGET from $SOURCES")
30274
</PRE
30275
></DD
30276
><DT
30277
><A
30278
NAME="cv-LEXFLAGS"
30279
></A
30280
><CODE
30281
CLASS="envar"
30282
>LEXFLAGS</CODE
30283
></DT
30284
><DD
30285
><P
30286
> General options passed to the lexical analyzer generator.
30287
</P
30288
></DD
30289
><DT
30290
><A
30291
NAME="cv-_LIBDIRFLAGS"
30292
></A
30293
><CODE
30294
CLASS="envar"
30295
>_LIBDIRFLAGS</CODE
30296
></DT
30297
><DD
30298
><P
30299
> An automatically-generated construction variable
30300
containing the linker command-line options
30301
for specifying directories to be searched for library.
30302
The value of <CODE
30303
CLASS="envar"
30304
>$_LIBDIRFLAGS</CODE
30305
> is created
30306
by appending <CODE
30307
CLASS="envar"
30308
>$LIBDIRPREFIX</CODE
30309
> and <CODE
30310
CLASS="envar"
30311
>$LIBDIRSUFFIX</CODE
30312
>
30313
to the beginning and end
30314
of each directory in <CODE
30315
CLASS="envar"
30316
>$LIBPATH</CODE
30317
>.
30318
</P
30319
></DD
30320
><DT
30321
><A
30322
NAME="cv-LIBDIRPREFIX"
30323
></A
30324
><CODE
30325
CLASS="envar"
30326
>LIBDIRPREFIX</CODE
30327
></DT
30328
><DD
30329
><P
30330
> The prefix used to specify a library directory on the linker command line.
30331
This will be appended to the beginning of each directory
30332
in the <CODE
30333
CLASS="envar"
30334
>$LIBPATH</CODE
30335
> construction variable
30336
when the <CODE
30337
CLASS="envar"
30338
>$_LIBDIRFLAGS</CODE
30339
> variable is automatically generated.
30340
</P
30341
></DD
30342
><DT
30343
><A
30344
NAME="cv-LIBDIRSUFFIX"
30345
></A
30346
><CODE
30347
CLASS="envar"
30348
>LIBDIRSUFFIX</CODE
30349
></DT
30350
><DD
30351
><P
30352
> The suffix used to specify a library directory on the linker command line.
30353
This will be appended to the end of each directory
30354
in the <CODE
30355
CLASS="envar"
30356
>$LIBPATH</CODE
30357
> construction variable
30358
when the <CODE
30359
CLASS="envar"
30360
>$_LIBDIRFLAGS</CODE
30361
> variable is automatically generated.
30362
</P
30363
></DD
30364
><DT
30365
><A
30366
NAME="cv-_LIBFLAGS"
30367
></A
30368
><CODE
30369
CLASS="envar"
30370
>_LIBFLAGS</CODE
30371
></DT
30372
><DD
30373
><P
30374
> An automatically-generated construction variable
30375
containing the linker command-line options
30376
for specifying libraries to be linked with the resulting target.
30377
The value of <CODE
30378
CLASS="envar"
30379
>$_LIBFLAGS</CODE
30380
> is created
30381
by appending <CODE
30382
CLASS="envar"
30383
>$LIBLINKPREFIX</CODE
30384
> and <CODE
30385
CLASS="envar"
30386
>$LIBLINKSUFFIX</CODE
30387
>
30388
to the beginning and end
30389
of each filename in <CODE
30390
CLASS="envar"
30391
>$LIBS</CODE
30392
>.
30393
</P
30394
></DD
30395
><DT
30396
><A
30397
NAME="cv-LIBLINKPREFIX"
30398
></A
30399
><CODE
30400
CLASS="envar"
30401
>LIBLINKPREFIX</CODE
30402
></DT
30403
><DD
30404
><P
30405
> The prefix used to specify a library to link on the linker command line.
30406
This will be appended to the beginning of each library
30407
in the <CODE
30408
CLASS="envar"
30409
>$LIBS</CODE
30410
> construction variable
30411
when the <CODE
30412
CLASS="envar"
30413
>$_LIBFLAGS</CODE
30414
> variable is automatically generated.
30415
</P
30416
></DD
30417
><DT
30418
><A
30419
NAME="cv-LIBLINKSUFFIX"
30420
></A
30421
><CODE
30422
CLASS="envar"
30423
>LIBLINKSUFFIX</CODE
30424
></DT
30425
><DD
30426
><P
30427
> The suffix used to specify a library to link on the linker command line.
30428
This will be appended to the end of each library
30429
in the <CODE
30430
CLASS="envar"
30431
>$LIBS</CODE
30432
> construction variable
30433
when the <CODE
30434
CLASS="envar"
30435
>$_LIBFLAGS</CODE
30436
> variable is automatically generated.
30437
</P
30438
></DD
30439
><DT
30440
><A
30441
NAME="cv-LIBPATH"
30442
></A
30443
><CODE
30444
CLASS="envar"
30445
>LIBPATH</CODE
30446
></DT
30447
><DD
30448
><P
30449
> The list of directories that will be searched for libraries.
30450
The implicit dependency scanner will search these
30451
directories for include files. Don't explicitly put include directory
30452
arguments in <CODE
30453
CLASS="envar"
30454
>$LINKFLAGS</CODE
30455
> or <CODE
30456
CLASS="envar"
30457
>$SHLINKFLAGS</CODE
30458
>
30459
because the result will be non-portable
30460
and the directories will not be searched by the dependency scanner. Note:
30461
directory names in LIBPATH will be looked-up relative to the SConscript
30462
directory when they are used in a command. To force
30463
<SPAN
30464
CLASS="application"
30465
>scons</SPAN
30466
>
30467
to look-up a directory relative to the root of the source tree use #:
30468
</P
30469
><PRE
30470
CLASS="programlisting"
30471
> env = Environment(LIBPATH='#/libs')
30472
</PRE
30473
><P
30474
> The directory look-up can also be forced using the
30475
<CODE
30476
CLASS="function"
30477
>Dir</CODE
30478
>()
30479
function:
30480
</P
30481
><PRE
30482
CLASS="programlisting"
30483
> libs = Dir('libs')
30484
env = Environment(LIBPATH=libs)
30485
</PRE
30486
><P
30487
> The directory list will be added to command lines
30488
through the automatically-generated
30489
<CODE
30490
CLASS="envar"
30491
>$_LIBDIRFLAGS</CODE
30492
>
30493
construction variable,
30494
which is constructed by
30495
appending the values of the
30496
<CODE
30497
CLASS="envar"
30498
>$LIBDIRPREFIX</CODE
30499
> and <CODE
30500
CLASS="envar"
30501
>$LIBDIRSUFFIX</CODE
30502
>
30503
construction variables
30504
to the beginning and end
30505
of each directory in <CODE
30506
CLASS="envar"
30507
>$LIBPATH</CODE
30508
>.
30509
Any command lines you define that need
30510
the LIBPATH directory list should
30511
include <CODE
30512
CLASS="envar"
30513
>$_LIBDIRFLAGS</CODE
30514
>:
30515
</P
30516
><PRE
30517
CLASS="programlisting"
30518
> env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET $SOURCE")
30519
</PRE
30520
></DD
30521
><DT
30522
><A
30523
NAME="cv-LIBPREFIX"
30524
></A
30525
><CODE
30526
CLASS="envar"
30527
>LIBPREFIX</CODE
30528
></DT
30529
><DD
30530
><P
30531
> The prefix used for (static) library file names.
30532
A default value is set for each platform
30533
(posix, win32, os2, etc.),
30534
but the value is overridden by individual tools
30535
(ar, mslib, sgiar, sunar, tlib, etc.)
30536
to reflect the names of the libraries they create.
30537
</P
30538
></DD
30539
><DT
30540
><A
30541
NAME="cv-LIBPREFIXES"
30542
></A
30543
><CODE
30544
CLASS="envar"
30545
>LIBPREFIXES</CODE
30546
></DT
30547
><DD
30548
><P
30549
> A list of all legal prefixes for library file names.
30550
When searching for library dependencies,
30551
SCons will look for files with these prefixes,
30552
the base library name,
30553
and suffixes in the <CODE
30554
CLASS="envar"
30555
>$LIBSUFFIXES</CODE
30556
> list.
30557
</P
30558
></DD
30559
><DT
30560
><A
30561
NAME="cv-LIBS"
30562
></A
30563
><CODE
30564
CLASS="envar"
30565
>LIBS</CODE
30566
></DT
30567
><DD
30568
><P
30569
> A list of one or more libraries
30570
that will be linked with
30571
any executable programs
30572
created by this environment.</P
30573
><P
30574
>The library list will be added to command lines
30575
through the automatically-generated
30576
<CODE
30577
CLASS="envar"
30578
>$_LIBFLAGS</CODE
30579
>
30580
construction variable,
30581
which is constructed by
30582
appending the values of the
30583
<CODE
30584
CLASS="envar"
30585
>$LIBLINKPREFIX</CODE
30586
> and <CODE
30587
CLASS="envar"
30588
>$LIBLINKSUFFIX</CODE
30589
>
30590
construction variables
30591
to the beginning and end
30592
of each filename in <CODE
30593
CLASS="envar"
30594
>$LIBS</CODE
30595
>.
30596
Any command lines you define that need
30597
the LIBS library list should
30598
include <CODE
30599
CLASS="envar"
30600
>$_LIBFLAGS</CODE
30601
>:
30602
</P
30603
><PRE
30604
CLASS="programlisting"
30605
> env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET $SOURCE")
30606
</PRE
30607
><P
30608
> If you add a
30609
File
30610
object to the
30611
<CODE
30612
CLASS="envar"
30613
>$LIBS</CODE
30614
>
30615
list, the name of that file will be added to
30616
<CODE
30617
CLASS="envar"
30618
>$_LIBFLAGS</CODE
30619
>,
30620
and thus the link line, as is, without
30621
<CODE
30622
CLASS="envar"
30623
>$LIBLINKPREFIX</CODE
30624
>
30625
or
30626
<CODE
30627
CLASS="envar"
30628
>$LIBLINKSUFFIX</CODE
30629
>.
30630
For example:
30631
</P
30632
><PRE
30633
CLASS="programlisting"
30634
> env.Append(LIBS=File('/tmp/mylib.so'))
30635
</PRE
30636
><P
30637
> In all cases, scons will add dependencies from the executable program to
30638
all the libraries in this list.
30639
</P
30640
></DD
30641
><DT
30642
><A
30643
NAME="cv-LIBSUFFIX"
30644
></A
30645
><CODE
30646
CLASS="envar"
30647
>LIBSUFFIX</CODE
30648
></DT
30649
><DD
30650
><P
30651
> The suffix used for (static) library file names.
30652
A default value is set for each platform
30653
(posix, win32, os2, etc.),
30654
but the value is overridden by individual tools
30655
(ar, mslib, sgiar, sunar, tlib, etc.)
30656
to reflect the names of the libraries they create.
30657
</P
30658
></DD
30659
><DT
30660
><A
30661
NAME="cv-LIBSUFFIXES"
30662
></A
30663
><CODE
30664
CLASS="envar"
30665
>LIBSUFFIXES</CODE
30666
></DT
30667
><DD
30668
><P
30669
> A list of all legal suffixes for library file names.
30670
When searching for library dependencies,
30671
SCons will look for files with prefixes, in the <CODE
30672
CLASS="envar"
30673
>$LIBPREFIXES</CODE
30674
> list,
30675
the base library name,
30676
and these suffixes.
30677
</P
30678
></DD
30679
><DT
30680
><A
30681
NAME="cv-LICENSE"
30682
></A
30683
><CODE
30684
CLASS="envar"
30685
>LICENSE</CODE
30686
></DT
30687
><DD
30688
><P
30689
> The abbreviated name of the license under which
30690
this project is released (gpl, lpgl, bsd etc.).
30691
See http://www.opensource.org/licenses/alphabetical
30692
for a list of license names.
30693
</P
30694
></DD
30695
><DT
30696
><A
30697
NAME="cv-LINK"
30698
></A
30699
><CODE
30700
CLASS="envar"
30701
>LINK</CODE
30702
></DT
30703
><DD
30704
><P
30705
> The linker.
30706
</P
30707
></DD
30708
><DT
30709
><A
30710
NAME="cv-LINKCOM"
30711
></A
30712
><CODE
30713
CLASS="envar"
30714
>LINKCOM</CODE
30715
></DT
30716
><DD
30717
><P
30718
> The command line used to link object files into an executable.
30719
</P
30720
></DD
30721
><DT
30722
><A
30723
NAME="cv-LINKCOMSTR"
30724
></A
30725
><CODE
30726
CLASS="envar"
30727
>LINKCOMSTR</CODE
30728
></DT
30729
><DD
30730
><P
30731
> The string displayed when object files
30732
are linked into an executable.
30733
If this is not set, then <A
30734
HREF="#cv-LINKCOM"
30735
><CODE
30736
CLASS="envar"
30737
>$LINKCOM</CODE
30738
></A
30739
> (the command line) is displayed.
30740
</P
30741
><PRE
30742
CLASS="programlisting"
30743
> env = Environment(LINKCOMSTR = "Linking $TARGET")
30744
</PRE
30745
></DD
30746
><DT
30747
><A
30748
NAME="cv-LINKFLAGS"
30749
></A
30750
><CODE
30751
CLASS="envar"
30752
>LINKFLAGS</CODE
30753
></DT
30754
><DD
30755
><P
30756
> General user options passed to the linker.
30757
Note that this variable should
30758
<SPAN
30759
CLASS="emphasis"
30760
><I
30761
CLASS="emphasis"
30762
>not</I
30763
></SPAN
30764
>
30765
contain
30766
<CODE
30767
CLASS="option"
30768
>-l</CODE
30769
>
30770
(or similar) options for linking with the libraries listed in <A
30771
HREF="#cv-LIBS"
30772
><CODE
30773
CLASS="envar"
30774
>$LIBS</CODE
30775
></A
30776
>,
30777
nor
30778
<CODE
30779
CLASS="option"
30780
>-L</CODE
30781
>
30782
(or similar) library search path options
30783
that scons generates automatically from <A
30784
HREF="#cv-LIBPATH"
30785
><CODE
30786
CLASS="envar"
30787
>$LIBPATH</CODE
30788
></A
30789
>.
30790
See
30791
<A
30792
HREF="#cv-_LIBFLAGS"
30793
><CODE
30794
CLASS="envar"
30795
>$_LIBFLAGS</CODE
30796
></A
30797
>
30798
above,
30799
for the variable that expands to library-link options,
30800
and
30801
<A
30802
HREF="#cv-_LIBDIRFLAGS"
30803
><CODE
30804
CLASS="envar"
30805
>$_LIBDIRFLAGS</CODE
30806
></A
30807
>
30808
above,
30809
for the variable that expands to library search path options.
30810
</P
30811
></DD
30812
><DT
30813
><A
30814
NAME="cv-M4"
30815
></A
30816
><CODE
30817
CLASS="envar"
30818
>M4</CODE
30819
></DT
30820
><DD
30821
><P
30822
> The M4 macro preprocessor.
30823
</P
30824
></DD
30825
><DT
30826
><A
30827
NAME="cv-M4COM"
30828
></A
30829
><CODE
30830
CLASS="envar"
30831
>M4COM</CODE
30832
></DT
30833
><DD
30834
><P
30835
> The command line used to pass files through the M4 macro preprocessor.
30836
</P
30837
></DD
30838
><DT
30839
><A
30840
NAME="cv-M4COMSTR"
30841
></A
30842
><CODE
30843
CLASS="envar"
30844
>M4COMSTR</CODE
30845
></DT
30846
><DD
30847
><P
30848
> The string displayed when
30849
a file is passed through the M4 macro preprocessor.
30850
If this is not set, then <A
30851
HREF="#cv-M4COM"
30852
><CODE
30853
CLASS="envar"
30854
>$M4COM</CODE
30855
></A
30856
> (the command line) is displayed.
30857
</P
30858
></DD
30859
><DT
30860
><A
30861
NAME="cv-M4FLAGS"
30862
></A
30863
><CODE
30864
CLASS="envar"
30865
>M4FLAGS</CODE
30866
></DT
30867
><DD
30868
><P
30869
> General options passed to the M4 macro preprocessor.
30870
</P
30871
></DD
30872
><DT
30873
><A
30874
NAME="cv-MAKEINDEX"
30875
></A
30876
><CODE
30877
CLASS="envar"
30878
>MAKEINDEX</CODE
30879
></DT
30880
><DD
30881
><P
30882
> The makeindex generator for the TeX formatter and typesetter and the
30883
LaTeX structured formatter and typesetter.
30884
</P
30885
></DD
30886
><DT
30887
><A
30888
NAME="cv-MAKEINDEXCOM"
30889
></A
30890
><CODE
30891
CLASS="envar"
30892
>MAKEINDEXCOM</CODE
30893
></DT
30894
><DD
30895
><P
30896
> The command line used to call the makeindex generator for the
30897
TeX formatter and typesetter and the LaTeX structured formatter and
30898
typesetter.
30899
</P
30900
></DD
30901
><DT
30902
><A
30903
NAME="cv-MAKEINDEXCOMSTR"
30904
></A
30905
><CODE
30906
CLASS="envar"
30907
>MAKEINDEXCOMSTR</CODE
30908
></DT
30909
><DD
30910
><P
30911
> The string displayed when calling the makeindex generator for the
30912
TeX formatter and typesetter
30913
and the LaTeX structured formatter and typesetter.
30914
If this is not set, then <A
30915
HREF="#cv-MAKEINDEXCOM"
30916
><CODE
30917
CLASS="envar"
30918
>$MAKEINDEXCOM</CODE
30919
></A
30920
> (the command line) is displayed.
30921
</P
30922
></DD
30923
><DT
30924
><A
30925
NAME="cv-MAKEINDEXFLAGS"
30926
></A
30927
><CODE
30928
CLASS="envar"
30929
>MAKEINDEXFLAGS</CODE
30930
></DT
30931
><DD
30932
><P
30933
> General options passed to the makeindex generator for the TeX formatter
30934
and typesetter and the LaTeX structured formatter and typesetter.
30935
</P
30936
></DD
30937
><DT
30938
><A
30939
NAME="cv-MAXLINELENGTH"
30940
></A
30941
><CODE
30942
CLASS="envar"
30943
>MAXLINELENGTH</CODE
30944
></DT
30945
><DD
30946
><P
30947
> The maximum number of characters allowed on an external command line.
30948
On Win32 systems,
30949
link lines longer than this many characters
30950
are linked via a temporary file name.
30951
</P
30952
></DD
30953
><DT
30954
><A
30955
NAME="cv-MIDL"
30956
></A
30957
><CODE
30958
CLASS="envar"
30959
>MIDL</CODE
30960
></DT
30961
><DD
30962
><P
30963
> The Microsoft IDL compiler.
30964
</P
30965
></DD
30966
><DT
30967
><A
30968
NAME="cv-MIDLCOM"
30969
></A
30970
><CODE
30971
CLASS="envar"
30972
>MIDLCOM</CODE
30973
></DT
30974
><DD
30975
><P
30976
> The command line used to pass files to the Microsoft IDL compiler.
30977
</P
30978
></DD
30979
><DT
30980
><A
30981
NAME="cv-MIDLCOMSTR"
30982
></A
30983
><CODE
30984
CLASS="envar"
30985
>MIDLCOMSTR</CODE
30986
></DT
30987
><DD
30988
><P
30989
> The string displayed when
30990
the Microsoft IDL copmiler is called.
30991
If this is not set, then <A
30992
HREF="#cv-MIDLCOM"
30993
><CODE
30994
CLASS="envar"
30995
>$MIDLCOM</CODE
30996
></A
30997
> (the command line) is displayed.
30998
</P
30999
></DD
31000
><DT
31001
><A
31002
NAME="cv-MIDLFLAGS"
31003
></A
31004
><CODE
31005
CLASS="envar"
31006
>MIDLFLAGS</CODE
31007
></DT
31008
><DD
31009
><P
31010
> General options passed to the Microsoft IDL compiler.
31011
</P
31012
></DD
31013
><DT
31014
><A
31015
NAME="cv-MSVS"
31016
></A
31017
><CODE
31018
CLASS="envar"
31019
>MSVS</CODE
31020
></DT
31021
><DD
31022
><P
31023
> When the Microsoft Visual Studio tools are initialized, they set up
31024
this dictionary with the following keys:</P
31025
><P
31026
><CODE
31027
CLASS="envar"
31028
>VERSION</CODE
31029
>:
31030
the version of MSVS being used (can be set via
31031
MSVS_VERSION)</P
31032
><P
31033
><CODE
31034
CLASS="envar"
31035
>VERSIONS</CODE
31036
>:
31037
the available versions of MSVS installed</P
31038
><P
31039
><CODE
31040
CLASS="envar"
31041
>VCINSTALLDIR</CODE
31042
>:
31043
installed directory of Visual C++</P
31044
><P
31045
><CODE
31046
CLASS="envar"
31047
>VSINSTALLDIR</CODE
31048
>:
31049
installed directory of Visual Studio</P
31050
><P
31051
><CODE
31052
CLASS="envar"
31053
>FRAMEWORKDIR</CODE
31054
>:
31055
installed directory of the .NET framework</P
31056
><P
31057
><CODE
31058
CLASS="envar"
31059
>FRAMEWORKVERSIONS</CODE
31060
>:
31061
list of installed versions of the .NET framework, sorted latest to oldest.</P
31062
><P
31063
><CODE
31064
CLASS="envar"
31065
>FRAMEWORKVERSION</CODE
31066
>:
31067
latest installed version of the .NET framework</P
31068
><P
31069
><CODE
31070
CLASS="envar"
31071
>FRAMEWORKSDKDIR</CODE
31072
>:
31073
installed location of the .NET SDK.</P
31074
><P
31075
><CODE
31076
CLASS="envar"
31077
>PLATFORMSDKDIR</CODE
31078
>:
31079
installed location of the Platform SDK.</P
31080
><P
31081
><CODE
31082
CLASS="envar"
31083
>PLATFORMSDK_MODULES</CODE
31084
>:
31085
dictionary of installed Platform SDK modules,
31086
where the dictionary keys are keywords for the various modules, and
31087
the values are 2-tuples where the first is the release date, and the
31088
second is the version number.</P
31089
><P
31090
>If a value isn't set, it wasn't available in the registry.
31091
</P
31092
></DD
31093
><DT
31094
><A
31095
NAME="cv-MSVS_IGNORE_IDE_PATHS"
31096
></A
31097
><CODE
31098
CLASS="envar"
31099
>MSVS_IGNORE_IDE_PATHS</CODE
31100
></DT
31101
><DD
31102
><P
31103
> Tells the MS Visual Studio tools to use minimal INCLUDE, LIB, and PATH settings,
31104
instead of the settings from the IDE.</P
31105
><P
31106
>For Visual Studio, SCons will (by default) automatically determine
31107
where MSVS is installed, and use the LIB, INCLUDE, and PATH variables
31108
set by the IDE. You can override this behavior by setting these
31109
variables after Environment initialization, or by setting
31110
<CODE
31111
CLASS="envar"
31112
>MSVS_IGNORE_IDE_PATHS = 1</CODE
31113
>
31114
in the Environment initialization.
31115
Specifying this will not leave these unset, but will set them to a
31116
minimal set of paths needed to run the tools successfully.</P
31117
><P
31118
>For VS6, the mininimal set is:
31119
</P
31120
><PRE
31121
CLASS="programlisting"
31122
> INCLUDE:'<VSDir>\VC98\ATL\include;<VSDir>\VC98\MFC\include;<VSDir>\VC98\include'
31123
LIB:'<VSDir>\VC98\MFC\lib;<VSDir>\VC98\lib'
31124
PATH:'<VSDir>\Common\MSDev98\bin;<VSDir>\VC98\bin'
31125
</PRE
31126
><P
31127
> For VS7, it is:
31128
</P
31129
><PRE
31130
CLASS="programlisting"
31131
> INCLUDE:'<VSDir>\Vc7\atlmfc\include;<VSDir>\Vc7\include'
31132
LIB:'<VSDir>\Vc7\atlmfc\lib;<VSDir>\Vc7\lib'
31133
PATH:'<VSDir>\Common7\Tools\bin;<VSDir>\Common7\Tools;<VSDir>\Vc7\bin'
31134
</PRE
31135
><P
31136
> Where '<VSDir>' is the installed location of Visual Studio.
31137
</P
31138
></DD
31139
><DT
31140
><A
31141
NAME="cv-MSVS_PROJECT_BASE_PATH"
31142
></A
31143
><CODE
31144
CLASS="envar"
31145
>MSVS_PROJECT_BASE_PATH</CODE
31146
></DT
31147
><DD
31148
><P
31149
> The string
31150
placed in a generated Microsoft Visual Studio solution file
31151
as the value of the
31152
<TT
31153
CLASS="literal"
31154
>SccProjectFilePathRelativizedFromConnection0</TT
31155
>
31156
and
31157
<TT
31158
CLASS="literal"
31159
>SccProjectFilePathRelativizedFromConnection1</TT
31160
>
31161
attributes of the
31162
<TT
31163
CLASS="literal"
31164
>GlobalSection(SourceCodeControl)</TT
31165
>
31166
section.
31167
There is no default value.
31168
</P
31169
></DD
31170
><DT
31171
><A
31172
NAME="cv-MSVS_PROJECT_GUID"
31173
></A
31174
><CODE
31175
CLASS="envar"
31176
>MSVS_PROJECT_GUID</CODE
31177
></DT
31178
><DD
31179
><P
31180
> The string
31181
placed in a generated Microsoft Visual Studio project file
31182
as the value of the
31183
<TT
31184
CLASS="literal"
31185
>ProjectGUID</TT
31186
>
31187
attribute.
31188
The string is also placed in the
31189
<TT
31190
CLASS="literal"
31191
>SolutionUniqueID</TT
31192
>
31193
attribute of the
31194
<TT
31195
CLASS="literal"
31196
>GlobalSection(SourceCodeControl)</TT
31197
>
31198
section of the Microsoft Visual Studio solution file.
31199
There is no default value.
31200
</P
31201
></DD
31202
><DT
31203
><A
31204
NAME="cv-MSVS_SCC_AUX_PATH"
31205
></A
31206
><CODE
31207
CLASS="envar"
31208
>MSVS_SCC_AUX_PATH</CODE
31209
></DT
31210
><DD
31211
><P
31212
> The path name
31213
placed in a generated Microsoft Visual Studio project file
31214
as the value of the
31215
<TT
31216
CLASS="literal"
31217
>SccAuxPath</TT
31218
>
31219
attribute
31220
if the
31221
<CODE
31222
CLASS="envar"
31223
>MSVS_SCC_PROVIDER</CODE
31224
>
31225
construction variable is also set.
31226
There is no default value.
31227
</P
31228
></DD
31229
><DT
31230
><A
31231
NAME="cv-MSVS_SCC_LOCAL_PATH"
31232
></A
31233
><CODE
31234
CLASS="envar"
31235
>MSVS_SCC_LOCAL_PATH</CODE
31236
></DT
31237
><DD
31238
><P
31239
> The path name
31240
placed in a generated Microsoft Visual Studio project file
31241
as the value of the
31242
<TT
31243
CLASS="literal"
31244
>SccLocalPath</TT
31245
>
31246
attribute
31247
if the
31248
<CODE
31249
CLASS="envar"
31250
>MSVS_SCC_PROVIDER</CODE
31251
>
31252
construction variable is also set.
31253
The path name is also placed in the
31254
<TT
31255
CLASS="literal"
31256
>SccLocalPath0</TT
31257
>
31258
and
31259
<TT
31260
CLASS="literal"
31261
>SccLocalPath1</TT
31262
>
31263
attributes of the
31264
<TT
31265
CLASS="literal"
31266
>GlobalSection(SourceCodeControl)</TT
31267
>
31268
section of the Microsoft Visual Studio solution file.
31269
There is no default value.
31270
</P
31271
></DD
31272
><DT
31273
><A
31274
NAME="cv-MSVS_SCC_PROJECT_NAME"
31275
></A
31276
><CODE
31277
CLASS="envar"
31278
>MSVS_SCC_PROJECT_NAME</CODE
31279
></DT
31280
><DD
31281
><P
31282
> The project name
31283
placed in a generated Microsoft Visual Studio project file
31284
as the value of the
31285
<TT
31286
CLASS="literal"
31287
>SccProjectName</TT
31288
>
31289
attribute.
31290
There is no default value.
31291
</P
31292
></DD
31293
><DT
31294
><A
31295
NAME="cv-MSVS_SCC_PROVIDER"
31296
></A
31297
><CODE
31298
CLASS="envar"
31299
>MSVS_SCC_PROVIDER</CODE
31300
></DT
31301
><DD
31302
><P
31303
> The string
31304
placed in a generated Microsoft Visual Studio project file
31305
as the value of the
31306
<TT
31307
CLASS="literal"
31308
>SccProvider</TT
31309
>
31310
attribute.
31311
The string is also placed in the
31312
<TT
31313
CLASS="literal"
31314
>SccProvider1</TT
31315
>
31316
attribute of the
31317
<TT
31318
CLASS="literal"
31319
>GlobalSection(SourceCodeControl)</TT
31320
>
31321
section of the Microsoft Visual Studio solution file.
31322
There is no default value.
31323
</P
31324
></DD
31325
><DT
31326
><A
31327
NAME="cv-MSVS_USE_MFC_DIRS"
31328
></A
31329
><CODE
31330
CLASS="envar"
31331
>MSVS_USE_MFC_DIRS</CODE
31332
></DT
31333
><DD
31334
><P
31335
> Tells the MS Visual Studio tool(s) to use
31336
the MFC directories in its default paths
31337
for compiling and linking.
31338
The <CODE
31339
CLASS="envar"
31340
>$MSVS_USE_MFC_DIRS</CODE
31341
> variable has no effect if the
31342
<CODE
31343
CLASS="envar"
31344
>INCLUDE</CODE
31345
>
31346
or
31347
<CODE
31348
CLASS="envar"
31349
>LIB</CODE
31350
>
31351
environment variables are set explictly.</P
31352
><P
31353
>Under Visual Studio version 6,
31354
setting
31355
<CODE
31356
CLASS="envar"
31357
>$MSVS_USE_MFC_DIRS</CODE
31358
>
31359
to a non-zero value
31360
adds the
31361
<TT
31362
CLASS="filename"
31363
>ATL\include</TT
31364
>
31365
and
31366
<TT
31367
CLASS="filename"
31368
>MFC\include</TT
31369
>
31370
directories to
31371
the default
31372
<CODE
31373
CLASS="envar"
31374
>INCLUDE</CODE
31375
>
31376
external environment variable,
31377
and adds the
31378
<TT
31379
CLASS="filename"
31380
>MFC\lib</TT
31381
>
31382
directory to
31383
the default
31384
<CODE
31385
CLASS="envar"
31386
>LIB</CODE
31387
>
31388
external environment variable.</P
31389
><P
31390
>Under Visual Studio version 7,
31391
setting
31392
<CODE
31393
CLASS="envar"
31394
>$MSVS_USE_MFC_DIRS</CODE
31395
>
31396
to a non-zero value
31397
adds the
31398
<TT
31399
CLASS="filename"
31400
>atlmfc\include</TT
31401
>
31402
directory to the default
31403
<CODE
31404
CLASS="envar"
31405
>INCLUDE</CODE
31406
>
31407
external environment variable,
31408
and adds the
31409
<TT
31410
CLASS="filename"
31411
>atlmfc\lib</TT
31412
>
31413
directory to the default
31414
<CODE
31415
CLASS="envar"
31416
>LIB</CODE
31417
>
31418
external environment variable.</P
31419
><P
31420
>Under Visual Studio version 8,
31421
setting
31422
<CODE
31423
CLASS="envar"
31424
>$MSVS_USE_MFC_DIRS</CODE
31425
>
31426
to a non-zero value will,
31427
by default,
31428
add the
31429
<TT
31430
CLASS="filename"
31431
>atlmfc\include</TT
31432
>
31433
directory to the default
31434
<CODE
31435
CLASS="envar"
31436
>INCLUDE</CODE
31437
>
31438
external environment variable,
31439
and the
31440
<TT
31441
CLASS="filename"
31442
>atlmfc\lib</TT
31443
>
31444
directory to the default
31445
<CODE
31446
CLASS="envar"
31447
>LIB</CODE
31448
>
31449
external environment variable.
31450
If, however, the
31451
<CODE
31452
CLASS="envar"
31453
>['MSVS']['PLATFORMSDKDIR']</CODE
31454
>
31455
variable is set,
31456
then the
31457
<TT
31458
CLASS="filename"
31459
>mfc</TT
31460
>
31461
and the
31462
<TT
31463
CLASS="filename"
31464
>atl</TT
31465
>
31466
subdirectories of the
31467
<CODE
31468
CLASS="envar"
31469
>PLATFORMSDKDIR</CODE
31470
>
31471
are added to the default value of the
31472
<CODE
31473
CLASS="envar"
31474
>INCLUDE</CODE
31475
>
31476
external environment variable,
31477
and the default value of the
31478
<CODE
31479
CLASS="envar"
31480
>LIB</CODE
31481
>
31482
external environment variable is left untouched.
31483
</P
31484
></DD
31485
><DT
31486
><A
31487
NAME="cv-MSVS_VERSION"
31488
></A
31489
><CODE
31490
CLASS="envar"
31491
>MSVS_VERSION</CODE
31492
></DT
31493
><DD
31494
><P
31495
> Sets the preferred version of MSVS to use.</P
31496
><P
31497
>SCons will (by default) select the latest version of MSVS
31498
installed on your machine.
31499
So, if you have version 6 and version 7 (MSVS .NET) installed,
31500
it will prefer version 7.
31501
You can override this by
31502
specifying the
31503
<CODE
31504
CLASS="envar"
31505
>MSVS_VERSION</CODE
31506
>
31507
variable in the Environment initialization, setting it to the
31508
appropriate version ('6.0' or '7.0', for example).
31509
If the given version isn't installed, tool initialization will fail.
31510
</P
31511
></DD
31512
><DT
31513
><A
31514
NAME="cv-MSVSBUILDCOM"
31515
></A
31516
><CODE
31517
CLASS="envar"
31518
>MSVSBUILDCOM</CODE
31519
></DT
31520
><DD
31521
><P
31522
> The build command line placed in
31523
a generated Microsoft Visual Studio project file.
31524
The default is to have Visual Studio invoke SCons with any specified
31525
build targets.
31526
</P
31527
></DD
31528
><DT
31529
><A
31530
NAME="cv-MSVSCLEANCOM"
31531
></A
31532
><CODE
31533
CLASS="envar"
31534
>MSVSCLEANCOM</CODE
31535
></DT
31536
><DD
31537
><P
31538
> The clean command line placed in
31539
a generated Microsoft Visual Studio project file.
31540
The default is to have Visual Studio invoke SCons with the -c option
31541
to remove any specified targets.
31542
</P
31543
></DD
31544
><DT
31545
><A
31546
NAME="cv-MSVSENCODING"
31547
></A
31548
><CODE
31549
CLASS="envar"
31550
>MSVSENCODING</CODE
31551
></DT
31552
><DD
31553
><P
31554
> The encoding string placed in
31555
a generated Microsoft Visual Studio project file.
31556
The default is encoding
31557
<TT
31558
CLASS="literal"
31559
>Windows-1252</TT
31560
>.
31561
</P
31562
></DD
31563
><DT
31564
><A
31565
NAME="cv-MSVSPROJECTCOM"
31566
></A
31567
><CODE
31568
CLASS="envar"
31569
>MSVSPROJECTCOM</CODE
31570
></DT
31571
><DD
31572
><P
31573
> The action used to generate Microsoft Visual Studio project files.
31574
</P
31575
></DD
31576
><DT
31577
><A
31578
NAME="cv-MSVSPROJECTSUFFIX"
31579
></A
31580
><CODE
31581
CLASS="envar"
31582
>MSVSPROJECTSUFFIX</CODE
31583
></DT
31584
><DD
31585
><P
31586
> The suffix used for Microsoft Visual Studio project (DSP) files.
31587
The default value is
31588
<TT
31589
CLASS="filename"
31590
>.vcproj</TT
31591
>
31592
when using Visual Studio version 7.x (.NET)
31593
or later version,
31594
and
31595
<TT
31596
CLASS="filename"
31597
>.dsp</TT
31598
>
31599
when using earlier versions of Visual Studio.
31600
</P
31601
></DD
31602
><DT
31603
><A
31604
NAME="cv-MSVSREBUILDCOM"
31605
></A
31606
><CODE
31607
CLASS="envar"
31608
>MSVSREBUILDCOM</CODE
31609
></DT
31610
><DD
31611
><P
31612
> The rebuild command line placed in
31613
a generated Microsoft Visual Studio project file.
31614
The default is to have Visual Studio invoke SCons with any specified
31615
rebuild targets.
31616
</P
31617
></DD
31618
><DT
31619
><A
31620
NAME="cv-MSVSSCONS"
31621
></A
31622
><CODE
31623
CLASS="envar"
31624
>MSVSSCONS</CODE
31625
></DT
31626
><DD
31627
><P
31628
> The SCons used in generated Microsoft Visual Studio project files.
31629
The default is the version of SCons being
31630
used to generate the project file.
31631
</P
31632
></DD
31633
><DT
31634
><A
31635
NAME="cv-MSVSSCONSCOM"
31636
></A
31637
><CODE
31638
CLASS="envar"
31639
>MSVSSCONSCOM</CODE
31640
></DT
31641
><DD
31642
><P
31643
> The default SCons command used in generated Microsoft Visual Studio
31644
project files.
31645
</P
31646
></DD
31647
><DT
31648
><A
31649
NAME="cv-MSVSSCONSCRIPT"
31650
></A
31651
><CODE
31652
CLASS="envar"
31653
>MSVSSCONSCRIPT</CODE
31654
></DT
31655
><DD
31656
><P
31657
> The sconscript file
31658
(that is,
31659
<TT
31660
CLASS="filename"
31661
>SConstruct</TT
31662
>
31663
or
31664
<TT
31665
CLASS="filename"
31666
>SConscript</TT
31667
>
31668
file)
31669
that will be invoked by Visual Studio
31670
project files
31671
(through the
31672
<A
31673
HREF="#cv-MSVSSCONSCOM"
31674
><CODE
31675
CLASS="envar"
31676
>$MSVSSCONSCOM</CODE
31677
></A
31678
>
31679
variable).
31680
The default is the same sconscript file
31681
that contains the call to
31682
<CODE
31683
CLASS="function"
31684
>MSVSProject</CODE
31685
>
31686
to build the project file.
31687
</P
31688
></DD
31689
><DT
31690
><A
31691
NAME="cv-MSVSSCONSFLAGS"
31692
></A
31693
><CODE
31694
CLASS="envar"
31695
>MSVSSCONSFLAGS</CODE
31696
></DT
31697
><DD
31698
><P
31699
> The SCons flags used in generated Microsoft Visual Studio
31700
project files.
31701
</P
31702
></DD
31703
><DT
31704
><A
31705
NAME="cv-MSVSSOLUTIONCOM"
31706
></A
31707
><CODE
31708
CLASS="envar"
31709
>MSVSSOLUTIONCOM</CODE
31710
></DT
31711
><DD
31712
><P
31713
> The action used to generate Microsoft Visual Studio solution files.
31714
</P
31715
></DD
31716
><DT
31717
><A
31718
NAME="cv-MSVSSOLUTIONSUFFIX"
31719
></A
31720
><CODE
31721
CLASS="envar"
31722
>MSVSSOLUTIONSUFFIX</CODE
31723
></DT
31724
><DD
31725
><P
31726
> The suffix used for Microsoft Visual Studio solution (DSW) files.
31727
The default value is
31728
<TT
31729
CLASS="filename"
31730
>.sln</TT
31731
>
31732
when using Visual Studio version 7.x (.NET),
31733
and
31734
<TT
31735
CLASS="filename"
31736
>.dsw</TT
31737
>
31738
when using earlier versions of Visual Studio.
31739
</P
31740
></DD
31741
><DT
31742
><A
31743
NAME="cv-MWCW_VERSION"
31744
></A
31745
><CODE
31746
CLASS="envar"
31747
>MWCW_VERSION</CODE
31748
></DT
31749
><DD
31750
><P
31751
> The version number of the MetroWerks CodeWarrior C compiler
31752
to be used.
31753
</P
31754
></DD
31755
><DT
31756
><A
31757
NAME="cv-MWCW_VERSIONS"
31758
></A
31759
><CODE
31760
CLASS="envar"
31761
>MWCW_VERSIONS</CODE
31762
></DT
31763
><DD
31764
><P
31765
> A list of installed versions of the MetroWerks CodeWarrior C compiler
31766
on this system.
31767
</P
31768
></DD
31769
><DT
31770
><A
31771
NAME="cv-NAME"
31772
></A
31773
><CODE
31774
CLASS="envar"
31775
>NAME</CODE
31776
></DT
31777
><DD
31778
><P
31779
> Specfies the name of the project to package.
31780
</P
31781
></DD
31782
><DT
31783
><A
31784
NAME="cv-no_import_lib"
31785
></A
31786
><CODE
31787
CLASS="envar"
31788
>no_import_lib</CODE
31789
></DT
31790
><DD
31791
><P
31792
> When set to non-zero,
31793
suppresses creation of a corresponding Windows static import lib by the
31794
<TT
31795
CLASS="literal"
31796
>SharedLibrary</TT
31797
>
31798
builder when used with
31799
MinGW, Microsoft Visual Studio or Metrowerks.
31800
This also suppresses creation
31801
of an export (.exp) file
31802
when using Microsoft Visual Studio.
31803
</P
31804
></DD
31805
><DT
31806
><A
31807
NAME="cv-OBJPREFIX"
31808
></A
31809
><CODE
31810
CLASS="envar"
31811
>OBJPREFIX</CODE
31812
></DT
31813
><DD
31814
><P
31815
> The prefix used for (static) object file names.
31816
</P
31817
></DD
31818
><DT
31819
><A
31820
NAME="cv-OBJSUFFIX"
31821
></A
31822
><CODE
31823
CLASS="envar"
31824
>OBJSUFFIX</CODE
31825
></DT
31826
><DD
31827
><P
31828
> The suffix used for (static) object file names.
31829
</P
31830
></DD
31831
><DT
31832
><A
31833
NAME="cv-P4"
31834
></A
31835
><CODE
31836
CLASS="envar"
31837
>P4</CODE
31838
></DT
31839
><DD
31840
><P
31841
> The Perforce executable.
31842
</P
31843
></DD
31844
><DT
31845
><A
31846
NAME="cv-P4COM"
31847
></A
31848
><CODE
31849
CLASS="envar"
31850
>P4COM</CODE
31851
></DT
31852
><DD
31853
><P
31854
> The command line used to
31855
fetch source files from Perforce.
31856
</P
31857
></DD
31858
><DT
31859
><A
31860
NAME="cv-P4COMSTR"
31861
></A
31862
><CODE
31863
CLASS="envar"
31864
>P4COMSTR</CODE
31865
></DT
31866
><DD
31867
><P
31868
> The string displayed when
31869
fetching a source file from Perforce.
31870
If this is not set, then <A
31871
HREF="#cv-P4COM"
31872
><CODE
31873
CLASS="envar"
31874
>$P4COM</CODE
31875
></A
31876
> (the command line) is displayed.
31877
</P
31878
></DD
31879
><DT
31880
><A
31881
NAME="cv-P4FLAGS"
31882
></A
31883
><CODE
31884
CLASS="envar"
31885
>P4FLAGS</CODE
31886
></DT
31887
><DD
31888
><P
31889
> General options that are passed to Perforce.
31890
</P
31891
></DD
31892
><DT
31893
><A
31894
NAME="cv-PACKAGEROOT"
31895
></A
31896
><CODE
31897
CLASS="envar"
31898
>PACKAGEROOT</CODE
31899
></DT
31900
><DD
31901
><P
31902
> Specifies the directory where all files in resulting archive will be
31903
placed if applicable. The default value is "$NAME-$VERSION".
31904
</P
31905
></DD
31906
><DT
31907
><A
31908
NAME="cv-PACKAGETYPE"
31909
></A
31910
><CODE
31911
CLASS="envar"
31912
>PACKAGETYPE</CODE
31913
></DT
31914
><DD
31915
><P
31916
> Selects the package type to build. Currently these are available:</P
31917
><P
31918
> * msi - Microsoft Installer
31919
* rpm - Redhat Package Manger
31920
* ipkg - Itsy Package Management System
31921
* tarbz2 - compressed tar
31922
* targz - compressed tar
31923
* zip - zip file
31924
* src_tarbz2 - compressed tar source
31925
* src_targz - compressed tar source
31926
* src_zip - zip file source</P
31927
><P
31928
>This may be overridden with the "package_type" command line option.
31929
</P
31930
></DD
31931
><DT
31932
><A
31933
NAME="cv-PACKAGEVERSION"
31934
></A
31935
><CODE
31936
CLASS="envar"
31937
>PACKAGEVERSION</CODE
31938
></DT
31939
><DD
31940
><P
31941
> The version of the package (not the underlying project).
31942
This is currently only used by the rpm packager
31943
and should reflect changes in the packaging,
31944
not the underlying project code itself.
31945
</P
31946
></DD
31947
><DT
31948
><A
31949
NAME="cv-PCH"
31950
></A
31951
><CODE
31952
CLASS="envar"
31953
>PCH</CODE
31954
></DT
31955
><DD
31956
><P
31957
> The Microsoft Visual C++ precompiled header that will be used when compiling
31958
object files. This variable is ignored by tools other than Microsoft Visual C++.
31959
When this variable is
31960
defined SCons will add options to the compiler command line to
31961
cause it to use the precompiled header, and will also set up the
31962
dependencies for the PCH file.
31963
Example:
31964
</P
31965
><PRE
31966
CLASS="programlisting"
31967
> env['PCH'] = 'StdAfx.pch'
31968
</PRE
31969
></DD
31970
><DT
31971
><A
31972
NAME="cv-PCHCOM"
31973
></A
31974
><CODE
31975
CLASS="envar"
31976
>PCHCOM</CODE
31977
></DT
31978
><DD
31979
><P
31980
> The command line used by the
31981
<CODE
31982
CLASS="function"
31983
>PCH</CODE
31984
>
31985
builder to generated a precompiled header.
31986
</P
31987
></DD
31988
><DT
31989
><A
31990
NAME="cv-PCHCOMSTR"
31991
></A
31992
><CODE
31993
CLASS="envar"
31994
>PCHCOMSTR</CODE
31995
></DT
31996
><DD
31997
><P
31998
> The string displayed when generating a precompiled header.
31999
If this is not set, then <A
32000
HREF="#cv-PCHCOM"
32001
><CODE
32002
CLASS="envar"
32003
>$PCHCOM</CODE
32004
></A
32005
> (the command line) is displayed.
32006
</P
32007
></DD
32008
><DT
32009
><A
32010
NAME="cv-PCHPDBFLAGS"
32011
></A
32012
><CODE
32013
CLASS="envar"
32014
>PCHPDBFLAGS</CODE
32015
></DT
32016
><DD
32017
><P
32018
> A construction variable that, when expanded,
32019
adds the <TT
32020
CLASS="literal"
32021
>/yD</TT
32022
> flag to the command line
32023
only if the <CODE
32024
CLASS="envar"
32025
>$PDB</CODE
32026
> construction variable is set.
32027
</P
32028
></DD
32029
><DT
32030
><A
32031
NAME="cv-PCHSTOP"
32032
></A
32033
><CODE
32034
CLASS="envar"
32035
>PCHSTOP</CODE
32036
></DT
32037
><DD
32038
><P
32039
> This variable specifies how much of a source file is precompiled. This
32040
variable is ignored by tools other than Microsoft Visual C++, or when
32041
the PCH variable is not being used. When this variable is define it
32042
must be a string that is the name of the header that
32043
is included at the end of the precompiled portion of the source files, or
32044
the empty string if the "#pragma hrdstop" construct is being used:
32045
</P
32046
><PRE
32047
CLASS="programlisting"
32048
> env['PCHSTOP'] = 'StdAfx.h'
32049
</PRE
32050
></DD
32051
><DT
32052
><A
32053
NAME="cv-PDB"
32054
></A
32055
><CODE
32056
CLASS="envar"
32057
>PDB</CODE
32058
></DT
32059
><DD
32060
><P
32061
> The Microsoft Visual C++ PDB file that will store debugging information for
32062
object files, shared libraries, and programs. This variable is ignored by
32063
tools other than Microsoft Visual C++.
32064
When this variable is
32065
defined SCons will add options to the compiler and linker command line to
32066
cause them to generate external debugging information, and will also set up the
32067
dependencies for the PDB file.
32068
Example:
32069
</P
32070
><PRE
32071
CLASS="programlisting"
32072
> env['PDB'] = 'hello.pdb'
32073
</PRE
32074
><P
32075
> The Visual C++ compiler switch that SCons uses by default
32076
to generate PDB information is <CODE
32077
CLASS="option"
32078
>/Z7</CODE
32079
>.
32080
This works correctly with parallel (<CODE
32081
CLASS="option"
32082
>-j</CODE
32083
>) builds
32084
because it embeds the debug information in the intermediate object files,
32085
as opposed to sharing a single PDB file between multiple object files.
32086
This is also the only way to get debug information
32087
embedded into a static library.
32088
Using the <CODE
32089
CLASS="option"
32090
>/Zi</CODE
32091
> instead may yield improved
32092
link-time performance,
32093
although parallel builds will no longer work.
32094
You can generate PDB files with the <CODE
32095
CLASS="option"
32096
>/Zi</CODE
32097
>
32098
switch by overriding the default <A
32099
HREF="#cv-CCPDBFLAGS"
32100
><CODE
32101
CLASS="envar"
32102
>$CCPDBFLAGS</CODE
32103
></A
32104
> variable;
32105
see the entry for that variable for specific examples.
32106
</P
32107
></DD
32108
><DT
32109
><A
32110
NAME="cv-PDFCOM"
32111
></A
32112
><CODE
32113
CLASS="envar"
32114
>PDFCOM</CODE
32115
></DT
32116
><DD
32117
><P
32118
> A deprecated synonym for <A
32119
HREF="#cv-DVIPDFCOM"
32120
><CODE
32121
CLASS="envar"
32122
>$DVIPDFCOM</CODE
32123
></A
32124
>.
32125
</P
32126
></DD
32127
><DT
32128
><A
32129
NAME="cv-PDFLATEX"
32130
></A
32131
><CODE
32132
CLASS="envar"
32133
>PDFLATEX</CODE
32134
></DT
32135
><DD
32136
><P
32137
> The <SPAN
32138
CLASS="application"
32139
>pdflatex</SPAN
32140
> utility.
32141
</P
32142
></DD
32143
><DT
32144
><A
32145
NAME="cv-PDFLATEXCOM"
32146
></A
32147
><CODE
32148
CLASS="envar"
32149
>PDFLATEXCOM</CODE
32150
></DT
32151
><DD
32152
><P
32153
> The command line used to call the <SPAN
32154
CLASS="application"
32155
>pdflatex</SPAN
32156
> utility.
32157
</P
32158
></DD
32159
><DT
32160
><A
32161
NAME="cv-PDFLATEXCOMSTR"
32162
></A
32163
><CODE
32164
CLASS="envar"
32165
>PDFLATEXCOMSTR</CODE
32166
></DT
32167
><DD
32168
><P
32169
> The string displayed when calling the <SPAN
32170
CLASS="application"
32171
>pdflatex</SPAN
32172
> utility.
32173
If this is not set, then <A
32174
HREF="#cv-PDFLATEXCOM"
32175
><CODE
32176
CLASS="envar"
32177
>$PDFLATEXCOM</CODE
32178
></A
32179
> (the command line) is displayed.
32180
</P
32181
><PRE
32182
CLASS="programlisting"
32183
> env = Environment(PDFLATEX;COMSTR = "Building $TARGET from LaTeX input $SOURCES")
32184
</PRE
32185
></DD
32186
><DT
32187
><A
32188
NAME="cv-PDFLATEXFLAGS"
32189
></A
32190
><CODE
32191
CLASS="envar"
32192
>PDFLATEXFLAGS</CODE
32193
></DT
32194
><DD
32195
><P
32196
> General options passed to the <SPAN
32197
CLASS="application"
32198
>pdflatex</SPAN
32199
> utility.
32200
</P
32201
></DD
32202
><DT
32203
><A
32204
NAME="cv-PDFPREFIX"
32205
></A
32206
><CODE
32207
CLASS="envar"
32208
>PDFPREFIX</CODE
32209
></DT
32210
><DD
32211
><P
32212
> The prefix used for PDF file names.
32213
</P
32214
></DD
32215
><DT
32216
><A
32217
NAME="cv-PDFSUFFIX"
32218
></A
32219
><CODE
32220
CLASS="envar"
32221
>PDFSUFFIX</CODE
32222
></DT
32223
><DD
32224
><P
32225
> The suffix used for PDF file names.
32226
</P
32227
></DD
32228
><DT
32229
><A
32230
NAME="cv-PDFTEX"
32231
></A
32232
><CODE
32233
CLASS="envar"
32234
>PDFTEX</CODE
32235
></DT
32236
><DD
32237
><P
32238
> The <SPAN
32239
CLASS="application"
32240
>pdftex</SPAN
32241
> utility.
32242
</P
32243
></DD
32244
><DT
32245
><A
32246
NAME="cv-PDFTEXCOM"
32247
></A
32248
><CODE
32249
CLASS="envar"
32250
>PDFTEXCOM</CODE
32251
></DT
32252
><DD
32253
><P
32254
> The command line used to call the <SPAN
32255
CLASS="application"
32256
>pdftex</SPAN
32257
> utility.
32258
</P
32259
></DD
32260
><DT
32261
><A
32262
NAME="cv-PDFTEXCOMSTR"
32263
></A
32264
><CODE
32265
CLASS="envar"
32266
>PDFTEXCOMSTR</CODE
32267
></DT
32268
><DD
32269
><P
32270
> The string displayed when calling the <SPAN
32271
CLASS="application"
32272
>pdftex</SPAN
32273
> utility.
32274
If this is not set, then <A
32275
HREF="#cv-PDFTEXCOM"
32276
><CODE
32277
CLASS="envar"
32278
>$PDFTEXCOM</CODE
32279
></A
32280
> (the command line) is displayed.
32281
</P
32282
><PRE
32283
CLASS="programlisting"
32284
> env = Environment(PDFTEXCOMSTR = "Building $TARGET from TeX input $SOURCES")
32285
</PRE
32286
></DD
32287
><DT
32288
><A
32289
NAME="cv-PDFTEXFLAGS"
32290
></A
32291
><CODE
32292
CLASS="envar"
32293
>PDFTEXFLAGS</CODE
32294
></DT
32295
><DD
32296
><P
32297
> General options passed to the <SPAN
32298
CLASS="application"
32299
>pdftex</SPAN
32300
> utility.
32301
</P
32302
></DD
32303
><DT
32304
><A
32305
NAME="cv-PKGCHK"
32306
></A
32307
><CODE
32308
CLASS="envar"
32309
>PKGCHK</CODE
32310
></DT
32311
><DD
32312
><P
32313
> On Solaris systems,
32314
the package-checking program that will
32315
be used (along with <CODE
32316
CLASS="envar"
32317
>$PKGINFO</CODE
32318
>)
32319
to look for installed versions of
32320
the Sun PRO C++ compiler.
32321
The default is
32322
<TT
32323
CLASS="filename"
32324
>/usr/sbin/pgkchk</TT
32325
>.
32326
</P
32327
></DD
32328
><DT
32329
><A
32330
NAME="cv-PKGINFO"
32331
></A
32332
><CODE
32333
CLASS="envar"
32334
>PKGINFO</CODE
32335
></DT
32336
><DD
32337
><P
32338
> On Solaris systems,
32339
the package information program that will
32340
be used (along with <CODE
32341
CLASS="envar"
32342
>$PKGCHK</CODE
32343
>)
32344
to look for installed versions of
32345
the Sun PRO C++ compiler.
32346
The default is
32347
<TT
32348
CLASS="filename"
32349
>pkginfo</TT
32350
>.
32351
</P
32352
></DD
32353
><DT
32354
><A
32355
NAME="cv-PLATFORM"
32356
></A
32357
><CODE
32358
CLASS="envar"
32359
>PLATFORM</CODE
32360
></DT
32361
><DD
32362
><P
32363
> The name of the platform used to create the Environment. If no platform is
32364
specified when the Environment is created,
32365
<SPAN
32366
CLASS="application"
32367
>scons</SPAN
32368
>
32369
autodetects the platform.
32370
</P
32371
><PRE
32372
CLASS="programlisting"
32373
> env = Environment(tools = [])
32374
if env['PLATFORM'] == 'cygwin':
32375
Tool('mingw')(env)
32376
else:
32377
Tool('msvc')(env)
32378
</PRE
32379
></DD
32380
><DT
32381
><A
32382
NAME="cv-PRINT_CMD_LINE_FUNC"
32383
></A
32384
><CODE
32385
CLASS="envar"
32386
>PRINT_CMD_LINE_FUNC</CODE
32387
></DT
32388
><DD
32389
><P
32390
> A Python function used to print the command lines as they are executed
32391
(assuming command printing is not disabled by the
32392
<CODE
32393
CLASS="option"
32394
>-q</CODE
32395
>
32396
or
32397
<CODE
32398
CLASS="option"
32399
>-s</CODE
32400
>
32401
options or their equivalents).
32402
The function should take four arguments:
32403
<CODE
32404
CLASS="varname"
32405
>s</CODE
32406
>,
32407
the command being executed (a string),
32408
<CODE
32409
CLASS="varname"
32410
>target</CODE
32411
>,
32412
the target being built (file node, list, or string name(s)),
32413
<CODE
32414
CLASS="varname"
32415
>source</CODE
32416
>,
32417
the source(s) used (file node, list, or string name(s)), and
32418
<CODE
32419
CLASS="varname"
32420
>env</CODE
32421
>,
32422
the environment being used.</P
32423
><P
32424
>The function must do the printing itself. The default implementation,
32425
used if this variable is not set or is None, is:
32426
</P
32427
><PRE
32428
CLASS="programlisting"
32429
> def print_cmd_line(s, target, source, env):
32430
sys.stdout.write(s + "\n")
32431
</PRE
32432
><P
32433
> Here's an example of a more interesting function:
32434
</P
32435
><PRE
32436
CLASS="programlisting"
32437
> def print_cmd_line(s, target, source, env):
32438
sys.stdout.write("Building %s -> %s...\n" %
32439
(' and '.join([str(x) for x in source]),
32440
' and '.join([str(x) for x in target])))
32441
env=Environment(PRINT_CMD_LINE_FUNC=print_cmd_line)
32442
env.Program('foo', 'foo.c')
32443
</PRE
32444
><P
32445
> This just prints "Building <CODE
32446
CLASS="varname"
32447
>targetname</CODE
32448
> from <CODE
32449
CLASS="varname"
32450
>sourcename</CODE
32451
>..." instead
32452
of the actual commands.
32453
Such a function could also log the actual commands to a log file,
32454
for example.
32455
</P
32456
></DD
32457
><DT
32458
><A
32459
NAME="cv-PROGPREFIX"
32460
></A
32461
><CODE
32462
CLASS="envar"
32463
>PROGPREFIX</CODE
32464
></DT
32465
><DD
32466
><P
32467
> The prefix used for executable file names.
32468
</P
32469
></DD
32470
><DT
32471
><A
32472
NAME="cv-PROGSUFFIX"
32473
></A
32474
><CODE
32475
CLASS="envar"
32476
>PROGSUFFIX</CODE
32477
></DT
32478
><DD
32479
><P
32480
> The suffix used for executable file names.
32481
</P
32482
></DD
32483
><DT
32484
><A
32485
NAME="cv-PSCOM"
32486
></A
32487
><CODE
32488
CLASS="envar"
32489
>PSCOM</CODE
32490
></DT
32491
><DD
32492
><P
32493
> The command line used to convert TeX DVI files into a PostScript file.
32494
</P
32495
></DD
32496
><DT
32497
><A
32498
NAME="cv-PSCOMSTR"
32499
></A
32500
><CODE
32501
CLASS="envar"
32502
>PSCOMSTR</CODE
32503
></DT
32504
><DD
32505
><P
32506
> The string displayed when a TeX DVI file
32507
is converted into a PostScript file.
32508
If this is not set, then <A
32509
HREF="#cv-PSCOM"
32510
><CODE
32511
CLASS="envar"
32512
>$PSCOM</CODE
32513
></A
32514
> (the command line) is displayed.
32515
</P
32516
></DD
32517
><DT
32518
><A
32519
NAME="cv-PSPREFIX"
32520
></A
32521
><CODE
32522
CLASS="envar"
32523
>PSPREFIX</CODE
32524
></DT
32525
><DD
32526
><P
32527
> The prefix used for PostScript file names.
32528
</P
32529
></DD
32530
><DT
32531
><A
32532
NAME="cv-PSSUFFIX"
32533
></A
32534
><CODE
32535
CLASS="envar"
32536
>PSSUFFIX</CODE
32537
></DT
32538
><DD
32539
><P
32540
> The prefix used for PostScript file names.
32541
</P
32542
></DD
32543
><DT
32544
><A
32545
NAME="cv-QT_AUTOSCAN"
32546
></A
32547
><CODE
32548
CLASS="envar"
32549
>QT_AUTOSCAN</CODE
32550
></DT
32551
><DD
32552
><P
32553
> Turn off scanning for mocable files. Use the Moc Builder to explicitely
32554
specify files to run moc on.
32555
</P
32556
></DD
32557
><DT
32558
><A
32559
NAME="cv-QT_BINPATH"
32560
></A
32561
><CODE
32562
CLASS="envar"
32563
>QT_BINPATH</CODE
32564
></DT
32565
><DD
32566
><P
32567
> The path where the qt binaries are installed.
32568
The default value is '<A
32569
HREF="#cv-QTDIR"
32570
><CODE
32571
CLASS="envar"
32572
>$QTDIR</CODE
32573
></A
32574
>/bin'.
32575
</P
32576
></DD
32577
><DT
32578
><A
32579
NAME="cv-QT_CPPPATH"
32580
></A
32581
><CODE
32582
CLASS="envar"
32583
>QT_CPPPATH</CODE
32584
></DT
32585
><DD
32586
><P
32587
> The path where the qt header files are installed.
32588
The default value is '<A
32589
HREF="#cv-QTDIR"
32590
><CODE
32591
CLASS="envar"
32592
>$QTDIR</CODE
32593
></A
32594
>/include'.
32595
Note: If you set this variable to None,
32596
the tool won't change the <A
32597
HREF="#cv-CPPPATH"
32598
><CODE
32599
CLASS="envar"
32600
>$CPPPATH</CODE
32601
></A
32602
>
32603
construction variable.
32604
</P
32605
></DD
32606
><DT
32607
><A
32608
NAME="cv-QT_DEBUG"
32609
></A
32610
><CODE
32611
CLASS="envar"
32612
>QT_DEBUG</CODE
32613
></DT
32614
><DD
32615
><P
32616
> Prints lots of debugging information while scanning for moc files.
32617
</P
32618
></DD
32619
><DT
32620
><A
32621
NAME="cv-QT_LIB"
32622
></A
32623
><CODE
32624
CLASS="envar"
32625
>QT_LIB</CODE
32626
></DT
32627
><DD
32628
><P
32629
> Default value is 'qt'. You may want to set this to 'qt-mt'. Note: If you set
32630
this variable to None, the tool won't change the <A
32631
HREF="#cv-LIBS"
32632
><CODE
32633
CLASS="envar"
32634
>$LIBS</CODE
32635
></A
32636
> variable.
32637
</P
32638
></DD
32639
><DT
32640
><A
32641
NAME="cv-QT_LIBPATH"
32642
></A
32643
><CODE
32644
CLASS="envar"
32645
>QT_LIBPATH</CODE
32646
></DT
32647
><DD
32648
><P
32649
> The path where the qt libraries are installed.
32650
The default value is '<A
32651
HREF="#cv-QTDIR"
32652
><CODE
32653
CLASS="envar"
32654
>$QTDIR</CODE
32655
></A
32656
>/lib'.
32657
Note: If you set this variable to None,
32658
the tool won't change the <A
32659
HREF="#cv-LIBPATH"
32660
><CODE
32661
CLASS="envar"
32662
>$LIBPATH</CODE
32663
></A
32664
>
32665
construction variable.
32666
</P
32667
></DD
32668
><DT
32669
><A
32670
NAME="cv-QT_MOC"
32671
></A
32672
><CODE
32673
CLASS="envar"
32674
>QT_MOC</CODE
32675
></DT
32676
><DD
32677
><P
32678
> Default value is '<A
32679
HREF="#cv-QT_BINPATH"
32680
><CODE
32681
CLASS="envar"
32682
>$QT_BINPATH</CODE
32683
></A
32684
>/moc'.
32685
</P
32686
></DD
32687
><DT
32688
><A
32689
NAME="cv-QT_MOCCXXPREFIX"
32690
></A
32691
><CODE
32692
CLASS="envar"
32693
>QT_MOCCXXPREFIX</CODE
32694
></DT
32695
><DD
32696
><P
32697
> Default value is ''. Prefix for moc output files, when source is a cxx file.
32698
</P
32699
></DD
32700
><DT
32701
><A
32702
NAME="cv-QT_MOCCXXSUFFIX"
32703
></A
32704
><CODE
32705
CLASS="envar"
32706
>QT_MOCCXXSUFFIX</CODE
32707
></DT
32708
><DD
32709
><P
32710
> Default value is '.moc'. Suffix for moc output files, when source is a cxx
32711
file.
32712
</P
32713
></DD
32714
><DT
32715
><A
32716
NAME="cv-QT_MOCFROMCXXCOM"
32717
></A
32718
><CODE
32719
CLASS="envar"
32720
>QT_MOCFROMCXXCOM</CODE
32721
></DT
32722
><DD
32723
><P
32724
> Command to generate a moc file from a cpp file.
32725
</P
32726
></DD
32727
><DT
32728
><A
32729
NAME="cv-QT_MOCFROMCXXCOMSTR"
32730
></A
32731
><CODE
32732
CLASS="envar"
32733
>QT_MOCFROMCXXCOMSTR</CODE
32734
></DT
32735
><DD
32736
><P
32737
> The string displayed when generating a moc file from a cpp file.
32738
If this is not set, then <A
32739
HREF="#cv-QT_MOCFROMCXXCOM"
32740
><CODE
32741
CLASS="envar"
32742
>$QT_MOCFROMCXXCOM</CODE
32743
></A
32744
> (the command line) is displayed.
32745
</P
32746
></DD
32747
><DT
32748
><A
32749
NAME="cv-QT_MOCFROMCXXFLAGS"
32750
></A
32751
><CODE
32752
CLASS="envar"
32753
>QT_MOCFROMCXXFLAGS</CODE
32754
></DT
32755
><DD
32756
><P
32757
> Default value is '-i'. These flags are passed to moc, when moccing a
32758
C++ file.
32759
</P
32760
></DD
32761
><DT
32762
><A
32763
NAME="cv-QT_MOCFROMHCOM"
32764
></A
32765
><CODE
32766
CLASS="envar"
32767
>QT_MOCFROMHCOM</CODE
32768
></DT
32769
><DD
32770
><P
32771
> Command to generate a moc file from a header.
32772
</P
32773
></DD
32774
><DT
32775
><A
32776
NAME="cv-QT_MOCFROMHCOMSTR"
32777
></A
32778
><CODE
32779
CLASS="envar"
32780
>QT_MOCFROMHCOMSTR</CODE
32781
></DT
32782
><DD
32783
><P
32784
> The string displayed when generating a moc file from a cpp file.
32785
If this is not set, then <A
32786
HREF="#cv-QT_MOCFROMHCOM"
32787
><CODE
32788
CLASS="envar"
32789
>$QT_MOCFROMHCOM</CODE
32790
></A
32791
> (the command line) is displayed.
32792
</P
32793
></DD
32794
><DT
32795
><A
32796
NAME="cv-QT_MOCFROMHFLAGS"
32797
></A
32798
><CODE
32799
CLASS="envar"
32800
>QT_MOCFROMHFLAGS</CODE
32801
></DT
32802
><DD
32803
><P
32804
> Default value is ''. These flags are passed to moc, when moccing a header
32805
file.
32806
</P
32807
></DD
32808
><DT
32809
><A
32810
NAME="cv-QT_MOCHPREFIX"
32811
></A
32812
><CODE
32813
CLASS="envar"
32814
>QT_MOCHPREFIX</CODE
32815
></DT
32816
><DD
32817
><P
32818
> Default value is 'moc_'. Prefix for moc output files, when source is a header.
32819
</P
32820
></DD
32821
><DT
32822
><A
32823
NAME="cv-QT_MOCHSUFFIX"
32824
></A
32825
><CODE
32826
CLASS="envar"
32827
>QT_MOCHSUFFIX</CODE
32828
></DT
32829
><DD
32830
><P
32831
> Default value is '<A
32832
HREF="#cv-CXXFILESUFFIX"
32833
><CODE
32834
CLASS="envar"
32835
>$CXXFILESUFFIX</CODE
32836
></A
32837
>'. Suffix for moc output files, when source is
32838
a header.
32839
</P
32840
></DD
32841
><DT
32842
><A
32843
NAME="cv-QT_UIC"
32844
></A
32845
><CODE
32846
CLASS="envar"
32847
>QT_UIC</CODE
32848
></DT
32849
><DD
32850
><P
32851
> Default value is '<A
32852
HREF="#cv-QT_BINPATH"
32853
><CODE
32854
CLASS="envar"
32855
>$QT_BINPATH</CODE
32856
></A
32857
>/uic'.
32858
</P
32859
></DD
32860
><DT
32861
><A
32862
NAME="cv-QT_UICCOM"
32863
></A
32864
><CODE
32865
CLASS="envar"
32866
>QT_UICCOM</CODE
32867
></DT
32868
><DD
32869
><P
32870
> Command to generate header files from .ui files.
32871
</P
32872
></DD
32873
><DT
32874
><A
32875
NAME="cv-QT_UICCOMSTR"
32876
></A
32877
><CODE
32878
CLASS="envar"
32879
>QT_UICCOMSTR</CODE
32880
></DT
32881
><DD
32882
><P
32883
> The string displayed when generating header files from .ui files.
32884
If this is not set, then <A
32885
HREF="#cv-QT_UICCOM"
32886
><CODE
32887
CLASS="envar"
32888
>$QT_UICCOM</CODE
32889
></A
32890
> (the command line) is displayed.
32891
</P
32892
></DD
32893
><DT
32894
><A
32895
NAME="cv-QT_UICDECLFLAGS"
32896
></A
32897
><CODE
32898
CLASS="envar"
32899
>QT_UICDECLFLAGS</CODE
32900
></DT
32901
><DD
32902
><P
32903
> Default value is ''. These flags are passed to uic, when creating a a h
32904
file from a .ui file.
32905
</P
32906
></DD
32907
><DT
32908
><A
32909
NAME="cv-QT_UICDECLPREFIX"
32910
></A
32911
><CODE
32912
CLASS="envar"
32913
>QT_UICDECLPREFIX</CODE
32914
></DT
32915
><DD
32916
><P
32917
> Default value is ''. Prefix for uic generated header files.
32918
</P
32919
></DD
32920
><DT
32921
><A
32922
NAME="cv-QT_UICDECLSUFFIX"
32923
></A
32924
><CODE
32925
CLASS="envar"
32926
>QT_UICDECLSUFFIX</CODE
32927
></DT
32928
><DD
32929
><P
32930
> Default value is '.h'. Suffix for uic generated header files.
32931
</P
32932
></DD
32933
><DT
32934
><A
32935
NAME="cv-QT_UICIMPLFLAGS"
32936
></A
32937
><CODE
32938
CLASS="envar"
32939
>QT_UICIMPLFLAGS</CODE
32940
></DT
32941
><DD
32942
><P
32943
> Default value is ''. These flags are passed to uic, when creating a cxx
32944
file from a .ui file.
32945
</P
32946
></DD
32947
><DT
32948
><A
32949
NAME="cv-QT_UICIMPLPREFIX"
32950
></A
32951
><CODE
32952
CLASS="envar"
32953
>QT_UICIMPLPREFIX</CODE
32954
></DT
32955
><DD
32956
><P
32957
> Default value is 'uic_'. Prefix for uic generated implementation files.
32958
</P
32959
></DD
32960
><DT
32961
><A
32962
NAME="cv-QT_UICIMPLSUFFIX"
32963
></A
32964
><CODE
32965
CLASS="envar"
32966
>QT_UICIMPLSUFFIX</CODE
32967
></DT
32968
><DD
32969
><P
32970
> Default value is '<A
32971
HREF="#cv-CXXFILESUFFIX"
32972
><CODE
32973
CLASS="envar"
32974
>$CXXFILESUFFIX</CODE
32975
></A
32976
>'. Suffix for uic generated implementation
32977
files.
32978
</P
32979
></DD
32980
><DT
32981
><A
32982
NAME="cv-QT_UISUFFIX"
32983
></A
32984
><CODE
32985
CLASS="envar"
32986
>QT_UISUFFIX</CODE
32987
></DT
32988
><DD
32989
><P
32990
> Default value is '.ui'. Suffix of designer input files.
32991
</P
32992
></DD
32993
><DT
32994
><A
32995
NAME="cv-QTDIR"
32996
></A
32997
><CODE
32998
CLASS="envar"
32999
>QTDIR</CODE
33000
></DT
33001
><DD
33002
><P
33003
> The qt tool tries to take this from os.environ.
33004
It also initializes all QT_*
33005
construction variables listed below.
33006
(Note that all paths are constructed
33007
with python's os.path.join() method,
33008
but are listed here with the '/' separator
33009
for easier reading.)
33010
In addition, the construction environment
33011
variables <A
33012
HREF="#cv-CPPPATH"
33013
><CODE
33014
CLASS="envar"
33015
>$CPPPATH</CODE
33016
></A
33017
>,
33018
<A
33019
HREF="#cv-LIBPATH"
33020
><CODE
33021
CLASS="envar"
33022
>$LIBPATH</CODE
33023
></A
33024
> and
33025
<A
33026
HREF="#cv-LIBS"
33027
><CODE
33028
CLASS="envar"
33029
>$LIBS</CODE
33030
></A
33031
> may be modified
33032
and the variables
33033
PROGEMITTER, SHLIBEMITTER and LIBEMITTER
33034
are modified. Because the build-performance is affected when using this tool,
33035
you have to explicitly specify it at Environment creation:
33036
</P
33037
><PRE
33038
CLASS="programlisting"
33039
> Environment(tools=['default','qt'])
33040
</PRE
33041
><P
33042
> The qt tool supports the following operations:</P
33043
><P
33044
><SPAN
33045
CLASS="emphasis"
33046
><I
33047
CLASS="emphasis"
33048
>Automatic moc file generation from header files.</I
33049
></SPAN
33050
>
33051
You do not have to specify moc files explicitly, the tool does it for you.
33052
However, there are a few preconditions to do so: Your header file must have
33053
the same filebase as your implementation file and must stay in the same
33054
directory. It must have one of the suffixes .h, .hpp, .H, .hxx, .hh. You
33055
can turn off automatic moc file generation by setting QT_AUTOSCAN to 0.
33056
See also the corresponding builder method
33057
.B Moc()</P
33058
><P
33059
><SPAN
33060
CLASS="emphasis"
33061
><I
33062
CLASS="emphasis"
33063
>Automatic moc file generation from cxx files.</I
33064
></SPAN
33065
>
33066
As stated in the qt documentation, include the moc file at the end of
33067
the cxx file. Note that you have to include the file, which is generated
33068
by the transformation ${QT_MOCCXXPREFIX}<basename>${QT_MOCCXXSUFFIX}, by default
33069
<basename>.moc. A warning is generated after building the moc file, if you
33070
do not include the correct file. If you are using VariantDir, you may
33071
need to specify duplicate=1. You can turn off automatic moc file generation
33072
by setting QT_AUTOSCAN to 0. See also the corresponding
33073
<CODE
33074
CLASS="function"
33075
>Moc</CODE
33076
>
33077
builder method.</P
33078
><P
33079
><SPAN
33080
CLASS="emphasis"
33081
><I
33082
CLASS="emphasis"
33083
>Automatic handling of .ui files.</I
33084
></SPAN
33085
>
33086
The implementation files generated from .ui files are handled much the same
33087
as yacc or lex files. Each .ui file given as a source of Program, Library or
33088
SharedLibrary will generate three files, the declaration file, the
33089
implementation file and a moc file. Because there are also generated headers,
33090
you may need to specify duplicate=1 in calls to VariantDir.
33091
See also the corresponding
33092
<CODE
33093
CLASS="function"
33094
>Uic</CODE
33095
>
33096
builder method.
33097
</P
33098
></DD
33099
><DT
33100
><A
33101
NAME="cv-RANLIB"
33102
></A
33103
><CODE
33104
CLASS="envar"
33105
>RANLIB</CODE
33106
></DT
33107
><DD
33108
><P
33109
> The archive indexer.
33110
</P
33111
></DD
33112
><DT
33113
><A
33114
NAME="cv-RANLIBCOM"
33115
></A
33116
><CODE
33117
CLASS="envar"
33118
>RANLIBCOM</CODE
33119
></DT
33120
><DD
33121
><P
33122
> The command line used to index a static library archive.
33123
</P
33124
></DD
33125
><DT
33126
><A
33127
NAME="cv-RANLIBCOMSTR"
33128
></A
33129
><CODE
33130
CLASS="envar"
33131
>RANLIBCOMSTR</CODE
33132
></DT
33133
><DD
33134
><P
33135
> The string displayed when a static library archive is indexed.
33136
If this is not set, then <A
33137
HREF="#cv-RANLIBCOM"
33138
><CODE
33139
CLASS="envar"
33140
>$RANLIBCOM</CODE
33141
></A
33142
> (the command line) is displayed.
33143
</P
33144
><PRE
33145
CLASS="programlisting"
33146
> env = Environment(RANLIBCOMSTR = "Indexing $TARGET")
33147
</PRE
33148
></DD
33149
><DT
33150
><A
33151
NAME="cv-RANLIBFLAGS"
33152
></A
33153
><CODE
33154
CLASS="envar"
33155
>RANLIBFLAGS</CODE
33156
></DT
33157
><DD
33158
><P
33159
> General options passed to the archive indexer.
33160
</P
33161
></DD
33162
><DT
33163
><A
33164
NAME="cv-RC"
33165
></A
33166
><CODE
33167
CLASS="envar"
33168
>RC</CODE
33169
></DT
33170
><DD
33171
><P
33172
> The resource compiler used to build
33173
a Microsoft Visual C++ resource file.
33174
</P
33175
></DD
33176
><DT
33177
><A
33178
NAME="cv-RCCOM"
33179
></A
33180
><CODE
33181
CLASS="envar"
33182
>RCCOM</CODE
33183
></DT
33184
><DD
33185
><P
33186
> The command line used to build
33187
a Microsoft Visual C++ resource file.
33188
</P
33189
></DD
33190
><DT
33191
><A
33192
NAME="cv-RCCOMSTR"
33193
></A
33194
><CODE
33195
CLASS="envar"
33196
>RCCOMSTR</CODE
33197
></DT
33198
><DD
33199
><P
33200
> The string displayed when invoking the resource compiler
33201
to build a Microsoft Visual C++ resource file.
33202
If this is not set, then <A
33203
HREF="#cv-RCCOM"
33204
><CODE
33205
CLASS="envar"
33206
>$RCCOM</CODE
33207
></A
33208
> (the command line) is displayed.
33209
</P
33210
></DD
33211
><DT
33212
><A
33213
NAME="cv-RCFLAGS"
33214
></A
33215
><CODE
33216
CLASS="envar"
33217
>RCFLAGS</CODE
33218
></DT
33219
><DD
33220
><P
33221
> The flags passed to the resource compiler by the RES builder.
33222
</P
33223
></DD
33224
><DT
33225
><A
33226
NAME="cv-RCINCFLAGS"
33227
></A
33228
><CODE
33229
CLASS="envar"
33230
>RCINCFLAGS</CODE
33231
></DT
33232
><DD
33233
><P
33234
> An automatically-generated construction variable
33235
containing the command-line options
33236
for specifying directories to be searched
33237
by the resource compiler.
33238
The value of <CODE
33239
CLASS="envar"
33240
>$RCINCFLAGS</CODE
33241
> is created
33242
by appending <CODE
33243
CLASS="envar"
33244
>$RCINCPREFIX</CODE
33245
> and <CODE
33246
CLASS="envar"
33247
>$RCINCSUFFIX</CODE
33248
>
33249
to the beginning and end
33250
of each directory in <CODE
33251
CLASS="envar"
33252
>$CPPPATH</CODE
33253
>.
33254
</P
33255
></DD
33256
><DT
33257
><A
33258
NAME="cv-RCINCPREFIX"
33259
></A
33260
><CODE
33261
CLASS="envar"
33262
>RCINCPREFIX</CODE
33263
></DT
33264
><DD
33265
><P
33266
> The prefix (flag) used to specify an include directory
33267
on the resource compiler command line.
33268
This will be appended to the beginning of each directory
33269
in the <CODE
33270
CLASS="envar"
33271
>$CPPPATH</CODE
33272
> construction variable
33273
when the <CODE
33274
CLASS="envar"
33275
>$RCINCFLAGS</CODE
33276
> variable is expanded.
33277
</P
33278
></DD
33279
><DT
33280
><A
33281
NAME="cv-RCINCSUFFIX"
33282
></A
33283
><CODE
33284
CLASS="envar"
33285
>RCINCSUFFIX</CODE
33286
></DT
33287
><DD
33288
><P
33289
> The suffix used to specify an include directory
33290
on the resource compiler command line.
33291
This will be appended to the end of each directory
33292
in the <CODE
33293
CLASS="envar"
33294
>$CPPPATH</CODE
33295
> construction variable
33296
when the <CODE
33297
CLASS="envar"
33298
>$RCINCFLAGS</CODE
33299
> variable is expanded.
33300
</P
33301
></DD
33302
><DT
33303
><A
33304
NAME="cv-RCS"
33305
></A
33306
><CODE
33307
CLASS="envar"
33308
>RCS</CODE
33309
></DT
33310
><DD
33311
><P
33312
> The RCS executable.
33313
Note that this variable is not actually used
33314
for the command to fetch source files from RCS;
33315
see the
33316
<A
33317
HREF="#cv-RCS_CO"
33318
><CODE
33319
CLASS="envar"
33320
>$RCS_CO</CODE
33321
></A
33322
>
33323
construction variable, below.
33324
</P
33325
></DD
33326
><DT
33327
><A
33328
NAME="cv-RCS_CO"
33329
></A
33330
><CODE
33331
CLASS="envar"
33332
>RCS_CO</CODE
33333
></DT
33334
><DD
33335
><P
33336
> The RCS "checkout" executable,
33337
used to fetch source files from RCS.
33338
</P
33339
></DD
33340
><DT
33341
><A
33342
NAME="cv-RCS_COCOM"
33343
></A
33344
><CODE
33345
CLASS="envar"
33346
>RCS_COCOM</CODE
33347
></DT
33348
><DD
33349
><P
33350
> The command line used to
33351
fetch (checkout) source files from RCS.
33352
</P
33353
></DD
33354
><DT
33355
><A
33356
NAME="cv-RCS_COCOMSTR"
33357
></A
33358
><CODE
33359
CLASS="envar"
33360
>RCS_COCOMSTR</CODE
33361
></DT
33362
><DD
33363
><P
33364
> The string displayed when fetching
33365
a source file from RCS.
33366
If this is not set, then <A
33367
HREF="#cv-RCS_COCOM"
33368
><CODE
33369
CLASS="envar"
33370
>$RCS_COCOM</CODE
33371
></A
33372
>
33373
(the command line) is displayed.
33374
</P
33375
></DD
33376
><DT
33377
><A
33378
NAME="cv-RCS_COFLAGS"
33379
></A
33380
><CODE
33381
CLASS="envar"
33382
>RCS_COFLAGS</CODE
33383
></DT
33384
><DD
33385
><P
33386
> Options that are passed to the <A
33387
HREF="#cv-RCS_CO"
33388
><CODE
33389
CLASS="envar"
33390
>$RCS_CO</CODE
33391
></A
33392
> command.
33393
</P
33394
></DD
33395
><DT
33396
><A
33397
NAME="cv-RDirs"
33398
></A
33399
><CODE
33400
CLASS="envar"
33401
>RDirs</CODE
33402
></DT
33403
><DD
33404
><P
33405
> A function that converts a string into a list of Dir instances by
33406
searching the repositories.
33407
</P
33408
></DD
33409
><DT
33410
><A
33411
NAME="cv-REGSVR"
33412
></A
33413
><CODE
33414
CLASS="envar"
33415
>REGSVR</CODE
33416
></DT
33417
><DD
33418
><P
33419
> The program used on Windows systems
33420
to register a newly-built DLL library
33421
whenever the <CODE
33422
CLASS="function"
33423
>SharedLibrary</CODE
33424
> builder
33425
is passed a keyword argument of <TT
33426
CLASS="literal"
33427
>register=1</TT
33428
>.
33429
</P
33430
></DD
33431
><DT
33432
><A
33433
NAME="cv-REGSVRCOM"
33434
></A
33435
><CODE
33436
CLASS="envar"
33437
>REGSVRCOM</CODE
33438
></DT
33439
><DD
33440
><P
33441
> The command line used on Windows systems
33442
to register a newly-built DLL library
33443
whenever the <CODE
33444
CLASS="function"
33445
>SharedLibrary</CODE
33446
> builder
33447
is passed a keyword argument of <TT
33448
CLASS="literal"
33449
>register=1</TT
33450
>.
33451
</P
33452
></DD
33453
><DT
33454
><A
33455
NAME="cv-REGSVRCOMSTR"
33456
></A
33457
><CODE
33458
CLASS="envar"
33459
>REGSVRCOMSTR</CODE
33460
></DT
33461
><DD
33462
><P
33463
> The string displayed when registering a newly-built DLL file.
33464
If this is not set, then <A
33465
HREF="#cv-REGSVRCOM"
33466
><CODE
33467
CLASS="envar"
33468
>$REGSVRCOM</CODE
33469
></A
33470
> (the command line) is displayed.
33471
</P
33472
></DD
33473
><DT
33474
><A
33475
NAME="cv-REGSVRFLAGS"
33476
></A
33477
><CODE
33478
CLASS="envar"
33479
>REGSVRFLAGS</CODE
33480
></DT
33481
><DD
33482
><P
33483
> Flags passed to the DLL registration program
33484
on Windows systems when a newly-built DLL library is registered.
33485
By default,
33486
this includes the <CODE
33487
CLASS="option"
33488
>/s</CODE
33489
>
33490
that prevents dialog boxes from popping up
33491
and requiring user attention.
33492
</P
33493
></DD
33494
><DT
33495
><A
33496
NAME="cv-RMIC"
33497
></A
33498
><CODE
33499
CLASS="envar"
33500
>RMIC</CODE
33501
></DT
33502
><DD
33503
><P
33504
> The Java RMI stub compiler.
33505
</P
33506
></DD
33507
><DT
33508
><A
33509
NAME="cv-RMICCOM"
33510
></A
33511
><CODE
33512
CLASS="envar"
33513
>RMICCOM</CODE
33514
></DT
33515
><DD
33516
><P
33517
> The command line used to compile stub
33518
and skeleton class files
33519
from Java classes that contain RMI implementations.
33520
Any options specified in the <A
33521
HREF="#cv-RMICFLAGS"
33522
><CODE
33523
CLASS="envar"
33524
>$RMICFLAGS</CODE
33525
></A
33526
> construction variable
33527
are included on this command line.
33528
</P
33529
></DD
33530
><DT
33531
><A
33532
NAME="cv-RMICCOMSTR"
33533
></A
33534
><CODE
33535
CLASS="envar"
33536
>RMICCOMSTR</CODE
33537
></DT
33538
><DD
33539
><P
33540
> The string displayed when compiling
33541
stub and skeleton class files
33542
from Java classes that contain RMI implementations.
33543
If this is not set, then <A
33544
HREF="#cv-RMICCOM"
33545
><CODE
33546
CLASS="envar"
33547
>$RMICCOM</CODE
33548
></A
33549
> (the command line) is displayed.
33550
</P
33551
><PRE
33552
CLASS="programlisting"
33553
> env = Environment(RMICCOMSTR = "Generating stub/skeleton class files $TARGETS from $SOURCES")
33554
</PRE
33555
></DD
33556
><DT
33557
><A
33558
NAME="cv-RMICFLAGS"
33559
></A
33560
><CODE
33561
CLASS="envar"
33562
>RMICFLAGS</CODE
33563
></DT
33564
><DD
33565
><P
33566
> General options passed to the Java RMI stub compiler.
33567
</P
33568
></DD
33569
><DT
33570
><A
33571
NAME="cv-_RPATH"
33572
></A
33573
><CODE
33574
CLASS="envar"
33575
>_RPATH</CODE
33576
></DT
33577
><DD
33578
><P
33579
> An automatically-generated construction variable
33580
containing the rpath flags to be used when linking
33581
a program with shared libraries.
33582
The value of <CODE
33583
CLASS="envar"
33584
>$_RPATH</CODE
33585
> is created
33586
by appending <CODE
33587
CLASS="envar"
33588
>$RPATHPREFIX</CODE
33589
> and <CODE
33590
CLASS="envar"
33591
>$RPATHSUFFIX</CODE
33592
>
33593
to the beginning and end
33594
of each directory in <CODE
33595
CLASS="envar"
33596
>$RPATH</CODE
33597
>.
33598
</P
33599
></DD
33600
><DT
33601
><A
33602
NAME="cv-RPATH"
33603
></A
33604
><CODE
33605
CLASS="envar"
33606
>RPATH</CODE
33607
></DT
33608
><DD
33609
><P
33610
> A list of paths to search for shared libraries when running programs.
33611
Currently only used in the GNU (gnulink),
33612
IRIX (sgilink) and Sun (sunlink) linkers.
33613
Ignored on platforms and toolchains that don't support it.
33614
Note that the paths added to RPATH
33615
are not transformed by
33616
<SPAN
33617
CLASS="application"
33618
>scons</SPAN
33619
>
33620
in any way: if you want an absolute
33621
path, you must make it absolute yourself.
33622
</P
33623
></DD
33624
><DT
33625
><A
33626
NAME="cv-RPATHPREFIX"
33627
></A
33628
><CODE
33629
CLASS="envar"
33630
>RPATHPREFIX</CODE
33631
></DT
33632
><DD
33633
><P
33634
> The prefix used to specify a directory to be searched for
33635
shared libraries when running programs.
33636
This will be appended to the beginning of each directory
33637
in the <CODE
33638
CLASS="envar"
33639
>$RPATH</CODE
33640
> construction variable
33641
when the <CODE
33642
CLASS="envar"
33643
>$_RPATH</CODE
33644
> variable is automatically generated.
33645
</P
33646
></DD
33647
><DT
33648
><A
33649
NAME="cv-RPATHSUFFIX"
33650
></A
33651
><CODE
33652
CLASS="envar"
33653
>RPATHSUFFIX</CODE
33654
></DT
33655
><DD
33656
><P
33657
> The suffix used to specify a directory to be searched for
33658
shared libraries when running programs.
33659
This will be appended to the end of each directory
33660
in the <CODE
33661
CLASS="envar"
33662
>$RPATH</CODE
33663
> construction variable
33664
when the <CODE
33665
CLASS="envar"
33666
>$_RPATH</CODE
33667
> variable is automatically generated.
33668
</P
33669
></DD
33670
><DT
33671
><A
33672
NAME="cv-RPCGEN"
33673
></A
33674
><CODE
33675
CLASS="envar"
33676
>RPCGEN</CODE
33677
></DT
33678
><DD
33679
><P
33680
> The RPC protocol compiler.
33681
</P
33682
></DD
33683
><DT
33684
><A
33685
NAME="cv-RPCGENCLIENTFLAGS"
33686
></A
33687
><CODE
33688
CLASS="envar"
33689
>RPCGENCLIENTFLAGS</CODE
33690
></DT
33691
><DD
33692
><P
33693
> Options passed to the RPC protocol compiler
33694
when generating client side stubs.
33695
These are in addition to any flags specified in the
33696
<A
33697
HREF="#cv-RPCGENFLAGS"
33698
><CODE
33699
CLASS="envar"
33700
>$RPCGENFLAGS</CODE
33701
></A
33702
>
33703
construction variable.
33704
</P
33705
></DD
33706
><DT
33707
><A
33708
NAME="cv-RPCGENFLAGS"
33709
></A
33710
><CODE
33711
CLASS="envar"
33712
>RPCGENFLAGS</CODE
33713
></DT
33714
><DD
33715
><P
33716
> General options passed to the RPC protocol compiler.
33717
</P
33718
></DD
33719
><DT
33720
><A
33721
NAME="cv-RPCGENHEADERFLAGS"
33722
></A
33723
><CODE
33724
CLASS="envar"
33725
>RPCGENHEADERFLAGS</CODE
33726
></DT
33727
><DD
33728
><P
33729
> Options passed to the RPC protocol compiler
33730
when generating a header file.
33731
These are in addition to any flags specified in the
33732
<A
33733
HREF="#cv-RPCGENFLAGS"
33734
><CODE
33735
CLASS="envar"
33736
>$RPCGENFLAGS</CODE
33737
></A
33738
>
33739
construction variable.
33740
</P
33741
></DD
33742
><DT
33743
><A
33744
NAME="cv-RPCGENSERVICEFLAGS"
33745
></A
33746
><CODE
33747
CLASS="envar"
33748
>RPCGENSERVICEFLAGS</CODE
33749
></DT
33750
><DD
33751
><P
33752
> Options passed to the RPC protocol compiler
33753
when generating server side stubs.
33754
These are in addition to any flags specified in the
33755
<A
33756
HREF="#cv-RPCGENFLAGS"
33757
><CODE
33758
CLASS="envar"
33759
>$RPCGENFLAGS</CODE
33760
></A
33761
>
33762
construction variable.
33763
</P
33764
></DD
33765
><DT
33766
><A
33767
NAME="cv-RPCGENXDRFLAGS"
33768
></A
33769
><CODE
33770
CLASS="envar"
33771
>RPCGENXDRFLAGS</CODE
33772
></DT
33773
><DD
33774
><P
33775
> Options passed to the RPC protocol compiler
33776
when generating XDR routines.
33777
These are in addition to any flags specified in the
33778
<A
33779
HREF="#cv-RPCGENFLAGS"
33780
><CODE
33781
CLASS="envar"
33782
>$RPCGENFLAGS</CODE
33783
></A
33784
>
33785
construction variable.
33786
</P
33787
></DD
33788
><DT
33789
><A
33790
NAME="cv-SCANNERS"
33791
></A
33792
><CODE
33793
CLASS="envar"
33794
>SCANNERS</CODE
33795
></DT
33796
><DD
33797
><P
33798
> A list of the available implicit dependency scanners.
33799
New file scanners may be added by
33800
appending to this list,
33801
although the more flexible approach
33802
is to associate scanners
33803
with a specific Builder.
33804
See the sections "Builder Objects"
33805
and "Scanner Objects,"
33806
below, for more information.
33807
</P
33808
></DD
33809
><DT
33810
><A
33811
NAME="cv-SCCS"
33812
></A
33813
><CODE
33814
CLASS="envar"
33815
>SCCS</CODE
33816
></DT
33817
><DD
33818
><P
33819
> The SCCS executable.
33820
</P
33821
></DD
33822
><DT
33823
><A
33824
NAME="cv-SCCSCOM"
33825
></A
33826
><CODE
33827
CLASS="envar"
33828
>SCCSCOM</CODE
33829
></DT
33830
><DD
33831
><P
33832
> The command line used to
33833
fetch source files from SCCS.
33834
</P
33835
></DD
33836
><DT
33837
><A
33838
NAME="cv-SCCSCOMSTR"
33839
></A
33840
><CODE
33841
CLASS="envar"
33842
>SCCSCOMSTR</CODE
33843
></DT
33844
><DD
33845
><P
33846
> The string displayed when fetching
33847
a source file from a CVS repository.
33848
If this is not set, then <A
33849
HREF="#cv-SCCSCOM"
33850
><CODE
33851
CLASS="envar"
33852
>$SCCSCOM</CODE
33853
></A
33854
>
33855
(the command line) is displayed.
33856
</P
33857
></DD
33858
><DT
33859
><A
33860
NAME="cv-SCCSFLAGS"
33861
></A
33862
><CODE
33863
CLASS="envar"
33864
>SCCSFLAGS</CODE
33865
></DT
33866
><DD
33867
><P
33868
> General options that are passed to SCCS.
33869
</P
33870
></DD
33871
><DT
33872
><A
33873
NAME="cv-SCCSGETFLAGS"
33874
></A
33875
><CODE
33876
CLASS="envar"
33877
>SCCSGETFLAGS</CODE
33878
></DT
33879
><DD
33880
><P
33881
> Options that are passed specifically to the SCCS "get" subcommand.
33882
This can be set, for example, to
33883
<CODE
33884
CLASS="option"
33885
>-e</CODE
33886
>
33887
to check out editable files from SCCS.
33888
</P
33889
></DD
33890
><DT
33891
><A
33892
NAME="cv-SCONS_HOME"
33893
></A
33894
><CODE
33895
CLASS="envar"
33896
>SCONS_HOME</CODE
33897
></DT
33898
><DD
33899
><P
33900
> The (optional) path to the SCons library directory,
33901
initialized from the external environment.
33902
If set, this is used to construct a shorter and more
33903
efficient search path in the
33904
<A
33905
HREF="#cv-MSVSSCONS"
33906
><CODE
33907
CLASS="envar"
33908
>$MSVSSCONS</CODE
33909
></A
33910
>
33911
command line executed
33912
from Microsoft Visual Studio project files.
33913
</P
33914
></DD
33915
><DT
33916
><A
33917
NAME="cv-SHCC"
33918
></A
33919
><CODE
33920
CLASS="envar"
33921
>SHCC</CODE
33922
></DT
33923
><DD
33924
><P
33925
> The C compiler used for generating shared-library objects.
33926
</P
33927
></DD
33928
><DT
33929
><A
33930
NAME="cv-SHCCCOM"
33931
></A
33932
><CODE
33933
CLASS="envar"
33934
>SHCCCOM</CODE
33935
></DT
33936
><DD
33937
><P
33938
> The command line used to compile a C source file
33939
to a shared-library object file.
33940
Any options specified in the <A
33941
HREF="#cv-SHCFLAGS"
33942
><CODE
33943
CLASS="envar"
33944
>$SHCFLAGS</CODE
33945
></A
33946
>,
33947
<A
33948
HREF="#cv-SHCCFLAGS"
33949
><CODE
33950
CLASS="envar"
33951
>$SHCCFLAGS</CODE
33952
></A
33953
> and
33954
<A
33955
HREF="#cv-CPPFLAGS"
33956
><CODE
33957
CLASS="envar"
33958
>$CPPFLAGS</CODE
33959
></A
33960
> construction variables
33961
are included on this command line.
33962
</P
33963
></DD
33964
><DT
33965
><A
33966
NAME="cv-SHCCCOMSTR"
33967
></A
33968
><CODE
33969
CLASS="envar"
33970
>SHCCCOMSTR</CODE
33971
></DT
33972
><DD
33973
><P
33974
> The string displayed when a C source file
33975
is compiled to a shared object file.
33976
If this is not set, then <A
33977
HREF="#cv-SHCCCOM"
33978
><CODE
33979
CLASS="envar"
33980
>$SHCCCOM</CODE
33981
></A
33982
> (the command line) is displayed.
33983
</P
33984
><PRE
33985
CLASS="programlisting"
33986
> env = Environment(SHCCCOMSTR = "Compiling shared object $TARGET")
33987
</PRE
33988
></DD
33989
><DT
33990
><A
33991
NAME="cv-SHCCFLAGS"
33992
></A
33993
><CODE
33994
CLASS="envar"
33995
>SHCCFLAGS</CODE
33996
></DT
33997
><DD
33998
><P
33999
> Options that are passed to the C and C++ compilers
34000
to generate shared-library objects.
34001
</P
34002
></DD
34003
><DT
34004
><A
34005
NAME="cv-SHCFLAGS"
34006
></A
34007
><CODE
34008
CLASS="envar"
34009
>SHCFLAGS</CODE
34010
></DT
34011
><DD
34012
><P
34013
> Options that are passed to the C compiler (only; not C++)
34014
to generate shared-library objects.
34015
</P
34016
></DD
34017
><DT
34018
><A
34019
NAME="cv-SHCXX"
34020
></A
34021
><CODE
34022
CLASS="envar"
34023
>SHCXX</CODE
34024
></DT
34025
><DD
34026
><P
34027
> The C++ compiler used for generating shared-library objects.
34028
</P
34029
></DD
34030
><DT
34031
><A
34032
NAME="cv-SHCXXCOM"
34033
></A
34034
><CODE
34035
CLASS="envar"
34036
>SHCXXCOM</CODE
34037
></DT
34038
><DD
34039
><P
34040
> The command line used to compile a C++ source file
34041
to a shared-library object file.
34042
Any options specified in the <A
34043
HREF="#cv-SHCXXFLAGS"
34044
><CODE
34045
CLASS="envar"
34046
>$SHCXXFLAGS</CODE
34047
></A
34048
> and
34049
<A
34050
HREF="#cv-CPPFLAGS"
34051
><CODE
34052
CLASS="envar"
34053
>$CPPFLAGS</CODE
34054
></A
34055
> construction variables
34056
are included on this command line.
34057
</P
34058
></DD
34059
><DT
34060
><A
34061
NAME="cv-SHCXXCOMSTR"
34062
></A
34063
><CODE
34064
CLASS="envar"
34065
>SHCXXCOMSTR</CODE
34066
></DT
34067
><DD
34068
><P
34069
> The string displayed when a C++ source file
34070
is compiled to a shared object file.
34071
If this is not set, then <A
34072
HREF="#cv-SHCXXCOM"
34073
><CODE
34074
CLASS="envar"
34075
>$SHCXXCOM</CODE
34076
></A
34077
> (the command line) is displayed.
34078
</P
34079
><PRE
34080
CLASS="programlisting"
34081
> env = Environment(SHCXXCOMSTR = "Compiling shared object $TARGET")
34082
</PRE
34083
></DD
34084
><DT
34085
><A
34086
NAME="cv-SHCXXFLAGS"
34087
></A
34088
><CODE
34089
CLASS="envar"
34090
>SHCXXFLAGS</CODE
34091
></DT
34092
><DD
34093
><P
34094
> Options that are passed to the C++ compiler
34095
to generate shared-library objects.
34096
</P
34097
></DD
34098
><DT
34099
><A
34100
NAME="cv-SHELL"
34101
></A
34102
><CODE
34103
CLASS="envar"
34104
>SHELL</CODE
34105
></DT
34106
><DD
34107
><P
34108
> A string naming the shell program that will be passed to the
34109
<CODE
34110
CLASS="envar"
34111
>$SPAWN</CODE
34112
>
34113
function.
34114
See the
34115
<CODE
34116
CLASS="envar"
34117
>$SPAWN</CODE
34118
>
34119
construction variable for more information.
34120
</P
34121
></DD
34122
><DT
34123
><A
34124
NAME="cv-SHF77"
34125
></A
34126
><CODE
34127
CLASS="envar"
34128
>SHF77</CODE
34129
></DT
34130
><DD
34131
><P
34132
> The Fortran 77 compiler used for generating shared-library objects.
34133
You should normally set the <A
34134
HREF="#cv-SHFORTRAN"
34135
><CODE
34136
CLASS="envar"
34137
>$SHFORTRAN</CODE
34138
></A
34139
> variable,
34140
which specifies the default Fortran compiler
34141
for all Fortran versions.
34142
You only need to set <A
34143
HREF="#cv-SHF77"
34144
><CODE
34145
CLASS="envar"
34146
>$SHF77</CODE
34147
></A
34148
> if you need to use a specific compiler
34149
or compiler version for Fortran 77 files.
34150
</P
34151
></DD
34152
><DT
34153
><A
34154
NAME="cv-SHF77COM"
34155
></A
34156
><CODE
34157
CLASS="envar"
34158
>SHF77COM</CODE
34159
></DT
34160
><DD
34161
><P
34162
> The command line used to compile a Fortran 77 source file
34163
to a shared-library object file.
34164
You only need to set <A
34165
HREF="#cv-SHF77COM"
34166
><CODE
34167
CLASS="envar"
34168
>$SHF77COM</CODE
34169
></A
34170
> if you need to use a specific
34171
command line for Fortran 77 files.
34172
You should normally set the <A
34173
HREF="#cv-SHFORTRANCOM"
34174
><CODE
34175
CLASS="envar"
34176
>$SHFORTRANCOM</CODE
34177
></A
34178
> variable,
34179
which specifies the default command line
34180
for all Fortran versions.
34181
</P
34182
></DD
34183
><DT
34184
><A
34185
NAME="cv-SHF77COMSTR"
34186
></A
34187
><CODE
34188
CLASS="envar"
34189
>SHF77COMSTR</CODE
34190
></DT
34191
><DD
34192
><P
34193
> The string displayed when a Fortran 77 source file
34194
is compiled to a shared-library object file.
34195
If this is not set, then <A
34196
HREF="#cv-SHF77COM"
34197
><CODE
34198
CLASS="envar"
34199
>$SHF77COM</CODE
34200
></A
34201
> or <A
34202
HREF="#cv-SHFORTRANCOM"
34203
><CODE
34204
CLASS="envar"
34205
>$SHFORTRANCOM</CODE
34206
></A
34207
>
34208
(the command line) is displayed.
34209
</P
34210
></DD
34211
><DT
34212
><A
34213
NAME="cv-SHF77FLAGS"
34214
></A
34215
><CODE
34216
CLASS="envar"
34217
>SHF77FLAGS</CODE
34218
></DT
34219
><DD
34220
><P
34221
> Options that are passed to the Fortran 77 compiler
34222
to generated shared-library objects.
34223
You only need to set <A
34224
HREF="#cv-SHF77FLAGS"
34225
><CODE
34226
CLASS="envar"
34227
>$SHF77FLAGS</CODE
34228
></A
34229
> if you need to define specific
34230
user options for Fortran 77 files.
34231
You should normally set the <A
34232
HREF="#cv-SHFORTRANFLAGS"
34233
><CODE
34234
CLASS="envar"
34235
>$SHFORTRANFLAGS</CODE
34236
></A
34237
> variable,
34238
which specifies the user-specified options
34239
passed to the default Fortran compiler
34240
for all Fortran versions.
34241
</P
34242
></DD
34243
><DT
34244
><A
34245
NAME="cv-SHF77PPCOM"
34246
></A
34247
><CODE
34248
CLASS="envar"
34249
>SHF77PPCOM</CODE
34250
></DT
34251
><DD
34252
><P
34253
> The command line used to compile a Fortran 77 source file to a
34254
shared-library object file
34255
after first running the file through the C preprocessor.
34256
Any options specified in the <A
34257
HREF="#cv-SHF77FLAGS"
34258
><CODE
34259
CLASS="envar"
34260
>$SHF77FLAGS</CODE
34261
></A
34262
> and <A
34263
HREF="#cv-CPPFLAGS"
34264
><CODE
34265
CLASS="envar"
34266
>$CPPFLAGS</CODE
34267
></A
34268
> construction variables
34269
are included on this command line.
34270
You only need to set <A
34271
HREF="#cv-SHF77PPCOM"
34272
><CODE
34273
CLASS="envar"
34274
>$SHF77PPCOM</CODE
34275
></A
34276
> if you need to use a specific
34277
C-preprocessor command line for Fortran 77 files.
34278
You should normally set the <A
34279
HREF="#cv-SHFORTRANPPCOM"
34280
><CODE
34281
CLASS="envar"
34282
>$SHFORTRANPPCOM</CODE
34283
></A
34284
> variable,
34285
which specifies the default C-preprocessor command line
34286
for all Fortran versions.
34287
</P
34288
></DD
34289
><DT
34290
><A
34291
NAME="cv-SHF77PPCOMSTR"
34292
></A
34293
><CODE
34294
CLASS="envar"
34295
>SHF77PPCOMSTR</CODE
34296
></DT
34297
><DD
34298
><P
34299
> The string displayed when a Fortran 77 source file
34300
is compiled to a shared-library object file
34301
after first running the file through the C preprocessor.
34302
If this is not set, then <A
34303
HREF="#cv-SHF77PPCOM"
34304
><CODE
34305
CLASS="envar"
34306
>$SHF77PPCOM</CODE
34307
></A
34308
> or <A
34309
HREF="#cv-SHFORTRANPPCOM"
34310
><CODE
34311
CLASS="envar"
34312
>$SHFORTRANPPCOM</CODE
34313
></A
34314
>
34315
(the command line) is displayed.
34316
</P
34317
></DD
34318
><DT
34319
><A
34320
NAME="cv-SHF90"
34321
></A
34322
><CODE
34323
CLASS="envar"
34324
>SHF90</CODE
34325
></DT
34326
><DD
34327
><P
34328
> The Fortran 90 compiler used for generating shared-library objects.
34329
You should normally set the <A
34330
HREF="#cv-SHFORTRAN"
34331
><CODE
34332
CLASS="envar"
34333
>$SHFORTRAN</CODE
34334
></A
34335
> variable,
34336
which specifies the default Fortran compiler
34337
for all Fortran versions.
34338
You only need to set <A
34339
HREF="#cv-SHF90"
34340
><CODE
34341
CLASS="envar"
34342
>$SHF90</CODE
34343
></A
34344
> if you need to use a specific compiler
34345
or compiler version for Fortran 90 files.
34346
</P
34347
></DD
34348
><DT
34349
><A
34350
NAME="cv-SHF90COM"
34351
></A
34352
><CODE
34353
CLASS="envar"
34354
>SHF90COM</CODE
34355
></DT
34356
><DD
34357
><P
34358
> The command line used to compile a Fortran 90 source file
34359
to a shared-library object file.
34360
You only need to set <A
34361
HREF="#cv-SHF90COM"
34362
><CODE
34363
CLASS="envar"
34364
>$SHF90COM</CODE
34365
></A
34366
> if you need to use a specific
34367
command line for Fortran 90 files.
34368
You should normally set the <A
34369
HREF="#cv-SHFORTRANCOM"
34370
><CODE
34371
CLASS="envar"
34372
>$SHFORTRANCOM</CODE
34373
></A
34374
> variable,
34375
which specifies the default command line
34376
for all Fortran versions.
34377
</P
34378
></DD
34379
><DT
34380
><A
34381
NAME="cv-SHF90COMSTR"
34382
></A
34383
><CODE
34384
CLASS="envar"
34385
>SHF90COMSTR</CODE
34386
></DT
34387
><DD
34388
><P
34389
> The string displayed when a Fortran 90 source file
34390
is compiled to a shared-library object file.
34391
If this is not set, then <A
34392
HREF="#cv-SHF90COM"
34393
><CODE
34394
CLASS="envar"
34395
>$SHF90COM</CODE
34396
></A
34397
> or <A
34398
HREF="#cv-SHFORTRANCOM"
34399
><CODE
34400
CLASS="envar"
34401
>$SHFORTRANCOM</CODE
34402
></A
34403
>
34404
(the command line) is displayed.
34405
</P
34406
></DD
34407
><DT
34408
><A
34409
NAME="cv-SHF90FLAGS"
34410
></A
34411
><CODE
34412
CLASS="envar"
34413
>SHF90FLAGS</CODE
34414
></DT
34415
><DD
34416
><P
34417
> Options that are passed to the Fortran 90 compiler
34418
to generated shared-library objects.
34419
You only need to set <A
34420
HREF="#cv-SHF90FLAGS"
34421
><CODE
34422
CLASS="envar"
34423
>$SHF90FLAGS</CODE
34424
></A
34425
> if you need to define specific
34426
user options for Fortran 90 files.
34427
You should normally set the <A
34428
HREF="#cv-SHFORTRANFLAGS"
34429
><CODE
34430
CLASS="envar"
34431
>$SHFORTRANFLAGS</CODE
34432
></A
34433
> variable,
34434
which specifies the user-specified options
34435
passed to the default Fortran compiler
34436
for all Fortran versions.
34437
</P
34438
></DD
34439
><DT
34440
><A
34441
NAME="cv-SHF90PPCOM"
34442
></A
34443
><CODE
34444
CLASS="envar"
34445
>SHF90PPCOM</CODE
34446
></DT
34447
><DD
34448
><P
34449
> The command line used to compile a Fortran 90 source file to a
34450
shared-library object file
34451
after first running the file through the C preprocessor.
34452
Any options specified in the <A
34453
HREF="#cv-SHF90FLAGS"
34454
><CODE
34455
CLASS="envar"
34456
>$SHF90FLAGS</CODE
34457
></A
34458
> and <A
34459
HREF="#cv-CPPFLAGS"
34460
><CODE
34461
CLASS="envar"
34462
>$CPPFLAGS</CODE
34463
></A
34464
> construction variables
34465
are included on this command line.
34466
You only need to set <A
34467
HREF="#cv-SHF90PPCOM"
34468
><CODE
34469
CLASS="envar"
34470
>$SHF90PPCOM</CODE
34471
></A
34472
> if you need to use a specific
34473
C-preprocessor command line for Fortran 90 files.
34474
You should normally set the <A
34475
HREF="#cv-SHFORTRANPPCOM"
34476
><CODE
34477
CLASS="envar"
34478
>$SHFORTRANPPCOM</CODE
34479
></A
34480
> variable,
34481
which specifies the default C-preprocessor command line
34482
for all Fortran versions.
34483
</P
34484
></DD
34485
><DT
34486
><A
34487
NAME="cv-SHF90PPCOMSTR"
34488
></A
34489
><CODE
34490
CLASS="envar"
34491
>SHF90PPCOMSTR</CODE
34492
></DT
34493
><DD
34494
><P
34495
> The string displayed when a Fortran 90 source file
34496
is compiled to a shared-library object file
34497
after first running the file through the C preprocessor.
34498
If this is not set, then <A
34499
HREF="#cv-SHF90PPCOM"
34500
><CODE
34501
CLASS="envar"
34502
>$SHF90PPCOM</CODE
34503
></A
34504
> or <A
34505
HREF="#cv-SHFORTRANPPCOM"
34506
><CODE
34507
CLASS="envar"
34508
>$SHFORTRANPPCOM</CODE
34509
></A
34510
>
34511
(the command line) is displayed.
34512
</P
34513
></DD
34514
><DT
34515
><A
34516
NAME="cv-SHF95"
34517
></A
34518
><CODE
34519
CLASS="envar"
34520
>SHF95</CODE
34521
></DT
34522
><DD
34523
><P
34524
> The Fortran 95 compiler used for generating shared-library objects.
34525
You should normally set the <A
34526
HREF="#cv-SHFORTRAN"
34527
><CODE
34528
CLASS="envar"
34529
>$SHFORTRAN</CODE
34530
></A
34531
> variable,
34532
which specifies the default Fortran compiler
34533
for all Fortran versions.
34534
You only need to set <A
34535
HREF="#cv-SHF95"
34536
><CODE
34537
CLASS="envar"
34538
>$SHF95</CODE
34539
></A
34540
> if you need to use a specific compiler
34541
or compiler version for Fortran 95 files.
34542
</P
34543
></DD
34544
><DT
34545
><A
34546
NAME="cv-SHF95COM"
34547
></A
34548
><CODE
34549
CLASS="envar"
34550
>SHF95COM</CODE
34551
></DT
34552
><DD
34553
><P
34554
> The command line used to compile a Fortran 95 source file
34555
to a shared-library object file.
34556
You only need to set <A
34557
HREF="#cv-SHF95COM"
34558
><CODE
34559
CLASS="envar"
34560
>$SHF95COM</CODE
34561
></A
34562
> if you need to use a specific
34563
command line for Fortran 95 files.
34564
You should normally set the <A
34565
HREF="#cv-SHFORTRANCOM"
34566
><CODE
34567
CLASS="envar"
34568
>$SHFORTRANCOM</CODE
34569
></A
34570
> variable,
34571
which specifies the default command line
34572
for all Fortran versions.
34573
</P
34574
></DD
34575
><DT
34576
><A
34577
NAME="cv-SHF95COMSTR"
34578
></A
34579
><CODE
34580
CLASS="envar"
34581
>SHF95COMSTR</CODE
34582
></DT
34583
><DD
34584
><P
34585
> The string displayed when a Fortran 95 source file
34586
is compiled to a shared-library object file.
34587
If this is not set, then <A
34588
HREF="#cv-SHF95COM"
34589
><CODE
34590
CLASS="envar"
34591
>$SHF95COM</CODE
34592
></A
34593
> or <A
34594
HREF="#cv-SHFORTRANCOM"
34595
><CODE
34596
CLASS="envar"
34597
>$SHFORTRANCOM</CODE
34598
></A
34599
>
34600
(the command line) is displayed.
34601
</P
34602
></DD
34603
><DT
34604
><A
34605
NAME="cv-SHF95FLAGS"
34606
></A
34607
><CODE
34608
CLASS="envar"
34609
>SHF95FLAGS</CODE
34610
></DT
34611
><DD
34612
><P
34613
> Options that are passed to the Fortran 95 compiler
34614
to generated shared-library objects.
34615
You only need to set <A
34616
HREF="#cv-SHF95FLAGS"
34617
><CODE
34618
CLASS="envar"
34619
>$SHF95FLAGS</CODE
34620
></A
34621
> if you need to define specific
34622
user options for Fortran 95 files.
34623
You should normally set the <A
34624
HREF="#cv-SHFORTRANFLAGS"
34625
><CODE
34626
CLASS="envar"
34627
>$SHFORTRANFLAGS</CODE
34628
></A
34629
> variable,
34630
which specifies the user-specified options
34631
passed to the default Fortran compiler
34632
for all Fortran versions.
34633
</P
34634
></DD
34635
><DT
34636
><A
34637
NAME="cv-SHF95PPCOM"
34638
></A
34639
><CODE
34640
CLASS="envar"
34641
>SHF95PPCOM</CODE
34642
></DT
34643
><DD
34644
><P
34645
> The command line used to compile a Fortran 95 source file to a
34646
shared-library object file
34647
after first running the file through the C preprocessor.
34648
Any options specified in the <A
34649
HREF="#cv-SHF95FLAGS"
34650
><CODE
34651
CLASS="envar"
34652
>$SHF95FLAGS</CODE
34653
></A
34654
> and <A
34655
HREF="#cv-CPPFLAGS"
34656
><CODE
34657
CLASS="envar"
34658
>$CPPFLAGS</CODE
34659
></A
34660
> construction variables
34661
are included on this command line.
34662
You only need to set <A
34663
HREF="#cv-SHF95PPCOM"
34664
><CODE
34665
CLASS="envar"
34666
>$SHF95PPCOM</CODE
34667
></A
34668
> if you need to use a specific
34669
C-preprocessor command line for Fortran 95 files.
34670
You should normally set the <A
34671
HREF="#cv-SHFORTRANPPCOM"
34672
><CODE
34673
CLASS="envar"
34674
>$SHFORTRANPPCOM</CODE
34675
></A
34676
> variable,
34677
which specifies the default C-preprocessor command line
34678
for all Fortran versions.
34679
</P
34680
></DD
34681
><DT
34682
><A
34683
NAME="cv-SHF95PPCOMSTR"
34684
></A
34685
><CODE
34686
CLASS="envar"
34687
>SHF95PPCOMSTR</CODE
34688
></DT
34689
><DD
34690
><P
34691
> The string displayed when a Fortran 95 source file
34692
is compiled to a shared-library object file
34693
after first running the file through the C preprocessor.
34694
If this is not set, then <A
34695
HREF="#cv-SHF95PPCOM"
34696
><CODE
34697
CLASS="envar"
34698
>$SHF95PPCOM</CODE
34699
></A
34700
> or <A
34701
HREF="#cv-SHFORTRANPPCOM"
34702
><CODE
34703
CLASS="envar"
34704
>$SHFORTRANPPCOM</CODE
34705
></A
34706
>
34707
(the command line) is displayed.
34708
</P
34709
></DD
34710
><DT
34711
><A
34712
NAME="cv-SHFORTRAN"
34713
></A
34714
><CODE
34715
CLASS="envar"
34716
>SHFORTRAN</CODE
34717
></DT
34718
><DD
34719
><P
34720
> The default Fortran compiler used for generating shared-library objects.
34721
</P
34722
></DD
34723
><DT
34724
><A
34725
NAME="cv-SHFORTRANCOM"
34726
></A
34727
><CODE
34728
CLASS="envar"
34729
>SHFORTRANCOM</CODE
34730
></DT
34731
><DD
34732
><P
34733
> The command line used to compile a Fortran source file
34734
to a shared-library object file.
34735
</P
34736
></DD
34737
><DT
34738
><A
34739
NAME="cv-SHFORTRANCOMSTR"
34740
></A
34741
><CODE
34742
CLASS="envar"
34743
>SHFORTRANCOMSTR</CODE
34744
></DT
34745
><DD
34746
><P
34747
> The string displayed when a Fortran source file
34748
is compiled to a shared-library object file.
34749
If this is not set, then <A
34750
HREF="#cv-SHFORTRANCOM"
34751
><CODE
34752
CLASS="envar"
34753
>$SHFORTRANCOM</CODE
34754
></A
34755
>
34756
(the command line) is displayed.
34757
</P
34758
></DD
34759
><DT
34760
><A
34761
NAME="cv-SHFORTRANFLAGS"
34762
></A
34763
><CODE
34764
CLASS="envar"
34765
>SHFORTRANFLAGS</CODE
34766
></DT
34767
><DD
34768
><P
34769
> Options that are passed to the Fortran compiler
34770
to generate shared-library objects.
34771
</P
34772
></DD
34773
><DT
34774
><A
34775
NAME="cv-SHFORTRANPPCOM"
34776
></A
34777
><CODE
34778
CLASS="envar"
34779
>SHFORTRANPPCOM</CODE
34780
></DT
34781
><DD
34782
><P
34783
> The command line used to compile a Fortran source file to a
34784
shared-library object file
34785
after first running the file through the C preprocessor.
34786
Any options specified
34787
in the <A
34788
HREF="#cv-SHFORTRANFLAGS"
34789
><CODE
34790
CLASS="envar"
34791
>$SHFORTRANFLAGS</CODE
34792
></A
34793
> and
34794
<A
34795
HREF="#cv-CPPFLAGS"
34796
><CODE
34797
CLASS="envar"
34798
>$CPPFLAGS</CODE
34799
></A
34800
> construction variables
34801
are included on this command line.
34802
</P
34803
></DD
34804
><DT
34805
><A
34806
NAME="cv-SHFORTRANPPCOMSTR"
34807
></A
34808
><CODE
34809
CLASS="envar"
34810
>SHFORTRANPPCOMSTR</CODE
34811
></DT
34812
><DD
34813
><P
34814
> The string displayed when a Fortran source file
34815
is compiled to a shared-library object file
34816
after first running the file throught the C preprocessor.
34817
If this is not set, then <A
34818
HREF="#cv-SHFORTRANPPCOM"
34819
><CODE
34820
CLASS="envar"
34821
>$SHFORTRANPPCOM</CODE
34822
></A
34823
>
34824
(the command line) is displayed.
34825
</P
34826
></DD
34827
><DT
34828
><A
34829
NAME="cv-SHLIBPREFIX"
34830
></A
34831
><CODE
34832
CLASS="envar"
34833
>SHLIBPREFIX</CODE
34834
></DT
34835
><DD
34836
><P
34837
> The prefix used for shared library file names.
34838
</P
34839
></DD
34840
><DT
34841
><A
34842
NAME="cv-SHLIBSUFFIX"
34843
></A
34844
><CODE
34845
CLASS="envar"
34846
>SHLIBSUFFIX</CODE
34847
></DT
34848
><DD
34849
><P
34850
> The suffix used for shared library file names.
34851
</P
34852
></DD
34853
><DT
34854
><A
34855
NAME="cv-SHLINK"
34856
></A
34857
><CODE
34858
CLASS="envar"
34859
>SHLINK</CODE
34860
></DT
34861
><DD
34862
><P
34863
> The linker for programs that use shared libraries.
34864
</P
34865
></DD
34866
><DT
34867
><A
34868
NAME="cv-SHLINKCOM"
34869
></A
34870
><CODE
34871
CLASS="envar"
34872
>SHLINKCOM</CODE
34873
></DT
34874
><DD
34875
><P
34876
> The command line used to link programs using shared libaries.
34877
</P
34878
></DD
34879
><DT
34880
><A
34881
NAME="cv-SHLINKCOMSTR"
34882
></A
34883
><CODE
34884
CLASS="envar"
34885
>SHLINKCOMSTR</CODE
34886
></DT
34887
><DD
34888
><P
34889
> The string displayed when programs using shared libraries are linked.
34890
If this is not set, then <A
34891
HREF="#cv-SHLINKCOM"
34892
><CODE
34893
CLASS="envar"
34894
>$SHLINKCOM</CODE
34895
></A
34896
> (the command line) is displayed.
34897
</P
34898
><PRE
34899
CLASS="programlisting"
34900
> env = Environment(SHLINKCOMSTR = "Linking shared $TARGET")
34901
</PRE
34902
></DD
34903
><DT
34904
><A
34905
NAME="cv-SHLINKFLAGS"
34906
></A
34907
><CODE
34908
CLASS="envar"
34909
>SHLINKFLAGS</CODE
34910
></DT
34911
><DD
34912
><P
34913
> General user options passed to the linker for programs using shared libraries.
34914
Note that this variable should
34915
<SPAN
34916
CLASS="emphasis"
34917
><I
34918
CLASS="emphasis"
34919
>not</I
34920
></SPAN
34921
>
34922
contain
34923
<CODE
34924
CLASS="option"
34925
>-l</CODE
34926
>
34927
(or similar) options for linking with the libraries listed in <A
34928
HREF="#cv-LIBS"
34929
><CODE
34930
CLASS="envar"
34931
>$LIBS</CODE
34932
></A
34933
>,
34934
nor
34935
<CODE
34936
CLASS="option"
34937
>-L</CODE
34938
>
34939
(or similar) include search path options
34940
that scons generates automatically from <A
34941
HREF="#cv-LIBPATH"
34942
><CODE
34943
CLASS="envar"
34944
>$LIBPATH</CODE
34945
></A
34946
>.
34947
See
34948
<A
34949
HREF="#cv-_LIBFLAGS"
34950
><CODE
34951
CLASS="envar"
34952
>$_LIBFLAGS</CODE
34953
></A
34954
>
34955
above,
34956
for the variable that expands to library-link options,
34957
and
34958
<A
34959
HREF="#cv-_LIBDIRFLAGS"
34960
><CODE
34961
CLASS="envar"
34962
>$_LIBDIRFLAGS</CODE
34963
></A
34964
>
34965
above,
34966
for the variable that expands to library search path options.
34967
</P
34968
></DD
34969
><DT
34970
><A
34971
NAME="cv-SHOBJPREFIX"
34972
></A
34973
><CODE
34974
CLASS="envar"
34975
>SHOBJPREFIX</CODE
34976
></DT
34977
><DD
34978
><P
34979
> The prefix used for shared object file names.
34980
</P
34981
></DD
34982
><DT
34983
><A
34984
NAME="cv-SHOBJSUFFIX"
34985
></A
34986
><CODE
34987
CLASS="envar"
34988
>SHOBJSUFFIX</CODE
34989
></DT
34990
><DD
34991
><P
34992
> The suffix used for shared object file names.
34993
</P
34994
></DD
34995
><DT
34996
><A
34997
NAME="cv-SOURCE"
34998
></A
34999
><CODE
35000
CLASS="envar"
35001
>SOURCE</CODE
35002
></DT
35003
><DD
35004
><P
35005
> A reserved variable name
35006
that may not be set or used in a construction environment.
35007
(See "Variable Substitution," below.)
35008
</P
35009
></DD
35010
><DT
35011
><A
35012
NAME="cv-SOURCE_URL"
35013
></A
35014
><CODE
35015
CLASS="envar"
35016
>SOURCE_URL</CODE
35017
></DT
35018
><DD
35019
><P
35020
> The URL
35021
(web address)
35022
of the location from which the project was retrieved.
35023
This is used to fill in the
35024
<TT
35025
CLASS="literal"
35026
>Source:</TT
35027
>
35028
field in the controlling information for Ipkg and RPM packages.
35029
</P
35030
></DD
35031
><DT
35032
><A
35033
NAME="cv-SOURCES"
35034
></A
35035
><CODE
35036
CLASS="envar"
35037
>SOURCES</CODE
35038
></DT
35039
><DD
35040
><P
35041
> A reserved variable name
35042
that may not be set or used in a construction environment.
35043
(See "Variable Substitution," below.)
35044
</P
35045
></DD
35046
><DT
35047
><A
35048
NAME="cv-SPAWN"
35049
></A
35050
><CODE
35051
CLASS="envar"
35052
>SPAWN</CODE
35053
></DT
35054
><DD
35055
><P
35056
> A command interpreter function that will be called to execute command line
35057
strings. The function must expect the following arguments:
35058
</P
35059
><PRE
35060
CLASS="programlisting"
35061
> def spawn(shell, escape, cmd, args, env):
35062
</PRE
35063
><P
35064
> <CODE
35065
CLASS="varname"
35066
>sh</CODE
35067
>
35068
is a string naming the shell program to use.
35069
<CODE
35070
CLASS="varname"
35071
>escape</CODE
35072
>
35073
is a function that can be called to escape shell special characters in
35074
the command line.
35075
<CODE
35076
CLASS="varname"
35077
>cmd</CODE
35078
>
35079
is the path to the command to be executed.
35080
<CODE
35081
CLASS="varname"
35082
>args</CODE
35083
>
35084
is the arguments to the command.
35085
<CODE
35086
CLASS="varname"
35087
>env</CODE
35088
>
35089
is a dictionary of the environment variables
35090
in which the command should be executed.
35091
</P
35092
></DD
35093
><DT
35094
><A
35095
NAME="cv-SUMMARY"
35096
></A
35097
><CODE
35098
CLASS="envar"
35099
>SUMMARY</CODE
35100
></DT
35101
><DD
35102
><P
35103
> A short summary of what the project is about.
35104
This is used to fill in the
35105
<TT
35106
CLASS="literal"
35107
>Summary:</TT
35108
>
35109
field in the controlling information for Ipkg and RPM packages,
35110
and as the
35111
<TT
35112
CLASS="literal"
35113
>Description:</TT
35114
>
35115
field in MSI packages.
35116
</P
35117
></DD
35118
><DT
35119
><A
35120
NAME="cv-SWIG"
35121
></A
35122
><CODE
35123
CLASS="envar"
35124
>SWIG</CODE
35125
></DT
35126
><DD
35127
><P
35128
> The scripting language wrapper and interface generator.
35129
</P
35130
></DD
35131
><DT
35132
><A
35133
NAME="cv-SWIGCFILESUFFIX"
35134
></A
35135
><CODE
35136
CLASS="envar"
35137
>SWIGCFILESUFFIX</CODE
35138
></DT
35139
><DD
35140
><P
35141
> The suffix that will be used for intermediate C
35142
source files generated by
35143
the scripting language wrapper and interface generator.
35144
The default value is
35145
<TT
35146
CLASS="filename"
35147
>_wrap</TT
35148
><A
35149
HREF="#cv-CFILESUFFIX"
35150
><CODE
35151
CLASS="envar"
35152
>$CFILESUFFIX</CODE
35153
></A
35154
>.
35155
By default, this value is used whenever the
35156
<CODE
35157
CLASS="option"
35158
>-c++</CODE
35159
>
35160
option is
35161
<SPAN
35162
CLASS="emphasis"
35163
><I
35164
CLASS="emphasis"
35165
>not</I
35166
></SPAN
35167
>
35168
specified as part of the
35169
<A
35170
HREF="#cv-SWIGFLAGS"
35171
><CODE
35172
CLASS="envar"
35173
>$SWIGFLAGS</CODE
35174
></A
35175
>
35176
construction variable.
35177
</P
35178
></DD
35179
><DT
35180
><A
35181
NAME="cv-SWIGCOM"
35182
></A
35183
><CODE
35184
CLASS="envar"
35185
>SWIGCOM</CODE
35186
></DT
35187
><DD
35188
><P
35189
> The command line used to call
35190
the scripting language wrapper and interface generator.
35191
</P
35192
></DD
35193
><DT
35194
><A
35195
NAME="cv-SWIGCOMSTR"
35196
></A
35197
><CODE
35198
CLASS="envar"
35199
>SWIGCOMSTR</CODE
35200
></DT
35201
><DD
35202
><P
35203
> The string displayed when calling
35204
the scripting language wrapper and interface generator.
35205
If this is not set, then <A
35206
HREF="#cv-SWIGCOM"
35207
><CODE
35208
CLASS="envar"
35209
>$SWIGCOM</CODE
35210
></A
35211
> (the command line) is displayed.
35212
</P
35213
></DD
35214
><DT
35215
><A
35216
NAME="cv-SWIGCXXFILESUFFIX"
35217
></A
35218
><CODE
35219
CLASS="envar"
35220
>SWIGCXXFILESUFFIX</CODE
35221
></DT
35222
><DD
35223
><P
35224
> The suffix that will be used for intermediate C++
35225
source files generated by
35226
the scripting language wrapper and interface generator.
35227
The default value is
35228
<TT
35229
CLASS="filename"
35230
>_wrap</TT
35231
><A
35232
HREF="#cv-CFILESUFFIX"
35233
><CODE
35234
CLASS="envar"
35235
>$CFILESUFFIX</CODE
35236
></A
35237
>.
35238
By default, this value is used whenever the
35239
<TT
35240
CLASS="filename"
35241
>-c++</TT
35242
>
35243
option is specified as part of the
35244
<A
35245
HREF="#cv-SWIGFLAGS"
35246
><CODE
35247
CLASS="envar"
35248
>$SWIGFLAGS</CODE
35249
></A
35250
>
35251
construction variable.
35252
</P
35253
></DD
35254
><DT
35255
><A
35256
NAME="cv-SWIGFLAGS"
35257
></A
35258
><CODE
35259
CLASS="envar"
35260
>SWIGFLAGS</CODE
35261
></DT
35262
><DD
35263
><P
35264
> General options passed to
35265
the scripting language wrapper and interface generator.
35266
This is where you should set
35267
<CODE
35268
CLASS="option"
35269
>-python</CODE
35270
>,
35271
<CODE
35272
CLASS="option"
35273
>-perl5</CODE
35274
>,
35275
<CODE
35276
CLASS="option"
35277
>-tcl</CODE
35278
>,
35279
or whatever other options you want to specify to SWIG.
35280
If you set the
35281
<CODE
35282
CLASS="option"
35283
>-c++</CODE
35284
>
35285
option in this variable,
35286
<SPAN
35287
CLASS="application"
35288
>scons</SPAN
35289
>
35290
will, by default,
35291
generate a C++ intermediate source file
35292
with the extension that is specified as the
35293
<A
35294
HREF="#cv-CXXFILESUFFIX"
35295
><CODE
35296
CLASS="envar"
35297
>$CXXFILESUFFIX</CODE
35298
></A
35299
>
35300
variable.
35301
</P
35302
></DD
35303
><DT
35304
><A
35305
NAME="cv-_SWIGINCFLAGS"
35306
></A
35307
><CODE
35308
CLASS="envar"
35309
>_SWIGINCFLAGS</CODE
35310
></DT
35311
><DD
35312
><P
35313
> An automatically-generated construction variable
35314
containing the SWIG command-line options
35315
for specifying directories to be searched for included files.
35316
The value of <CODE
35317
CLASS="envar"
35318
>$_SWIGINCFLAGS</CODE
35319
> is created
35320
by appending <CODE
35321
CLASS="envar"
35322
>$SWIGINCPREFIX</CODE
35323
> and <CODE
35324
CLASS="envar"
35325
>$SWIGINCSUFFIX</CODE
35326
>
35327
to the beginning and end
35328
of each directory in <CODE
35329
CLASS="envar"
35330
>$SWIGPATH</CODE
35331
>.
35332
</P
35333
></DD
35334
><DT
35335
><A
35336
NAME="cv-SWIGINCPREFIX"
35337
></A
35338
><CODE
35339
CLASS="envar"
35340
>SWIGINCPREFIX</CODE
35341
></DT
35342
><DD
35343
><P
35344
> The prefix used to specify an include directory on the SWIG command line.
35345
This will be appended to the beginning of each directory
35346
in the <CODE
35347
CLASS="envar"
35348
>$SWIGPATH</CODE
35349
> construction variable
35350
when the <CODE
35351
CLASS="envar"
35352
>$_SWIGINCFLAGS</CODE
35353
> variable is automatically generated.
35354
</P
35355
></DD
35356
><DT
35357
><A
35358
NAME="cv-SWIGINCSUFFIX"
35359
></A
35360
><CODE
35361
CLASS="envar"
35362
>SWIGINCSUFFIX</CODE
35363
></DT
35364
><DD
35365
><P
35366
> The suffix used to specify an include directory on the SWIG command line.
35367
This will be appended to the end of each directory
35368
in the <CODE
35369
CLASS="envar"
35370
>$SWIGPATH</CODE
35371
> construction variable
35372
when the <CODE
35373
CLASS="envar"
35374
>$_SWIGINCFLAGS</CODE
35375
> variable is automatically generated.
35376
</P
35377
></DD
35378
><DT
35379
><A
35380
NAME="cv-SWIGOUTDIR"
35381
></A
35382
><CODE
35383
CLASS="envar"
35384
>SWIGOUTDIR</CODE
35385
></DT
35386
><DD
35387
><P
35388
> Specifies the output directory in which
35389
the scripting language wrapper and interface generator
35390
should place generated language-specific files.
35391
This will be used by SCons to identify
35392
the files that will be generated by the <SPAN
35393
CLASS="application"
35394
>swig</SPAN
35395
> call,
35396
and translated into the
35397
<TT
35398
CLASS="literal"
35399
>swig -outdir</TT
35400
> option on the command line.
35401
</P
35402
></DD
35403
><DT
35404
><A
35405
NAME="cv-SWIGPATH"
35406
></A
35407
><CODE
35408
CLASS="envar"
35409
>SWIGPATH</CODE
35410
></DT
35411
><DD
35412
><P
35413
> The list of directories that the scripting language wrapper
35414
and interface generate will search for included files.
35415
The SWIG implicit dependency scanner will search these
35416
directories for include files.
35417
The default is to use the same path
35418
specified as <CODE
35419
CLASS="envar"
35420
>$CPPPATH</CODE
35421
>.</P
35422
><P
35423
>Don't explicitly put include directory
35424
arguments in SWIGFLAGS;
35425
the result will be non-portable
35426
and the directories will not be searched by the dependency scanner.
35427
Note: directory names in SWIGPATH will be looked-up relative to the SConscript
35428
directory when they are used in a command.
35429
To force
35430
<SPAN
35431
CLASS="application"
35432
>scons</SPAN
35433
>
35434
to look-up a directory relative to the root of the source tree use #:
35435
</P
35436
><PRE
35437
CLASS="programlisting"
35438
> env = Environment(SWIGPATH='#/include')
35439
</PRE
35440
><P
35441
> The directory look-up can also be forced using the
35442
<CODE
35443
CLASS="function"
35444
>Dir</CODE
35445
>()
35446
function:
35447
</P
35448
><PRE
35449
CLASS="programlisting"
35450
> include = Dir('include')
35451
env = Environment(SWIGPATH=include)
35452
</PRE
35453
><P
35454
> The directory list will be added to command lines
35455
through the automatically-generated
35456
<CODE
35457
CLASS="envar"
35458
>$_SWIGINCFLAGS</CODE
35459
>
35460
construction variable,
35461
which is constructed by
35462
appending the values of the
35463
<CODE
35464
CLASS="envar"
35465
>$SWIGINCPREFIX</CODE
35466
> and <CODE
35467
CLASS="envar"
35468
>$SWIGINCSUFFIX</CODE
35469
>
35470
construction variables
35471
to the beginning and end
35472
of each directory in <CODE
35473
CLASS="envar"
35474
>$SWIGPATH</CODE
35475
>.
35476
Any command lines you define that need
35477
the SWIGPATH directory list should
35478
include <CODE
35479
CLASS="envar"
35480
>$_SWIGINCFLAGS</CODE
35481
>:
35482
</P
35483
><PRE
35484
CLASS="programlisting"
35485
> env = Environment(SWIGCOM="my_swig -o $TARGET $_SWIGINCFLAGS $SORUCES")
35486
</PRE
35487
></DD
35488
><DT
35489
><A
35490
NAME="cv-TAR"
35491
></A
35492
><CODE
35493
CLASS="envar"
35494
>TAR</CODE
35495
></DT
35496
><DD
35497
><P
35498
> The tar archiver.
35499
</P
35500
></DD
35501
><DT
35502
><A
35503
NAME="cv-TARCOM"
35504
></A
35505
><CODE
35506
CLASS="envar"
35507
>TARCOM</CODE
35508
></DT
35509
><DD
35510
><P
35511
> The command line used to call the tar archiver.
35512
</P
35513
></DD
35514
><DT
35515
><A
35516
NAME="cv-TARCOMSTR"
35517
></A
35518
><CODE
35519
CLASS="envar"
35520
>TARCOMSTR</CODE
35521
></DT
35522
><DD
35523
><P
35524
> The string displayed when archiving files
35525
using the tar archiver.
35526
If this is not set, then <A
35527
HREF="#cv-TARCOM"
35528
><CODE
35529
CLASS="envar"
35530
>$TARCOM</CODE
35531
></A
35532
> (the command line) is displayed.
35533
</P
35534
><PRE
35535
CLASS="programlisting"
35536
> env = Environment(TARCOMSTR = "Archiving $TARGET")
35537
</PRE
35538
></DD
35539
><DT
35540
><A
35541
NAME="cv-TARFLAGS"
35542
></A
35543
><CODE
35544
CLASS="envar"
35545
>TARFLAGS</CODE
35546
></DT
35547
><DD
35548
><P
35549
> General options passed to the tar archiver.
35550
</P
35551
></DD
35552
><DT
35553
><A
35554
NAME="cv-TARGET"
35555
></A
35556
><CODE
35557
CLASS="envar"
35558
>TARGET</CODE
35559
></DT
35560
><DD
35561
><P
35562
> A reserved variable name
35563
that may not be set or used in a construction environment.
35564
(See "Variable Substitution," below.)
35565
</P
35566
></DD
35567
><DT
35568
><A
35569
NAME="cv-TARGETS"
35570
></A
35571
><CODE
35572
CLASS="envar"
35573
>TARGETS</CODE
35574
></DT
35575
><DD
35576
><P
35577
> A reserved variable name
35578
that may not be set or used in a construction environment.
35579
(See "Variable Substitution," below.)
35580
</P
35581
></DD
35582
><DT
35583
><A
35584
NAME="cv-TARSUFFIX"
35585
></A
35586
><CODE
35587
CLASS="envar"
35588
>TARSUFFIX</CODE
35589
></DT
35590
><DD
35591
><P
35592
> The suffix used for tar file names.
35593
</P
35594
></DD
35595
><DT
35596
><A
35597
NAME="cv-TEMPFILEPREFIX"
35598
></A
35599
><CODE
35600
CLASS="envar"
35601
>TEMPFILEPREFIX</CODE
35602
></DT
35603
><DD
35604
><P
35605
> The prefix for a temporary file used
35606
to execute lines longer than $MAXLINELENGTH.
35607
The default is '@'.
35608
This may be set for toolchains that use other values,
35609
such as '-@' for the diab compiler
35610
or '-via' for ARM toolchain.
35611
</P
35612
></DD
35613
><DT
35614
><A
35615
NAME="cv-TEX"
35616
></A
35617
><CODE
35618
CLASS="envar"
35619
>TEX</CODE
35620
></DT
35621
><DD
35622
><P
35623
> The TeX formatter and typesetter.
35624
</P
35625
></DD
35626
><DT
35627
><A
35628
NAME="cv-TEXCOM"
35629
></A
35630
><CODE
35631
CLASS="envar"
35632
>TEXCOM</CODE
35633
></DT
35634
><DD
35635
><P
35636
> The command line used to call the TeX formatter and typesetter.
35637
</P
35638
></DD
35639
><DT
35640
><A
35641
NAME="cv-TEXCOMSTR"
35642
></A
35643
><CODE
35644
CLASS="envar"
35645
>TEXCOMSTR</CODE
35646
></DT
35647
><DD
35648
><P
35649
> The string displayed when calling
35650
the TeX formatter and typesetter.
35651
If this is not set, then <A
35652
HREF="#cv-TEXCOM"
35653
><CODE
35654
CLASS="envar"
35655
>$TEXCOM</CODE
35656
></A
35657
> (the command line) is displayed.
35658
</P
35659
><PRE
35660
CLASS="programlisting"
35661
> env = Environment(TEXCOMSTR = "Building $TARGET from TeX input $SOURCES")
35662
</PRE
35663
></DD
35664
><DT
35665
><A
35666
NAME="cv-TEXFLAGS"
35667
></A
35668
><CODE
35669
CLASS="envar"
35670
>TEXFLAGS</CODE
35671
></DT
35672
><DD
35673
><P
35674
> General options passed to the TeX formatter and typesetter.
35675
</P
35676
></DD
35677
><DT
35678
><A
35679
NAME="cv-TEXINPUTS"
35680
></A
35681
><CODE
35682
CLASS="envar"
35683
>TEXINPUTS</CODE
35684
></DT
35685
><DD
35686
><P
35687
> List of directories that the LaTeX programm will search
35688
for include directories.
35689
The LaTeX implicit dependency scanner will search these
35690
directories for \include and \import files.
35691
</P
35692
></DD
35693
><DT
35694
><A
35695
NAME="cv-TOOLS"
35696
></A
35697
><CODE
35698
CLASS="envar"
35699
>TOOLS</CODE
35700
></DT
35701
><DD
35702
><P
35703
> A list of the names of the Tool specifications
35704
that are part of this construction environment.
35705
</P
35706
></DD
35707
><DT
35708
><A
35709
NAME="cv-VENDOR"
35710
></A
35711
><CODE
35712
CLASS="envar"
35713
>VENDOR</CODE
35714
></DT
35715
><DD
35716
><P
35717
> The person or organization who supply the packaged software.
35718
This is used to fill in the
35719
<TT
35720
CLASS="literal"
35721
>Vendor:</TT
35722
>
35723
field in the controlling information for RPM packages,
35724
and the
35725
<TT
35726
CLASS="literal"
35727
>Manufacturer:</TT
35728
>
35729
field in the controlling information for MSI packages.
35730
</P
35731
></DD
35732
><DT
35733
><A
35734
NAME="cv-VERSION"
35735
></A
35736
><CODE
35737
CLASS="envar"
35738
>VERSION</CODE
35739
></DT
35740
><DD
35741
><P
35742
> The version of the project, specified as a string.
35743
</P
35744
></DD
35745
><DT
35746
><A
35747
NAME="cv-WIN32_INSERT_DEF"
35748
></A
35749
><CODE
35750
CLASS="envar"
35751
>WIN32_INSERT_DEF</CODE
35752
></DT
35753
><DD
35754
><P
35755
> A deprecated synonym for <A
35756
HREF="#cv-WINDOWS_INSERT_DEF"
35757
><CODE
35758
CLASS="envar"
35759
>$WINDOWS_INSERT_DEF</CODE
35760
></A
35761
>.
35762
</P
35763
></DD
35764
><DT
35765
><A
35766
NAME="cv-WIN32DEFPREFIX"
35767
></A
35768
><CODE
35769
CLASS="envar"
35770
>WIN32DEFPREFIX</CODE
35771
></DT
35772
><DD
35773
><P
35774
> A deprecated synonym for <A
35775
HREF="#cv-WINDOWSDEFPREFIX"
35776
><CODE
35777
CLASS="envar"
35778
>$WINDOWSDEFPREFIX</CODE
35779
></A
35780
>.
35781
</P
35782
></DD
35783
><DT
35784
><A
35785
NAME="cv-WIN32DEFSUFFIX"
35786
></A
35787
><CODE
35788
CLASS="envar"
35789
>WIN32DEFSUFFIX</CODE
35790
></DT
35791
><DD
35792
><P
35793
> A deprecated synonym for <A
35794
HREF="#cv-WINDOWSDEFSUFFIX"
35795
><CODE
35796
CLASS="envar"
35797
>$WINDOWSDEFSUFFIX</CODE
35798
></A
35799
>.
35800
</P
35801
></DD
35802
><DT
35803
><A
35804
NAME="cv-WIN32EXPPREFIX"
35805
></A
35806
><CODE
35807
CLASS="envar"
35808
>WIN32EXPPREFIX</CODE
35809
></DT
35810
><DD
35811
><P
35812
> A deprecated synonym for <A
35813
HREF="#cv-WINDOWSEXPSUFFIX"
35814
><CODE
35815
CLASS="envar"
35816
>$WINDOWSEXPSUFFIX</CODE
35817
></A
35818
>.
35819
</P
35820
></DD
35821
><DT
35822
><A
35823
NAME="cv-WIN32EXPSUFFIX"
35824
></A
35825
><CODE
35826
CLASS="envar"
35827
>WIN32EXPSUFFIX</CODE
35828
></DT
35829
><DD
35830
><P
35831
> A deprecated synonym for <A
35832
HREF="#cv-WINDOWSEXPSUFFIX"
35833
><CODE
35834
CLASS="envar"
35835
>$WINDOWSEXPSUFFIX</CODE
35836
></A
35837
>.
35838
</P
35839
></DD
35840
><DT
35841
><A
35842
NAME="cv-WINDOWS_INSERT_DEF"
35843
></A
35844
><CODE
35845
CLASS="envar"
35846
>WINDOWS_INSERT_DEF</CODE
35847
></DT
35848
><DD
35849
><P
35850
> When this is set to true,
35851
a library build of a Windows shared library
35852
(<TT
35853
CLASS="filename"
35854
>.dll</TT
35855
>file)
35856
will also build a corresponding <TT
35857
CLASS="filename"
35858
>.def</TT
35859
> file
35860
at the same time,
35861
if a <TT
35862
CLASS="filename"
35863
>.def</TT
35864
> file
35865
is not already listed as a build target.
35866
The default is 0 (do not build a <TT
35867
CLASS="filename"
35868
>.def</TT
35869
> file).
35870
</P
35871
></DD
35872
><DT
35873
><A
35874
NAME="cv-WINDOWS_INSERT_MANIFEST"
35875
></A
35876
><CODE
35877
CLASS="envar"
35878
>WINDOWS_INSERT_MANIFEST</CODE
35879
></DT
35880
><DD
35881
><P
35882
> When this is set to true,
35883
<SPAN
35884
CLASS="application"
35885
>scons</SPAN
35886
>
35887
will be aware of the
35888
<TT
35889
CLASS="filename"
35890
>.manifest</TT
35891
>
35892
files generated by Microsoft Visua C/C++ 8.
35893
</P
35894
></DD
35895
><DT
35896
><A
35897
NAME="cv-WINDOWSDEFPREFIX"
35898
></A
35899
><CODE
35900
CLASS="envar"
35901
>WINDOWSDEFPREFIX</CODE
35902
></DT
35903
><DD
35904
><P
35905
> The prefix used for Windows <TT
35906
CLASS="filename"
35907
>.def</TT
35908
>file names.
35909
</P
35910
></DD
35911
><DT
35912
><A
35913
NAME="cv-WINDOWSDEFSUFFIX"
35914
></A
35915
><CODE
35916
CLASS="envar"
35917
>WINDOWSDEFSUFFIX</CODE
35918
></DT
35919
><DD
35920
><P
35921
> The suffix used for Windows <TT
35922
CLASS="filename"
35923
>.def</TT
35924
> file names.
35925
</P
35926
></DD
35927
><DT
35928
><A
35929
NAME="cv-WINDOWSEXPPREFIX"
35930
></A
35931
><CODE
35932
CLASS="envar"
35933
>WINDOWSEXPPREFIX</CODE
35934
></DT
35935
><DD
35936
><P
35937
> The prefix used for Windows <TT
35938
CLASS="filename"
35939
>.exp</TT
35940
> file names.
35941
</P
35942
></DD
35943
><DT
35944
><A
35945
NAME="cv-WINDOWSEXPSUFFIX"
35946
></A
35947
><CODE
35948
CLASS="envar"
35949
>WINDOWSEXPSUFFIX</CODE
35950
></DT
35951
><DD
35952
><P
35953
> The suffix used for Windows <TT
35954
CLASS="filename"
35955
>.exp</TT
35956
> file names.
35957
</P
35958
></DD
35959
><DT
35960
><A
35961
NAME="cv-WINDOWSPROGMANIFESTPREFIX"
35962
></A
35963
><CODE
35964
CLASS="envar"
35965
>WINDOWSPROGMANIFESTPREFIX</CODE
35966
></DT
35967
><DD
35968
><P
35969
> The prefix used for executable program <TT
35970
CLASS="filename"
35971
>.manifest</TT
35972
> files
35973
generated by Microsoft Visual C/C++.
35974
</P
35975
></DD
35976
><DT
35977
><A
35978
NAME="cv-WINDOWSPROGMANIFESTSUFFIX"
35979
></A
35980
><CODE
35981
CLASS="envar"
35982
>WINDOWSPROGMANIFESTSUFFIX</CODE
35983
></DT
35984
><DD
35985
><P
35986
> The suffix used for executable program <TT
35987
CLASS="filename"
35988
>.manifest</TT
35989
> files
35990
generated by Microsoft Visual C/C++.
35991
</P
35992
></DD
35993
><DT
35994
><A
35995
NAME="cv-WINDOWSSHLIBMANIFESTPREFIX"
35996
></A
35997
><CODE
35998
CLASS="envar"
35999
>WINDOWSSHLIBMANIFESTPREFIX</CODE
36000
></DT
36001
><DD
36002
><P
36003
> The prefix used for shared library <TT
36004
CLASS="filename"
36005
>.manifest</TT
36006
> files
36007
generated by Microsoft Visual C/C++.
36008
</P
36009
></DD
36010
><DT
36011
><A
36012
NAME="cv-WINDOWSSHLIBMANIFESTSUFFIX"
36013
></A
36014
><CODE
36015
CLASS="envar"
36016
>WINDOWSSHLIBMANIFESTSUFFIX</CODE
36017
></DT
36018
><DD
36019
><P
36020
> The suffix used for shared library <TT
36021
CLASS="filename"
36022
>.manifest</TT
36023
> files
36024
generated by Microsoft Visual C/C++.
36025
</P
36026
></DD
36027
><DT
36028
><A
36029
NAME="cv-X_IPK_DEPENDS"
36030
></A
36031
><CODE
36032
CLASS="envar"
36033
>X_IPK_DEPENDS</CODE
36034
></DT
36035
><DD
36036
><P
36037
> This is used to fill in the
36038
<TT
36039
CLASS="literal"
36040
>Depends:</TT
36041
>
36042
field in the controlling information for Ipkg packages.
36043
</P
36044
></DD
36045
><DT
36046
><A
36047
NAME="cv-X_IPK_DESCRIPTION"
36048
></A
36049
><CODE
36050
CLASS="envar"
36051
>X_IPK_DESCRIPTION</CODE
36052
></DT
36053
><DD
36054
><P
36055
> This is used to fill in the
36056
<TT
36057
CLASS="literal"
36058
>Description:</TT
36059
>
36060
field in the controlling information for Ipkg packages.
36061
The default value is
36062
<TT
36063
CLASS="literal"
36064
>$SUMMARY\n$DESCRIPTION</TT
36065
>
36066
</P
36067
></DD
36068
><DT
36069
><A
36070
NAME="cv-X_IPK_MAINTAINER"
36071
></A
36072
><CODE
36073
CLASS="envar"
36074
>X_IPK_MAINTAINER</CODE
36075
></DT
36076
><DD
36077
><P
36078
> This is used to fill in the
36079
<TT
36080
CLASS="literal"
36081
>Maintainer:</TT
36082
>
36083
field in the controlling information for Ipkg packages.
36084
</P
36085
></DD
36086
><DT
36087
><A
36088
NAME="cv-X_IPK_PRIORITY"
36089
></A
36090
><CODE
36091
CLASS="envar"
36092
>X_IPK_PRIORITY</CODE
36093
></DT
36094
><DD
36095
><P
36096
> This is used to fill in the
36097
<TT
36098
CLASS="literal"
36099
>Priority:</TT
36100
>
36101
field in the controlling information for Ipkg packages.
36102
</P
36103
></DD
36104
><DT
36105
><A
36106
NAME="cv-X_IPK_SECTION"
36107
></A
36108
><CODE
36109
CLASS="envar"
36110
>X_IPK_SECTION</CODE
36111
></DT
36112
><DD
36113
><P
36114
> This is used to fill in the
36115
<TT
36116
CLASS="literal"
36117
>Section:</TT
36118
>
36119
field in the controlling information for Ipkg packages.
36120
</P
36121
></DD
36122
><DT
36123
><A
36124
NAME="cv-X_MSI_LANGUAGE"
36125
></A
36126
><CODE
36127
CLASS="envar"
36128
>X_MSI_LANGUAGE</CODE
36129
></DT
36130
><DD
36131
><P
36132
> This is used to fill in the
36133
<TT
36134
CLASS="literal"
36135
>Language:</TT
36136
>
36137
attribute in the controlling information for MSI packages.
36138
</P
36139
></DD
36140
><DT
36141
><A
36142
NAME="cv-X_MSI_LICENSE_TEXT"
36143
></A
36144
><CODE
36145
CLASS="envar"
36146
>X_MSI_LICENSE_TEXT</CODE
36147
></DT
36148
><DD
36149
><P
36150
> The text of the software license in RTF format.
36151
Carriage return characters will be
36152
replaced with the RTF equivalent \\par.
36153
</P
36154
></DD
36155
><DT
36156
><A
36157
NAME="cv-X_MSI_UPGRADE_CODE"
36158
></A
36159
><CODE
36160
CLASS="envar"
36161
>X_MSI_UPGRADE_CODE</CODE
36162
></DT
36163
><DD
36164
><P
36165
> TODO
36166
</P
36167
></DD
36168
><DT
36169
><A
36170
NAME="cv-X_RPM_AUTOREQPROV"
36171
></A
36172
><CODE
36173
CLASS="envar"
36174
>X_RPM_AUTOREQPROV</CODE
36175
></DT
36176
><DD
36177
><P
36178
> This is used to fill in the
36179
<TT
36180
CLASS="literal"
36181
>AutoReqProv:</TT
36182
>
36183
field in the RPM
36184
<TT
36185
CLASS="filename"
36186
>.spec</TT
36187
> file.
36188
</P
36189
></DD
36190
><DT
36191
><A
36192
NAME="cv-X_RPM_BUILD"
36193
></A
36194
><CODE
36195
CLASS="envar"
36196
>X_RPM_BUILD</CODE
36197
></DT
36198
><DD
36199
><P
36200
> internal, but overridable
36201
</P
36202
></DD
36203
><DT
36204
><A
36205
NAME="cv-X_RPM_BUILDREQUIRES"
36206
></A
36207
><CODE
36208
CLASS="envar"
36209
>X_RPM_BUILDREQUIRES</CODE
36210
></DT
36211
><DD
36212
><P
36213
> This is used to fill in the
36214
<TT
36215
CLASS="literal"
36216
>BuildRequires:</TT
36217
>
36218
field in the RPM
36219
<TT
36220
CLASS="filename"
36221
>.spec</TT
36222
> file.
36223
</P
36224
></DD
36225
><DT
36226
><A
36227
NAME="cv-X_RPM_BUILDROOT"
36228
></A
36229
><CODE
36230
CLASS="envar"
36231
>X_RPM_BUILDROOT</CODE
36232
></DT
36233
><DD
36234
><P
36235
> internal, but overridable
36236
</P
36237
></DD
36238
><DT
36239
><A
36240
NAME="cv-X_RPM_CLEAN"
36241
></A
36242
><CODE
36243
CLASS="envar"
36244
>X_RPM_CLEAN</CODE
36245
></DT
36246
><DD
36247
><P
36248
> internal, but overridable
36249
</P
36250
></DD
36251
><DT
36252
><A
36253
NAME="cv-X_RPM_CONFLICTS"
36254
></A
36255
><CODE
36256
CLASS="envar"
36257
>X_RPM_CONFLICTS</CODE
36258
></DT
36259
><DD
36260
><P
36261
> This is used to fill in the
36262
<TT
36263
CLASS="literal"
36264
>Conflicts:</TT
36265
>
36266
field in the RPM
36267
<TT
36268
CLASS="filename"
36269
>.spec</TT
36270
> file.
36271
</P
36272
></DD
36273
><DT
36274
><A
36275
NAME="cv-X_RPM_DEFATTR"
36276
></A
36277
><CODE
36278
CLASS="envar"
36279
>X_RPM_DEFATTR</CODE
36280
></DT
36281
><DD
36282
><P
36283
> This value is used as the default attributes
36284
for the files in the RPM package.
36285
The default value is
36286
<TT
36287
CLASS="literal"
36288
>(-,root,root)</TT
36289
>.
36290
</P
36291
></DD
36292
><DT
36293
><A
36294
NAME="cv-X_RPM_DISTRIBUTION"
36295
></A
36296
><CODE
36297
CLASS="envar"
36298
>X_RPM_DISTRIBUTION</CODE
36299
></DT
36300
><DD
36301
><P
36302
> This is used to fill in the
36303
<TT
36304
CLASS="literal"
36305
>Distribution:</TT
36306
>
36307
field in the RPM
36308
<TT
36309
CLASS="filename"
36310
>.spec</TT
36311
> file.
36312
</P
36313
></DD
36314
><DT
36315
><A
36316
NAME="cv-X_RPM_EPOCH"
36317
></A
36318
><CODE
36319
CLASS="envar"
36320
>X_RPM_EPOCH</CODE
36321
></DT
36322
><DD
36323
><P
36324
> This is used to fill in the
36325
<TT
36326
CLASS="literal"
36327
>Epoch:</TT
36328
>
36329
field in the controlling information for RPM packages.
36330
</P
36331
></DD
36332
><DT
36333
><A
36334
NAME="cv-X_RPM_EXCLUDEARCH"
36335
></A
36336
><CODE
36337
CLASS="envar"
36338
>X_RPM_EXCLUDEARCH</CODE
36339
></DT
36340
><DD
36341
><P
36342
> This is used to fill in the
36343
<TT
36344
CLASS="literal"
36345
>ExcludeArch:</TT
36346
>
36347
field in the RPM
36348
<TT
36349
CLASS="filename"
36350
>.spec</TT
36351
> file.
36352
</P
36353
></DD
36354
><DT
36355
><A
36356
NAME="cv-X_RPM_EXLUSIVEARCH"
36357
></A
36358
><CODE
36359
CLASS="envar"
36360
>X_RPM_EXLUSIVEARCH</CODE
36361
></DT
36362
><DD
36363
><P
36364
> This is used to fill in the
36365
<TT
36366
CLASS="literal"
36367
>ExclusiveArch:</TT
36368
>
36369
field in the RPM
36370
<TT
36371
CLASS="filename"
36372
>.spec</TT
36373
> file.
36374
</P
36375
></DD
36376
><DT
36377
><A
36378
NAME="cv-X_RPM_GROUP"
36379
></A
36380
><CODE
36381
CLASS="envar"
36382
>X_RPM_GROUP</CODE
36383
></DT
36384
><DD
36385
><P
36386
> This is used to fill in the
36387
<TT
36388
CLASS="literal"
36389
>Group:</TT
36390
>
36391
field in the RPM
36392
<TT
36393
CLASS="filename"
36394
>.spec</TT
36395
> file.
36396
</P
36397
></DD
36398
><DT
36399
><A
36400
NAME="cv-X_RPM_GROUP_lang"
36401
></A
36402
><CODE
36403
CLASS="envar"
36404
>X_RPM_GROUP_lang</CODE
36405
></DT
36406
><DD
36407
><P
36408
> This is used to fill in the
36409
<TT
36410
CLASS="literal"
36411
>Group(lang):</TT
36412
>
36413
field in the RPM
36414
<TT
36415
CLASS="filename"
36416
>.spec</TT
36417
> file.
36418
Note that
36419
<CODE
36420
CLASS="varname"
36421
>lang</CODE
36422
>
36423
is not literal
36424
and should be replaced by
36425
the appropriate language code.
36426
</P
36427
></DD
36428
><DT
36429
><A
36430
NAME="cv-X_RPM_ICON"
36431
></A
36432
><CODE
36433
CLASS="envar"
36434
>X_RPM_ICON</CODE
36435
></DT
36436
><DD
36437
><P
36438
> This is used to fill in the
36439
<TT
36440
CLASS="literal"
36441
>Icon:</TT
36442
>
36443
field in the RPM
36444
<TT
36445
CLASS="filename"
36446
>.spec</TT
36447
> file.
36448
</P
36449
></DD
36450
><DT
36451
><A
36452
NAME="cv-X_RPM_INSTALL"
36453
></A
36454
><CODE
36455
CLASS="envar"
36456
>X_RPM_INSTALL</CODE
36457
></DT
36458
><DD
36459
><P
36460
> internal, but overridable
36461
</P
36462
></DD
36463
><DT
36464
><A
36465
NAME="cv-X_RPM_PACKAGER"
36466
></A
36467
><CODE
36468
CLASS="envar"
36469
>X_RPM_PACKAGER</CODE
36470
></DT
36471
><DD
36472
><P
36473
> This is used to fill in the
36474
<TT
36475
CLASS="literal"
36476
>Packager:</TT
36477
>
36478
field in the RPM
36479
<TT
36480
CLASS="filename"
36481
>.spec</TT
36482
> file.
36483
</P
36484
></DD
36485
><DT
36486
><A
36487
NAME="cv-X_RPM_POSTINSTALL"
36488
></A
36489
><CODE
36490
CLASS="envar"
36491
>X_RPM_POSTINSTALL</CODE
36492
></DT
36493
><DD
36494
><P
36495
> This is used to fill in the
36496
<TT
36497
CLASS="literal"
36498
>%post:</TT
36499
>
36500
section in the RPM
36501
<TT
36502
CLASS="filename"
36503
>.spec</TT
36504
> file.
36505
</P
36506
></DD
36507
><DT
36508
><A
36509
NAME="cv-X_RPM_POSTUNINSTALL"
36510
></A
36511
><CODE
36512
CLASS="envar"
36513
>X_RPM_POSTUNINSTALL</CODE
36514
></DT
36515
><DD
36516
><P
36517
> This is used to fill in the
36518
<TT
36519
CLASS="literal"
36520
>%postun:</TT
36521
>
36522
section in the RPM
36523
<TT
36524
CLASS="filename"
36525
>.spec</TT
36526
> file.
36527
</P
36528
></DD
36529
><DT
36530
><A
36531
NAME="cv-X_RPM_PREFIX"
36532
></A
36533
><CODE
36534
CLASS="envar"
36535
>X_RPM_PREFIX</CODE
36536
></DT
36537
><DD
36538
><P
36539
> This is used to fill in the
36540
<TT
36541
CLASS="literal"
36542
>Prefix:</TT
36543
>
36544
field in the RPM
36545
<TT
36546
CLASS="filename"
36547
>.spec</TT
36548
> file.
36549
</P
36550
></DD
36551
><DT
36552
><A
36553
NAME="cv-X_RPM_PREINSTALL"
36554
></A
36555
><CODE
36556
CLASS="envar"
36557
>X_RPM_PREINSTALL</CODE
36558
></DT
36559
><DD
36560
><P
36561
> This is used to fill in the
36562
<TT
36563
CLASS="literal"
36564
>%pre:</TT
36565
>
36566
section in the RPM
36567
<TT
36568
CLASS="filename"
36569
>.spec</TT
36570
> file.
36571
</P
36572
></DD
36573
><DT
36574
><A
36575
NAME="cv-X_RPM_PREP"
36576
></A
36577
><CODE
36578
CLASS="envar"
36579
>X_RPM_PREP</CODE
36580
></DT
36581
><DD
36582
><P
36583
> internal, but overridable
36584
</P
36585
></DD
36586
><DT
36587
><A
36588
NAME="cv-X_RPM_PREUNINSTALL"
36589
></A
36590
><CODE
36591
CLASS="envar"
36592
>X_RPM_PREUNINSTALL</CODE
36593
></DT
36594
><DD
36595
><P
36596
> This is used to fill in the
36597
<TT
36598
CLASS="literal"
36599
>%preun:</TT
36600
>
36601
section in the RPM
36602
<TT
36603
CLASS="filename"
36604
>.spec</TT
36605
> file.
36606
</P
36607
></DD
36608
><DT
36609
><A
36610
NAME="cv-X_RPM_PROVIDES"
36611
></A
36612
><CODE
36613
CLASS="envar"
36614
>X_RPM_PROVIDES</CODE
36615
></DT
36616
><DD
36617
><P
36618
> This is used to fill in the
36619
<TT
36620
CLASS="literal"
36621
>Provides:</TT
36622
>
36623
field in the RPM
36624
<TT
36625
CLASS="filename"
36626
>.spec</TT
36627
> file.
36628
</P
36629
></DD
36630
><DT
36631
><A
36632
NAME="cv-X_RPM_REQUIRES"
36633
></A
36634
><CODE
36635
CLASS="envar"
36636
>X_RPM_REQUIRES</CODE
36637
></DT
36638
><DD
36639
><P
36640
> This is used to fill in the
36641
<TT
36642
CLASS="literal"
36643
>Requires:</TT
36644
>
36645
field in the RPM
36646
<TT
36647
CLASS="filename"
36648
>.spec</TT
36649
> file.
36650
</P
36651
></DD
36652
><DT
36653
><A
36654
NAME="cv-X_RPM_SERIAL"
36655
></A
36656
><CODE
36657
CLASS="envar"
36658
>X_RPM_SERIAL</CODE
36659
></DT
36660
><DD
36661
><P
36662
> This is used to fill in the
36663
<TT
36664
CLASS="literal"
36665
>Serial:</TT
36666
>
36667
field in the RPM
36668
<TT
36669
CLASS="filename"
36670
>.spec</TT
36671
> file.
36672
</P
36673
></DD
36674
><DT
36675
><A
36676
NAME="cv-X_RPM_URL"
36677
></A
36678
><CODE
36679
CLASS="envar"
36680
>X_RPM_URL</CODE
36681
></DT
36682
><DD
36683
><P
36684
> This is used to fill in the
36685
<TT
36686
CLASS="literal"
36687
>Url:</TT
36688
>
36689
field in the RPM
36690
<TT
36691
CLASS="filename"
36692
>.spec</TT
36693
> file.
36694
</P
36695
></DD
36696
><DT
36697
><A
36698
NAME="cv-YACC"
36699
></A
36700
><CODE
36701
CLASS="envar"
36702
>YACC</CODE
36703
></DT
36704
><DD
36705
><P
36706
> The parser generator.
36707
</P
36708
></DD
36709
><DT
36710
><A
36711
NAME="cv-YACCCOM"
36712
></A
36713
><CODE
36714
CLASS="envar"
36715
>YACCCOM</CODE
36716
></DT
36717
><DD
36718
><P
36719
> The command line used to call the parser generator
36720
to generate a source file.
36721
</P
36722
></DD
36723
><DT
36724
><A
36725
NAME="cv-YACCCOMSTR"
36726
></A
36727
><CODE
36728
CLASS="envar"
36729
>YACCCOMSTR</CODE
36730
></DT
36731
><DD
36732
><P
36733
> The string displayed when generating a source file
36734
using the parser generator.
36735
If this is not set, then <A
36736
HREF="#cv-YACCCOM"
36737
><CODE
36738
CLASS="envar"
36739
>$YACCCOM</CODE
36740
></A
36741
> (the command line) is displayed.
36742
</P
36743
><PRE
36744
CLASS="programlisting"
36745
> env = Environment(YACCCOMSTR = "Yacc'ing $TARGET from $SOURCES")
36746
</PRE
36747
></DD
36748
><DT
36749
><A
36750
NAME="cv-YACCFLAGS"
36751
></A
36752
><CODE
36753
CLASS="envar"
36754
>YACCFLAGS</CODE
36755
></DT
36756
><DD
36757
><P
36758
> General options passed to the parser generator.
36759
If <A
36760
HREF="#cv-YACCFLAGS"
36761
><CODE
36762
CLASS="envar"
36763
>$YACCFLAGS</CODE
36764
></A
36765
> contains a <CODE
36766
CLASS="option"
36767
>-d</CODE
36768
> option,
36769
SCons assumes that the call will also create a .h file
36770
(if the yacc source file ends in a .y suffix)
36771
or a .hpp file
36772
(if the yacc source file ends in a .yy suffix)
36773
</P
36774
></DD
36775
><DT
36776
><A
36777
NAME="cv-YACCHFILESUFFIX"
36778
></A
36779
><CODE
36780
CLASS="envar"
36781
>YACCHFILESUFFIX</CODE
36782
></DT
36783
><DD
36784
><P
36785
> The suffix of the C
36786
header file generated by the parser generator
36787
when the
36788
<CODE
36789
CLASS="option"
36790
>-d</CODE
36791
>
36792
option is used.
36793
Note that setting this variable does not cause
36794
the parser generator to generate a header
36795
file with the specified suffix,
36796
it exists to allow you to specify
36797
what suffix the parser generator will use of its own accord.
36798
The default value is
36799
<TT
36800
CLASS="filename"
36801
>.h</TT
36802
>.
36803
</P
36804
></DD
36805
><DT
36806
><A
36807
NAME="cv-YACCHXXFILESUFFIX"
36808
></A
36809
><CODE
36810
CLASS="envar"
36811
>YACCHXXFILESUFFIX</CODE
36812
></DT
36813
><DD
36814
><P
36815
> The suffix of the C++
36816
header file generated by the parser generator
36817
when the
36818
<CODE
36819
CLASS="option"
36820
>-d</CODE
36821
>
36822
option is used.
36823
Note that setting this variable does not cause
36824
the parser generator to generate a header
36825
file with the specified suffix,
36826
it exists to allow you to specify
36827
what suffix the parser generator will use of its own accord.
36828
The default value is
36829
<TT
36830
CLASS="filename"
36831
>.hpp</TT
36832
>,
36833
except on Mac OS X,
36834
where the default is
36835
<TT
36836
CLASS="filename"
36837
>${TARGET.suffix}.h</TT
36838
>.
36839
because the default <SPAN
36840
CLASS="application"
36841
>bison</SPAN
36842
> parser generator just
36843
appends <TT
36844
CLASS="filename"
36845
>.h</TT
36846
>
36847
to the name of the generated C++ file.
36848
</P
36849
></DD
36850
><DT
36851
><A
36852
NAME="cv-YACCVCGFILESUFFIX"
36853
></A
36854
><CODE
36855
CLASS="envar"
36856
>YACCVCGFILESUFFIX</CODE
36857
></DT
36858
><DD
36859
><P
36860
> The suffix of the file
36861
containing the VCG grammar automaton definition
36862
when the
36863
<CODE
36864
CLASS="option"
36865
>--graph=</CODE
36866
>
36867
option is used.
36868
Note that setting this variable does not cause
36869
the parser generator to generate a VCG
36870
file with the specified suffix,
36871
it exists to allow you to specify
36872
what suffix the parser generator will use of its own accord.
36873
The default value is
36874
<TT
36875
CLASS="filename"
36876
>.vcg</TT
36877
>.
36878
</P
36879
></DD
36880
><DT
36881
><A
36882
NAME="cv-ZIP"
36883
></A
36884
><CODE
36885
CLASS="envar"
36886
>ZIP</CODE
36887
></DT
36888
><DD
36889
><P
36890
> The zip compression and file packaging utility.
36891
</P
36892
></DD
36893
><DT
36894
><A
36895
NAME="cv-ZIPCOM"
36896
></A
36897
><CODE
36898
CLASS="envar"
36899
>ZIPCOM</CODE
36900
></DT
36901
><DD
36902
><P
36903
> The command line used to call the zip utility,
36904
or the internal Python function used to create a
36905
zip archive.
36906
</P
36907
></DD
36908
><DT
36909
><A
36910
NAME="cv-ZIPCOMPRESSION"
36911
></A
36912
><CODE
36913
CLASS="envar"
36914
>ZIPCOMPRESSION</CODE
36915
></DT
36916
><DD
36917
><P
36918
> The
36919
<CODE
36920
CLASS="varname"
36921
>compression</CODE
36922
>
36923
flag
36924
from the Python
36925
<TT
36926
CLASS="filename"
36927
>zipfile</TT
36928
>
36929
module used by the internal Python function
36930
to control whether the zip archive
36931
is compressed or not.
36932
The default value is
36933
<TT
36934
CLASS="literal"
36935
>zipfile.ZIP_DEFLATED</TT
36936
>,
36937
which creates a compressed zip archive.
36938
This value has no effect when using Python 1.5.2
36939
or if the
36940
<TT
36941
CLASS="literal"
36942
>zipfile</TT
36943
>
36944
module is otherwise unavailable.
36945
</P
36946
></DD
36947
><DT
36948
><A
36949
NAME="cv-ZIPCOMSTR"
36950
></A
36951
><CODE
36952
CLASS="envar"
36953
>ZIPCOMSTR</CODE
36954
></DT
36955
><DD
36956
><P
36957
> The string displayed when archiving files
36958
using the zip utility.
36959
If this is not set, then <A
36960
HREF="#cv-ZIPCOM"
36961
><CODE
36962
CLASS="envar"
36963
>$ZIPCOM</CODE
36964
></A
36965
>
36966
(the command line or internal Python function) is displayed.
36967
</P
36968
><PRE
36969
CLASS="programlisting"
36970
> env = Environment(ZIPCOMSTR = "Zipping $TARGET")
36971
</PRE
36972
></DD
36973
><DT
36974
><A
36975
NAME="cv-ZIPFLAGS"
36976
></A
36977
><CODE
36978
CLASS="envar"
36979
>ZIPFLAGS</CODE
36980
></DT
36981
><DD
36982
><P
36983
> General options passed to the zip utility.
36984
</P
36985
></DD
36986
><DT
36987
><A
36988
NAME="cv-ZIPSUFFIX"
36989
></A
36990
><CODE
36991
CLASS="envar"
36992
>ZIPSUFFIX</CODE
36993
></DT
36994
><DD
36995
><P
36996
> The suffix used for zip file names.
36997
</P
36998
></DD
36999
></DL
37000
></DIV
37001
></DIV
37002
><DIV
37003
CLASS="appendix"
37004
><HR><H1
37005
><A
37006
NAME="app-builders"
37007
></A
37008
>Appendix B. Builders</H1
37009
><P
37010
>
37011
This appendix contains descriptions of all of the
37012
Builders that are <SPAN
37013
CLASS="emphasis"
37014
><I
37015
CLASS="emphasis"
37016
>potentially</I
37017
></SPAN
37018
>
37019
available "out of the box" in this version of SCons.
37020
37021
</P
37022
><P
37023
></P
37024
><DIV
37025
CLASS="variablelist"
37026
><DL
37027
><DT
37028
><A
37029
NAME="b-CFile"
37030
></A
37031
><CODE
37032
CLASS="function"
37033
>CFile()</CODE
37034
>, <CODE
37035
CLASS="function"
37036
>env.CFile()</CODE
37037
></DT
37038
><DD
37039
><P
37040
> Builds a C source file given a lex (<TT
37041
CLASS="filename"
37042
>.l</TT
37043
>)
37044
or yacc (<TT
37045
CLASS="filename"
37046
>.y</TT
37047
>) input file.
37048
The suffix specified by the <A
37049
HREF="#cv-CFILESUFFIX"
37050
><CODE
37051
CLASS="envar"
37052
>$CFILESUFFIX</CODE
37053
></A
37054
> construction variable
37055
(<TT
37056
CLASS="filename"
37057
>.c</TT
37058
> by default)
37059
is automatically added to the target
37060
if it is not already present.
37061
Example:
37062
</P
37063
><PRE
37064
CLASS="programlisting"
37065
> # builds foo.c
37066
env.CFile(target = 'foo.c', source = 'foo.l')
37067
# builds bar.c
37068
env.CFile(target = 'bar', source = 'bar.y')
37069
</PRE
37070
></DD
37071
><DT
37072
><A
37073
NAME="b-CXXFile"
37074
></A
37075
><CODE
37076
CLASS="function"
37077
>CXXFile()</CODE
37078
>, <CODE
37079
CLASS="function"
37080
>env.CXXFile()</CODE
37081
></DT
37082
><DD
37083
><P
37084
> Builds a C++ source file given a lex (<TT
37085
CLASS="filename"
37086
>.ll</TT
37087
>)
37088
or yacc (<TT
37089
CLASS="filename"
37090
>.yy</TT
37091
>)
37092
input file.
37093
The suffix specified by the <A
37094
HREF="#cv-CXXFILESUFFIX"
37095
><CODE
37096
CLASS="envar"
37097
>$CXXFILESUFFIX</CODE
37098
></A
37099
> construction variable
37100
(<TT
37101
CLASS="filename"
37102
>.cc</TT
37103
> by default)
37104
is automatically added to the target
37105
if it is not already present.
37106
Example:
37107
</P
37108
><PRE
37109
CLASS="programlisting"
37110
> # builds foo.cc
37111
env.CXXFile(target = 'foo.cc', source = 'foo.ll')
37112
# builds bar.cc
37113
env.CXXFile(target = 'bar', source = 'bar.yy')
37114
</PRE
37115
></DD
37116
><DT
37117
><A
37118
NAME="b-DVI"
37119
></A
37120
><CODE
37121
CLASS="function"
37122
>DVI()</CODE
37123
>, <CODE
37124
CLASS="function"
37125
>env.DVI()</CODE
37126
></DT
37127
><DD
37128
><P
37129
> Builds a <TT
37130
CLASS="filename"
37131
>.dvi</TT
37132
> file
37133
from a <TT
37134
CLASS="filename"
37135
>.tex</TT
37136
>,
37137
<TT
37138
CLASS="filename"
37139
>.ltx</TT
37140
> or <TT
37141
CLASS="filename"
37142
>.latex</TT
37143
> input file.
37144
If the source file suffix is <TT
37145
CLASS="filename"
37146
>.tex</TT
37147
>,
37148
<SPAN
37149
CLASS="application"
37150
>scons</SPAN
37151
>
37152
will examine the contents of the file;
37153
if the string
37154
<TT
37155
CLASS="literal"
37156
>\documentclass</TT
37157
>
37158
or
37159
<TT
37160
CLASS="literal"
37161
>\documentstyle</TT
37162
>
37163
is found, the file is assumed to be a LaTeX file and
37164
the target is built by invoking the <A
37165
HREF="#cv-LATEXCOM"
37166
><CODE
37167
CLASS="envar"
37168
>$LATEXCOM</CODE
37169
></A
37170
> command line;
37171
otherwise, the <A
37172
HREF="#cv-TEXCOM"
37173
><CODE
37174
CLASS="envar"
37175
>$TEXCOM</CODE
37176
></A
37177
> command line is used.
37178
If the file is a LaTeX file,
37179
the
37180
<CODE
37181
CLASS="function"
37182
>DVI</CODE
37183
>
37184
builder method will also examine the contents
37185
of the
37186
<TT
37187
CLASS="filename"
37188
>.aux</TT
37189
>
37190
file and invoke the <A
37191
HREF="#cv-BIBTEX"
37192
><CODE
37193
CLASS="envar"
37194
>$BIBTEX</CODE
37195
></A
37196
> command line
37197
if the string
37198
<TT
37199
CLASS="literal"
37200
>bibdata</TT
37201
>
37202
is found,
37203
start <A
37204
HREF="#cv-MAKEINDEX"
37205
><CODE
37206
CLASS="envar"
37207
>$MAKEINDEX</CODE
37208
></A
37209
> to generate an index if a
37210
<TT
37211
CLASS="filename"
37212
>.ind</TT
37213
>
37214
file is found
37215
and will examine the contents
37216
<TT
37217
CLASS="filename"
37218
>.log</TT
37219
>
37220
file and re-run the <A
37221
HREF="#cv-LATEXCOM"
37222
><CODE
37223
CLASS="envar"
37224
>$LATEXCOM</CODE
37225
></A
37226
> command
37227
if the log file says it is necessary.</P
37228
><P
37229
>The suffix <TT
37230
CLASS="filename"
37231
>.dvi</TT
37232
>
37233
(hard-coded within TeX itself)
37234
is automatically added to the target
37235
if it is not already present.
37236
Examples:
37237
</P
37238
><PRE
37239
CLASS="programlisting"
37240
> # builds from aaa.tex
37241
env.DVI(target = 'aaa.dvi', source = 'aaa.tex')
37242
# builds bbb.dvi
37243
env.DVI(target = 'bbb', source = 'bbb.ltx')
37244
# builds from ccc.latex
37245
env.DVI(target = 'ccc.dvi', source = 'ccc.latex')
37246
</PRE
37247
></DD
37248
><DT
37249
><A
37250
NAME="b-Install"
37251
></A
37252
><CODE
37253
CLASS="function"
37254
>Install()</CODE
37255
>, <CODE
37256
CLASS="function"
37257
>env.Install()</CODE
37258
></DT
37259
><DD
37260
><P
37261
> Installs one or more source files or directories
37262
in the specified target,
37263
which must be a directory.
37264
The names of the specified source files or directories
37265
remain the same within the destination directory.
37266
</P
37267
><PRE
37268
CLASS="programlisting"
37269
> env.Install('/usr/local/bin', source = ['foo', 'bar'])
37270
</PRE
37271
></DD
37272
><DT
37273
><A
37274
NAME="b-InstallAs"
37275
></A
37276
><CODE
37277
CLASS="function"
37278
>InstallAs()</CODE
37279
>, <CODE
37280
CLASS="function"
37281
>env.InstallAs()</CODE
37282
></DT
37283
><DD
37284
><P
37285
> Installs one or more source files or directories
37286
to specific names,
37287
allowing changing a file or directory name
37288
as part of the installation.
37289
It is an error if the
37290
target
37291
and
37292
source
37293
arguments list different numbers of files or directories.
37294
</P
37295
><PRE
37296
CLASS="programlisting"
37297
> env.InstallAs(target = '/usr/local/bin/foo',
37298
source = 'foo_debug')
37299
env.InstallAs(target = ['../lib/libfoo.a', '../lib/libbar.a'],
37300
source = ['libFOO.a', 'libBAR.a'])
37301
</PRE
37302
></DD
37303
><DT
37304
><A
37305
NAME="b-Jar"
37306
></A
37307
><CODE
37308
CLASS="function"
37309
>Jar()</CODE
37310
>, <CODE
37311
CLASS="function"
37312
>env.Jar()</CODE
37313
></DT
37314
><DD
37315
><P
37316
> Builds a Java archive (<TT
37317
CLASS="filename"
37318
>.jar</TT
37319
>) file
37320
from the specified list of sources.
37321
Any directories in the source list
37322
will be searched for <TT
37323
CLASS="filename"
37324
>.class</TT
37325
> files).
37326
Any <TT
37327
CLASS="filename"
37328
>.java</TT
37329
> files in the source list
37330
will be compiled to <TT
37331
CLASS="filename"
37332
>.class</TT
37333
> files
37334
by calling the <A
37335
HREF="#b-Java"
37336
><CODE
37337
CLASS="function"
37338
>Java</CODE
37339
></A
37340
> Builder.</P
37341
><P
37342
>If the <A
37343
HREF="#cv-JARCHDIR"
37344
><CODE
37345
CLASS="envar"
37346
>$JARCHDIR</CODE
37347
></A
37348
> value is set, the
37349
<SPAN
37350
CLASS="application"
37351
>jar</SPAN
37352
>
37353
command will change to the specified directory using the
37354
<CODE
37355
CLASS="option"
37356
>-C</CODE
37357
>
37358
option.
37359
If <CODE
37360
CLASS="envar"
37361
>$JARCHDIR</CODE
37362
> is not set explicitly,
37363
<SPAN
37364
CLASS="application"
37365
>SCons</SPAN
37366
> will use the top of any subdirectory tree
37367
in which Java <TT
37368
CLASS="filename"
37369
>.class</TT
37370
>
37371
were built by the <A
37372
HREF="#b-Java"
37373
><CODE
37374
CLASS="function"
37375
>Java</CODE
37376
></A
37377
> Builder.</P
37378
><P
37379
>If the contents any of the source files begin with the string
37380
<TT
37381
CLASS="literal"
37382
>Manifest-Version</TT
37383
>,
37384
the file is assumed to be a manifest
37385
and is passed to the
37386
<SPAN
37387
CLASS="application"
37388
>jar</SPAN
37389
>
37390
command with the
37391
<CODE
37392
CLASS="option"
37393
>m</CODE
37394
>
37395
option set.
37396
</P
37397
><PRE
37398
CLASS="programlisting"
37399
> env.Jar(target = 'foo.jar', source = 'classes')
37400
37401
env.Jar(target = 'bar.jar',
37402
source = ['bar1.java', 'bar2.java'])
37403
</PRE
37404
></DD
37405
><DT
37406
><A
37407
NAME="b-Java"
37408
></A
37409
><CODE
37410
CLASS="function"
37411
>Java()</CODE
37412
>, <CODE
37413
CLASS="function"
37414
>env.Java()</CODE
37415
></DT
37416
><DD
37417
><P
37418
> Builds one or more Java class files.
37419
The sources may be any combination of explicit
37420
<TT
37421
CLASS="filename"
37422
>.java</TT
37423
> files,
37424
or directory trees which will be scanned
37425
for <TT
37426
CLASS="filename"
37427
>.java</TT
37428
> files.</P
37429
><P
37430
>SCons will parse each source <TT
37431
CLASS="filename"
37432
>.java</TT
37433
> file
37434
to find the classes
37435
(including inner classes)
37436
defined within that file,
37437
and from that figure out the
37438
target <TT
37439
CLASS="filename"
37440
>.class</TT
37441
> files that will be created.
37442
The class files will be placed underneath
37443
the specified target directory.</P
37444
><P
37445
>SCons will also search each Java file
37446
for the Java package name,
37447
which it assumes can be found on a line
37448
beginning with the string
37449
<TT
37450
CLASS="literal"
37451
>package</TT
37452
>
37453
in the first column;
37454
the resulting <TT
37455
CLASS="filename"
37456
>.class</TT
37457
> files
37458
will be placed in a directory reflecting
37459
the specified package name.
37460
For example,
37461
the file
37462
<TT
37463
CLASS="filename"
37464
>Foo.java</TT
37465
>
37466
defining a single public
37467
<CODE
37468
CLASS="classname"
37469
>Foo</CODE
37470
>
37471
class and
37472
containing a package name of
37473
<CODE
37474
CLASS="classname"
37475
>sub.dir</CODE
37476
>
37477
will generate a corresponding
37478
<TT
37479
CLASS="filename"
37480
>sub/dir/Foo.class</TT
37481
>
37482
class file.</P
37483
><P
37484
>Examples:
37485
</P
37486
><PRE
37487
CLASS="programlisting"
37488
> env.Java(target = 'classes', source = 'src')
37489
env.Java(target = 'classes', source = ['src1', 'src2'])
37490
env.Java(target = 'classes', source = ['File1.java', 'File2.java'])
37491
</PRE
37492
><P
37493
> Java source files can use the native encoding for the underlying OS.
37494
Since SCons compiles in simple ASCII mode by default,
37495
the compiler will generate warnings about unmappable characters,
37496
which may lead to errors as the file is processed further.
37497
In this case, the user must specify the <TT
37498
CLASS="literal"
37499
>LANG</TT
37500
>
37501
environment variable to tell the compiler what encoding is uesd.
37502
For portibility, it's best if the encoding is hard-coded
37503
so that the compile will work if it is done on a system
37504
with a different encoding.
37505
</P
37506
><PRE
37507
CLASS="programlisting"
37508
> env = Environment()
37509
env['ENV']['LANG'] = 'en_GB.UTF-8'
37510
</PRE
37511
></DD
37512
><DT
37513
><A
37514
NAME="b-JavaH"
37515
></A
37516
><CODE
37517
CLASS="function"
37518
>JavaH()</CODE
37519
>, <CODE
37520
CLASS="function"
37521
>env.JavaH()</CODE
37522
></DT
37523
><DD
37524
><P
37525
> Builds C header and source files for
37526
implementing Java native methods.
37527
The target can be either a directory
37528
in which the header files will be written,
37529
or a header file name which
37530
will contain all of the definitions.
37531
The source can be the names of <TT
37532
CLASS="filename"
37533
>.class</TT
37534
> files,
37535
the names of <TT
37536
CLASS="filename"
37537
>.java</TT
37538
> files
37539
to be compiled into <TT
37540
CLASS="filename"
37541
>.class</TT
37542
> files
37543
by calling the <A
37544
HREF="#b-Java"
37545
><CODE
37546
CLASS="function"
37547
>Java</CODE
37548
></A
37549
> builder method,
37550
or the objects returned from the
37551
<CODE
37552
CLASS="function"
37553
>Java</CODE
37554
>
37555
builder method.</P
37556
><P
37557
>If the construction variable
37558
<A
37559
HREF="#cv-JAVACLASSDIR"
37560
><CODE
37561
CLASS="envar"
37562
>$JAVACLASSDIR</CODE
37563
></A
37564
>
37565
is set, either in the environment
37566
or in the call to the
37567
<CODE
37568
CLASS="function"
37569
>JavaH</CODE
37570
>
37571
builder method itself,
37572
then the value of the variable
37573
will be stripped from the
37574
beginning of any <TT
37575
CLASS="filename"
37576
>.class</TT
37577
> file names.</P
37578
><P
37579
>Examples:
37580
</P
37581
><PRE
37582
CLASS="programlisting"
37583
> # builds java_native.h
37584
classes = env.Java(target = 'classdir', source = 'src')
37585
env.JavaH(target = 'java_native.h', source = classes)
37586
37587
# builds include/package_foo.h and include/package_bar.h
37588
env.JavaH(target = 'include',
37589
source = ['package/foo.class', 'package/bar.class'])
37590
37591
# builds export/foo.h and export/bar.h
37592
env.JavaH(target = 'export',
37593
source = ['classes/foo.class', 'classes/bar.class'],
37594
JAVACLASSDIR = 'classes')
37595
</PRE
37596
></DD
37597
><DT
37598
><A
37599
NAME="b-Library"
37600
></A
37601
><CODE
37602
CLASS="function"
37603
>Library()</CODE
37604
>, <CODE
37605
CLASS="function"
37606
>env.Library()</CODE
37607
></DT
37608
><DD
37609
><P
37610
> A synonym for the
37611
<CODE
37612
CLASS="function"
37613
>StaticLibrary</CODE
37614
>
37615
builder method.
37616
</P
37617
></DD
37618
><DT
37619
><A
37620
NAME="b-LoadableModule"
37621
></A
37622
><CODE
37623
CLASS="function"
37624
>LoadableModule()</CODE
37625
>, <CODE
37626
CLASS="function"
37627
>env.LoadableModule()</CODE
37628
></DT
37629
><DD
37630
><P
37631
> On most systems,
37632
this is the same as
37633
<CODE
37634
CLASS="function"
37635
>SharedLibrary</CODE
37636
>.
37637
On Mac OS X (Darwin) platforms,
37638
this creates a loadable module bundle.
37639
</P
37640
></DD
37641
><DT
37642
><A
37643
NAME="b-M4"
37644
></A
37645
><CODE
37646
CLASS="function"
37647
>M4()</CODE
37648
>, <CODE
37649
CLASS="function"
37650
>env.M4()</CODE
37651
></DT
37652
><DD
37653
><P
37654
> Builds an output file from an M4 input file.
37655
This uses a default <A
37656
HREF="#cv-M4FLAGS"
37657
><CODE
37658
CLASS="envar"
37659
>$M4FLAGS</CODE
37660
></A
37661
> value of
37662
<CODE
37663
CLASS="option"
37664
>-E</CODE
37665
>,
37666
which considers all warnings to be fatal
37667
and stops on the first warning
37668
when using the GNU version of m4.
37669
Example:
37670
</P
37671
><PRE
37672
CLASS="programlisting"
37673
> env.M4(target = 'foo.c', source = 'foo.c.m4')
37674
</PRE
37675
></DD
37676
><DT
37677
><A
37678
NAME="b-Moc"
37679
></A
37680
><CODE
37681
CLASS="function"
37682
>Moc()</CODE
37683
>, <CODE
37684
CLASS="function"
37685
>env.Moc()</CODE
37686
></DT
37687
><DD
37688
><P
37689
> Builds an output file from a moc input file. Moc input files are either
37690
header files or cxx files. This builder is only available after using the
37691
tool 'qt'. See the <A
37692
HREF="#cv-QTDIR"
37693
><CODE
37694
CLASS="envar"
37695
>$QTDIR</CODE
37696
></A
37697
> variable for more information.
37698
Example:
37699
</P
37700
><PRE
37701
CLASS="programlisting"
37702
> env.Moc('foo.h') # generates moc_foo.cc
37703
env.Moc('foo.cpp') # generates foo.moc
37704
</PRE
37705
></DD
37706
><DT
37707
><A
37708
NAME="b-MSVSProject"
37709
></A
37710
><CODE
37711
CLASS="function"
37712
>MSVSProject()</CODE
37713
>, <CODE
37714
CLASS="function"
37715
>env.MSVSProject()</CODE
37716
></DT
37717
><DD
37718
><P
37719
> Builds a Microsoft Visual Studio project file,
37720
and by default builds a solution file as well.</P
37721
><P
37722
>This builds a Visual Studio project file, based on the version of
37723
Visual Studio that is configured (either the latest installed version,
37724
or the version specified by
37725
<A
37726
HREF="#cv-MSVS_VERSION"
37727
><CODE
37728
CLASS="envar"
37729
>$MSVS_VERSION</CODE
37730
></A
37731
>
37732
in the Environment constructor).
37733
For Visual Studio 6, it will generate a
37734
<TT
37735
CLASS="filename"
37736
>.dsp</TT
37737
>
37738
file.
37739
For Visual Studio 7 (.NET) and later versions, it will generate a
37740
<TT
37741
CLASS="filename"
37742
>.vcproj</TT
37743
>
37744
file.</P
37745
><P
37746
>By default,
37747
this also generates a solution file
37748
for the specified project,
37749
a
37750
<TT
37751
CLASS="filename"
37752
>.dsw</TT
37753
>
37754
file for Visual Studio 6
37755
or a
37756
<TT
37757
CLASS="filename"
37758
>.sln</TT
37759
>
37760
file for Visual Studio 7 (.NET).
37761
This behavior may be disabled by specifying
37762
<TT
37763
CLASS="literal"
37764
>auto_build_solution=0</TT
37765
>
37766
when you call
37767
<CODE
37768
CLASS="function"
37769
>MSVSProject</CODE
37770
>,
37771
in which case you presumably want to
37772
build the solution file(s)
37773
by calling the
37774
<CODE
37775
CLASS="function"
37776
>MSVSSolution</CODE
37777
>
37778
Builder (see below).</P
37779
><P
37780
>The <CODE
37781
CLASS="function"
37782
>MSVSProject</CODE
37783
> builder
37784
takes several lists of filenames
37785
to be placed into the project file.
37786
These are currently limited to
37787
<TT
37788
CLASS="literal"
37789
>srcs</TT
37790
>,
37791
<TT
37792
CLASS="literal"
37793
>incs</TT
37794
>,
37795
<TT
37796
CLASS="literal"
37797
>localincs</TT
37798
>,
37799
<TT
37800
CLASS="literal"
37801
>resources</TT
37802
>,
37803
and
37804
<TT
37805
CLASS="literal"
37806
>misc</TT
37807
>.
37808
These are pretty self-explanatory, but it should be noted that these
37809
lists are added to the <A
37810
HREF="#cv-SOURCES"
37811
><CODE
37812
CLASS="envar"
37813
>$SOURCES</CODE
37814
></A
37815
> construction variable as strings,
37816
NOT as SCons File Nodes. This is because they represent file
37817
names to be added to the project file, not the source files used to
37818
build the project file.</P
37819
><P
37820
>The above filename lists are all optional,
37821
although at least one must be specified
37822
for the resulting project file to be non-empty.</P
37823
><P
37824
>In addition to the above lists of values,
37825
the following values may be specified:</P
37826
><P
37827
><TT
37828
CLASS="literal"
37829
>target</TT
37830
>:
37831
The name of the target
37832
<TT
37833
CLASS="filename"
37834
>.dsp</TT
37835
>
37836
or
37837
<TT
37838
CLASS="filename"
37839
>.vcproj</TT
37840
>
37841
file.
37842
The correct
37843
suffix for the version of Visual Studio must be used,
37844
but the
37845
<A
37846
HREF="#cv-MSVSPROJECTSUFFIX"
37847
><CODE
37848
CLASS="envar"
37849
>$MSVSPROJECTSUFFIX</CODE
37850
></A
37851
>
37852
construction variable
37853
will be defined to the correct value (see example below).</P
37854
><P
37855
><TT
37856
CLASS="literal"
37857
>variant</TT
37858
>:
37859
The name of this particular variant.
37860
For Visual Studio 7 projects,
37861
this can also be a list of variant names.
37862
These are typically things like "Debug" or "Release", but really
37863
can be anything you want.
37864
For Visual Studio 7 projects,
37865
they may also specify a target platform
37866
separated from the variant name by a
37867
<TT
37868
CLASS="literal"
37869
>|</TT
37870
>
37871
(vertical pipe)
37872
character:
37873
<TT
37874
CLASS="literal"
37875
>Debug|Xbox</TT
37876
>.
37877
The default target platform is Win32.
37878
Multiple calls to
37879
<CODE
37880
CLASS="function"
37881
>MSVSProject</CODE
37882
>
37883
with different variants are allowed;
37884
all variants will be added to the project file with their appropriate
37885
build targets and sources.</P
37886
><P
37887
><TT
37888
CLASS="literal"
37889
>buildtarget</TT
37890
>:
37891
An optional string, node, or list of strings or nodes
37892
(one per build variant), to tell the Visual Studio debugger
37893
what output target to use in what build variant.
37894
The number of
37895
<TT
37896
CLASS="literal"
37897
>buildtarget</TT
37898
>
37899
entries must match the number of
37900
<TT
37901
CLASS="literal"
37902
>variant</TT
37903
>
37904
entries.</P
37905
><P
37906
><TT
37907
CLASS="literal"
37908
>runfile</TT
37909
>:
37910
The name of the file that Visual Studio 7 and later
37911
will run and debug.
37912
This appears as the value of the
37913
<TT
37914
CLASS="literal"
37915
>Output</TT
37916
>
37917
field in the resutling Visual Studio project file.
37918
If this is not specified,
37919
the default is the same as the specified
37920
<TT
37921
CLASS="literal"
37922
>buildtarget</TT
37923
>
37924
value.</P
37925
><P
37926
>Note that because <SPAN
37927
CLASS="application"
37928
>SCons</SPAN
37929
> always executes its build commands
37930
from the directory in which the <TT
37931
CLASS="filename"
37932
>SConstruct</TT
37933
> file is located,
37934
if you generate a project file in a different directory
37935
than the <TT
37936
CLASS="filename"
37937
>SConstruct</TT
37938
> directory,
37939
users will not be able to double-click
37940
on the file name in compilation error messages
37941
displayed in the Visual Studio console output window.
37942
This can be remedied by adding the
37943
Visual C/C++
37944
.B /FC
37945
compiler option to the <A
37946
HREF="#cv-CCFLAGS"
37947
><CODE
37948
CLASS="envar"
37949
>$CCFLAGS</CODE
37950
></A
37951
> variable
37952
so that the compiler will print
37953
the full path name of any
37954
files that cause compilation errors.</P
37955
><P
37956
>Example usage:
37957
</P
37958
><PRE
37959
CLASS="programlisting"
37960
> barsrcs = ['bar.cpp'],
37961
barincs = ['bar.h'],
37962
barlocalincs = ['StdAfx.h']
37963
barresources = ['bar.rc','resource.h']
37964
barmisc = ['bar_readme.txt']
37965
37966
dll = env.SharedLibrary(target = 'bar.dll',
37967
source = barsrcs)
37968
37969
env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'],
37970
srcs = barsrcs,
37971
incs = barincs,
37972
localincs = barlocalincs,
37973
resources = barresources,
37974
misc = barmisc,
37975
buildtarget = dll,
37976
variant = 'Release')
37977
</PRE
37978
></DD
37979
><DT
37980
><A
37981
NAME="b-MSVSSolution"
37982
></A
37983
><CODE
37984
CLASS="function"
37985
>MSVSSolution()</CODE
37986
>, <CODE
37987
CLASS="function"
37988
>env.MSVSSolution()</CODE
37989
></DT
37990
><DD
37991
><P
37992
> Builds a Microsoft Visual Studio solution file.</P
37993
><P
37994
>This builds a Visual Studio solution file,
37995
based on the version of Visual Studio that is configured
37996
(either the latest installed version,
37997
or the version specified by
37998
<A
37999
HREF="#cv-MSVS_VERSION"
38000
><CODE
38001
CLASS="envar"
38002
>$MSVS_VERSION</CODE
38003
></A
38004
>
38005
in the construction environment).
38006
For Visual Studio 6, it will generate a
38007
<TT
38008
CLASS="filename"
38009
>.dsw</TT
38010
>
38011
file.
38012
For Visual Studio 7 (.NET), it will
38013
generate a
38014
<TT
38015
CLASS="filename"
38016
>.sln</TT
38017
>
38018
file.</P
38019
><P
38020
>The following values must be specified:</P
38021
><P
38022
><TT
38023
CLASS="literal"
38024
>target</TT
38025
>:
38026
The name of the target .dsw or .sln file. The correct
38027
suffix for the version of Visual Studio must be used, but the value
38028
<A
38029
HREF="#cv-MSVSSOLUTIONSUFFIX"
38030
><CODE
38031
CLASS="envar"
38032
>$MSVSSOLUTIONSUFFIX</CODE
38033
></A
38034
>
38035
will be defined to the correct value (see example below).</P
38036
><P
38037
><TT
38038
CLASS="literal"
38039
>variant</TT
38040
>:
38041
The name of this particular variant, or a list of variant
38042
names (the latter is only supported for MSVS 7 solutions). These are
38043
typically things like "Debug" or "Release", but really can be anything
38044
you want. For MSVS 7 they may also specify target platform, like this
38045
"Debug|Xbox". Default platform is Win32.</P
38046
><P
38047
><TT
38048
CLASS="literal"
38049
>projects</TT
38050
>:
38051
A list of project file names, or Project nodes returned by calls to the
38052
<CODE
38053
CLASS="function"
38054
>MSVSProject</CODE
38055
>
38056
Builder,
38057
to be placed into the solution file.
38058
It should be noted that these file names are NOT added to the $SOURCES
38059
environment variable in form of files, but rather as strings. This
38060
is because they represent file names to be added to the solution file,
38061
not the source files used to build the solution file.</P
38062
><P
38063
>(NOTE: Currently only one project is supported per solution.)</P
38064
><P
38065
>Example Usage:
38066
</P
38067
><PRE
38068
CLASS="programlisting"
38069
> env.MSVSSolution(target = 'Bar' + env['MSVSSOLUTIONSUFFIX'],
38070
projects = ['bar' + env['MSVSPROJECTSUFFIX']],
38071
variant = 'Release')
38072
</PRE
38073
></DD
38074
><DT
38075
><A
38076
NAME="b-Object"
38077
></A
38078
><CODE
38079
CLASS="function"
38080
>Object()</CODE
38081
>, <CODE
38082
CLASS="function"
38083
>env.Object()</CODE
38084
></DT
38085
><DD
38086
><P
38087
> A synonym for the
38088
<CODE
38089
CLASS="function"
38090
>StaticObject</CODE
38091
>
38092
builder method.
38093
</P
38094
></DD
38095
><DT
38096
><A
38097
NAME="b-Package"
38098
></A
38099
><CODE
38100
CLASS="function"
38101
>Package()</CODE
38102
>, <CODE
38103
CLASS="function"
38104
>env.Package()</CODE
38105
></DT
38106
><DD
38107
><P
38108
> Builds software distribution packages.
38109
Packages consist of files to install and packaging information.
38110
The former may be specified with the <CODE
38111
CLASS="varname"
38112
>source</CODE
38113
> parameter and may be left out,
38114
in which case the <CODE
38115
CLASS="function"
38116
>FindInstalledFiles</CODE
38117
> function will collect
38118
all files that have an <CODE
38119
CLASS="function"
38120
>Install</CODE
38121
> or <CODE
38122
CLASS="function"
38123
>InstallAs</CODE
38124
> Builder attached.
38125
If the <CODE
38126
CLASS="varname"
38127
>target</CODE
38128
> is not specified
38129
it will be deduced from additional information given to this Builder.</P
38130
><P
38131
>The packaging information is specified
38132
with the help of construction variables documented below.
38133
This information is called a tag to stress that
38134
some of them can also be attached to files with the <CODE
38135
CLASS="function"
38136
>Tag</CODE
38137
> function.
38138
The mandatory ones will complain if they were not specified.
38139
They vary depending on chosen target packager.</P
38140
><P
38141
>The target packager may be selected with the "PACKAGETYPE" command line
38142
option or with the <CODE
38143
CLASS="envar"
38144
>$PACKAGETYPE</CODE
38145
> construction variable. Currently
38146
the following packagers available:</P
38147
><P
38148
> * msi - Microsoft Installer
38149
* rpm - Redhat Package Manger
38150
* ipkg - Itsy Package Management System
38151
* tarbz2 - compressed tar
38152
* targz - compressed tar
38153
* zip - zip file
38154
* src_tarbz2 - compressed tar source
38155
* src_targz - compressed tar source
38156
* src_zip - zip file source</P
38157
><P
38158
>An updated list is always available under the "package_type" option when
38159
running "scons --help" on a project that has packaging activated.
38160
</P
38161
><PRE
38162
CLASS="programlisting"
38163
> env = Environment(tools=['default', 'packaging'])
38164
env.Install('/bin/', 'my_program')
38165
env.Package( NAME = 'foo',
38166
VERSION = '1.2.3',
38167
PACKAGEVERSION = 0,
38168
PACKAGETYPE = 'rpm',
38169
LICENSE = 'gpl',
38170
SUMMARY = 'balalalalal',
38171
DESCRIPTION = 'this should be really really long',
38172
X_RPM_GROUP = 'Application/fu',
38173
SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
38174
)
38175
</PRE
38176
></DD
38177
><DT
38178
><A
38179
NAME="b-PCH"
38180
></A
38181
><CODE
38182
CLASS="function"
38183
>PCH()</CODE
38184
>, <CODE
38185
CLASS="function"
38186
>env.PCH()</CODE
38187
></DT
38188
><DD
38189
><P
38190
> Builds a Microsoft Visual C++ precompiled header.
38191
Calling this builder method
38192
returns a list of two targets: the PCH as the first element, and the object
38193
file as the second element. Normally the object file is ignored.
38194
This builder method is only
38195
provided when Microsoft Visual C++ is being used as the compiler.
38196
The PCH builder method is generally used in
38197
conjuction with the PCH construction variable to force object files to use
38198
the precompiled header:
38199
</P
38200
><PRE
38201
CLASS="programlisting"
38202
> env['PCH'] = env.PCH('StdAfx.cpp')[0]
38203
</PRE
38204
></DD
38205
><DT
38206
><A
38207
NAME="b-PDF"
38208
></A
38209
><CODE
38210
CLASS="function"
38211
>PDF()</CODE
38212
>, <CODE
38213
CLASS="function"
38214
>env.PDF()</CODE
38215
></DT
38216
><DD
38217
><P
38218
> Builds a <TT
38219
CLASS="filename"
38220
>.pdf</TT
38221
> file
38222
from a <TT
38223
CLASS="filename"
38224
>.dvi</TT
38225
> input file
38226
(or, by extension, a <TT
38227
CLASS="filename"
38228
>.tex</TT
38229
>,
38230
<TT
38231
CLASS="filename"
38232
>.ltx</TT
38233
>,
38234
or
38235
<TT
38236
CLASS="filename"
38237
>.latex</TT
38238
> input file).
38239
The suffix specified by the <A
38240
HREF="#cv-PDFSUFFIX"
38241
><CODE
38242
CLASS="envar"
38243
>$PDFSUFFIX</CODE
38244
></A
38245
> construction variable
38246
(<TT
38247
CLASS="filename"
38248
>.pdf</TT
38249
> by default)
38250
is added automatically to the target
38251
if it is not already present. Example:
38252
</P
38253
><PRE
38254
CLASS="programlisting"
38255
> # builds from aaa.tex
38256
env.PDF(target = 'aaa.pdf', source = 'aaa.tex')
38257
# builds bbb.pdf from bbb.dvi
38258
env.PDF(target = 'bbb', source = 'bbb.dvi')
38259
</PRE
38260
></DD
38261
><DT
38262
><A
38263
NAME="b-PostScript"
38264
></A
38265
><CODE
38266
CLASS="function"
38267
>PostScript()</CODE
38268
>, <CODE
38269
CLASS="function"
38270
>env.PostScript()</CODE
38271
></DT
38272
><DD
38273
><P
38274
> Builds a <TT
38275
CLASS="filename"
38276
>.ps</TT
38277
> file
38278
from a <TT
38279
CLASS="filename"
38280
>.dvi</TT
38281
> input file
38282
(or, by extension, a <TT
38283
CLASS="filename"
38284
>.tex</TT
38285
>,
38286
<TT
38287
CLASS="filename"
38288
>.ltx</TT
38289
>,
38290
or
38291
<TT
38292
CLASS="filename"
38293
>.latex</TT
38294
> input file).
38295
The suffix specified by the <A
38296
HREF="#cv-PSSUFFIX"
38297
><CODE
38298
CLASS="envar"
38299
>$PSSUFFIX</CODE
38300
></A
38301
> construction variable
38302
(<TT
38303
CLASS="filename"
38304
>.ps</TT
38305
> by default)
38306
is added automatically to the target
38307
if it is not already present. Example:
38308
</P
38309
><PRE
38310
CLASS="programlisting"
38311
> # builds from aaa.tex
38312
env.PostScript(target = 'aaa.ps', source = 'aaa.tex')
38313
# builds bbb.ps from bbb.dvi
38314
env.PostScript(target = 'bbb', source = 'bbb.dvi')
38315
</PRE
38316
></DD
38317
><DT
38318
><A
38319
NAME="b-Program"
38320
></A
38321
><CODE
38322
CLASS="function"
38323
>Program()</CODE
38324
>, <CODE
38325
CLASS="function"
38326
>env.Program()</CODE
38327
></DT
38328
><DD
38329
><P
38330
> Builds an executable given one or more object files
38331
or C, C++, D, or Fortran source files.
38332
If any C, C++, D or Fortran source files are specified,
38333
then they will be automatically
38334
compiled to object files using the
38335
<CODE
38336
CLASS="function"
38337
>Object</CODE
38338
>
38339
builder method;
38340
see that builder method's description for
38341
a list of legal source file suffixes
38342
and how they are interpreted.
38343
The target executable file prefix
38344
(specified by the <A
38345
HREF="#cv-PROGPREFIX"
38346
><CODE
38347
CLASS="envar"
38348
>$PROGPREFIX</CODE
38349
></A
38350
> construction variable; nothing by default)
38351
and suffix
38352
(specified by the <A
38353
HREF="#cv-PROGSUFFIX"
38354
><CODE
38355
CLASS="envar"
38356
>$PROGSUFFIX</CODE
38357
></A
38358
> construction variable;
38359
by default, <TT
38360
CLASS="filename"
38361
>.exe</TT
38362
> on Windows systems,
38363
nothing on POSIX systems)
38364
are automatically added to the target if not already present.
38365
Example:
38366
</P
38367
><PRE
38368
CLASS="programlisting"
38369
> env.Program(target = 'foo', source = ['foo.o', 'bar.c', 'baz.f'])
38370
</PRE
38371
></DD
38372
><DT
38373
><A
38374
NAME="b-RES"
38375
></A
38376
><CODE
38377
CLASS="function"
38378
>RES()</CODE
38379
>, <CODE
38380
CLASS="function"
38381
>env.RES()</CODE
38382
></DT
38383
><DD
38384
><P
38385
> Builds a Microsoft Visual C++ resource file.
38386
This builder method is only provided
38387
when Microsoft Visual C++ or MinGW is being used as the compiler. The
38388
<TT
38389
CLASS="filename"
38390
>.res</TT
38391
>
38392
(or
38393
<TT
38394
CLASS="filename"
38395
>.o</TT
38396
>
38397
for MinGW) suffix is added to the target name if no other suffix is given.
38398
The source
38399
file is scanned for implicit dependencies as though it were a C file.
38400
Example:
38401
</P
38402
><PRE
38403
CLASS="programlisting"
38404
> env.RES('resource.rc')
38405
</PRE
38406
></DD
38407
><DT
38408
><A
38409
NAME="b-RMIC"
38410
></A
38411
><CODE
38412
CLASS="function"
38413
>RMIC()</CODE
38414
>, <CODE
38415
CLASS="function"
38416
>env.RMIC()</CODE
38417
></DT
38418
><DD
38419
><P
38420
> Builds stub and skeleton class files
38421
for remote objects
38422
from Java <TT
38423
CLASS="filename"
38424
>.class</TT
38425
> files.
38426
The target is a directory
38427
relative to which the stub
38428
and skeleton class files will be written.
38429
The source can be the names of <TT
38430
CLASS="filename"
38431
>.class</TT
38432
> files,
38433
or the objects return from the
38434
<CODE
38435
CLASS="function"
38436
>Java</CODE
38437
>
38438
builder method.</P
38439
><P
38440
>If the construction variable
38441
<A
38442
HREF="#cv-JAVACLASSDIR"
38443
><CODE
38444
CLASS="envar"
38445
>$JAVACLASSDIR</CODE
38446
></A
38447
>
38448
is set, either in the environment
38449
or in the call to the
38450
<CODE
38451
CLASS="function"
38452
>RMIC</CODE
38453
>
38454
builder method itself,
38455
then the value of the variable
38456
will be stripped from the
38457
beginning of any <TT
38458
CLASS="filename"
38459
>.class </TT
38460
>
38461
file names.
38462
</P
38463
><PRE
38464
CLASS="programlisting"
38465
> classes = env.Java(target = 'classdir', source = 'src')
38466
env.RMIC(target = 'outdir1', source = classes)
38467
38468
env.RMIC(target = 'outdir2',
38469
source = ['package/foo.class', 'package/bar.class'])
38470
38471
env.RMIC(target = 'outdir3',
38472
source = ['classes/foo.class', 'classes/bar.class'],
38473
JAVACLASSDIR = 'classes')
38474
</PRE
38475
></DD
38476
><DT
38477
><A
38478
NAME="b-RPCGenClient"
38479
></A
38480
><CODE
38481
CLASS="function"
38482
>RPCGenClient()</CODE
38483
>, <CODE
38484
CLASS="function"
38485
>env.RPCGenClient()</CODE
38486
></DT
38487
><DD
38488
><P
38489
> Generates an RPC client stub (<TT
38490
CLASS="filename"
38491
>_clnt.c</TT
38492
>) file
38493
from a specified RPC (<TT
38494
CLASS="filename"
38495
>.x</TT
38496
>) source file.
38497
Because rpcgen only builds output files
38498
in the local directory,
38499
the command will be executed
38500
in the source file's directory by default.
38501
</P
38502
><PRE
38503
CLASS="programlisting"
38504
> # Builds src/rpcif_clnt.c
38505
env.RPCGenClient('src/rpcif.x')
38506
</PRE
38507
></DD
38508
><DT
38509
><A
38510
NAME="b-RPCGenHeader"
38511
></A
38512
><CODE
38513
CLASS="function"
38514
>RPCGenHeader()</CODE
38515
>, <CODE
38516
CLASS="function"
38517
>env.RPCGenHeader()</CODE
38518
></DT
38519
><DD
38520
><P
38521
> Generates an RPC header (<TT
38522
CLASS="filename"
38523
>.h</TT
38524
>) file
38525
from a specified RPC (<TT
38526
CLASS="filename"
38527
>.x</TT
38528
>) source file.
38529
Because rpcgen only builds output files
38530
in the local directory,
38531
the command will be executed
38532
in the source file's directory by default.
38533
</P
38534
><PRE
38535
CLASS="programlisting"
38536
> # Builds src/rpcif.h
38537
env.RPCGenHeader('src/rpcif.x')
38538
</PRE
38539
></DD
38540
><DT
38541
><A
38542
NAME="b-RPCGenService"
38543
></A
38544
><CODE
38545
CLASS="function"
38546
>RPCGenService()</CODE
38547
>, <CODE
38548
CLASS="function"
38549
>env.RPCGenService()</CODE
38550
></DT
38551
><DD
38552
><P
38553
> Generates an RPC server-skeleton (<TT
38554
CLASS="filename"
38555
>_svc.c</TT
38556
>) file
38557
from a specified RPC (<TT
38558
CLASS="filename"
38559
>.x</TT
38560
>) source file.
38561
Because rpcgen only builds output files
38562
in the local directory,
38563
the command will be executed
38564
in the source file's directory by default.
38565
</P
38566
><PRE
38567
CLASS="programlisting"
38568
> # Builds src/rpcif_svc.c
38569
env.RPCGenClient('src/rpcif.x')
38570
</PRE
38571
></DD
38572
><DT
38573
><A
38574
NAME="b-RPCGenXDR"
38575
></A
38576
><CODE
38577
CLASS="function"
38578
>RPCGenXDR()</CODE
38579
>, <CODE
38580
CLASS="function"
38581
>env.RPCGenXDR()</CODE
38582
></DT
38583
><DD
38584
><P
38585
> Generates an RPC XDR routine (<TT
38586
CLASS="filename"
38587
>_xdr.c</TT
38588
>) file
38589
from a specified RPC (<TT
38590
CLASS="filename"
38591
>.x</TT
38592
>) source file.
38593
Because rpcgen only builds output files
38594
in the local directory,
38595
the command will be executed
38596
in the source file's directory by default.
38597
</P
38598
><PRE
38599
CLASS="programlisting"
38600
> # Builds src/rpcif_xdr.c
38601
env.RPCGenClient('src/rpcif.x')
38602
</PRE
38603
></DD
38604
><DT
38605
><A
38606
NAME="b-SharedLibrary"
38607
></A
38608
><CODE
38609
CLASS="function"
38610
>SharedLibrary()</CODE
38611
>, <CODE
38612
CLASS="function"
38613
>env.SharedLibrary()</CODE
38614
></DT
38615
><DD
38616
><P
38617
> Builds a shared library
38618
(<TT
38619
CLASS="filename"
38620
>.so</TT
38621
> on a POSIX system,
38622
<TT
38623
CLASS="filename"
38624
>.dll</TT
38625
> on Windows)
38626
given one or more object files
38627
or C, C++, D or Fortran source files.
38628
If any source files are given,
38629
then they will be automatically
38630
compiled to object files.
38631
The static library prefix and suffix (if any)
38632
are automatically added to the target.
38633
The target library file prefix
38634
(specified by the <A
38635
HREF="#cv-SHLIBPREFIX"
38636
><CODE
38637
CLASS="envar"
38638
>$SHLIBPREFIX</CODE
38639
></A
38640
> construction variable;
38641
by default, <TT
38642
CLASS="filename"
38643
>lib</TT
38644
> on POSIX systems,
38645
nothing on Windows systems)
38646
and suffix
38647
(specified by the <A
38648
HREF="#cv-SHLIBSUFFIX"
38649
><CODE
38650
CLASS="envar"
38651
>$SHLIBSUFFIX</CODE
38652
></A
38653
> construction variable;
38654
by default, <TT
38655
CLASS="filename"
38656
>.dll</TT
38657
> on Windows systems,
38658
<TT
38659
CLASS="filename"
38660
>.so</TT
38661
> on POSIX systems)
38662
are automatically added to the target if not already present.
38663
Example:
38664
</P
38665
><PRE
38666
CLASS="programlisting"
38667
> env.SharedLibrary(target = 'bar', source = ['bar.c', 'foo.o'])
38668
</PRE
38669
><P
38670
> On Windows systems, the
38671
<CODE
38672
CLASS="function"
38673
>SharedLibrary</CODE
38674
>
38675
builder method will always build an import
38676
(<TT
38677
CLASS="filename"
38678
>.lib</TT
38679
>) library
38680
in addition to the shared (<TT
38681
CLASS="filename"
38682
>.dll</TT
38683
>) library,
38684
adding a <TT
38685
CLASS="filename"
38686
>.lib</TT
38687
> library with the same basename
38688
if there is not already a <TT
38689
CLASS="filename"
38690
>.lib</TT
38691
> file explicitly
38692
listed in the targets.</P
38693
><P
38694
>Any object files listed in the
38695
<TT
38696
CLASS="literal"
38697
>source</TT
38698
>
38699
must have been built for a shared library
38700
(that is, using the
38701
<CODE
38702
CLASS="function"
38703
>SharedObject</CODE
38704
>
38705
builder method).
38706
<SPAN
38707
CLASS="application"
38708
>scons</SPAN
38709
>
38710
will raise an error if there is any mismatch.</P
38711
><P
38712
>On Windows systems, specifying
38713
<TT
38714
CLASS="literal"
38715
>register=1</TT
38716
>
38717
will cause the <TT
38718
CLASS="filename"
38719
>.dll</TT
38720
> to be
38721
registered after it is built using REGSVR32.
38722
The command that is run
38723
("regsvr32" by default) is determined by <A
38724
HREF="#cv-REGSVR"
38725
><CODE
38726
CLASS="envar"
38727
>$REGSVR</CODE
38728
></A
38729
> construction
38730
variable, and the flags passed are determined by <A
38731
HREF="#cv-REGSVRFLAGS"
38732
><CODE
38733
CLASS="envar"
38734
>$REGSVRFLAGS</CODE
38735
></A
38736
>. By
38737
default, <A
38738
HREF="#cv-REGSVRFLAGS"
38739
><CODE
38740
CLASS="envar"
38741
>$REGSVRFLAGS</CODE
38742
></A
38743
> includes the <CODE
38744
CLASS="option"
38745
>/s</CODE
38746
> option,
38747
to prevent dialogs from popping
38748
up and requiring user attention when it is run. If you change
38749
<A
38750
HREF="#cv-REGSVRFLAGS"
38751
><CODE
38752
CLASS="envar"
38753
>$REGSVRFLAGS</CODE
38754
></A
38755
>, be sure to include the <CODE
38756
CLASS="option"
38757
>/s</CODE
38758
> option.
38759
For example,
38760
</P
38761
><PRE
38762
CLASS="programlisting"
38763
> env.SharedLibrary(target = 'bar',
38764
source = ['bar.cxx', 'foo.obj'],
38765
register=1)
38766
</PRE
38767
><P
38768
> will register <TT
38769
CLASS="filename"
38770
>bar.dll</TT
38771
> as a COM object
38772
when it is done linking it.
38773
</P
38774
></DD
38775
><DT
38776
><A
38777
NAME="b-SharedObject"
38778
></A
38779
><CODE
38780
CLASS="function"
38781
>SharedObject()</CODE
38782
>, <CODE
38783
CLASS="function"
38784
>env.SharedObject()</CODE
38785
></DT
38786
><DD
38787
><P
38788
> Builds an object file for
38789
inclusion in a shared library.
38790
Source files must have one of the same set of extensions
38791
specified above for the
38792
<CODE
38793
CLASS="function"
38794
>StaticObject</CODE
38795
>
38796
builder method.
38797
On some platforms building a shared object requires additional
38798
compiler option
38799
(e.g. <CODE
38800
CLASS="option"
38801
>-fPIC</CODE
38802
> for gcc)
38803
in addition to those needed to build a
38804
normal (static) object, but on some platforms there is no difference between a
38805
shared object and a normal (static) one. When there is a difference, SCons
38806
will only allow shared objects to be linked into a shared library, and will
38807
use a different suffix for shared objects. On platforms where there is no
38808
difference, SCons will allow both normal (static)
38809
and shared objects to be linked into a
38810
shared library, and will use the same suffix for shared and normal
38811
(static) objects.
38812
The target object file prefix
38813
(specified by the <A
38814
HREF="#cv-SHOBJPREFIX"
38815
><CODE
38816
CLASS="envar"
38817
>$SHOBJPREFIX</CODE
38818
></A
38819
> construction variable;
38820
by default, the same as <A
38821
HREF="#cv-OBJPREFIX"
38822
><CODE
38823
CLASS="envar"
38824
>$OBJPREFIX</CODE
38825
></A
38826
>)
38827
and suffix
38828
(specified by the <A
38829
HREF="#cv-SHOBJSUFFIX"
38830
><CODE
38831
CLASS="envar"
38832
>$SHOBJSUFFIX</CODE
38833
></A
38834
> construction variable)
38835
are automatically added to the target if not already present.
38836
Examples:
38837
</P
38838
><PRE
38839
CLASS="programlisting"
38840
> env.SharedObject(target = 'ddd', source = 'ddd.c')
38841
env.SharedObject(target = 'eee.o', source = 'eee.cpp')
38842
env.SharedObject(target = 'fff.obj', source = 'fff.for')
38843
</PRE
38844
><P
38845
> Note that the source files will be scanned
38846
according to the suffix mappings in the
38847
<TT
38848
CLASS="literal"
38849
>SourceFileScanner</TT
38850
>
38851
object.
38852
See the section "Scanner Objects,"
38853
below, for a more information.
38854
</P
38855
></DD
38856
><DT
38857
><A
38858
NAME="b-StaticLibrary"
38859
></A
38860
><CODE
38861
CLASS="function"
38862
>StaticLibrary()</CODE
38863
>, <CODE
38864
CLASS="function"
38865
>env.StaticLibrary()</CODE
38866
></DT
38867
><DD
38868
><P
38869
> Builds a static library given one or more object files
38870
or C, C++, D or Fortran source files.
38871
If any source files are given,
38872
then they will be automatically
38873
compiled to object files.
38874
The static library prefix and suffix (if any)
38875
are automatically added to the target.
38876
The target library file prefix
38877
(specified by the <A
38878
HREF="#cv-LIBPREFIX"
38879
><CODE
38880
CLASS="envar"
38881
>$LIBPREFIX</CODE
38882
></A
38883
> construction variable;
38884
by default, <TT
38885
CLASS="filename"
38886
>lib</TT
38887
> on POSIX systems,
38888
nothing on Windows systems)
38889
and suffix
38890
(specified by the <A
38891
HREF="#cv-LIBSUFFIX"
38892
><CODE
38893
CLASS="envar"
38894
>$LIBSUFFIX</CODE
38895
></A
38896
> construction variable;
38897
by default, <TT
38898
CLASS="filename"
38899
>.lib</TT
38900
> on Windows systems,
38901
<TT
38902
CLASS="filename"
38903
>.a</TT
38904
> on POSIX systems)
38905
are automatically added to the target if not already present.
38906
Example:
38907
</P
38908
><PRE
38909
CLASS="programlisting"
38910
> env.StaticLibrary(target = 'bar', source = ['bar.c', 'foo.o'])
38911
</PRE
38912
><P
38913
> Any object files listed in the
38914
<TT
38915
CLASS="literal"
38916
>source</TT
38917
>
38918
must have been built for a static library
38919
(that is, using the
38920
<CODE
38921
CLASS="function"
38922
>StaticObject</CODE
38923
>
38924
builder method).
38925
<SPAN
38926
CLASS="application"
38927
>scons</SPAN
38928
>
38929
will raise an error if there is any mismatch.
38930
</P
38931
></DD
38932
><DT
38933
><A
38934
NAME="b-StaticObject"
38935
></A
38936
><CODE
38937
CLASS="function"
38938
>StaticObject()</CODE
38939
>, <CODE
38940
CLASS="function"
38941
>env.StaticObject()</CODE
38942
></DT
38943
><DD
38944
><P
38945
> Builds a static object file
38946
from one or more C, C++, D, or Fortran source files.
38947
Source files must have one of the following extensions:
38948
</P
38949
><PRE
38950
CLASS="programlisting"
38951
> .asm assembly language file
38952
.ASM assembly language file
38953
.c C file
38954
.C Windows: C file
38955
POSIX: C++ file
38956
.cc C++ file
38957
.cpp C++ file
38958
.cxx C++ file
38959
.cxx C++ file
38960
.c++ C++ file
38961
.C++ C++ file
38962
.d D file
38963
.f Fortran file
38964
.F Windows: Fortran file
38965
POSIX: Fortran file + C pre-processor
38966
.for Fortran file
38967
.FOR Fortran file
38968
.fpp Fortran file + C pre-processor
38969
.FPP Fortran file + C pre-processor
38970
.m Object C file
38971
.mm Object C++ file
38972
.s assembly language file
38973
.S Windows: assembly language file
38974
POSIX: assembly language file + C pre-processor
38975
.spp assembly language file + C pre-processor
38976
.SPP assembly language file + C pre-processor
38977
</PRE
38978
><P
38979
> The target object file prefix
38980
(specified by the <A
38981
HREF="#cv-OBJPREFIX"
38982
><CODE
38983
CLASS="envar"
38984
>$OBJPREFIX</CODE
38985
></A
38986
> construction variable; nothing by default)
38987
and suffix
38988
(specified by the <A
38989
HREF="#cv-OBJSUFFIX"
38990
><CODE
38991
CLASS="envar"
38992
>$OBJSUFFIX</CODE
38993
></A
38994
> construction variable;
38995
<TT
38996
CLASS="filename"
38997
>.obj</TT
38998
> on Windows systems,
38999
<TT
39000
CLASS="filename"
39001
>.o</TT
39002
> on POSIX systems)
39003
are automatically added to the target if not already present.
39004
Examples:
39005
</P
39006
><PRE
39007
CLASS="programlisting"
39008
> env.StaticObject(target = 'aaa', source = 'aaa.c')
39009
env.StaticObject(target = 'bbb.o', source = 'bbb.c++')
39010
env.StaticObject(target = 'ccc.obj', source = 'ccc.f')
39011
</PRE
39012
><P
39013
> Note that the source files will be scanned
39014
according to the suffix mappings in
39015
<TT
39016
CLASS="literal"
39017
>SourceFileScanner</TT
39018
>
39019
object.
39020
See the section "Scanner Objects,"
39021
below, for a more information.
39022
</P
39023
></DD
39024
><DT
39025
><A
39026
NAME="b-Tar"
39027
></A
39028
><CODE
39029
CLASS="function"
39030
>Tar()</CODE
39031
>, <CODE
39032
CLASS="function"
39033
>env.Tar()</CODE
39034
></DT
39035
><DD
39036
><P
39037
> Builds a tar archive of the specified files
39038
and/or directories.
39039
Unlike most builder methods,
39040
the
39041
<CODE
39042
CLASS="function"
39043
>Tar</CODE
39044
>
39045
builder method may be called multiple times
39046
for a given target;
39047
each additional call
39048
adds to the list of entries
39049
that will be built into the archive.
39050
Any source directories will
39051
be scanned for changes to
39052
any on-disk files,
39053
regardless of whether or not
39054
<SPAN
39055
CLASS="application"
39056
>scons</SPAN
39057
>
39058
knows about them from other Builder or function calls.
39059
</P
39060
><PRE
39061
CLASS="programlisting"
39062
> env.Tar('src.tar', 'src')
39063
39064
# Create the stuff.tar file.
39065
env.Tar('stuff', ['subdir1', 'subdir2'])
39066
# Also add "another" to the stuff.tar file.
39067
env.Tar('stuff', 'another')
39068
39069
# Set TARFLAGS to create a gzip-filtered archive.
39070
env = Environment(TARFLAGS = '-c -z')
39071
env.Tar('foo.tar.gz', 'foo')
39072
39073
# Also set the suffix to .tgz.
39074
env = Environment(TARFLAGS = '-c -z',
39075
TARSUFFIX = '.tgz')
39076
env.Tar('foo')
39077
</PRE
39078
></DD
39079
><DT
39080
><A
39081
NAME="b-TypeLibrary"
39082
></A
39083
><CODE
39084
CLASS="function"
39085
>TypeLibrary()</CODE
39086
>, <CODE
39087
CLASS="function"
39088
>env.TypeLibrary()</CODE
39089
></DT
39090
><DD
39091
><P
39092
> Builds a Windows type library (<TT
39093
CLASS="filename"
39094
>.tlb</TT
39095
>)
39096
file from an input IDL file (<TT
39097
CLASS="filename"
39098
>.idl</TT
39099
>).
39100
In addition, it will build the associated inteface stub and
39101
proxy source files,
39102
naming them according to the base name of the <TT
39103
CLASS="filename"
39104
>.idl</TT
39105
> file.
39106
For example,
39107
</P
39108
><PRE
39109
CLASS="programlisting"
39110
> env.TypeLibrary(source="foo.idl")
39111
</PRE
39112
><P
39113
> Will create <TT
39114
CLASS="filename"
39115
>foo.tlb</TT
39116
>,
39117
<TT
39118
CLASS="filename"
39119
>foo.h</TT
39120
>,
39121
<TT
39122
CLASS="filename"
39123
>foo_i.c</TT
39124
>,
39125
<TT
39126
CLASS="filename"
39127
>foo_p.c</TT
39128
>
39129
and
39130
<TT
39131
CLASS="filename"
39132
>foo_data.c</TT
39133
>
39134
files.
39135
</P
39136
></DD
39137
><DT
39138
><A
39139
NAME="b-Uic"
39140
></A
39141
><CODE
39142
CLASS="function"
39143
>Uic()</CODE
39144
>, <CODE
39145
CLASS="function"
39146
>env.Uic()</CODE
39147
></DT
39148
><DD
39149
><P
39150
> Builds a header file, an implementation file and a moc file from an ui file.
39151
and returns the corresponding nodes in the above order.
39152
This builder is only available after using the tool 'qt'. Note: you can
39153
specify <TT
39154
CLASS="filename"
39155
>.ui</TT
39156
> files directly as source
39157
files to the <CODE
39158
CLASS="function"
39159
>Program</CODE
39160
>,
39161
<CODE
39162
CLASS="function"
39163
>Library</CODE
39164
> and <CODE
39165
CLASS="function"
39166
>SharedLibrary</CODE
39167
> builders
39168
without using this builder. Using this builder lets you override the standard
39169
naming conventions (be careful: prefixes are always prepended to names of
39170
built files; if you don't want prefixes, you may set them to ``).
39171
See the <A
39172
HREF="#cv-QTDIR"
39173
><CODE
39174
CLASS="envar"
39175
>$QTDIR</CODE
39176
></A
39177
> variable for more information.
39178
Example:
39179
</P
39180
><PRE
39181
CLASS="programlisting"
39182
> env.Uic('foo.ui') # -> ['foo.h', 'uic_foo.cc', 'moc_foo.cc']
39183
env.Uic(target = Split('include/foo.h gen/uicfoo.cc gen/mocfoo.cc'),
39184
source = 'foo.ui') # -> ['include/foo.h', 'gen/uicfoo.cc', 'gen/mocfoo.cc']
39185
</PRE
39186
></DD
39187
><DT
39188
><A
39189
NAME="b-Zip"
39190
></A
39191
><CODE
39192
CLASS="function"
39193
>Zip()</CODE
39194
>, <CODE
39195
CLASS="function"
39196
>env.Zip()</CODE
39197
></DT
39198
><DD
39199
><P
39200
> Builds a zip archive of the specified files
39201
and/or directories.
39202
Unlike most builder methods,
39203
the
39204
<CODE
39205
CLASS="function"
39206
>Zip</CODE
39207
>
39208
builder method may be called multiple times
39209
for a given target;
39210
each additional call
39211
adds to the list of entries
39212
that will be built into the archive.
39213
Any source directories will
39214
be scanned for changes to
39215
any on-disk files,
39216
regardless of whether or not
39217
<SPAN
39218
CLASS="application"
39219
>scons</SPAN
39220
>
39221
knows about them from other Builder or function calls.
39222
</P
39223
><PRE
39224
CLASS="programlisting"
39225
> env.Zip('src.zip', 'src')
39226
39227
# Create the stuff.zip file.
39228
env.Zip('stuff', ['subdir1', 'subdir2'])
39229
# Also add "another" to the stuff.tar file.
39230
env.Zip('stuff', 'another')
39231
</PRE
39232
></DD
39233
></DL
39234
></DIV
39235
></DIV
39236
><DIV
39237
CLASS="appendix"
39238
><HR><H1
39239
><A
39240
NAME="app-tools"
39241
></A
39242
>Appendix C. Tools</H1
39243
><P
39244
>
39245
This appendix contains descriptions of all of the
39246
Tools modules that are
39247
available "out of the box" in this version of SCons.
39248
39249
</P
39250
><P
39251
></P
39252
><DIV
39253
CLASS="variablelist"
39254
><DL
39255
><DT
39256
><A
39257
NAME="t-386asm"
39258
></A
39259
><TT
39260
CLASS="literal"
39261
>386asm</TT
39262
></DT
39263
><DD
39264
><P
39265
> Sets construction variables for the 386ASM assembler
39266
for the Phar Lap ETS embedded operating system.
39267
</P
39268
><P
39269
> Sets: <A
39270
HREF="#cv-AS"
39271
><CODE
39272
CLASS="envar"
39273
>$AS</CODE
39274
></A
39275
>, <A
39276
HREF="#cv-ASCOM"
39277
><CODE
39278
CLASS="envar"
39279
>$ASCOM</CODE
39280
></A
39281
>, <A
39282
HREF="#cv-ASFLAGS"
39283
><CODE
39284
CLASS="envar"
39285
>$ASFLAGS</CODE
39286
></A
39287
>, <A
39288
HREF="#cv-ASPPCOM"
39289
><CODE
39290
CLASS="envar"
39291
>$ASPPCOM</CODE
39292
></A
39293
>, <A
39294
HREF="#cv-ASPPFLAGS"
39295
><CODE
39296
CLASS="envar"
39297
>$ASPPFLAGS</CODE
39298
></A
39299
>.
39300
</P
39301
><P
39302
> Uses: <A
39303
HREF="#cv-CC"
39304
><CODE
39305
CLASS="envar"
39306
>$CC</CODE
39307
></A
39308
>, <A
39309
HREF="#cv-CPPFLAGS"
39310
><CODE
39311
CLASS="envar"
39312
>$CPPFLAGS</CODE
39313
></A
39314
>, <A
39315
HREF="#cv-_CPPDEFFLAGS"
39316
><CODE
39317
CLASS="envar"
39318
>$_CPPDEFFLAGS</CODE
39319
></A
39320
>, <A
39321
HREF="#cv-_CPPINCFLAGS"
39322
><CODE
39323
CLASS="envar"
39324
>$_CPPINCFLAGS</CODE
39325
></A
39326
>.
39327
</P
39328
></DD
39329
><DT
39330
><A
39331
NAME="t-aixcXX"
39332
></A
39333
><TT
39334
CLASS="literal"
39335
>aixc++</TT
39336
></DT
39337
><DD
39338
><P
39339
> Sets construction variables for the IMB xlc / Visual Age C++ compiler.
39340
</P
39341
><P
39342
> Sets: <A
39343
HREF="#cv-CXX"
39344
><CODE
39345
CLASS="envar"
39346
>$CXX</CODE
39347
></A
39348
>, <A
39349
HREF="#cv-CXXVERSION"
39350
><CODE
39351
CLASS="envar"
39352
>$CXXVERSION</CODE
39353
></A
39354
>, <A
39355
HREF="#cv-SHCXX"
39356
><CODE
39357
CLASS="envar"
39358
>$SHCXX</CODE
39359
></A
39360
>, <A
39361
HREF="#cv-SHOBJSUFFIX"
39362
><CODE
39363
CLASS="envar"
39364
>$SHOBJSUFFIX</CODE
39365
></A
39366
>.
39367
</P
39368
></DD
39369
><DT
39370
><A
39371
NAME="t-aixcc"
39372
></A
39373
><TT
39374
CLASS="literal"
39375
>aixcc</TT
39376
></DT
39377
><DD
39378
><P
39379
> Sets construction variables for the IBM xlc / Visual Age C compiler.
39380
</P
39381
><P
39382
> Sets: <A
39383
HREF="#cv-CC"
39384
><CODE
39385
CLASS="envar"
39386
>$CC</CODE
39387
></A
39388
>, <A
39389
HREF="#cv-CCVERSION"
39390
><CODE
39391
CLASS="envar"
39392
>$CCVERSION</CODE
39393
></A
39394
>, <A
39395
HREF="#cv-SHCC"
39396
><CODE
39397
CLASS="envar"
39398
>$SHCC</CODE
39399
></A
39400
>.
39401
</P
39402
></DD
39403
><DT
39404
><A
39405
NAME="t-aixf77"
39406
></A
39407
><TT
39408
CLASS="literal"
39409
>aixf77</TT
39410
></DT
39411
><DD
39412
><P
39413
> Sets construction variables for the IBM Visual Age f77 Fortran compiler.
39414
</P
39415
><P
39416
> Sets: <A
39417
HREF="#cv-F77"
39418
><CODE
39419
CLASS="envar"
39420
>$F77</CODE
39421
></A
39422
>, <A
39423
HREF="#cv-SHF77"
39424
><CODE
39425
CLASS="envar"
39426
>$SHF77</CODE
39427
></A
39428
>.
39429
</P
39430
></DD
39431
><DT
39432
><A
39433
NAME="t-aixlink"
39434
></A
39435
><TT
39436
CLASS="literal"
39437
>aixlink</TT
39438
></DT
39439
><DD
39440
><P
39441
> Sets construction variables for the IBM Visual Age linker.
39442
</P
39443
><P
39444
> Sets: <A
39445
HREF="#cv-LINKFLAGS"
39446
><CODE
39447
CLASS="envar"
39448
>$LINKFLAGS</CODE
39449
></A
39450
>, <A
39451
HREF="#cv-SHLIBSUFFIX"
39452
><CODE
39453
CLASS="envar"
39454
>$SHLIBSUFFIX</CODE
39455
></A
39456
>, <A
39457
HREF="#cv-SHLINKFLAGS"
39458
><CODE
39459
CLASS="envar"
39460
>$SHLINKFLAGS</CODE
39461
></A
39462
>.
39463
</P
39464
></DD
39465
><DT
39466
><A
39467
NAME="t-applelink"
39468
></A
39469
><TT
39470
CLASS="literal"
39471
>applelink</TT
39472
></DT
39473
><DD
39474
><P
39475
> Sets construction variables for the Apple linker
39476
(similar to the GNU linker).
39477
</P
39478
><P
39479
> Sets: <A
39480
HREF="#cv-FRAMEWORKPATHPREFIX"
39481
><CODE
39482
CLASS="envar"
39483
>$FRAMEWORKPATHPREFIX</CODE
39484
></A
39485
>, <A
39486
HREF="#cv-LDMODULECOM"
39487
><CODE
39488
CLASS="envar"
39489
>$LDMODULECOM</CODE
39490
></A
39491
>, <A
39492
HREF="#cv-LDMODULEFLAGS"
39493
><CODE
39494
CLASS="envar"
39495
>$LDMODULEFLAGS</CODE
39496
></A
39497
>, <A
39498
HREF="#cv-LDMODULEPREFIX"
39499
><CODE
39500
CLASS="envar"
39501
>$LDMODULEPREFIX</CODE
39502
></A
39503
>, <A
39504
HREF="#cv-LDMODULESUFFIX"
39505
><CODE
39506
CLASS="envar"
39507
>$LDMODULESUFFIX</CODE
39508
></A
39509
>, <A
39510
HREF="#cv-LINKCOM"
39511
><CODE
39512
CLASS="envar"
39513
>$LINKCOM</CODE
39514
></A
39515
>, <A
39516
HREF="#cv-SHLINKCOM"
39517
><CODE
39518
CLASS="envar"
39519
>$SHLINKCOM</CODE
39520
></A
39521
>, <A
39522
HREF="#cv-SHLINKFLAGS"
39523
><CODE
39524
CLASS="envar"
39525
>$SHLINKFLAGS</CODE
39526
></A
39527
>, <A
39528
HREF="#cv-_FRAMEWORKPATH"
39529
><CODE
39530
CLASS="envar"
39531
>$_FRAMEWORKPATH</CODE
39532
></A
39533
>, <A
39534
HREF="#cv-_FRAMEWORKS"
39535
><CODE
39536
CLASS="envar"
39537
>$_FRAMEWORKS</CODE
39538
></A
39539
>.
39540
</P
39541
><P
39542
> Uses: <A
39543
HREF="#cv-FRAMEWORKSFLAGS"
39544
><CODE
39545
CLASS="envar"
39546
>$FRAMEWORKSFLAGS</CODE
39547
></A
39548
>.
39549
</P
39550
></DD
39551
><DT
39552
><A
39553
NAME="t-ar"
39554
></A
39555
><TT
39556
CLASS="literal"
39557
>ar</TT
39558
></DT
39559
><DD
39560
><P
39561
> Sets construction variables for the <SPAN
39562
CLASS="application"
39563
>ar</SPAN
39564
> library archiver.
39565
</P
39566
><P
39567
> Sets: <A
39568
HREF="#cv-AR"
39569
><CODE
39570
CLASS="envar"
39571
>$AR</CODE
39572
></A
39573
>, <A
39574
HREF="#cv-ARCOM"
39575
><CODE
39576
CLASS="envar"
39577
>$ARCOM</CODE
39578
></A
39579
>, <A
39580
HREF="#cv-ARFLAGS"
39581
><CODE
39582
CLASS="envar"
39583
>$ARFLAGS</CODE
39584
></A
39585
>, <A
39586
HREF="#cv-LIBPREFIX"
39587
><CODE
39588
CLASS="envar"
39589
>$LIBPREFIX</CODE
39590
></A
39591
>, <A
39592
HREF="#cv-LIBSUFFIX"
39593
><CODE
39594
CLASS="envar"
39595
>$LIBSUFFIX</CODE
39596
></A
39597
>, <A
39598
HREF="#cv-RANLIB"
39599
><CODE
39600
CLASS="envar"
39601
>$RANLIB</CODE
39602
></A
39603
>, <A
39604
HREF="#cv-RANLIBCOM"
39605
><CODE
39606
CLASS="envar"
39607
>$RANLIBCOM</CODE
39608
></A
39609
>, <A
39610
HREF="#cv-RANLIBFLAGS"
39611
><CODE
39612
CLASS="envar"
39613
>$RANLIBFLAGS</CODE
39614
></A
39615
>.
39616
</P
39617
></DD
39618
><DT
39619
><A
39620
NAME="t-as"
39621
></A
39622
><TT
39623
CLASS="literal"
39624
>as</TT
39625
></DT
39626
><DD
39627
><P
39628
> Sets construction variables for the <SPAN
39629
CLASS="application"
39630
>as</SPAN
39631
> assembler.
39632
</P
39633
><P
39634
> Sets: <A
39635
HREF="#cv-AS"
39636
><CODE
39637
CLASS="envar"
39638
>$AS</CODE
39639
></A
39640
>, <A
39641
HREF="#cv-ASCOM"
39642
><CODE
39643
CLASS="envar"
39644
>$ASCOM</CODE
39645
></A
39646
>, <A
39647
HREF="#cv-ASFLAGS"
39648
><CODE
39649
CLASS="envar"
39650
>$ASFLAGS</CODE
39651
></A
39652
>, <A
39653
HREF="#cv-ASPPCOM"
39654
><CODE
39655
CLASS="envar"
39656
>$ASPPCOM</CODE
39657
></A
39658
>, <A
39659
HREF="#cv-ASPPFLAGS"
39660
><CODE
39661
CLASS="envar"
39662
>$ASPPFLAGS</CODE
39663
></A
39664
>.
39665
</P
39666
><P
39667
> Uses: <A
39668
HREF="#cv-CC"
39669
><CODE
39670
CLASS="envar"
39671
>$CC</CODE
39672
></A
39673
>, <A
39674
HREF="#cv-CPPFLAGS"
39675
><CODE
39676
CLASS="envar"
39677
>$CPPFLAGS</CODE
39678
></A
39679
>, <A
39680
HREF="#cv-_CPPDEFFLAGS"
39681
><CODE
39682
CLASS="envar"
39683
>$_CPPDEFFLAGS</CODE
39684
></A
39685
>, <A
39686
HREF="#cv-_CPPINCFLAGS"
39687
><CODE
39688
CLASS="envar"
39689
>$_CPPINCFLAGS</CODE
39690
></A
39691
>.
39692
</P
39693
></DD
39694
><DT
39695
><A
39696
NAME="t-bcc32"
39697
></A
39698
><TT
39699
CLASS="literal"
39700
>bcc32</TT
39701
></DT
39702
><DD
39703
><P
39704
> Sets construction variables for the bcc32 compiler.
39705
</P
39706
><P
39707
> Sets: <A
39708
HREF="#cv-CC"
39709
><CODE
39710
CLASS="envar"
39711
>$CC</CODE
39712
></A
39713
>, <A
39714
HREF="#cv-CCCOM"
39715
><CODE
39716
CLASS="envar"
39717
>$CCCOM</CODE
39718
></A
39719
>, <A
39720
HREF="#cv-CCFLAGS"
39721
><CODE
39722
CLASS="envar"
39723
>$CCFLAGS</CODE
39724
></A
39725
>, <A
39726
HREF="#cv-CFILESUFFIX"
39727
><CODE
39728
CLASS="envar"
39729
>$CFILESUFFIX</CODE
39730
></A
39731
>, <A
39732
HREF="#cv-CFLAGS"
39733
><CODE
39734
CLASS="envar"
39735
>$CFLAGS</CODE
39736
></A
39737
>, <A
39738
HREF="#cv-CPPDEFPREFIX"
39739
><CODE
39740
CLASS="envar"
39741
>$CPPDEFPREFIX</CODE
39742
></A
39743
>, <A
39744
HREF="#cv-CPPDEFSUFFIX"
39745
><CODE
39746
CLASS="envar"
39747
>$CPPDEFSUFFIX</CODE
39748
></A
39749
>, <A
39750
HREF="#cv-INCPREFIX"
39751
><CODE
39752
CLASS="envar"
39753
>$INCPREFIX</CODE
39754
></A
39755
>, <A
39756
HREF="#cv-INCSUFFIX"
39757
><CODE
39758
CLASS="envar"
39759
>$INCSUFFIX</CODE
39760
></A
39761
>, <A
39762
HREF="#cv-SHCC"
39763
><CODE
39764
CLASS="envar"
39765
>$SHCC</CODE
39766
></A
39767
>, <A
39768
HREF="#cv-SHCCCOM"
39769
><CODE
39770
CLASS="envar"
39771
>$SHCCCOM</CODE
39772
></A
39773
>, <A
39774
HREF="#cv-SHCCFLAGS"
39775
><CODE
39776
CLASS="envar"
39777
>$SHCCFLAGS</CODE
39778
></A
39779
>, <A
39780
HREF="#cv-SHCFLAGS"
39781
><CODE
39782
CLASS="envar"
39783
>$SHCFLAGS</CODE
39784
></A
39785
>, <A
39786
HREF="#cv-SHOBJSUFFIX"
39787
><CODE
39788
CLASS="envar"
39789
>$SHOBJSUFFIX</CODE
39790
></A
39791
>.
39792
</P
39793
><P
39794
> Uses: <A
39795
HREF="#cv-_CPPDEFFLAGS"
39796
><CODE
39797
CLASS="envar"
39798
>$_CPPDEFFLAGS</CODE
39799
></A
39800
>, <A
39801
HREF="#cv-_CPPINCFLAGS"
39802
><CODE
39803
CLASS="envar"
39804
>$_CPPINCFLAGS</CODE
39805
></A
39806
>.
39807
</P
39808
></DD
39809
><DT
39810
><A
39811
NAME="t-BitKeeper"
39812
></A
39813
><TT
39814
CLASS="literal"
39815
>BitKeeper</TT
39816
></DT
39817
><DD
39818
><P
39819
> Sets construction variables for the BitKeeper
39820
source code control system.
39821
</P
39822
><P
39823
> Sets: <A
39824
HREF="#cv-BITKEEPER"
39825
><CODE
39826
CLASS="envar"
39827
>$BITKEEPER</CODE
39828
></A
39829
>, <A
39830
HREF="#cv-BITKEEPERCOM"
39831
><CODE
39832
CLASS="envar"
39833
>$BITKEEPERCOM</CODE
39834
></A
39835
>, <A
39836
HREF="#cv-BITKEEPERGET"
39837
><CODE
39838
CLASS="envar"
39839
>$BITKEEPERGET</CODE
39840
></A
39841
>, <A
39842
HREF="#cv-BITKEEPERGETFLAGS"
39843
><CODE
39844
CLASS="envar"
39845
>$BITKEEPERGETFLAGS</CODE
39846
></A
39847
>.
39848
</P
39849
><P
39850
> Uses: <A
39851
HREF="#cv-BITKEEPERCOMSTR"
39852
><CODE
39853
CLASS="envar"
39854
>$BITKEEPERCOMSTR</CODE
39855
></A
39856
>.
39857
</P
39858
></DD
39859
><DT
39860
><A
39861
NAME="t-cc"
39862
></A
39863
><TT
39864
CLASS="literal"
39865
>cc</TT
39866
></DT
39867
><DD
39868
><P
39869
> Sets construction variables for generic POSIX C copmilers.
39870
</P
39871
><P
39872
> Sets: <A
39873
HREF="#cv-CC"
39874
><CODE
39875
CLASS="envar"
39876
>$CC</CODE
39877
></A
39878
>, <A
39879
HREF="#cv-CCCOM"
39880
><CODE
39881
CLASS="envar"
39882
>$CCCOM</CODE
39883
></A
39884
>, <A
39885
HREF="#cv-CCFLAGS"
39886
><CODE
39887
CLASS="envar"
39888
>$CCFLAGS</CODE
39889
></A
39890
>, <A
39891
HREF="#cv-CFILESUFFIX"
39892
><CODE
39893
CLASS="envar"
39894
>$CFILESUFFIX</CODE
39895
></A
39896
>, <A
39897
HREF="#cv-CFLAGS"
39898
><CODE
39899
CLASS="envar"
39900
>$CFLAGS</CODE
39901
></A
39902
>, <A
39903
HREF="#cv-CPPDEFPREFIX"
39904
><CODE
39905
CLASS="envar"
39906
>$CPPDEFPREFIX</CODE
39907
></A
39908
>, <A
39909
HREF="#cv-CPPDEFSUFFIX"
39910
><CODE
39911
CLASS="envar"
39912
>$CPPDEFSUFFIX</CODE
39913
></A
39914
>, <A
39915
HREF="#cv-FRAMEWORKPATH"
39916
><CODE
39917
CLASS="envar"
39918
>$FRAMEWORKPATH</CODE
39919
></A
39920
>, <A
39921
HREF="#cv-FRAMEWORKS"
39922
><CODE
39923
CLASS="envar"
39924
>$FRAMEWORKS</CODE
39925
></A
39926
>, <A
39927
HREF="#cv-INCPREFIX"
39928
><CODE
39929
CLASS="envar"
39930
>$INCPREFIX</CODE
39931
></A
39932
>, <A
39933
HREF="#cv-INCSUFFIX"
39934
><CODE
39935
CLASS="envar"
39936
>$INCSUFFIX</CODE
39937
></A
39938
>, <A
39939
HREF="#cv-SHCC"
39940
><CODE
39941
CLASS="envar"
39942
>$SHCC</CODE
39943
></A
39944
>, <A
39945
HREF="#cv-SHCCCOM"
39946
><CODE
39947
CLASS="envar"
39948
>$SHCCCOM</CODE
39949
></A
39950
>, <A
39951
HREF="#cv-SHCCFLAGS"
39952
><CODE
39953
CLASS="envar"
39954
>$SHCCFLAGS</CODE
39955
></A
39956
>, <A
39957
HREF="#cv-SHCFLAGS"
39958
><CODE
39959
CLASS="envar"
39960
>$SHCFLAGS</CODE
39961
></A
39962
>, <A
39963
HREF="#cv-SHOBJSUFFIX"
39964
><CODE
39965
CLASS="envar"
39966
>$SHOBJSUFFIX</CODE
39967
></A
39968
>.
39969
</P
39970
><P
39971
> Uses: <A
39972
HREF="#cv-PLATFORM"
39973
><CODE
39974
CLASS="envar"
39975
>$PLATFORM</CODE
39976
></A
39977
>.
39978
</P
39979
></DD
39980
><DT
39981
><A
39982
NAME="t-cvf"
39983
></A
39984
><TT
39985
CLASS="literal"
39986
>cvf</TT
39987
></DT
39988
><DD
39989
><P
39990
> Sets construction variables for the Compaq Visual Fortran compiler.
39991
</P
39992
><P
39993
> Sets: <A
39994
HREF="#cv-FORTRAN"
39995
><CODE
39996
CLASS="envar"
39997
>$FORTRAN</CODE
39998
></A
39999
>, <A
40000
HREF="#cv-FORTRANCOM"
40001
><CODE
40002
CLASS="envar"
40003
>$FORTRANCOM</CODE
40004
></A
40005
>, <A
40006
HREF="#cv-FORTRANMODDIR"
40007
><CODE
40008
CLASS="envar"
40009
>$FORTRANMODDIR</CODE
40010
></A
40011
>, <A
40012
HREF="#cv-FORTRANMODDIRPREFIX"
40013
><CODE
40014
CLASS="envar"
40015
>$FORTRANMODDIRPREFIX</CODE
40016
></A
40017
>, <A
40018
HREF="#cv-FORTRANMODDIRSUFFIX"
40019
><CODE
40020
CLASS="envar"
40021
>$FORTRANMODDIRSUFFIX</CODE
40022
></A
40023
>, <A
40024
HREF="#cv-FORTRANPPCOM"
40025
><CODE
40026
CLASS="envar"
40027
>$FORTRANPPCOM</CODE
40028
></A
40029
>, <A
40030
HREF="#cv-OBJSUFFIX"
40031
><CODE
40032
CLASS="envar"
40033
>$OBJSUFFIX</CODE
40034
></A
40035
>, <A
40036
HREF="#cv-SHFORTRANCOM"
40037
><CODE
40038
CLASS="envar"
40039
>$SHFORTRANCOM</CODE
40040
></A
40041
>, <A
40042
HREF="#cv-SHFORTRANPPCOM"
40043
><CODE
40044
CLASS="envar"
40045
>$SHFORTRANPPCOM</CODE
40046
></A
40047
>.
40048
</P
40049
><P
40050
> Uses: <A
40051
HREF="#cv-CPPFLAGS"
40052
><CODE
40053
CLASS="envar"
40054
>$CPPFLAGS</CODE
40055
></A
40056
>, <A
40057
HREF="#cv-FORTRANFLAGS"
40058
><CODE
40059
CLASS="envar"
40060
>$FORTRANFLAGS</CODE
40061
></A
40062
>, <A
40063
HREF="#cv-SHFORTRANFLAGS"
40064
><CODE
40065
CLASS="envar"
40066
>$SHFORTRANFLAGS</CODE
40067
></A
40068
>, <A
40069
HREF="#cv-_CPPDEFFLAGS"
40070
><CODE
40071
CLASS="envar"
40072
>$_CPPDEFFLAGS</CODE
40073
></A
40074
>, <A
40075
HREF="#cv-_FORTRANINCFLAGS"
40076
><CODE
40077
CLASS="envar"
40078
>$_FORTRANINCFLAGS</CODE
40079
></A
40080
>, <A
40081
HREF="#cv-_FORTRANMODFLAG"
40082
><CODE
40083
CLASS="envar"
40084
>$_FORTRANMODFLAG</CODE
40085
></A
40086
>.
40087
</P
40088
></DD
40089
><DT
40090
><A
40091
NAME="t-CVS"
40092
></A
40093
><TT
40094
CLASS="literal"
40095
>CVS</TT
40096
></DT
40097
><DD
40098
><P
40099
> Sets construction variables for the CVS source code
40100
management system.
40101
</P
40102
><P
40103
> Sets: <A
40104
HREF="#cv-CVS"
40105
><CODE
40106
CLASS="envar"
40107
>$CVS</CODE
40108
></A
40109
>, <A
40110
HREF="#cv-CVSCOFLAGS"
40111
><CODE
40112
CLASS="envar"
40113
>$CVSCOFLAGS</CODE
40114
></A
40115
>, <A
40116
HREF="#cv-CVSCOM"
40117
><CODE
40118
CLASS="envar"
40119
>$CVSCOM</CODE
40120
></A
40121
>, <A
40122
HREF="#cv-CVSFLAGS"
40123
><CODE
40124
CLASS="envar"
40125
>$CVSFLAGS</CODE
40126
></A
40127
>.
40128
</P
40129
><P
40130
> Uses: <A
40131
HREF="#cv-CVSCOMSTR"
40132
><CODE
40133
CLASS="envar"
40134
>$CVSCOMSTR</CODE
40135
></A
40136
>.
40137
</P
40138
></DD
40139
><DT
40140
><A
40141
NAME="t-cXX"
40142
></A
40143
><TT
40144
CLASS="literal"
40145
>cXX</TT
40146
></DT
40147
><DD
40148
><P
40149
> Sets construction variables for generic POSIX C++ compilers.
40150
</P
40151
><P
40152
> Sets: <A
40153
HREF="#cv-CPPDEFPREFIX"
40154
><CODE
40155
CLASS="envar"
40156
>$CPPDEFPREFIX</CODE
40157
></A
40158
>, <A
40159
HREF="#cv-CPPDEFSUFFIX"
40160
><CODE
40161
CLASS="envar"
40162
>$CPPDEFSUFFIX</CODE
40163
></A
40164
>, <A
40165
HREF="#cv-CXX"
40166
><CODE
40167
CLASS="envar"
40168
>$CXX</CODE
40169
></A
40170
>, <A
40171
HREF="#cv-CXXCOM"
40172
><CODE
40173
CLASS="envar"
40174
>$CXXCOM</CODE
40175
></A
40176
>, <A
40177
HREF="#cv-CXXFILESUFFIX"
40178
><CODE
40179
CLASS="envar"
40180
>$CXXFILESUFFIX</CODE
40181
></A
40182
>, <A
40183
HREF="#cv-CXXFLAGS"
40184
><CODE
40185
CLASS="envar"
40186
>$CXXFLAGS</CODE
40187
></A
40188
>, <A
40189
HREF="#cv-INCPREFIX"
40190
><CODE
40191
CLASS="envar"
40192
>$INCPREFIX</CODE
40193
></A
40194
>, <A
40195
HREF="#cv-INCSUFFIX"
40196
><CODE
40197
CLASS="envar"
40198
>$INCSUFFIX</CODE
40199
></A
40200
>, <A
40201
HREF="#cv-OBJSUFFIX"
40202
><CODE
40203
CLASS="envar"
40204
>$OBJSUFFIX</CODE
40205
></A
40206
>, <A
40207
HREF="#cv-SHCXX"
40208
><CODE
40209
CLASS="envar"
40210
>$SHCXX</CODE
40211
></A
40212
>, <A
40213
HREF="#cv-SHCXXCOM"
40214
><CODE
40215
CLASS="envar"
40216
>$SHCXXCOM</CODE
40217
></A
40218
>, <A
40219
HREF="#cv-SHCXXFLAGS"
40220
><CODE
40221
CLASS="envar"
40222
>$SHCXXFLAGS</CODE
40223
></A
40224
>, <A
40225
HREF="#cv-SHOBJSUFFIX"
40226
><CODE
40227
CLASS="envar"
40228
>$SHOBJSUFFIX</CODE
40229
></A
40230
>.
40231
</P
40232
><P
40233
> Uses: <A
40234
HREF="#cv-CXXCOMSTR"
40235
><CODE
40236
CLASS="envar"
40237
>$CXXCOMSTR</CODE
40238
></A
40239
>.
40240
</P
40241
></DD
40242
><DT
40243
><A
40244
NAME="t-default"
40245
></A
40246
><TT
40247
CLASS="literal"
40248
>default</TT
40249
></DT
40250
><DD
40251
><P
40252
> Sets variables by calling a default list of Tool modules
40253
for the platform on which SCons is running.
40254
</P
40255
></DD
40256
><DT
40257
><A
40258
NAME="t-dmd"
40259
></A
40260
><TT
40261
CLASS="literal"
40262
>dmd</TT
40263
></DT
40264
><DD
40265
><P
40266
> Sets construction variables for D language compilers
40267
(the Digital Mars D compiler, or GDC).
40268
</P
40269
></DD
40270
><DT
40271
><A
40272
NAME="t-dvi"
40273
></A
40274
><TT
40275
CLASS="literal"
40276
>dvi</TT
40277
></DT
40278
><DD
40279
><P
40280
> Attaches the <CODE
40281
CLASS="function"
40282
>DVI</CODE
40283
> builder to the
40284
construction environment.
40285
</P
40286
></DD
40287
><DT
40288
><A
40289
NAME="t-dvipdf"
40290
></A
40291
><TT
40292
CLASS="literal"
40293
>dvipdf</TT
40294
></DT
40295
><DD
40296
><P
40297
> Sets construction variables for the dvipdf utility.
40298
</P
40299
><P
40300
> Sets: <A
40301
HREF="#cv-DVIPDF"
40302
><CODE
40303
CLASS="envar"
40304
>$DVIPDF</CODE
40305
></A
40306
>, <A
40307
HREF="#cv-DVIPDFCOM"
40308
><CODE
40309
CLASS="envar"
40310
>$DVIPDFCOM</CODE
40311
></A
40312
>, <A
40313
HREF="#cv-DVIPDFFLAGS"
40314
><CODE
40315
CLASS="envar"
40316
>$DVIPDFFLAGS</CODE
40317
></A
40318
>.
40319
</P
40320
><P
40321
> Uses: <A
40322
HREF="#cv-DVIPDFCOMSTR"
40323
><CODE
40324
CLASS="envar"
40325
>$DVIPDFCOMSTR</CODE
40326
></A
40327
>.
40328
</P
40329
></DD
40330
><DT
40331
><A
40332
NAME="t-dvips"
40333
></A
40334
><TT
40335
CLASS="literal"
40336
>dvips</TT
40337
></DT
40338
><DD
40339
><P
40340
> Sets construction variables for the dvips utility.
40341
</P
40342
><P
40343
> Sets: <A
40344
HREF="#cv-DVIPS"
40345
><CODE
40346
CLASS="envar"
40347
>$DVIPS</CODE
40348
></A
40349
>, <A
40350
HREF="#cv-DVIPSFLAGS"
40351
><CODE
40352
CLASS="envar"
40353
>$DVIPSFLAGS</CODE
40354
></A
40355
>, <A
40356
HREF="#cv-PSCOM"
40357
><CODE
40358
CLASS="envar"
40359
>$PSCOM</CODE
40360
></A
40361
>, <A
40362
HREF="#cv-PSPREFIX"
40363
><CODE
40364
CLASS="envar"
40365
>$PSPREFIX</CODE
40366
></A
40367
>, <A
40368
HREF="#cv-PSSUFFIX"
40369
><CODE
40370
CLASS="envar"
40371
>$PSSUFFIX</CODE
40372
></A
40373
>.
40374
</P
40375
><P
40376
> Uses: <A
40377
HREF="#cv-PSCOMSTR"
40378
><CODE
40379
CLASS="envar"
40380
>$PSCOMSTR</CODE
40381
></A
40382
>.
40383
</P
40384
></DD
40385
><DT
40386
><A
40387
NAME="t-f77"
40388
></A
40389
><TT
40390
CLASS="literal"
40391
>f77</TT
40392
></DT
40393
><DD
40394
><P
40395
> Set construction variables for generic POSIX Fortran 77 compilers.
40396
</P
40397
><P
40398
> Sets: <A
40399
HREF="#cv-F77"
40400
><CODE
40401
CLASS="envar"
40402
>$F77</CODE
40403
></A
40404
>, <A
40405
HREF="#cv-F77COM"
40406
><CODE
40407
CLASS="envar"
40408
>$F77COM</CODE
40409
></A
40410
>, <A
40411
HREF="#cv-F77FILESUFFIXES"
40412
><CODE
40413
CLASS="envar"
40414
>$F77FILESUFFIXES</CODE
40415
></A
40416
>, <A
40417
HREF="#cv-F77FLAGS"
40418
><CODE
40419
CLASS="envar"
40420
>$F77FLAGS</CODE
40421
></A
40422
>, <A
40423
HREF="#cv-F77PPCOM"
40424
><CODE
40425
CLASS="envar"
40426
>$F77PPCOM</CODE
40427
></A
40428
>, <A
40429
HREF="#cv-F77PPFILESUFFIXES"
40430
><CODE
40431
CLASS="envar"
40432
>$F77PPFILESUFFIXES</CODE
40433
></A
40434
>, <A
40435
HREF="#cv-FORTRAN"
40436
><CODE
40437
CLASS="envar"
40438
>$FORTRAN</CODE
40439
></A
40440
>, <A
40441
HREF="#cv-FORTRANCOM"
40442
><CODE
40443
CLASS="envar"
40444
>$FORTRANCOM</CODE
40445
></A
40446
>, <A
40447
HREF="#cv-FORTRANFLAGS"
40448
><CODE
40449
CLASS="envar"
40450
>$FORTRANFLAGS</CODE
40451
></A
40452
>, <A
40453
HREF="#cv-SHF77"
40454
><CODE
40455
CLASS="envar"
40456
>$SHF77</CODE
40457
></A
40458
>, <A
40459
HREF="#cv-SHF77COM"
40460
><CODE
40461
CLASS="envar"
40462
>$SHF77COM</CODE
40463
></A
40464
>, <A
40465
HREF="#cv-SHF77FLAGS"
40466
><CODE
40467
CLASS="envar"
40468
>$SHF77FLAGS</CODE
40469
></A
40470
>, <A
40471
HREF="#cv-SHF77PPCOM"
40472
><CODE
40473
CLASS="envar"
40474
>$SHF77PPCOM</CODE
40475
></A
40476
>, <A
40477
HREF="#cv-SHFORTRAN"
40478
><CODE
40479
CLASS="envar"
40480
>$SHFORTRAN</CODE
40481
></A
40482
>, <A
40483
HREF="#cv-SHFORTRANCOM"
40484
><CODE
40485
CLASS="envar"
40486
>$SHFORTRANCOM</CODE
40487
></A
40488
>, <A
40489
HREF="#cv-SHFORTRANFLAGS"
40490
><CODE
40491
CLASS="envar"
40492
>$SHFORTRANFLAGS</CODE
40493
></A
40494
>, <A
40495
HREF="#cv-SHFORTRANPPCOM"
40496
><CODE
40497
CLASS="envar"
40498
>$SHFORTRANPPCOM</CODE
40499
></A
40500
>, <A
40501
HREF="#cv-_F77INCFLAGS"
40502
><CODE
40503
CLASS="envar"
40504
>$_F77INCFLAGS</CODE
40505
></A
40506
>.
40507
</P
40508
><P
40509
> Uses: <A
40510
HREF="#cv-F77COMSTR"
40511
><CODE
40512
CLASS="envar"
40513
>$F77COMSTR</CODE
40514
></A
40515
>, <A
40516
HREF="#cv-F77PPCOMSTR"
40517
><CODE
40518
CLASS="envar"
40519
>$F77PPCOMSTR</CODE
40520
></A
40521
>, <A
40522
HREF="#cv-FORTRANCOMSTR"
40523
><CODE
40524
CLASS="envar"
40525
>$FORTRANCOMSTR</CODE
40526
></A
40527
>, <A
40528
HREF="#cv-FORTRANPPCOMSTR"
40529
><CODE
40530
CLASS="envar"
40531
>$FORTRANPPCOMSTR</CODE
40532
></A
40533
>, <A
40534
HREF="#cv-SHF77COMSTR"
40535
><CODE
40536
CLASS="envar"
40537
>$SHF77COMSTR</CODE
40538
></A
40539
>, <A
40540
HREF="#cv-SHF77PPCOMSTR"
40541
><CODE
40542
CLASS="envar"
40543
>$SHF77PPCOMSTR</CODE
40544
></A
40545
>, <A
40546
HREF="#cv-SHFORTRANCOMSTR"
40547
><CODE
40548
CLASS="envar"
40549
>$SHFORTRANCOMSTR</CODE
40550
></A
40551
>, <A
40552
HREF="#cv-SHFORTRANPPCOMSTR"
40553
><CODE
40554
CLASS="envar"
40555
>$SHFORTRANPPCOMSTR</CODE
40556
></A
40557
>.
40558
</P
40559
></DD
40560
><DT
40561
><A
40562
NAME="t-f90"
40563
></A
40564
><TT
40565
CLASS="literal"
40566
>f90</TT
40567
></DT
40568
><DD
40569
><P
40570
> Set construction variables for generic POSIX Fortran 90 compilers.
40571
</P
40572
><P
40573
> Sets: <A
40574
HREF="#cv-F90"
40575
><CODE
40576
CLASS="envar"
40577
>$F90</CODE
40578
></A
40579
>, <A
40580
HREF="#cv-F90COM"
40581
><CODE
40582
CLASS="envar"
40583
>$F90COM</CODE
40584
></A
40585
>, <A
40586
HREF="#cv-F90FLAGS"
40587
><CODE
40588
CLASS="envar"
40589
>$F90FLAGS</CODE
40590
></A
40591
>, <A
40592
HREF="#cv-F90PPCOM"
40593
><CODE
40594
CLASS="envar"
40595
>$F90PPCOM</CODE
40596
></A
40597
>, <A
40598
HREF="#cv-SHF90"
40599
><CODE
40600
CLASS="envar"
40601
>$SHF90</CODE
40602
></A
40603
>, <A
40604
HREF="#cv-SHF90COM"
40605
><CODE
40606
CLASS="envar"
40607
>$SHF90COM</CODE
40608
></A
40609
>, <A
40610
HREF="#cv-SHF90FLAGS"
40611
><CODE
40612
CLASS="envar"
40613
>$SHF90FLAGS</CODE
40614
></A
40615
>, <A
40616
HREF="#cv-SHF90PPCOM"
40617
><CODE
40618
CLASS="envar"
40619
>$SHF90PPCOM</CODE
40620
></A
40621
>, <A
40622
HREF="#cv-_F90INCFLAGS"
40623
><CODE
40624
CLASS="envar"
40625
>$_F90INCFLAGS</CODE
40626
></A
40627
>.
40628
</P
40629
><P
40630
> Uses: <A
40631
HREF="#cv-F90COMSTR"
40632
><CODE
40633
CLASS="envar"
40634
>$F90COMSTR</CODE
40635
></A
40636
>, <A
40637
HREF="#cv-F90PPCOMSTR"
40638
><CODE
40639
CLASS="envar"
40640
>$F90PPCOMSTR</CODE
40641
></A
40642
>, <A
40643
HREF="#cv-SHF90COMSTR"
40644
><CODE
40645
CLASS="envar"
40646
>$SHF90COMSTR</CODE
40647
></A
40648
>, <A
40649
HREF="#cv-SHF90PPCOMSTR"
40650
><CODE
40651
CLASS="envar"
40652
>$SHF90PPCOMSTR</CODE
40653
></A
40654
>.
40655
</P
40656
></DD
40657
><DT
40658
><A
40659
NAME="t-f95"
40660
></A
40661
><TT
40662
CLASS="literal"
40663
>f95</TT
40664
></DT
40665
><DD
40666
><P
40667
> Set construction variables for generic POSIX Fortran 95 compilers.
40668
</P
40669
><P
40670
> Sets: <A
40671
HREF="#cv-F95"
40672
><CODE
40673
CLASS="envar"
40674
>$F95</CODE
40675
></A
40676
>, <A
40677
HREF="#cv-F95COM"
40678
><CODE
40679
CLASS="envar"
40680
>$F95COM</CODE
40681
></A
40682
>, <A
40683
HREF="#cv-F95FLAGS"
40684
><CODE
40685
CLASS="envar"
40686
>$F95FLAGS</CODE
40687
></A
40688
>, <A
40689
HREF="#cv-F95PPCOM"
40690
><CODE
40691
CLASS="envar"
40692
>$F95PPCOM</CODE
40693
></A
40694
>, <A
40695
HREF="#cv-SHF95"
40696
><CODE
40697
CLASS="envar"
40698
>$SHF95</CODE
40699
></A
40700
>, <A
40701
HREF="#cv-SHF95COM"
40702
><CODE
40703
CLASS="envar"
40704
>$SHF95COM</CODE
40705
></A
40706
>, <A
40707
HREF="#cv-SHF95FLAGS"
40708
><CODE
40709
CLASS="envar"
40710
>$SHF95FLAGS</CODE
40711
></A
40712
>, <A
40713
HREF="#cv-SHF95PPCOM"
40714
><CODE
40715
CLASS="envar"
40716
>$SHF95PPCOM</CODE
40717
></A
40718
>, <A
40719
HREF="#cv-_F95INCFLAGS"
40720
><CODE
40721
CLASS="envar"
40722
>$_F95INCFLAGS</CODE
40723
></A
40724
>.
40725
</P
40726
><P
40727
> Uses: <A
40728
HREF="#cv-F95COMSTR"
40729
><CODE
40730
CLASS="envar"
40731
>$F95COMSTR</CODE
40732
></A
40733
>, <A
40734
HREF="#cv-F95PPCOMSTR"
40735
><CODE
40736
CLASS="envar"
40737
>$F95PPCOMSTR</CODE
40738
></A
40739
>, <A
40740
HREF="#cv-SHF95COMSTR"
40741
><CODE
40742
CLASS="envar"
40743
>$SHF95COMSTR</CODE
40744
></A
40745
>, <A
40746
HREF="#cv-SHF95PPCOMSTR"
40747
><CODE
40748
CLASS="envar"
40749
>$SHF95PPCOMSTR</CODE
40750
></A
40751
>.
40752
</P
40753
></DD
40754
><DT
40755
><A
40756
NAME="t-fortran"
40757
></A
40758
><TT
40759
CLASS="literal"
40760
>fortran</TT
40761
></DT
40762
><DD
40763
><P
40764
> Set construction variables for generic POSIX Fortran compilers.
40765
</P
40766
><P
40767
> Sets: <A
40768
HREF="#cv-FORTRAN"
40769
><CODE
40770
CLASS="envar"
40771
>$FORTRAN</CODE
40772
></A
40773
>, <A
40774
HREF="#cv-FORTRANCOM"
40775
><CODE
40776
CLASS="envar"
40777
>$FORTRANCOM</CODE
40778
></A
40779
>, <A
40780
HREF="#cv-FORTRANFLAGS"
40781
><CODE
40782
CLASS="envar"
40783
>$FORTRANFLAGS</CODE
40784
></A
40785
>, <A
40786
HREF="#cv-SHFORTRAN"
40787
><CODE
40788
CLASS="envar"
40789
>$SHFORTRAN</CODE
40790
></A
40791
>, <A
40792
HREF="#cv-SHFORTRANCOM"
40793
><CODE
40794
CLASS="envar"
40795
>$SHFORTRANCOM</CODE
40796
></A
40797
>, <A
40798
HREF="#cv-SHFORTRANFLAGS"
40799
><CODE
40800
CLASS="envar"
40801
>$SHFORTRANFLAGS</CODE
40802
></A
40803
>, <A
40804
HREF="#cv-SHFORTRANPPCOM"
40805
><CODE
40806
CLASS="envar"
40807
>$SHFORTRANPPCOM</CODE
40808
></A
40809
>.
40810
</P
40811
><P
40812
> Uses: <A
40813
HREF="#cv-FORTRANCOMSTR"
40814
><CODE
40815
CLASS="envar"
40816
>$FORTRANCOMSTR</CODE
40817
></A
40818
>, <A
40819
HREF="#cv-FORTRANPPCOMSTR"
40820
><CODE
40821
CLASS="envar"
40822
>$FORTRANPPCOMSTR</CODE
40823
></A
40824
>, <A
40825
HREF="#cv-SHFORTRANCOMSTR"
40826
><CODE
40827
CLASS="envar"
40828
>$SHFORTRANCOMSTR</CODE
40829
></A
40830
>, <A
40831
HREF="#cv-SHFORTRANPPCOMSTR"
40832
><CODE
40833
CLASS="envar"
40834
>$SHFORTRANPPCOMSTR</CODE
40835
></A
40836
>.
40837
</P
40838
></DD
40839
><DT
40840
><A
40841
NAME="t-gXX"
40842
></A
40843
><TT
40844
CLASS="literal"
40845
>g++</TT
40846
></DT
40847
><DD
40848
><P
40849
> Set construction variables for the <SPAN
40850
CLASS="application"
40851
>gXX</SPAN
40852
> C++ compiler.
40853
</P
40854
><P
40855
> Sets: <A
40856
HREF="#cv-CXX"
40857
><CODE
40858
CLASS="envar"
40859
>$CXX</CODE
40860
></A
40861
>, <A
40862
HREF="#cv-CXXVERSION"
40863
><CODE
40864
CLASS="envar"
40865
>$CXXVERSION</CODE
40866
></A
40867
>, <A
40868
HREF="#cv-SHCXXFLAGS"
40869
><CODE
40870
CLASS="envar"
40871
>$SHCXXFLAGS</CODE
40872
></A
40873
>, <A
40874
HREF="#cv-SHOBJSUFFIX"
40875
><CODE
40876
CLASS="envar"
40877
>$SHOBJSUFFIX</CODE
40878
></A
40879
>.
40880
</P
40881
></DD
40882
><DT
40883
><A
40884
NAME="t-g77"
40885
></A
40886
><TT
40887
CLASS="literal"
40888
>g77</TT
40889
></DT
40890
><DD
40891
><P
40892
> Set construction variables for the <SPAN
40893
CLASS="application"
40894
>g77</SPAN
40895
> Fortran compiler.
40896
Calls the <TT
40897
CLASS="literal"
40898
>f77</TT
40899
> Tool module
40900
to set variables.
40901
</P
40902
></DD
40903
><DT
40904
><A
40905
NAME="t-gas"
40906
></A
40907
><TT
40908
CLASS="literal"
40909
>gas</TT
40910
></DT
40911
><DD
40912
><P
40913
> Sets construction variables for the <SPAN
40914
CLASS="application"
40915
>gas</SPAN
40916
> assembler.
40917
Calls the <TT
40918
CLASS="literal"
40919
>as</TT
40920
> module.
40921
</P
40922
><P
40923
> Sets: <A
40924
HREF="#cv-AS"
40925
><CODE
40926
CLASS="envar"
40927
>$AS</CODE
40928
></A
40929
>.
40930
</P
40931
></DD
40932
><DT
40933
><A
40934
NAME="t-gcc"
40935
></A
40936
><TT
40937
CLASS="literal"
40938
>gcc</TT
40939
></DT
40940
><DD
40941
><P
40942
> Set construction variables for the <SPAN
40943
CLASS="application"
40944
>gcc</SPAN
40945
> C compiler.
40946
</P
40947
><P
40948
> Sets: <A
40949
HREF="#cv-CC"
40950
><CODE
40951
CLASS="envar"
40952
>$CC</CODE
40953
></A
40954
>, <A
40955
HREF="#cv-CCVERSION"
40956
><CODE
40957
CLASS="envar"
40958
>$CCVERSION</CODE
40959
></A
40960
>, <A
40961
HREF="#cv-SHCCFLAGS"
40962
><CODE
40963
CLASS="envar"
40964
>$SHCCFLAGS</CODE
40965
></A
40966
>.
40967
</P
40968
></DD
40969
><DT
40970
><A
40971
NAME="t-gnulink"
40972
></A
40973
><TT
40974
CLASS="literal"
40975
>gnulink</TT
40976
></DT
40977
><DD
40978
><P
40979
> Set construction variables for GNU linker/loader.
40980
</P
40981
><P
40982
> Sets: <A
40983
HREF="#cv-RPATHPREFIX"
40984
><CODE
40985
CLASS="envar"
40986
>$RPATHPREFIX</CODE
40987
></A
40988
>, <A
40989
HREF="#cv-RPATHSUFFIX"
40990
><CODE
40991
CLASS="envar"
40992
>$RPATHSUFFIX</CODE
40993
></A
40994
>, <A
40995
HREF="#cv-SHLINKFLAGS"
40996
><CODE
40997
CLASS="envar"
40998
>$SHLINKFLAGS</CODE
40999
></A
41000
>.
41001
</P
41002
></DD
41003
><DT
41004
><A
41005
NAME="t-gs"
41006
></A
41007
><TT
41008
CLASS="literal"
41009
>gs</TT
41010
></DT
41011
><DD
41012
><P
41013
> Set construction variables for Ghostscript.
41014
</P
41015
><P
41016
> Sets: <A
41017
HREF="#cv-GS"
41018
><CODE
41019
CLASS="envar"
41020
>$GS</CODE
41021
></A
41022
>, <A
41023
HREF="#cv-GSCOM"
41024
><CODE
41025
CLASS="envar"
41026
>$GSCOM</CODE
41027
></A
41028
>, <A
41029
HREF="#cv-GSFLAGS"
41030
><CODE
41031
CLASS="envar"
41032
>$GSFLAGS</CODE
41033
></A
41034
>.
41035
</P
41036
><P
41037
> Uses: <A
41038
HREF="#cv-GSCOMSTR"
41039
><CODE
41040
CLASS="envar"
41041
>$GSCOMSTR</CODE
41042
></A
41043
>.
41044
</P
41045
></DD
41046
><DT
41047
><A
41048
NAME="t-hpcXX"
41049
></A
41050
><TT
41051
CLASS="literal"
41052
>hpc++</TT
41053
></DT
41054
><DD
41055
><P
41056
> Set construction variables for the compilers aCC on HP/UX systems.
41057
</P
41058
></DD
41059
><DT
41060
><A
41061
NAME="t-hpcc"
41062
></A
41063
><TT
41064
CLASS="literal"
41065
>hpcc</TT
41066
></DT
41067
><DD
41068
><P
41069
> Set construction variables for the
41070
<SPAN
41071
CLASS="application"
41072
>aCC</SPAN
41073
> on HP/UX systems.
41074
Calls the <TT
41075
CLASS="literal"
41076
>cXX</TT
41077
> tool for additional variables.
41078
</P
41079
><P
41080
> Sets: <A
41081
HREF="#cv-CXX"
41082
><CODE
41083
CLASS="envar"
41084
>$CXX</CODE
41085
></A
41086
>, <A
41087
HREF="#cv-CXXVERSION"
41088
><CODE
41089
CLASS="envar"
41090
>$CXXVERSION</CODE
41091
></A
41092
>, <A
41093
HREF="#cv-SHCXXFLAGS"
41094
><CODE
41095
CLASS="envar"
41096
>$SHCXXFLAGS</CODE
41097
></A
41098
>.
41099
</P
41100
></DD
41101
><DT
41102
><A
41103
NAME="t-hplink"
41104
></A
41105
><TT
41106
CLASS="literal"
41107
>hplink</TT
41108
></DT
41109
><DD
41110
><P
41111
> Sets construction variables for the linker on HP/UX systems.
41112
</P
41113
><P
41114
> Sets: <A
41115
HREF="#cv-LINKFLAGS"
41116
><CODE
41117
CLASS="envar"
41118
>$LINKFLAGS</CODE
41119
></A
41120
>, <A
41121
HREF="#cv-SHLIBSUFFIX"
41122
><CODE
41123
CLASS="envar"
41124
>$SHLIBSUFFIX</CODE
41125
></A
41126
>, <A
41127
HREF="#cv-SHLINKFLAGS"
41128
><CODE
41129
CLASS="envar"
41130
>$SHLINKFLAGS</CODE
41131
></A
41132
>.
41133
</P
41134
></DD
41135
><DT
41136
><A
41137
NAME="t-icc"
41138
></A
41139
><TT
41140
CLASS="literal"
41141
>icc</TT
41142
></DT
41143
><DD
41144
><P
41145
> Sets construction variables for the
41146
<SPAN
41147
CLASS="application"
41148
>icc</SPAN
41149
> compiler on OS/2 systems.
41150
</P
41151
><P
41152
> Sets: <A
41153
HREF="#cv-CC"
41154
><CODE
41155
CLASS="envar"
41156
>$CC</CODE
41157
></A
41158
>, <A
41159
HREF="#cv-CCCOM"
41160
><CODE
41161
CLASS="envar"
41162
>$CCCOM</CODE
41163
></A
41164
>, <A
41165
HREF="#cv-CFILESUFFIX"
41166
><CODE
41167
CLASS="envar"
41168
>$CFILESUFFIX</CODE
41169
></A
41170
>, <A
41171
HREF="#cv-CPPDEFPREFIX"
41172
><CODE
41173
CLASS="envar"
41174
>$CPPDEFPREFIX</CODE
41175
></A
41176
>, <A
41177
HREF="#cv-CPPDEFSUFFIX"
41178
><CODE
41179
CLASS="envar"
41180
>$CPPDEFSUFFIX</CODE
41181
></A
41182
>, <A
41183
HREF="#cv-CXXCOM"
41184
><CODE
41185
CLASS="envar"
41186
>$CXXCOM</CODE
41187
></A
41188
>, <A
41189
HREF="#cv-CXXFILESUFFIX"
41190
><CODE
41191
CLASS="envar"
41192
>$CXXFILESUFFIX</CODE
41193
></A
41194
>, <A
41195
HREF="#cv-INCPREFIX"
41196
><CODE
41197
CLASS="envar"
41198
>$INCPREFIX</CODE
41199
></A
41200
>, <A
41201
HREF="#cv-INCSUFFIX"
41202
><CODE
41203
CLASS="envar"
41204
>$INCSUFFIX</CODE
41205
></A
41206
>.
41207
</P
41208
><P
41209
> Uses: <A
41210
HREF="#cv-CCFLAGS"
41211
><CODE
41212
CLASS="envar"
41213
>$CCFLAGS</CODE
41214
></A
41215
>, <A
41216
HREF="#cv-CFLAGS"
41217
><CODE
41218
CLASS="envar"
41219
>$CFLAGS</CODE
41220
></A
41221
>, <A
41222
HREF="#cv-CPPFLAGS"
41223
><CODE
41224
CLASS="envar"
41225
>$CPPFLAGS</CODE
41226
></A
41227
>, <A
41228
HREF="#cv-_CPPDEFFLAGS"
41229
><CODE
41230
CLASS="envar"
41231
>$_CPPDEFFLAGS</CODE
41232
></A
41233
>, <A
41234
HREF="#cv-_CPPINCFLAGS"
41235
><CODE
41236
CLASS="envar"
41237
>$_CPPINCFLAGS</CODE
41238
></A
41239
>.
41240
</P
41241
></DD
41242
><DT
41243
><A
41244
NAME="t-icl"
41245
></A
41246
><TT
41247
CLASS="literal"
41248
>icl</TT
41249
></DT
41250
><DD
41251
><P
41252
> Sets construction variables for the Intel C/C++ compiler.
41253
Calls the <TT
41254
CLASS="literal"
41255
>intelc</TT
41256
> Tool module to set its variables.
41257
</P
41258
></DD
41259
><DT
41260
><A
41261
NAME="t-ifl"
41262
></A
41263
><TT
41264
CLASS="literal"
41265
>ifl</TT
41266
></DT
41267
><DD
41268
><P
41269
> Sets construction variables for the Intel Fortran compiler.
41270
</P
41271
><P
41272
> Sets: <A
41273
HREF="#cv-FORTRAN"
41274
><CODE
41275
CLASS="envar"
41276
>$FORTRAN</CODE
41277
></A
41278
>, <A
41279
HREF="#cv-FORTRANCOM"
41280
><CODE
41281
CLASS="envar"
41282
>$FORTRANCOM</CODE
41283
></A
41284
>, <A
41285
HREF="#cv-FORTRANPPCOM"
41286
><CODE
41287
CLASS="envar"
41288
>$FORTRANPPCOM</CODE
41289
></A
41290
>, <A
41291
HREF="#cv-SHFORTRANCOM"
41292
><CODE
41293
CLASS="envar"
41294
>$SHFORTRANCOM</CODE
41295
></A
41296
>, <A
41297
HREF="#cv-SHFORTRANPPCOM"
41298
><CODE
41299
CLASS="envar"
41300
>$SHFORTRANPPCOM</CODE
41301
></A
41302
>.
41303
</P
41304
><P
41305
> Uses: <A
41306
HREF="#cv-CPPFLAGS"
41307
><CODE
41308
CLASS="envar"
41309
>$CPPFLAGS</CODE
41310
></A
41311
>, <A
41312
HREF="#cv-FORTRANFLAGS"
41313
><CODE
41314
CLASS="envar"
41315
>$FORTRANFLAGS</CODE
41316
></A
41317
>, <A
41318
HREF="#cv-_CPPDEFFLAGS"
41319
><CODE
41320
CLASS="envar"
41321
>$_CPPDEFFLAGS</CODE
41322
></A
41323
>, <A
41324
HREF="#cv-_FORTRANINCFLAGS"
41325
><CODE
41326
CLASS="envar"
41327
>$_FORTRANINCFLAGS</CODE
41328
></A
41329
>.
41330
</P
41331
></DD
41332
><DT
41333
><A
41334
NAME="t-ifort"
41335
></A
41336
><TT
41337
CLASS="literal"
41338
>ifort</TT
41339
></DT
41340
><DD
41341
><P
41342
> Sets construction variables for newer versions
41343
of the Intel Fortran compiler for Linux.
41344
</P
41345
><P
41346
> Sets: <A
41347
HREF="#cv-F77"
41348
><CODE
41349
CLASS="envar"
41350
>$F77</CODE
41351
></A
41352
>, <A
41353
HREF="#cv-F90"
41354
><CODE
41355
CLASS="envar"
41356
>$F90</CODE
41357
></A
41358
>, <A
41359
HREF="#cv-F95"
41360
><CODE
41361
CLASS="envar"
41362
>$F95</CODE
41363
></A
41364
>, <A
41365
HREF="#cv-FORTRAN"
41366
><CODE
41367
CLASS="envar"
41368
>$FORTRAN</CODE
41369
></A
41370
>, <A
41371
HREF="#cv-SHF77"
41372
><CODE
41373
CLASS="envar"
41374
>$SHF77</CODE
41375
></A
41376
>, <A
41377
HREF="#cv-SHF77FLAGS"
41378
><CODE
41379
CLASS="envar"
41380
>$SHF77FLAGS</CODE
41381
></A
41382
>, <A
41383
HREF="#cv-SHF90"
41384
><CODE
41385
CLASS="envar"
41386
>$SHF90</CODE
41387
></A
41388
>, <A
41389
HREF="#cv-SHF90FLAGS"
41390
><CODE
41391
CLASS="envar"
41392
>$SHF90FLAGS</CODE
41393
></A
41394
>, <A
41395
HREF="#cv-SHF95"
41396
><CODE
41397
CLASS="envar"
41398
>$SHF95</CODE
41399
></A
41400
>, <A
41401
HREF="#cv-SHF95FLAGS"
41402
><CODE
41403
CLASS="envar"
41404
>$SHF95FLAGS</CODE
41405
></A
41406
>, <A
41407
HREF="#cv-SHFORTRAN"
41408
><CODE
41409
CLASS="envar"
41410
>$SHFORTRAN</CODE
41411
></A
41412
>, <A
41413
HREF="#cv-SHFORTRANFLAGS"
41414
><CODE
41415
CLASS="envar"
41416
>$SHFORTRANFLAGS</CODE
41417
></A
41418
>.
41419
</P
41420
></DD
41421
><DT
41422
><A
41423
NAME="t-ilink"
41424
></A
41425
><TT
41426
CLASS="literal"
41427
>ilink</TT
41428
></DT
41429
><DD
41430
><P
41431
> Sets construction variables for the
41432
<SPAN
41433
CLASS="application"
41434
>ilink</SPAN
41435
> linker on OS/2 systems.
41436
</P
41437
><P
41438
> Sets: <A
41439
HREF="#cv-LIBDIRPREFIX"
41440
><CODE
41441
CLASS="envar"
41442
>$LIBDIRPREFIX</CODE
41443
></A
41444
>, <A
41445
HREF="#cv-LIBDIRSUFFIX"
41446
><CODE
41447
CLASS="envar"
41448
>$LIBDIRSUFFIX</CODE
41449
></A
41450
>, <A
41451
HREF="#cv-LIBLINKPREFIX"
41452
><CODE
41453
CLASS="envar"
41454
>$LIBLINKPREFIX</CODE
41455
></A
41456
>, <A
41457
HREF="#cv-LIBLINKSUFFIX"
41458
><CODE
41459
CLASS="envar"
41460
>$LIBLINKSUFFIX</CODE
41461
></A
41462
>, <A
41463
HREF="#cv-LINK"
41464
><CODE
41465
CLASS="envar"
41466
>$LINK</CODE
41467
></A
41468
>, <A
41469
HREF="#cv-LINKCOM"
41470
><CODE
41471
CLASS="envar"
41472
>$LINKCOM</CODE
41473
></A
41474
>, <A
41475
HREF="#cv-LINKFLAGS"
41476
><CODE
41477
CLASS="envar"
41478
>$LINKFLAGS</CODE
41479
></A
41480
>.
41481
</P
41482
></DD
41483
><DT
41484
><A
41485
NAME="t-ilink32"
41486
></A
41487
><TT
41488
CLASS="literal"
41489
>ilink32</TT
41490
></DT
41491
><DD
41492
><P
41493
> Sets construction variables for the Borland
41494
<SPAN
41495
CLASS="application"
41496
>ilink32</SPAN
41497
> linker.
41498
</P
41499
><P
41500
> Sets: <A
41501
HREF="#cv-LIBDIRPREFIX"
41502
><CODE
41503
CLASS="envar"
41504
>$LIBDIRPREFIX</CODE
41505
></A
41506
>, <A
41507
HREF="#cv-LIBDIRSUFFIX"
41508
><CODE
41509
CLASS="envar"
41510
>$LIBDIRSUFFIX</CODE
41511
></A
41512
>, <A
41513
HREF="#cv-LIBLINKPREFIX"
41514
><CODE
41515
CLASS="envar"
41516
>$LIBLINKPREFIX</CODE
41517
></A
41518
>, <A
41519
HREF="#cv-LIBLINKSUFFIX"
41520
><CODE
41521
CLASS="envar"
41522
>$LIBLINKSUFFIX</CODE
41523
></A
41524
>, <A
41525
HREF="#cv-LINK"
41526
><CODE
41527
CLASS="envar"
41528
>$LINK</CODE
41529
></A
41530
>, <A
41531
HREF="#cv-LINKCOM"
41532
><CODE
41533
CLASS="envar"
41534
>$LINKCOM</CODE
41535
></A
41536
>, <A
41537
HREF="#cv-LINKFLAGS"
41538
><CODE
41539
CLASS="envar"
41540
>$LINKFLAGS</CODE
41541
></A
41542
>.
41543
</P
41544
></DD
41545
><DT
41546
><A
41547
NAME="t-install"
41548
></A
41549
><TT
41550
CLASS="literal"
41551
>install</TT
41552
></DT
41553
><DD
41554
><P
41555
> Sets construction variables for file
41556
and directory installation.
41557
</P
41558
><P
41559
> Sets: <A
41560
HREF="#cv-INSTALL"
41561
><CODE
41562
CLASS="envar"
41563
>$INSTALL</CODE
41564
></A
41565
>, <A
41566
HREF="#cv-INSTALLSTR"
41567
><CODE
41568
CLASS="envar"
41569
>$INSTALLSTR</CODE
41570
></A
41571
>.
41572
</P
41573
></DD
41574
><DT
41575
><A
41576
NAME="t-intelc"
41577
></A
41578
><TT
41579
CLASS="literal"
41580
>intelc</TT
41581
></DT
41582
><DD
41583
><P
41584
> Sets construction variables for the Intel C/C++ compiler
41585
(Linux and Windows, version 7 and later).
41586
Calls the <TT
41587
CLASS="literal"
41588
>gcc</TT
41589
> or <TT
41590
CLASS="literal"
41591
>msvc</TT
41592
>
41593
(on Linux and Windows, respectively)
41594
to set underlying variables.
41595
</P
41596
><P
41597
> Sets: <A
41598
HREF="#cv-AR"
41599
><CODE
41600
CLASS="envar"
41601
>$AR</CODE
41602
></A
41603
>, <A
41604
HREF="#cv-CC"
41605
><CODE
41606
CLASS="envar"
41607
>$CC</CODE
41608
></A
41609
>, <A
41610
HREF="#cv-CXX"
41611
><CODE
41612
CLASS="envar"
41613
>$CXX</CODE
41614
></A
41615
>, <A
41616
HREF="#cv-INTEL_C_COMPILER_VERSION"
41617
><CODE
41618
CLASS="envar"
41619
>$INTEL_C_COMPILER_VERSION</CODE
41620
></A
41621
>, <A
41622
HREF="#cv-LINK"
41623
><CODE
41624
CLASS="envar"
41625
>$LINK</CODE
41626
></A
41627
>.
41628
</P
41629
></DD
41630
><DT
41631
><A
41632
NAME="t-jar"
41633
></A
41634
><TT
41635
CLASS="literal"
41636
>jar</TT
41637
></DT
41638
><DD
41639
><P
41640
> Sets construction variables for the <SPAN
41641
CLASS="application"
41642
>jar</SPAN
41643
> utility.
41644
</P
41645
><P
41646
> Sets: <A
41647
HREF="#cv-JAR"
41648
><CODE
41649
CLASS="envar"
41650
>$JAR</CODE
41651
></A
41652
>, <A
41653
HREF="#cv-JARCOM"
41654
><CODE
41655
CLASS="envar"
41656
>$JARCOM</CODE
41657
></A
41658
>, <A
41659
HREF="#cv-JARFLAGS"
41660
><CODE
41661
CLASS="envar"
41662
>$JARFLAGS</CODE
41663
></A
41664
>, <A
41665
HREF="#cv-JARSUFFIX"
41666
><CODE
41667
CLASS="envar"
41668
>$JARSUFFIX</CODE
41669
></A
41670
>.
41671
</P
41672
><P
41673
> Uses: <A
41674
HREF="#cv-JARCOMSTR"
41675
><CODE
41676
CLASS="envar"
41677
>$JARCOMSTR</CODE
41678
></A
41679
>.
41680
</P
41681
></DD
41682
><DT
41683
><A
41684
NAME="t-javac"
41685
></A
41686
><TT
41687
CLASS="literal"
41688
>javac</TT
41689
></DT
41690
><DD
41691
><P
41692
> Sets construction variables for the <SPAN
41693
CLASS="application"
41694
>javac</SPAN
41695
> compiler.
41696
</P
41697
><P
41698
> Sets: <A
41699
HREF="#cv-JAVABOOTCLASSPATH"
41700
><CODE
41701
CLASS="envar"
41702
>$JAVABOOTCLASSPATH</CODE
41703
></A
41704
>, <A
41705
HREF="#cv-JAVAC"
41706
><CODE
41707
CLASS="envar"
41708
>$JAVAC</CODE
41709
></A
41710
>, <A
41711
HREF="#cv-JAVACCOM"
41712
><CODE
41713
CLASS="envar"
41714
>$JAVACCOM</CODE
41715
></A
41716
>, <A
41717
HREF="#cv-JAVACFLAGS"
41718
><CODE
41719
CLASS="envar"
41720
>$JAVACFLAGS</CODE
41721
></A
41722
>, <A
41723
HREF="#cv-JAVACLASSPATH"
41724
><CODE
41725
CLASS="envar"
41726
>$JAVACLASSPATH</CODE
41727
></A
41728
>, <A
41729
HREF="#cv-JAVACLASSSUFFIX"
41730
><CODE
41731
CLASS="envar"
41732
>$JAVACLASSSUFFIX</CODE
41733
></A
41734
>, <A
41735
HREF="#cv-JAVASOURCEPATH"
41736
><CODE
41737
CLASS="envar"
41738
>$JAVASOURCEPATH</CODE
41739
></A
41740
>, <A
41741
HREF="#cv-JAVASUFFIX"
41742
><CODE
41743
CLASS="envar"
41744
>$JAVASUFFIX</CODE
41745
></A
41746
>.
41747
</P
41748
><P
41749
> Uses: <A
41750
HREF="#cv-JAVACCOMSTR"
41751
><CODE
41752
CLASS="envar"
41753
>$JAVACCOMSTR</CODE
41754
></A
41755
>.
41756
</P
41757
></DD
41758
><DT
41759
><A
41760
NAME="t-javah"
41761
></A
41762
><TT
41763
CLASS="literal"
41764
>javah</TT
41765
></DT
41766
><DD
41767
><P
41768
> Sets construction variables for the <SPAN
41769
CLASS="application"
41770
>javah</SPAN
41771
> tool.
41772
</P
41773
><P
41774
> Sets: <A
41775
HREF="#cv-JAVACLASSSUFFIX"
41776
><CODE
41777
CLASS="envar"
41778
>$JAVACLASSSUFFIX</CODE
41779
></A
41780
>, <A
41781
HREF="#cv-JAVAH"
41782
><CODE
41783
CLASS="envar"
41784
>$JAVAH</CODE
41785
></A
41786
>, <A
41787
HREF="#cv-JAVAHCOM"
41788
><CODE
41789
CLASS="envar"
41790
>$JAVAHCOM</CODE
41791
></A
41792
>, <A
41793
HREF="#cv-JAVAHFLAGS"
41794
><CODE
41795
CLASS="envar"
41796
>$JAVAHFLAGS</CODE
41797
></A
41798
>.
41799
</P
41800
><P
41801
> Uses: <A
41802
HREF="#cv-JAVACLASSPATH"
41803
><CODE
41804
CLASS="envar"
41805
>$JAVACLASSPATH</CODE
41806
></A
41807
>, <A
41808
HREF="#cv-JAVAHCOMSTR"
41809
><CODE
41810
CLASS="envar"
41811
>$JAVAHCOMSTR</CODE
41812
></A
41813
>.
41814
</P
41815
></DD
41816
><DT
41817
><A
41818
NAME="t-latex"
41819
></A
41820
><TT
41821
CLASS="literal"
41822
>latex</TT
41823
></DT
41824
><DD
41825
><P
41826
> Sets construction variables for the <SPAN
41827
CLASS="application"
41828
>latex</SPAN
41829
> utility.
41830
</P
41831
><P
41832
> Sets: <A
41833
HREF="#cv-LATEX"
41834
><CODE
41835
CLASS="envar"
41836
>$LATEX</CODE
41837
></A
41838
>, <A
41839
HREF="#cv-LATEXCOM"
41840
><CODE
41841
CLASS="envar"
41842
>$LATEXCOM</CODE
41843
></A
41844
>, <A
41845
HREF="#cv-LATEXFLAGS"
41846
><CODE
41847
CLASS="envar"
41848
>$LATEXFLAGS</CODE
41849
></A
41850
>.
41851
</P
41852
><P
41853
> Uses: <A
41854
HREF="#cv-LATEXCOMSTR"
41855
><CODE
41856
CLASS="envar"
41857
>$LATEXCOMSTR</CODE
41858
></A
41859
>.
41860
</P
41861
></DD
41862
><DT
41863
><A
41864
NAME="t-lex"
41865
></A
41866
><TT
41867
CLASS="literal"
41868
>lex</TT
41869
></DT
41870
><DD
41871
><P
41872
> Sets construction variables for the <SPAN
41873
CLASS="application"
41874
>lex</SPAN
41875
> lexical analyser.
41876
</P
41877
><P
41878
> Sets: <A
41879
HREF="#cv-LEX"
41880
><CODE
41881
CLASS="envar"
41882
>$LEX</CODE
41883
></A
41884
>, <A
41885
HREF="#cv-LEXCOM"
41886
><CODE
41887
CLASS="envar"
41888
>$LEXCOM</CODE
41889
></A
41890
>, <A
41891
HREF="#cv-LEXFLAGS"
41892
><CODE
41893
CLASS="envar"
41894
>$LEXFLAGS</CODE
41895
></A
41896
>.
41897
</P
41898
><P
41899
> Uses: <A
41900
HREF="#cv-LEXCOMSTR"
41901
><CODE
41902
CLASS="envar"
41903
>$LEXCOMSTR</CODE
41904
></A
41905
>.
41906
</P
41907
></DD
41908
><DT
41909
><A
41910
NAME="t-link"
41911
></A
41912
><TT
41913
CLASS="literal"
41914
>link</TT
41915
></DT
41916
><DD
41917
><P
41918
> Sets construction variables for generic POSIX linkers.
41919
</P
41920
><P
41921
> Sets: <A
41922
HREF="#cv-LDMODULE"
41923
><CODE
41924
CLASS="envar"
41925
>$LDMODULE</CODE
41926
></A
41927
>, <A
41928
HREF="#cv-LDMODULECOM"
41929
><CODE
41930
CLASS="envar"
41931
>$LDMODULECOM</CODE
41932
></A
41933
>, <A
41934
HREF="#cv-LDMODULEFLAGS"
41935
><CODE
41936
CLASS="envar"
41937
>$LDMODULEFLAGS</CODE
41938
></A
41939
>, <A
41940
HREF="#cv-LDMODULEPREFIX"
41941
><CODE
41942
CLASS="envar"
41943
>$LDMODULEPREFIX</CODE
41944
></A
41945
>, <A
41946
HREF="#cv-LDMODULESUFFIX"
41947
><CODE
41948
CLASS="envar"
41949
>$LDMODULESUFFIX</CODE
41950
></A
41951
>, <A
41952
HREF="#cv-LIBDIRPREFIX"
41953
><CODE
41954
CLASS="envar"
41955
>$LIBDIRPREFIX</CODE
41956
></A
41957
>, <A
41958
HREF="#cv-LIBDIRSUFFIX"
41959
><CODE
41960
CLASS="envar"
41961
>$LIBDIRSUFFIX</CODE
41962
></A
41963
>, <A
41964
HREF="#cv-LIBLINKPREFIX"
41965
><CODE
41966
CLASS="envar"
41967
>$LIBLINKPREFIX</CODE
41968
></A
41969
>, <A
41970
HREF="#cv-LIBLINKSUFFIX"
41971
><CODE
41972
CLASS="envar"
41973
>$LIBLINKSUFFIX</CODE
41974
></A
41975
>, <A
41976
HREF="#cv-LINK"
41977
><CODE
41978
CLASS="envar"
41979
>$LINK</CODE
41980
></A
41981
>, <A
41982
HREF="#cv-LINKCOM"
41983
><CODE
41984
CLASS="envar"
41985
>$LINKCOM</CODE
41986
></A
41987
>, <A
41988
HREF="#cv-LINKFLAGS"
41989
><CODE
41990
CLASS="envar"
41991
>$LINKFLAGS</CODE
41992
></A
41993
>, <A
41994
HREF="#cv-SHLIBSUFFIX"
41995
><CODE
41996
CLASS="envar"
41997
>$SHLIBSUFFIX</CODE
41998
></A
41999
>, <A
42000
HREF="#cv-SHLINK"
42001
><CODE
42002
CLASS="envar"
42003
>$SHLINK</CODE
42004
></A
42005
>, <A
42006
HREF="#cv-SHLINKCOM"
42007
><CODE
42008
CLASS="envar"
42009
>$SHLINKCOM</CODE
42010
></A
42011
>, <A
42012
HREF="#cv-SHLINKFLAGS"
42013
><CODE
42014
CLASS="envar"
42015
>$SHLINKFLAGS</CODE
42016
></A
42017
>.
42018
</P
42019
><P
42020
> Uses: <A
42021
HREF="#cv-LDMODULECOMSTR"
42022
><CODE
42023
CLASS="envar"
42024
>$LDMODULECOMSTR</CODE
42025
></A
42026
>, <A
42027
HREF="#cv-LINKCOMSTR"
42028
><CODE
42029
CLASS="envar"
42030
>$LINKCOMSTR</CODE
42031
></A
42032
>, <A
42033
HREF="#cv-SHLINKCOMSTR"
42034
><CODE
42035
CLASS="envar"
42036
>$SHLINKCOMSTR</CODE
42037
></A
42038
>.
42039
</P
42040
></DD
42041
><DT
42042
><A
42043
NAME="t-linkloc"
42044
></A
42045
><TT
42046
CLASS="literal"
42047
>linkloc</TT
42048
></DT
42049
><DD
42050
><P
42051
> Sets construction variables for the
42052
<SPAN
42053
CLASS="application"
42054
>LinkLoc</SPAN
42055
>
42056
linker for the Phar Lap ETS embedded operating system.
42057
</P
42058
><P
42059
> Sets: <A
42060
HREF="#cv-LIBDIRPREFIX"
42061
><CODE
42062
CLASS="envar"
42063
>$LIBDIRPREFIX</CODE
42064
></A
42065
>, <A
42066
HREF="#cv-LIBDIRSUFFIX"
42067
><CODE
42068
CLASS="envar"
42069
>$LIBDIRSUFFIX</CODE
42070
></A
42071
>, <A
42072
HREF="#cv-LIBLINKPREFIX"
42073
><CODE
42074
CLASS="envar"
42075
>$LIBLINKPREFIX</CODE
42076
></A
42077
>, <A
42078
HREF="#cv-LIBLINKSUFFIX"
42079
><CODE
42080
CLASS="envar"
42081
>$LIBLINKSUFFIX</CODE
42082
></A
42083
>, <A
42084
HREF="#cv-LINK"
42085
><CODE
42086
CLASS="envar"
42087
>$LINK</CODE
42088
></A
42089
>, <A
42090
HREF="#cv-LINKCOM"
42091
><CODE
42092
CLASS="envar"
42093
>$LINKCOM</CODE
42094
></A
42095
>, <A
42096
HREF="#cv-LINKFLAGS"
42097
><CODE
42098
CLASS="envar"
42099
>$LINKFLAGS</CODE
42100
></A
42101
>, <A
42102
HREF="#cv-SHLINK"
42103
><CODE
42104
CLASS="envar"
42105
>$SHLINK</CODE
42106
></A
42107
>, <A
42108
HREF="#cv-SHLINKCOM"
42109
><CODE
42110
CLASS="envar"
42111
>$SHLINKCOM</CODE
42112
></A
42113
>, <A
42114
HREF="#cv-SHLINKFLAGS"
42115
><CODE
42116
CLASS="envar"
42117
>$SHLINKFLAGS</CODE
42118
></A
42119
>.
42120
</P
42121
><P
42122
> Uses: <A
42123
HREF="#cv-LINKCOMSTR"
42124
><CODE
42125
CLASS="envar"
42126
>$LINKCOMSTR</CODE
42127
></A
42128
>, <A
42129
HREF="#cv-SHLINKCOMSTR"
42130
><CODE
42131
CLASS="envar"
42132
>$SHLINKCOMSTR</CODE
42133
></A
42134
>.
42135
</P
42136
></DD
42137
><DT
42138
><A
42139
NAME="t-m4"
42140
></A
42141
><TT
42142
CLASS="literal"
42143
>m4</TT
42144
></DT
42145
><DD
42146
><P
42147
> Sets construction variables for the <SPAN
42148
CLASS="application"
42149
>m4</SPAN
42150
> macro processor.
42151
</P
42152
><P
42153
> Sets: <A
42154
HREF="#cv-M4"
42155
><CODE
42156
CLASS="envar"
42157
>$M4</CODE
42158
></A
42159
>, <A
42160
HREF="#cv-M4COM"
42161
><CODE
42162
CLASS="envar"
42163
>$M4COM</CODE
42164
></A
42165
>, <A
42166
HREF="#cv-M4FLAGS"
42167
><CODE
42168
CLASS="envar"
42169
>$M4FLAGS</CODE
42170
></A
42171
>.
42172
</P
42173
><P
42174
> Uses: <A
42175
HREF="#cv-M4COMSTR"
42176
><CODE
42177
CLASS="envar"
42178
>$M4COMSTR</CODE
42179
></A
42180
>.
42181
</P
42182
></DD
42183
><DT
42184
><A
42185
NAME="t-masm"
42186
></A
42187
><TT
42188
CLASS="literal"
42189
>masm</TT
42190
></DT
42191
><DD
42192
><P
42193
> Sets construction variables for the Microsoft assembler.
42194
</P
42195
><P
42196
> Sets: <A
42197
HREF="#cv-AS"
42198
><CODE
42199
CLASS="envar"
42200
>$AS</CODE
42201
></A
42202
>, <A
42203
HREF="#cv-ASCOM"
42204
><CODE
42205
CLASS="envar"
42206
>$ASCOM</CODE
42207
></A
42208
>, <A
42209
HREF="#cv-ASFLAGS"
42210
><CODE
42211
CLASS="envar"
42212
>$ASFLAGS</CODE
42213
></A
42214
>, <A
42215
HREF="#cv-ASPPCOM"
42216
><CODE
42217
CLASS="envar"
42218
>$ASPPCOM</CODE
42219
></A
42220
>, <A
42221
HREF="#cv-ASPPFLAGS"
42222
><CODE
42223
CLASS="envar"
42224
>$ASPPFLAGS</CODE
42225
></A
42226
>.
42227
</P
42228
><P
42229
> Uses: <A
42230
HREF="#cv-ASCOMSTR"
42231
><CODE
42232
CLASS="envar"
42233
>$ASCOMSTR</CODE
42234
></A
42235
>, <A
42236
HREF="#cv-ASPPCOMSTR"
42237
><CODE
42238
CLASS="envar"
42239
>$ASPPCOMSTR</CODE
42240
></A
42241
>, <A
42242
HREF="#cv-CPPFLAGS"
42243
><CODE
42244
CLASS="envar"
42245
>$CPPFLAGS</CODE
42246
></A
42247
>, <A
42248
HREF="#cv-_CPPDEFFLAGS"
42249
><CODE
42250
CLASS="envar"
42251
>$_CPPDEFFLAGS</CODE
42252
></A
42253
>, <A
42254
HREF="#cv-_CPPINCFLAGS"
42255
><CODE
42256
CLASS="envar"
42257
>$_CPPINCFLAGS</CODE
42258
></A
42259
>.
42260
</P
42261
></DD
42262
><DT
42263
><A
42264
NAME="t-midl"
42265
></A
42266
><TT
42267
CLASS="literal"
42268
>midl</TT
42269
></DT
42270
><DD
42271
><P
42272
> Sets construction variables for the Microsoft IDL compiler.
42273
</P
42274
><P
42275
> Sets: <A
42276
HREF="#cv-MIDL"
42277
><CODE
42278
CLASS="envar"
42279
>$MIDL</CODE
42280
></A
42281
>, <A
42282
HREF="#cv-MIDLCOM"
42283
><CODE
42284
CLASS="envar"
42285
>$MIDLCOM</CODE
42286
></A
42287
>, <A
42288
HREF="#cv-MIDLFLAGS"
42289
><CODE
42290
CLASS="envar"
42291
>$MIDLFLAGS</CODE
42292
></A
42293
>.
42294
</P
42295
><P
42296
> Uses: <A
42297
HREF="#cv-MIDLCOMSTR"
42298
><CODE
42299
CLASS="envar"
42300
>$MIDLCOMSTR</CODE
42301
></A
42302
>.
42303
</P
42304
></DD
42305
><DT
42306
><A
42307
NAME="t-mingw"
42308
></A
42309
><TT
42310
CLASS="literal"
42311
>mingw</TT
42312
></DT
42313
><DD
42314
><P
42315
> Sets construction variables for MinGW (Minimal Gnu on Windows).
42316
</P
42317
><P
42318
> Sets: <A
42319
HREF="#cv-AS"
42320
><CODE
42321
CLASS="envar"
42322
>$AS</CODE
42323
></A
42324
>, <A
42325
HREF="#cv-CC"
42326
><CODE
42327
CLASS="envar"
42328
>$CC</CODE
42329
></A
42330
>, <A
42331
HREF="#cv-CXX"
42332
><CODE
42333
CLASS="envar"
42334
>$CXX</CODE
42335
></A
42336
>, <A
42337
HREF="#cv-LDMODULECOM"
42338
><CODE
42339
CLASS="envar"
42340
>$LDMODULECOM</CODE
42341
></A
42342
>, <A
42343
HREF="#cv-LIBPREFIX"
42344
><CODE
42345
CLASS="envar"
42346
>$LIBPREFIX</CODE
42347
></A
42348
>, <A
42349
HREF="#cv-LIBSUFFIX"
42350
><CODE
42351
CLASS="envar"
42352
>$LIBSUFFIX</CODE
42353
></A
42354
>, <A
42355
HREF="#cv-OBJSUFFIX"
42356
><CODE
42357
CLASS="envar"
42358
>$OBJSUFFIX</CODE
42359
></A
42360
>, <A
42361
HREF="#cv-RC"
42362
><CODE
42363
CLASS="envar"
42364
>$RC</CODE
42365
></A
42366
>, <A
42367
HREF="#cv-RCCOM"
42368
><CODE
42369
CLASS="envar"
42370
>$RCCOM</CODE
42371
></A
42372
>, <A
42373
HREF="#cv-RCFLAGS"
42374
><CODE
42375
CLASS="envar"
42376
>$RCFLAGS</CODE
42377
></A
42378
>, <A
42379
HREF="#cv-RCINCFLAGS"
42380
><CODE
42381
CLASS="envar"
42382
>$RCINCFLAGS</CODE
42383
></A
42384
>, <A
42385
HREF="#cv-RCINCPREFIX"
42386
><CODE
42387
CLASS="envar"
42388
>$RCINCPREFIX</CODE
42389
></A
42390
>, <A
42391
HREF="#cv-RCINCSUFFIX"
42392
><CODE
42393
CLASS="envar"
42394
>$RCINCSUFFIX</CODE
42395
></A
42396
>, <A
42397
HREF="#cv-SHCCFLAGS"
42398
><CODE
42399
CLASS="envar"
42400
>$SHCCFLAGS</CODE
42401
></A
42402
>, <A
42403
HREF="#cv-SHCXXFLAGS"
42404
><CODE
42405
CLASS="envar"
42406
>$SHCXXFLAGS</CODE
42407
></A
42408
>, <A
42409
HREF="#cv-SHLINKCOM"
42410
><CODE
42411
CLASS="envar"
42412
>$SHLINKCOM</CODE
42413
></A
42414
>, <A
42415
HREF="#cv-SHLINKFLAGS"
42416
><CODE
42417
CLASS="envar"
42418
>$SHLINKFLAGS</CODE
42419
></A
42420
>, <A
42421
HREF="#cv-SHOBJSUFFIX"
42422
><CODE
42423
CLASS="envar"
42424
>$SHOBJSUFFIX</CODE
42425
></A
42426
>, <A
42427
HREF="#cv-WINDOWSDEFPREFIX"
42428
><CODE
42429
CLASS="envar"
42430
>$WINDOWSDEFPREFIX</CODE
42431
></A
42432
>, <A
42433
HREF="#cv-WINDOWSDEFSUFFIX"
42434
><CODE
42435
CLASS="envar"
42436
>$WINDOWSDEFSUFFIX</CODE
42437
></A
42438
>.
42439
</P
42440
><P
42441
> Uses: <A
42442
HREF="#cv-RCCOMSTR"
42443
><CODE
42444
CLASS="envar"
42445
>$RCCOMSTR</CODE
42446
></A
42447
>, <A
42448
HREF="#cv-SHLINKCOMSTR"
42449
><CODE
42450
CLASS="envar"
42451
>$SHLINKCOMSTR</CODE
42452
></A
42453
>.
42454
</P
42455
></DD
42456
><DT
42457
><A
42458
NAME="t-mslib"
42459
></A
42460
><TT
42461
CLASS="literal"
42462
>mslib</TT
42463
></DT
42464
><DD
42465
><P
42466
> Sets construction variables for the Microsoft
42467
<SPAN
42468
CLASS="application"
42469
>mslib</SPAN
42470
>
42471
library archiver.
42472
</P
42473
><P
42474
> Sets: <A
42475
HREF="#cv-AR"
42476
><CODE
42477
CLASS="envar"
42478
>$AR</CODE
42479
></A
42480
>, <A
42481
HREF="#cv-ARCOM"
42482
><CODE
42483
CLASS="envar"
42484
>$ARCOM</CODE
42485
></A
42486
>, <A
42487
HREF="#cv-ARFLAGS"
42488
><CODE
42489
CLASS="envar"
42490
>$ARFLAGS</CODE
42491
></A
42492
>, <A
42493
HREF="#cv-LIBPREFIX"
42494
><CODE
42495
CLASS="envar"
42496
>$LIBPREFIX</CODE
42497
></A
42498
>, <A
42499
HREF="#cv-LIBSUFFIX"
42500
><CODE
42501
CLASS="envar"
42502
>$LIBSUFFIX</CODE
42503
></A
42504
>.
42505
</P
42506
><P
42507
> Uses: <A
42508
HREF="#cv-ARCOMSTR"
42509
><CODE
42510
CLASS="envar"
42511
>$ARCOMSTR</CODE
42512
></A
42513
>.
42514
</P
42515
></DD
42516
><DT
42517
><A
42518
NAME="t-mslink"
42519
></A
42520
><TT
42521
CLASS="literal"
42522
>mslink</TT
42523
></DT
42524
><DD
42525
><P
42526
> Sets construction variables for the Microsoft linker.
42527
</P
42528
><P
42529
> Sets: <A
42530
HREF="#cv-LDMODULE"
42531
><CODE
42532
CLASS="envar"
42533
>$LDMODULE</CODE
42534
></A
42535
>, <A
42536
HREF="#cv-LDMODULECOM"
42537
><CODE
42538
CLASS="envar"
42539
>$LDMODULECOM</CODE
42540
></A
42541
>, <A
42542
HREF="#cv-LDMODULEFLAGS"
42543
><CODE
42544
CLASS="envar"
42545
>$LDMODULEFLAGS</CODE
42546
></A
42547
>, <A
42548
HREF="#cv-LDMODULEPREFIX"
42549
><CODE
42550
CLASS="envar"
42551
>$LDMODULEPREFIX</CODE
42552
></A
42553
>, <A
42554
HREF="#cv-LDMODULESUFFIX"
42555
><CODE
42556
CLASS="envar"
42557
>$LDMODULESUFFIX</CODE
42558
></A
42559
>, <A
42560
HREF="#cv-LIBDIRPREFIX"
42561
><CODE
42562
CLASS="envar"
42563
>$LIBDIRPREFIX</CODE
42564
></A
42565
>, <A
42566
HREF="#cv-LIBDIRSUFFIX"
42567
><CODE
42568
CLASS="envar"
42569
>$LIBDIRSUFFIX</CODE
42570
></A
42571
>, <A
42572
HREF="#cv-LIBLINKPREFIX"
42573
><CODE
42574
CLASS="envar"
42575
>$LIBLINKPREFIX</CODE
42576
></A
42577
>, <A
42578
HREF="#cv-LIBLINKSUFFIX"
42579
><CODE
42580
CLASS="envar"
42581
>$LIBLINKSUFFIX</CODE
42582
></A
42583
>, <A
42584
HREF="#cv-LINK"
42585
><CODE
42586
CLASS="envar"
42587
>$LINK</CODE
42588
></A
42589
>, <A
42590
HREF="#cv-LINKCOM"
42591
><CODE
42592
CLASS="envar"
42593
>$LINKCOM</CODE
42594
></A
42595
>, <A
42596
HREF="#cv-LINKFLAGS"
42597
><CODE
42598
CLASS="envar"
42599
>$LINKFLAGS</CODE
42600
></A
42601
>, <A
42602
HREF="#cv-REGSVR"
42603
><CODE
42604
CLASS="envar"
42605
>$REGSVR</CODE
42606
></A
42607
>, <A
42608
HREF="#cv-REGSVRCOM"
42609
><CODE
42610
CLASS="envar"
42611
>$REGSVRCOM</CODE
42612
></A
42613
>, <A
42614
HREF="#cv-REGSVRFLAGS"
42615
><CODE
42616
CLASS="envar"
42617
>$REGSVRFLAGS</CODE
42618
></A
42619
>, <A
42620
HREF="#cv-SHLINK"
42621
><CODE
42622
CLASS="envar"
42623
>$SHLINK</CODE
42624
></A
42625
>, <A
42626
HREF="#cv-SHLINKCOM"
42627
><CODE
42628
CLASS="envar"
42629
>$SHLINKCOM</CODE
42630
></A
42631
>, <A
42632
HREF="#cv-SHLINKFLAGS"
42633
><CODE
42634
CLASS="envar"
42635
>$SHLINKFLAGS</CODE
42636
></A
42637
>, <A
42638
HREF="#cv-WIN32DEFPREFIX"
42639
><CODE
42640
CLASS="envar"
42641
>$WIN32DEFPREFIX</CODE
42642
></A
42643
>, <A
42644
HREF="#cv-WIN32DEFSUFFIX"
42645
><CODE
42646
CLASS="envar"
42647
>$WIN32DEFSUFFIX</CODE
42648
></A
42649
>, <A
42650
HREF="#cv-WIN32EXPPREFIX"
42651
><CODE
42652
CLASS="envar"
42653
>$WIN32EXPPREFIX</CODE
42654
></A
42655
>, <A
42656
HREF="#cv-WIN32EXPSUFFIX"
42657
><CODE
42658
CLASS="envar"
42659
>$WIN32EXPSUFFIX</CODE
42660
></A
42661
>, <A
42662
HREF="#cv-WINDOWSDEFPREFIX"
42663
><CODE
42664
CLASS="envar"
42665
>$WINDOWSDEFPREFIX</CODE
42666
></A
42667
>, <A
42668
HREF="#cv-WINDOWSDEFSUFFIX"
42669
><CODE
42670
CLASS="envar"
42671
>$WINDOWSDEFSUFFIX</CODE
42672
></A
42673
>, <A
42674
HREF="#cv-WINDOWSEXPPREFIX"
42675
><CODE
42676
CLASS="envar"
42677
>$WINDOWSEXPPREFIX</CODE
42678
></A
42679
>, <A
42680
HREF="#cv-WINDOWSEXPSUFFIX"
42681
><CODE
42682
CLASS="envar"
42683
>$WINDOWSEXPSUFFIX</CODE
42684
></A
42685
>, <A
42686
HREF="#cv-WINDOWSPROGMANIFESTPREFIX"
42687
><CODE
42688
CLASS="envar"
42689
>$WINDOWSPROGMANIFESTPREFIX</CODE
42690
></A
42691
>, <A
42692
HREF="#cv-WINDOWSPROGMANIFESTSUFFIX"
42693
><CODE
42694
CLASS="envar"
42695
>$WINDOWSPROGMANIFESTSUFFIX</CODE
42696
></A
42697
>, <A
42698
HREF="#cv-WINDOWSSHLIBMANIFESTPREFIX"
42699
><CODE
42700
CLASS="envar"
42701
>$WINDOWSSHLIBMANIFESTPREFIX</CODE
42702
></A
42703
>, <A
42704
HREF="#cv-WINDOWSSHLIBMANIFESTSUFFIX"
42705
><CODE
42706
CLASS="envar"
42707
>$WINDOWSSHLIBMANIFESTSUFFIX</CODE
42708
></A
42709
>, <A
42710
HREF="#cv-WINDOWS_INSERT_DEF"
42711
><CODE
42712
CLASS="envar"
42713
>$WINDOWS_INSERT_DEF</CODE
42714
></A
42715
>.
42716
</P
42717
><P
42718
> Uses: <A
42719
HREF="#cv-LDMODULECOMSTR"
42720
><CODE
42721
CLASS="envar"
42722
>$LDMODULECOMSTR</CODE
42723
></A
42724
>, <A
42725
HREF="#cv-LINKCOMSTR"
42726
><CODE
42727
CLASS="envar"
42728
>$LINKCOMSTR</CODE
42729
></A
42730
>, <A
42731
HREF="#cv-MSVS_IGNORE_IDE_PATHS"
42732
><CODE
42733
CLASS="envar"
42734
>$MSVS_IGNORE_IDE_PATHS</CODE
42735
></A
42736
>, <A
42737
HREF="#cv-REGSVRCOMSTR"
42738
><CODE
42739
CLASS="envar"
42740
>$REGSVRCOMSTR</CODE
42741
></A
42742
>, <A
42743
HREF="#cv-SHLINKCOMSTR"
42744
><CODE
42745
CLASS="envar"
42746
>$SHLINKCOMSTR</CODE
42747
></A
42748
>.
42749
</P
42750
></DD
42751
><DT
42752
><A
42753
NAME="t-msvc"
42754
></A
42755
><TT
42756
CLASS="literal"
42757
>msvc</TT
42758
></DT
42759
><DD
42760
><P
42761
> Sets construction variables for the Microsoft Visual C/C++ compiler.
42762
</P
42763
><P
42764
> Sets: <A
42765
HREF="#cv-BUILDERS"
42766
><CODE
42767
CLASS="envar"
42768
>$BUILDERS</CODE
42769
></A
42770
>, <A
42771
HREF="#cv-CC"
42772
><CODE
42773
CLASS="envar"
42774
>$CC</CODE
42775
></A
42776
>, <A
42777
HREF="#cv-CCCOM"
42778
><CODE
42779
CLASS="envar"
42780
>$CCCOM</CODE
42781
></A
42782
>, <A
42783
HREF="#cv-CCFLAGS"
42784
><CODE
42785
CLASS="envar"
42786
>$CCFLAGS</CODE
42787
></A
42788
>, <A
42789
HREF="#cv-CCPCHFLAGS"
42790
><CODE
42791
CLASS="envar"
42792
>$CCPCHFLAGS</CODE
42793
></A
42794
>, <A
42795
HREF="#cv-CCPDBFLAGS"
42796
><CODE
42797
CLASS="envar"
42798
>$CCPDBFLAGS</CODE
42799
></A
42800
>, <A
42801
HREF="#cv-CFILESUFFIX"
42802
><CODE
42803
CLASS="envar"
42804
>$CFILESUFFIX</CODE
42805
></A
42806
>, <A
42807
HREF="#cv-CFLAGS"
42808
><CODE
42809
CLASS="envar"
42810
>$CFLAGS</CODE
42811
></A
42812
>, <A
42813
HREF="#cv-CPPDEFPREFIX"
42814
><CODE
42815
CLASS="envar"
42816
>$CPPDEFPREFIX</CODE
42817
></A
42818
>, <A
42819
HREF="#cv-CPPDEFSUFFIX"
42820
><CODE
42821
CLASS="envar"
42822
>$CPPDEFSUFFIX</CODE
42823
></A
42824
>, <A
42825
HREF="#cv-CXX"
42826
><CODE
42827
CLASS="envar"
42828
>$CXX</CODE
42829
></A
42830
>, <A
42831
HREF="#cv-CXXCOM"
42832
><CODE
42833
CLASS="envar"
42834
>$CXXCOM</CODE
42835
></A
42836
>, <A
42837
HREF="#cv-CXXFILESUFFIX"
42838
><CODE
42839
CLASS="envar"
42840
>$CXXFILESUFFIX</CODE
42841
></A
42842
>, <A
42843
HREF="#cv-CXXFLAGS"
42844
><CODE
42845
CLASS="envar"
42846
>$CXXFLAGS</CODE
42847
></A
42848
>, <A
42849
HREF="#cv-INCPREFIX"
42850
><CODE
42851
CLASS="envar"
42852
>$INCPREFIX</CODE
42853
></A
42854
>, <A
42855
HREF="#cv-INCSUFFIX"
42856
><CODE
42857
CLASS="envar"
42858
>$INCSUFFIX</CODE
42859
></A
42860
>, <A
42861
HREF="#cv-OBJPREFIX"
42862
><CODE
42863
CLASS="envar"
42864
>$OBJPREFIX</CODE
42865
></A
42866
>, <A
42867
HREF="#cv-OBJSUFFIX"
42868
><CODE
42869
CLASS="envar"
42870
>$OBJSUFFIX</CODE
42871
></A
42872
>, <A
42873
HREF="#cv-PCHCOM"
42874
><CODE
42875
CLASS="envar"
42876
>$PCHCOM</CODE
42877
></A
42878
>, <A
42879
HREF="#cv-PCHPDBFLAGS"
42880
><CODE
42881
CLASS="envar"
42882
>$PCHPDBFLAGS</CODE
42883
></A
42884
>, <A
42885
HREF="#cv-RC"
42886
><CODE
42887
CLASS="envar"
42888
>$RC</CODE
42889
></A
42890
>, <A
42891
HREF="#cv-RCCOM"
42892
><CODE
42893
CLASS="envar"
42894
>$RCCOM</CODE
42895
></A
42896
>, <A
42897
HREF="#cv-RCFLAGS"
42898
><CODE
42899
CLASS="envar"
42900
>$RCFLAGS</CODE
42901
></A
42902
>, <A
42903
HREF="#cv-SHCC"
42904
><CODE
42905
CLASS="envar"
42906
>$SHCC</CODE
42907
></A
42908
>, <A
42909
HREF="#cv-SHCCCOM"
42910
><CODE
42911
CLASS="envar"
42912
>$SHCCCOM</CODE
42913
></A
42914
>, <A
42915
HREF="#cv-SHCCFLAGS"
42916
><CODE
42917
CLASS="envar"
42918
>$SHCCFLAGS</CODE
42919
></A
42920
>, <A
42921
HREF="#cv-SHCFLAGS"
42922
><CODE
42923
CLASS="envar"
42924
>$SHCFLAGS</CODE
42925
></A
42926
>, <A
42927
HREF="#cv-SHCXX"
42928
><CODE
42929
CLASS="envar"
42930
>$SHCXX</CODE
42931
></A
42932
>, <A
42933
HREF="#cv-SHCXXCOM"
42934
><CODE
42935
CLASS="envar"
42936
>$SHCXXCOM</CODE
42937
></A
42938
>, <A
42939
HREF="#cv-SHCXXFLAGS"
42940
><CODE
42941
CLASS="envar"
42942
>$SHCXXFLAGS</CODE
42943
></A
42944
>, <A
42945
HREF="#cv-SHOBJPREFIX"
42946
><CODE
42947
CLASS="envar"
42948
>$SHOBJPREFIX</CODE
42949
></A
42950
>, <A
42951
HREF="#cv-SHOBJSUFFIX"
42952
><CODE
42953
CLASS="envar"
42954
>$SHOBJSUFFIX</CODE
42955
></A
42956
>.
42957
</P
42958
><P
42959
> Uses: <A
42960
HREF="#cv-CCCOMSTR"
42961
><CODE
42962
CLASS="envar"
42963
>$CCCOMSTR</CODE
42964
></A
42965
>, <A
42966
HREF="#cv-CXXCOMSTR"
42967
><CODE
42968
CLASS="envar"
42969
>$CXXCOMSTR</CODE
42970
></A
42971
>, <A
42972
HREF="#cv-SHCCCOMSTR"
42973
><CODE
42974
CLASS="envar"
42975
>$SHCCCOMSTR</CODE
42976
></A
42977
>, <A
42978
HREF="#cv-SHCXXCOMSTR"
42979
><CODE
42980
CLASS="envar"
42981
>$SHCXXCOMSTR</CODE
42982
></A
42983
>.
42984
</P
42985
></DD
42986
><DT
42987
><A
42988
NAME="t-msvs"
42989
></A
42990
><TT
42991
CLASS="literal"
42992
>msvs</TT
42993
></DT
42994
><DD
42995
><P
42996
> Sets construction variables for Microsoft Visual Studio.
42997
</P
42998
><P
42999
> Sets: <A
43000
HREF="#cv-MSVSBUILDCOM"
43001
><CODE
43002
CLASS="envar"
43003
>$MSVSBUILDCOM</CODE
43004
></A
43005
>, <A
43006
HREF="#cv-MSVSCLEANCOM"
43007
><CODE
43008
CLASS="envar"
43009
>$MSVSCLEANCOM</CODE
43010
></A
43011
>, <A
43012
HREF="#cv-MSVSENCODING"
43013
><CODE
43014
CLASS="envar"
43015
>$MSVSENCODING</CODE
43016
></A
43017
>, <A
43018
HREF="#cv-MSVSPROJECTCOM"
43019
><CODE
43020
CLASS="envar"
43021
>$MSVSPROJECTCOM</CODE
43022
></A
43023
>, <A
43024
HREF="#cv-MSVSREBUILDCOM"
43025
><CODE
43026
CLASS="envar"
43027
>$MSVSREBUILDCOM</CODE
43028
></A
43029
>, <A
43030
HREF="#cv-MSVSSCONS"
43031
><CODE
43032
CLASS="envar"
43033
>$MSVSSCONS</CODE
43034
></A
43035
>, <A
43036
HREF="#cv-MSVSSCONSCOM"
43037
><CODE
43038
CLASS="envar"
43039
>$MSVSSCONSCOM</CODE
43040
></A
43041
>, <A
43042
HREF="#cv-MSVSSCONSCRIPT"
43043
><CODE
43044
CLASS="envar"
43045
>$MSVSSCONSCRIPT</CODE
43046
></A
43047
>, <A
43048
HREF="#cv-MSVSSCONSFLAGS"
43049
><CODE
43050
CLASS="envar"
43051
>$MSVSSCONSFLAGS</CODE
43052
></A
43053
>, <A
43054
HREF="#cv-MSVSSOLUTIONCOM"
43055
><CODE
43056
CLASS="envar"
43057
>$MSVSSOLUTIONCOM</CODE
43058
></A
43059
>.
43060
</P
43061
></DD
43062
><DT
43063
><A
43064
NAME="t-mwcc"
43065
></A
43066
><TT
43067
CLASS="literal"
43068
>mwcc</TT
43069
></DT
43070
><DD
43071
><P
43072
> Sets construction variables for the Metrowerks CodeWarrior compiler.
43073
</P
43074
><P
43075
> Sets: <A
43076
HREF="#cv-CC"
43077
><CODE
43078
CLASS="envar"
43079
>$CC</CODE
43080
></A
43081
>, <A
43082
HREF="#cv-CCCOM"
43083
><CODE
43084
CLASS="envar"
43085
>$CCCOM</CODE
43086
></A
43087
>, <A
43088
HREF="#cv-CFILESUFFIX"
43089
><CODE
43090
CLASS="envar"
43091
>$CFILESUFFIX</CODE
43092
></A
43093
>, <A
43094
HREF="#cv-CPPDEFPREFIX"
43095
><CODE
43096
CLASS="envar"
43097
>$CPPDEFPREFIX</CODE
43098
></A
43099
>, <A
43100
HREF="#cv-CPPDEFSUFFIX"
43101
><CODE
43102
CLASS="envar"
43103
>$CPPDEFSUFFIX</CODE
43104
></A
43105
>, <A
43106
HREF="#cv-CXX"
43107
><CODE
43108
CLASS="envar"
43109
>$CXX</CODE
43110
></A
43111
>, <A
43112
HREF="#cv-CXXCOM"
43113
><CODE
43114
CLASS="envar"
43115
>$CXXCOM</CODE
43116
></A
43117
>, <A
43118
HREF="#cv-CXXFILESUFFIX"
43119
><CODE
43120
CLASS="envar"
43121
>$CXXFILESUFFIX</CODE
43122
></A
43123
>, <A
43124
HREF="#cv-INCPREFIX"
43125
><CODE
43126
CLASS="envar"
43127
>$INCPREFIX</CODE
43128
></A
43129
>, <A
43130
HREF="#cv-INCSUFFIX"
43131
><CODE
43132
CLASS="envar"
43133
>$INCSUFFIX</CODE
43134
></A
43135
>, <A
43136
HREF="#cv-MWCW_VERSION"
43137
><CODE
43138
CLASS="envar"
43139
>$MWCW_VERSION</CODE
43140
></A
43141
>, <A
43142
HREF="#cv-MWCW_VERSIONS"
43143
><CODE
43144
CLASS="envar"
43145
>$MWCW_VERSIONS</CODE
43146
></A
43147
>, <A
43148
HREF="#cv-SHCC"
43149
><CODE
43150
CLASS="envar"
43151
>$SHCC</CODE
43152
></A
43153
>, <A
43154
HREF="#cv-SHCCCOM"
43155
><CODE
43156
CLASS="envar"
43157
>$SHCCCOM</CODE
43158
></A
43159
>, <A
43160
HREF="#cv-SHCCFLAGS"
43161
><CODE
43162
CLASS="envar"
43163
>$SHCCFLAGS</CODE
43164
></A
43165
>, <A
43166
HREF="#cv-SHCFLAGS"
43167
><CODE
43168
CLASS="envar"
43169
>$SHCFLAGS</CODE
43170
></A
43171
>, <A
43172
HREF="#cv-SHCXX"
43173
><CODE
43174
CLASS="envar"
43175
>$SHCXX</CODE
43176
></A
43177
>, <A
43178
HREF="#cv-SHCXXCOM"
43179
><CODE
43180
CLASS="envar"
43181
>$SHCXXCOM</CODE
43182
></A
43183
>, <A
43184
HREF="#cv-SHCXXFLAGS"
43185
><CODE
43186
CLASS="envar"
43187
>$SHCXXFLAGS</CODE
43188
></A
43189
>.
43190
</P
43191
><P
43192
> Uses: <A
43193
HREF="#cv-CCCOMSTR"
43194
><CODE
43195
CLASS="envar"
43196
>$CCCOMSTR</CODE
43197
></A
43198
>, <A
43199
HREF="#cv-CXXCOMSTR"
43200
><CODE
43201
CLASS="envar"
43202
>$CXXCOMSTR</CODE
43203
></A
43204
>, <A
43205
HREF="#cv-SHCCCOMSTR"
43206
><CODE
43207
CLASS="envar"
43208
>$SHCCCOMSTR</CODE
43209
></A
43210
>, <A
43211
HREF="#cv-SHCXXCOMSTR"
43212
><CODE
43213
CLASS="envar"
43214
>$SHCXXCOMSTR</CODE
43215
></A
43216
>.
43217
</P
43218
></DD
43219
><DT
43220
><A
43221
NAME="t-mwld"
43222
></A
43223
><TT
43224
CLASS="literal"
43225
>mwld</TT
43226
></DT
43227
><DD
43228
><P
43229
> Sets construction variables for the Metrowerks CodeWarrior linker.
43230
</P
43231
><P
43232
> Sets: <A
43233
HREF="#cv-AR"
43234
><CODE
43235
CLASS="envar"
43236
>$AR</CODE
43237
></A
43238
>, <A
43239
HREF="#cv-ARCOM"
43240
><CODE
43241
CLASS="envar"
43242
>$ARCOM</CODE
43243
></A
43244
>, <A
43245
HREF="#cv-LIBDIRPREFIX"
43246
><CODE
43247
CLASS="envar"
43248
>$LIBDIRPREFIX</CODE
43249
></A
43250
>, <A
43251
HREF="#cv-LIBDIRSUFFIX"
43252
><CODE
43253
CLASS="envar"
43254
>$LIBDIRSUFFIX</CODE
43255
></A
43256
>, <A
43257
HREF="#cv-LIBLINKPREFIX"
43258
><CODE
43259
CLASS="envar"
43260
>$LIBLINKPREFIX</CODE
43261
></A
43262
>, <A
43263
HREF="#cv-LIBLINKSUFFIX"
43264
><CODE
43265
CLASS="envar"
43266
>$LIBLINKSUFFIX</CODE
43267
></A
43268
>, <A
43269
HREF="#cv-LINK"
43270
><CODE
43271
CLASS="envar"
43272
>$LINK</CODE
43273
></A
43274
>, <A
43275
HREF="#cv-LINKCOM"
43276
><CODE
43277
CLASS="envar"
43278
>$LINKCOM</CODE
43279
></A
43280
>, <A
43281
HREF="#cv-SHLINK"
43282
><CODE
43283
CLASS="envar"
43284
>$SHLINK</CODE
43285
></A
43286
>, <A
43287
HREF="#cv-SHLINKCOM"
43288
><CODE
43289
CLASS="envar"
43290
>$SHLINKCOM</CODE
43291
></A
43292
>, <A
43293
HREF="#cv-SHLINKFLAGS"
43294
><CODE
43295
CLASS="envar"
43296
>$SHLINKFLAGS</CODE
43297
></A
43298
>.
43299
</P
43300
></DD
43301
><DT
43302
><A
43303
NAME="t-nasm"
43304
></A
43305
><TT
43306
CLASS="literal"
43307
>nasm</TT
43308
></DT
43309
><DD
43310
><P
43311
> Sets construction variables for the
43312
<SPAN
43313
CLASS="application"
43314
>nasm</SPAN
43315
> Netwide Assembler.
43316
</P
43317
><P
43318
> Sets: <A
43319
HREF="#cv-AS"
43320
><CODE
43321
CLASS="envar"
43322
>$AS</CODE
43323
></A
43324
>, <A
43325
HREF="#cv-ASCOM"
43326
><CODE
43327
CLASS="envar"
43328
>$ASCOM</CODE
43329
></A
43330
>, <A
43331
HREF="#cv-ASFLAGS"
43332
><CODE
43333
CLASS="envar"
43334
>$ASFLAGS</CODE
43335
></A
43336
>, <A
43337
HREF="#cv-ASPPCOM"
43338
><CODE
43339
CLASS="envar"
43340
>$ASPPCOM</CODE
43341
></A
43342
>, <A
43343
HREF="#cv-ASPPFLAGS"
43344
><CODE
43345
CLASS="envar"
43346
>$ASPPFLAGS</CODE
43347
></A
43348
>.
43349
</P
43350
><P
43351
> Uses: <A
43352
HREF="#cv-ASCOMSTR"
43353
><CODE
43354
CLASS="envar"
43355
>$ASCOMSTR</CODE
43356
></A
43357
>, <A
43358
HREF="#cv-ASPPCOMSTR"
43359
><CODE
43360
CLASS="envar"
43361
>$ASPPCOMSTR</CODE
43362
></A
43363
>.
43364
</P
43365
></DD
43366
><DT
43367
><A
43368
NAME="t-packaging"
43369
></A
43370
><TT
43371
CLASS="literal"
43372
>packaging</TT
43373
></DT
43374
><DD
43375
><P
43376
> A framework for building binary and source packages.
43377
</P
43378
></DD
43379
><DT
43380
><A
43381
NAME="t-Packaging"
43382
></A
43383
><TT
43384
CLASS="literal"
43385
>Packaging</TT
43386
></DT
43387
><DD
43388
><P
43389
> Sets construction variables for the <CODE
43390
CLASS="function"
43391
>Package</CODE
43392
> Builder.
43393
</P
43394
></DD
43395
><DT
43396
><A
43397
NAME="t-pdf"
43398
></A
43399
><TT
43400
CLASS="literal"
43401
>pdf</TT
43402
></DT
43403
><DD
43404
><P
43405
> Sets construction variables for the Portable Document Format builder.
43406
</P
43407
><P
43408
> Sets: <A
43409
HREF="#cv-PDFPREFIX"
43410
><CODE
43411
CLASS="envar"
43412
>$PDFPREFIX</CODE
43413
></A
43414
>, <A
43415
HREF="#cv-PDFSUFFIX"
43416
><CODE
43417
CLASS="envar"
43418
>$PDFSUFFIX</CODE
43419
></A
43420
>.
43421
</P
43422
></DD
43423
><DT
43424
><A
43425
NAME="t-pdflatex"
43426
></A
43427
><TT
43428
CLASS="literal"
43429
>pdflatex</TT
43430
></DT
43431
><DD
43432
><P
43433
> Sets construction variables for the <SPAN
43434
CLASS="application"
43435
>pdflatex</SPAN
43436
> utility.
43437
</P
43438
><P
43439
> Sets: <A
43440
HREF="#cv-LATEXRETRIES"
43441
><CODE
43442
CLASS="envar"
43443
>$LATEXRETRIES</CODE
43444
></A
43445
>, <A
43446
HREF="#cv-PDFLATEX"
43447
><CODE
43448
CLASS="envar"
43449
>$PDFLATEX</CODE
43450
></A
43451
>, <A
43452
HREF="#cv-PDFLATEXCOM"
43453
><CODE
43454
CLASS="envar"
43455
>$PDFLATEXCOM</CODE
43456
></A
43457
>, <A
43458
HREF="#cv-PDFLATEXFLAGS"
43459
><CODE
43460
CLASS="envar"
43461
>$PDFLATEXFLAGS</CODE
43462
></A
43463
>.
43464
</P
43465
><P
43466
> Uses: <A
43467
HREF="#cv-PDFLATEXCOMSTR"
43468
><CODE
43469
CLASS="envar"
43470
>$PDFLATEXCOMSTR</CODE
43471
></A
43472
>.
43473
</P
43474
></DD
43475
><DT
43476
><A
43477
NAME="t-pdftex"
43478
></A
43479
><TT
43480
CLASS="literal"
43481
>pdftex</TT
43482
></DT
43483
><DD
43484
><P
43485
> Sets construction variables for the <SPAN
43486
CLASS="application"
43487
>pdftex</SPAN
43488
> utility.
43489
</P
43490
><P
43491
> Sets: <A
43492
HREF="#cv-LATEXRETRIES"
43493
><CODE
43494
CLASS="envar"
43495
>$LATEXRETRIES</CODE
43496
></A
43497
>, <A
43498
HREF="#cv-PDFLATEX"
43499
><CODE
43500
CLASS="envar"
43501
>$PDFLATEX</CODE
43502
></A
43503
>, <A
43504
HREF="#cv-PDFLATEXCOM"
43505
><CODE
43506
CLASS="envar"
43507
>$PDFLATEXCOM</CODE
43508
></A
43509
>, <A
43510
HREF="#cv-PDFLATEXFLAGS"
43511
><CODE
43512
CLASS="envar"
43513
>$PDFLATEXFLAGS</CODE
43514
></A
43515
>, <A
43516
HREF="#cv-PDFTEX"
43517
><CODE
43518
CLASS="envar"
43519
>$PDFTEX</CODE
43520
></A
43521
>, <A
43522
HREF="#cv-PDFTEXCOM"
43523
><CODE
43524
CLASS="envar"
43525
>$PDFTEXCOM</CODE
43526
></A
43527
>, <A
43528
HREF="#cv-PDFTEXFLAGS"
43529
><CODE
43530
CLASS="envar"
43531
>$PDFTEXFLAGS</CODE
43532
></A
43533
>.
43534
</P
43535
><P
43536
> Uses: <A
43537
HREF="#cv-PDFLATEXCOMSTR"
43538
><CODE
43539
CLASS="envar"
43540
>$PDFLATEXCOMSTR</CODE
43541
></A
43542
>, <A
43543
HREF="#cv-PDFTEXCOMSTR"
43544
><CODE
43545
CLASS="envar"
43546
>$PDFTEXCOMSTR</CODE
43547
></A
43548
>.
43549
</P
43550
></DD
43551
><DT
43552
><A
43553
NAME="t-Perforce"
43554
></A
43555
><TT
43556
CLASS="literal"
43557
>Perforce</TT
43558
></DT
43559
><DD
43560
><P
43561
> Sets construction variables for interacting with the
43562
Perforce source code management system.
43563
</P
43564
><P
43565
> Sets: <A
43566
HREF="#cv-P4"
43567
><CODE
43568
CLASS="envar"
43569
>$P4</CODE
43570
></A
43571
>, <A
43572
HREF="#cv-P4COM"
43573
><CODE
43574
CLASS="envar"
43575
>$P4COM</CODE
43576
></A
43577
>, <A
43578
HREF="#cv-P4FLAGS"
43579
><CODE
43580
CLASS="envar"
43581
>$P4FLAGS</CODE
43582
></A
43583
>.
43584
</P
43585
><P
43586
> Uses: <A
43587
HREF="#cv-P4COMSTR"
43588
><CODE
43589
CLASS="envar"
43590
>$P4COMSTR</CODE
43591
></A
43592
>.
43593
</P
43594
></DD
43595
><DT
43596
><A
43597
NAME="t-qt"
43598
></A
43599
><TT
43600
CLASS="literal"
43601
>qt</TT
43602
></DT
43603
><DD
43604
><P
43605
> Sets construction variables for building Qt applications.
43606
</P
43607
><P
43608
> Sets: <A
43609
HREF="#cv-QTDIR"
43610
><CODE
43611
CLASS="envar"
43612
>$QTDIR</CODE
43613
></A
43614
>, <A
43615
HREF="#cv-QT_AUTOSCAN"
43616
><CODE
43617
CLASS="envar"
43618
>$QT_AUTOSCAN</CODE
43619
></A
43620
>, <A
43621
HREF="#cv-QT_BINPATH"
43622
><CODE
43623
CLASS="envar"
43624
>$QT_BINPATH</CODE
43625
></A
43626
>, <A
43627
HREF="#cv-QT_CPPPATH"
43628
><CODE
43629
CLASS="envar"
43630
>$QT_CPPPATH</CODE
43631
></A
43632
>, <A
43633
HREF="#cv-QT_LIB"
43634
><CODE
43635
CLASS="envar"
43636
>$QT_LIB</CODE
43637
></A
43638
>, <A
43639
HREF="#cv-QT_LIBPATH"
43640
><CODE
43641
CLASS="envar"
43642
>$QT_LIBPATH</CODE
43643
></A
43644
>, <A
43645
HREF="#cv-QT_MOC"
43646
><CODE
43647
CLASS="envar"
43648
>$QT_MOC</CODE
43649
></A
43650
>, <A
43651
HREF="#cv-QT_MOCCXXPREFIX"
43652
><CODE
43653
CLASS="envar"
43654
>$QT_MOCCXXPREFIX</CODE
43655
></A
43656
>, <A
43657
HREF="#cv-QT_MOCCXXSUFFIX"
43658
><CODE
43659
CLASS="envar"
43660
>$QT_MOCCXXSUFFIX</CODE
43661
></A
43662
>, <A
43663
HREF="#cv-QT_MOCFROMCXXCOM"
43664
><CODE
43665
CLASS="envar"
43666
>$QT_MOCFROMCXXCOM</CODE
43667
></A
43668
>, <A
43669
HREF="#cv-QT_MOCFROMCXXFLAGS"
43670
><CODE
43671
CLASS="envar"
43672
>$QT_MOCFROMCXXFLAGS</CODE
43673
></A
43674
>, <A
43675
HREF="#cv-QT_MOCFROMHCOM"
43676
><CODE
43677
CLASS="envar"
43678
>$QT_MOCFROMHCOM</CODE
43679
></A
43680
>, <A
43681
HREF="#cv-QT_MOCFROMHFLAGS"
43682
><CODE
43683
CLASS="envar"
43684
>$QT_MOCFROMHFLAGS</CODE
43685
></A
43686
>, <A
43687
HREF="#cv-QT_MOCHPREFIX"
43688
><CODE
43689
CLASS="envar"
43690
>$QT_MOCHPREFIX</CODE
43691
></A
43692
>, <A
43693
HREF="#cv-QT_MOCHSUFFIX"
43694
><CODE
43695
CLASS="envar"
43696
>$QT_MOCHSUFFIX</CODE
43697
></A
43698
>, <A
43699
HREF="#cv-QT_UIC"
43700
><CODE
43701
CLASS="envar"
43702
>$QT_UIC</CODE
43703
></A
43704
>, <A
43705
HREF="#cv-QT_UICCOM"
43706
><CODE
43707
CLASS="envar"
43708
>$QT_UICCOM</CODE
43709
></A
43710
>, <A
43711
HREF="#cv-QT_UICDECLFLAGS"
43712
><CODE
43713
CLASS="envar"
43714
>$QT_UICDECLFLAGS</CODE
43715
></A
43716
>, <A
43717
HREF="#cv-QT_UICDECLPREFIX"
43718
><CODE
43719
CLASS="envar"
43720
>$QT_UICDECLPREFIX</CODE
43721
></A
43722
>, <A
43723
HREF="#cv-QT_UICDECLSUFFIX"
43724
><CODE
43725
CLASS="envar"
43726
>$QT_UICDECLSUFFIX</CODE
43727
></A
43728
>, <A
43729
HREF="#cv-QT_UICIMPLFLAGS"
43730
><CODE
43731
CLASS="envar"
43732
>$QT_UICIMPLFLAGS</CODE
43733
></A
43734
>, <A
43735
HREF="#cv-QT_UICIMPLPREFIX"
43736
><CODE
43737
CLASS="envar"
43738
>$QT_UICIMPLPREFIX</CODE
43739
></A
43740
>, <A
43741
HREF="#cv-QT_UICIMPLSUFFIX"
43742
><CODE
43743
CLASS="envar"
43744
>$QT_UICIMPLSUFFIX</CODE
43745
></A
43746
>, <A
43747
HREF="#cv-QT_UISUFFIX"
43748
><CODE
43749
CLASS="envar"
43750
>$QT_UISUFFIX</CODE
43751
></A
43752
>.
43753
</P
43754
></DD
43755
><DT
43756
><A
43757
NAME="t-RCS"
43758
></A
43759
><TT
43760
CLASS="literal"
43761
>RCS</TT
43762
></DT
43763
><DD
43764
><P
43765
> Sets construction variables for the interaction
43766
with the Revision Control System.
43767
</P
43768
><P
43769
> Sets: <A
43770
HREF="#cv-RCS"
43771
><CODE
43772
CLASS="envar"
43773
>$RCS</CODE
43774
></A
43775
>, <A
43776
HREF="#cv-RCS_CO"
43777
><CODE
43778
CLASS="envar"
43779
>$RCS_CO</CODE
43780
></A
43781
>, <A
43782
HREF="#cv-RCS_COCOM"
43783
><CODE
43784
CLASS="envar"
43785
>$RCS_COCOM</CODE
43786
></A
43787
>, <A
43788
HREF="#cv-RCS_COFLAGS"
43789
><CODE
43790
CLASS="envar"
43791
>$RCS_COFLAGS</CODE
43792
></A
43793
>.
43794
</P
43795
><P
43796
> Uses: <A
43797
HREF="#cv-RCS_COCOMSTR"
43798
><CODE
43799
CLASS="envar"
43800
>$RCS_COCOMSTR</CODE
43801
></A
43802
>.
43803
</P
43804
></DD
43805
><DT
43806
><A
43807
NAME="t-rmic"
43808
></A
43809
><TT
43810
CLASS="literal"
43811
>rmic</TT
43812
></DT
43813
><DD
43814
><P
43815
> Sets construction variables for the <SPAN
43816
CLASS="application"
43817
>rmic</SPAN
43818
> utility.
43819
</P
43820
><P
43821
> Sets: <A
43822
HREF="#cv-JAVACLASSSUFFIX"
43823
><CODE
43824
CLASS="envar"
43825
>$JAVACLASSSUFFIX</CODE
43826
></A
43827
>, <A
43828
HREF="#cv-RMIC"
43829
><CODE
43830
CLASS="envar"
43831
>$RMIC</CODE
43832
></A
43833
>, <A
43834
HREF="#cv-RMICCOM"
43835
><CODE
43836
CLASS="envar"
43837
>$RMICCOM</CODE
43838
></A
43839
>, <A
43840
HREF="#cv-RMICFLAGS"
43841
><CODE
43842
CLASS="envar"
43843
>$RMICFLAGS</CODE
43844
></A
43845
>.
43846
</P
43847
><P
43848
> Uses: <A
43849
HREF="#cv-RMICCOMSTR"
43850
><CODE
43851
CLASS="envar"
43852
>$RMICCOMSTR</CODE
43853
></A
43854
>.
43855
</P
43856
></DD
43857
><DT
43858
><A
43859
NAME="t-rpcgen"
43860
></A
43861
><TT
43862
CLASS="literal"
43863
>rpcgen</TT
43864
></DT
43865
><DD
43866
><P
43867
> Sets construction variables for building with RPCGEN.
43868
</P
43869
><P
43870
> Sets: <A
43871
HREF="#cv-RPCGEN"
43872
><CODE
43873
CLASS="envar"
43874
>$RPCGEN</CODE
43875
></A
43876
>, <A
43877
HREF="#cv-RPCGENCLIENTFLAGS"
43878
><CODE
43879
CLASS="envar"
43880
>$RPCGENCLIENTFLAGS</CODE
43881
></A
43882
>, <A
43883
HREF="#cv-RPCGENFLAGS"
43884
><CODE
43885
CLASS="envar"
43886
>$RPCGENFLAGS</CODE
43887
></A
43888
>, <A
43889
HREF="#cv-RPCGENHEADERFLAGS"
43890
><CODE
43891
CLASS="envar"
43892
>$RPCGENHEADERFLAGS</CODE
43893
></A
43894
>, <A
43895
HREF="#cv-RPCGENSERVICEFLAGS"
43896
><CODE
43897
CLASS="envar"
43898
>$RPCGENSERVICEFLAGS</CODE
43899
></A
43900
>, <A
43901
HREF="#cv-RPCGENXDRFLAGS"
43902
><CODE
43903
CLASS="envar"
43904
>$RPCGENXDRFLAGS</CODE
43905
></A
43906
>.
43907
</P
43908
></DD
43909
><DT
43910
><A
43911
NAME="t-SCCS"
43912
></A
43913
><TT
43914
CLASS="literal"
43915
>SCCS</TT
43916
></DT
43917
><DD
43918
><P
43919
> Sets construction variables for interacting with the
43920
Source Code Control System.
43921
</P
43922
><P
43923
> Sets: <A
43924
HREF="#cv-SCCS"
43925
><CODE
43926
CLASS="envar"
43927
>$SCCS</CODE
43928
></A
43929
>, <A
43930
HREF="#cv-SCCSCOM"
43931
><CODE
43932
CLASS="envar"
43933
>$SCCSCOM</CODE
43934
></A
43935
>, <A
43936
HREF="#cv-SCCSFLAGS"
43937
><CODE
43938
CLASS="envar"
43939
>$SCCSFLAGS</CODE
43940
></A
43941
>, <A
43942
HREF="#cv-SCCSGETFLAGS"
43943
><CODE
43944
CLASS="envar"
43945
>$SCCSGETFLAGS</CODE
43946
></A
43947
>.
43948
</P
43949
><P
43950
> Uses: <A
43951
HREF="#cv-SCCSCOMSTR"
43952
><CODE
43953
CLASS="envar"
43954
>$SCCSCOMSTR</CODE
43955
></A
43956
>.
43957
</P
43958
></DD
43959
><DT
43960
><A
43961
NAME="t-sgiar"
43962
></A
43963
><TT
43964
CLASS="literal"
43965
>sgiar</TT
43966
></DT
43967
><DD
43968
><P
43969
> Sets construction variables for the SGI library archiver.
43970
</P
43971
><P
43972
> Sets: <A
43973
HREF="#cv-AR"
43974
><CODE
43975
CLASS="envar"
43976
>$AR</CODE
43977
></A
43978
>, <A
43979
HREF="#cv-ARCOMSTR"
43980
><CODE
43981
CLASS="envar"
43982
>$ARCOMSTR</CODE
43983
></A
43984
>, <A
43985
HREF="#cv-ARFLAGS"
43986
><CODE
43987
CLASS="envar"
43988
>$ARFLAGS</CODE
43989
></A
43990
>, <A
43991
HREF="#cv-LIBPREFIX"
43992
><CODE
43993
CLASS="envar"
43994
>$LIBPREFIX</CODE
43995
></A
43996
>, <A
43997
HREF="#cv-LIBSUFFIX"
43998
><CODE
43999
CLASS="envar"
44000
>$LIBSUFFIX</CODE
44001
></A
44002
>, <A
44003
HREF="#cv-SHLINK"
44004
><CODE
44005
CLASS="envar"
44006
>$SHLINK</CODE
44007
></A
44008
>, <A
44009
HREF="#cv-SHLINKFLAGS"
44010
><CODE
44011
CLASS="envar"
44012
>$SHLINKFLAGS</CODE
44013
></A
44014
>.
44015
</P
44016
><P
44017
> Uses: <A
44018
HREF="#cv-ARCOMSTR"
44019
><CODE
44020
CLASS="envar"
44021
>$ARCOMSTR</CODE
44022
></A
44023
>, <A
44024
HREF="#cv-SHLINKCOMSTR"
44025
><CODE
44026
CLASS="envar"
44027
>$SHLINKCOMSTR</CODE
44028
></A
44029
>.
44030
</P
44031
></DD
44032
><DT
44033
><A
44034
NAME="t-sgicXX"
44035
></A
44036
><TT
44037
CLASS="literal"
44038
>sgic++</TT
44039
></DT
44040
><DD
44041
><P
44042
> Sets construction variables for the SGI C++ compiler.
44043
</P
44044
><P
44045
> Sets: <A
44046
HREF="#cv-CXX"
44047
><CODE
44048
CLASS="envar"
44049
>$CXX</CODE
44050
></A
44051
>, <A
44052
HREF="#cv-CXXFLAGS"
44053
><CODE
44054
CLASS="envar"
44055
>$CXXFLAGS</CODE
44056
></A
44057
>, <A
44058
HREF="#cv-SHCXX"
44059
><CODE
44060
CLASS="envar"
44061
>$SHCXX</CODE
44062
></A
44063
>, <A
44064
HREF="#cv-SHOBJSUFFIX"
44065
><CODE
44066
CLASS="envar"
44067
>$SHOBJSUFFIX</CODE
44068
></A
44069
>.
44070
</P
44071
></DD
44072
><DT
44073
><A
44074
NAME="t-sgicc"
44075
></A
44076
><TT
44077
CLASS="literal"
44078
>sgicc</TT
44079
></DT
44080
><DD
44081
><P
44082
> Sets construction variables for the SGI C compiler.
44083
</P
44084
><P
44085
> Sets: <A
44086
HREF="#cv-CXX"
44087
><CODE
44088
CLASS="envar"
44089
>$CXX</CODE
44090
></A
44091
>, <A
44092
HREF="#cv-SHOBJSUFFIX"
44093
><CODE
44094
CLASS="envar"
44095
>$SHOBJSUFFIX</CODE
44096
></A
44097
>.
44098
</P
44099
></DD
44100
><DT
44101
><A
44102
NAME="t-sgilink"
44103
></A
44104
><TT
44105
CLASS="literal"
44106
>sgilink</TT
44107
></DT
44108
><DD
44109
><P
44110
> Sets construction variables for the SGI linker.
44111
</P
44112
><P
44113
> Sets: <A
44114
HREF="#cv-LINK"
44115
><CODE
44116
CLASS="envar"
44117
>$LINK</CODE
44118
></A
44119
>, <A
44120
HREF="#cv-RPATHPREFIX"
44121
><CODE
44122
CLASS="envar"
44123
>$RPATHPREFIX</CODE
44124
></A
44125
>, <A
44126
HREF="#cv-RPATHSUFFIX"
44127
><CODE
44128
CLASS="envar"
44129
>$RPATHSUFFIX</CODE
44130
></A
44131
>, <A
44132
HREF="#cv-SHLINKFLAGS"
44133
><CODE
44134
CLASS="envar"
44135
>$SHLINKFLAGS</CODE
44136
></A
44137
>.
44138
</P
44139
></DD
44140
><DT
44141
><A
44142
NAME="t-sunar"
44143
></A
44144
><TT
44145
CLASS="literal"
44146
>sunar</TT
44147
></DT
44148
><DD
44149
><P
44150
> Sets construction variables for the Sun library archiver.
44151
</P
44152
><P
44153
> Sets: <A
44154
HREF="#cv-AR"
44155
><CODE
44156
CLASS="envar"
44157
>$AR</CODE
44158
></A
44159
>, <A
44160
HREF="#cv-ARCOM"
44161
><CODE
44162
CLASS="envar"
44163
>$ARCOM</CODE
44164
></A
44165
>, <A
44166
HREF="#cv-ARFLAGS"
44167
><CODE
44168
CLASS="envar"
44169
>$ARFLAGS</CODE
44170
></A
44171
>, <A
44172
HREF="#cv-LIBPREFIX"
44173
><CODE
44174
CLASS="envar"
44175
>$LIBPREFIX</CODE
44176
></A
44177
>, <A
44178
HREF="#cv-LIBSUFFIX"
44179
><CODE
44180
CLASS="envar"
44181
>$LIBSUFFIX</CODE
44182
></A
44183
>, <A
44184
HREF="#cv-SHLINK"
44185
><CODE
44186
CLASS="envar"
44187
>$SHLINK</CODE
44188
></A
44189
>, <A
44190
HREF="#cv-SHLINKCOM"
44191
><CODE
44192
CLASS="envar"
44193
>$SHLINKCOM</CODE
44194
></A
44195
>, <A
44196
HREF="#cv-SHLINKFLAGS"
44197
><CODE
44198
CLASS="envar"
44199
>$SHLINKFLAGS</CODE
44200
></A
44201
>.
44202
</P
44203
><P
44204
> Uses: <A
44205
HREF="#cv-ARCOMSTR"
44206
><CODE
44207
CLASS="envar"
44208
>$ARCOMSTR</CODE
44209
></A
44210
>, <A
44211
HREF="#cv-SHLINKCOMSTR"
44212
><CODE
44213
CLASS="envar"
44214
>$SHLINKCOMSTR</CODE
44215
></A
44216
>.
44217
</P
44218
></DD
44219
><DT
44220
><A
44221
NAME="t-suncXX"
44222
></A
44223
><TT
44224
CLASS="literal"
44225
>sunc++</TT
44226
></DT
44227
><DD
44228
><P
44229
> Sets construction variables for the Sun C++ compiler.
44230
</P
44231
><P
44232
> Sets: <A
44233
HREF="#cv-CXX"
44234
><CODE
44235
CLASS="envar"
44236
>$CXX</CODE
44237
></A
44238
>, <A
44239
HREF="#cv-CXXVERSION"
44240
><CODE
44241
CLASS="envar"
44242
>$CXXVERSION</CODE
44243
></A
44244
>, <A
44245
HREF="#cv-SHCXX"
44246
><CODE
44247
CLASS="envar"
44248
>$SHCXX</CODE
44249
></A
44250
>, <A
44251
HREF="#cv-SHCXXFLAGS"
44252
><CODE
44253
CLASS="envar"
44254
>$SHCXXFLAGS</CODE
44255
></A
44256
>, <A
44257
HREF="#cv-SHOBJPREFIX"
44258
><CODE
44259
CLASS="envar"
44260
>$SHOBJPREFIX</CODE
44261
></A
44262
>, <A
44263
HREF="#cv-SHOBJSUFFIX"
44264
><CODE
44265
CLASS="envar"
44266
>$SHOBJSUFFIX</CODE
44267
></A
44268
>.
44269
</P
44270
></DD
44271
><DT
44272
><A
44273
NAME="t-suncc"
44274
></A
44275
><TT
44276
CLASS="literal"
44277
>suncc</TT
44278
></DT
44279
><DD
44280
><P
44281
> Sets construction variables for the Sun C compiler.
44282
</P
44283
><P
44284
> Sets: <A
44285
HREF="#cv-CXX"
44286
><CODE
44287
CLASS="envar"
44288
>$CXX</CODE
44289
></A
44290
>, <A
44291
HREF="#cv-SHCCFLAGS"
44292
><CODE
44293
CLASS="envar"
44294
>$SHCCFLAGS</CODE
44295
></A
44296
>, <A
44297
HREF="#cv-SHOBJPREFIX"
44298
><CODE
44299
CLASS="envar"
44300
>$SHOBJPREFIX</CODE
44301
></A
44302
>, <A
44303
HREF="#cv-SHOBJSUFFIX"
44304
><CODE
44305
CLASS="envar"
44306
>$SHOBJSUFFIX</CODE
44307
></A
44308
>.
44309
</P
44310
></DD
44311
><DT
44312
><A
44313
NAME="t-sunlink"
44314
></A
44315
><TT
44316
CLASS="literal"
44317
>sunlink</TT
44318
></DT
44319
><DD
44320
><P
44321
> Sets construction variables for the Sun linker.
44322
</P
44323
><P
44324
> Sets: <A
44325
HREF="#cv-RPATHPREFIX"
44326
><CODE
44327
CLASS="envar"
44328
>$RPATHPREFIX</CODE
44329
></A
44330
>, <A
44331
HREF="#cv-RPATHSUFFIX"
44332
><CODE
44333
CLASS="envar"
44334
>$RPATHSUFFIX</CODE
44335
></A
44336
>, <A
44337
HREF="#cv-SHLINKFLAGS"
44338
><CODE
44339
CLASS="envar"
44340
>$SHLINKFLAGS</CODE
44341
></A
44342
>.
44343
</P
44344
></DD
44345
><DT
44346
><A
44347
NAME="t-swig"
44348
></A
44349
><TT
44350
CLASS="literal"
44351
>swig</TT
44352
></DT
44353
><DD
44354
><P
44355
> Sets construction variables for the SWIG interface generator.
44356
</P
44357
><P
44358
> Sets: <A
44359
HREF="#cv-SWIG"
44360
><CODE
44361
CLASS="envar"
44362
>$SWIG</CODE
44363
></A
44364
>, <A
44365
HREF="#cv-SWIGCFILESUFFIX"
44366
><CODE
44367
CLASS="envar"
44368
>$SWIGCFILESUFFIX</CODE
44369
></A
44370
>, <A
44371
HREF="#cv-SWIGCOM"
44372
><CODE
44373
CLASS="envar"
44374
>$SWIGCOM</CODE
44375
></A
44376
>, <A
44377
HREF="#cv-SWIGCXXFILESUFFIX"
44378
><CODE
44379
CLASS="envar"
44380
>$SWIGCXXFILESUFFIX</CODE
44381
></A
44382
>, <A
44383
HREF="#cv-SWIGFLAGS"
44384
><CODE
44385
CLASS="envar"
44386
>$SWIGFLAGS</CODE
44387
></A
44388
>, <A
44389
HREF="#cv-SWIGINCPREFIX"
44390
><CODE
44391
CLASS="envar"
44392
>$SWIGINCPREFIX</CODE
44393
></A
44394
>, <A
44395
HREF="#cv-SWIGINCSUFFIX"
44396
><CODE
44397
CLASS="envar"
44398
>$SWIGINCSUFFIX</CODE
44399
></A
44400
>, <A
44401
HREF="#cv-SWIGPATH"
44402
><CODE
44403
CLASS="envar"
44404
>$SWIGPATH</CODE
44405
></A
44406
>, <A
44407
HREF="#cv-_SWIGINCFLAGS"
44408
><CODE
44409
CLASS="envar"
44410
>$_SWIGINCFLAGS</CODE
44411
></A
44412
>.
44413
</P
44414
><P
44415
> Uses: <A
44416
HREF="#cv-SWIGCOMSTR"
44417
><CODE
44418
CLASS="envar"
44419
>$SWIGCOMSTR</CODE
44420
></A
44421
>.
44422
</P
44423
></DD
44424
><DT
44425
><A
44426
NAME="t-tar"
44427
></A
44428
><TT
44429
CLASS="literal"
44430
>tar</TT
44431
></DT
44432
><DD
44433
><P
44434
> Sets construction variables for the <SPAN
44435
CLASS="application"
44436
>tar</SPAN
44437
> archiver.
44438
</P
44439
><P
44440
> Sets: <A
44441
HREF="#cv-TAR"
44442
><CODE
44443
CLASS="envar"
44444
>$TAR</CODE
44445
></A
44446
>, <A
44447
HREF="#cv-TARCOM"
44448
><CODE
44449
CLASS="envar"
44450
>$TARCOM</CODE
44451
></A
44452
>, <A
44453
HREF="#cv-TARFLAGS"
44454
><CODE
44455
CLASS="envar"
44456
>$TARFLAGS</CODE
44457
></A
44458
>, <A
44459
HREF="#cv-TARSUFFIX"
44460
><CODE
44461
CLASS="envar"
44462
>$TARSUFFIX</CODE
44463
></A
44464
>.
44465
</P
44466
><P
44467
> Uses: <A
44468
HREF="#cv-TARCOMSTR"
44469
><CODE
44470
CLASS="envar"
44471
>$TARCOMSTR</CODE
44472
></A
44473
>.
44474
</P
44475
></DD
44476
><DT
44477
><A
44478
NAME="t-tex"
44479
></A
44480
><TT
44481
CLASS="literal"
44482
>tex</TT
44483
></DT
44484
><DD
44485
><P
44486
> Sets construction variables for the TeX formatter and typesetter.
44487
</P
44488
><P
44489
> Sets: <A
44490
HREF="#cv-BIBTEX"
44491
><CODE
44492
CLASS="envar"
44493
>$BIBTEX</CODE
44494
></A
44495
>, <A
44496
HREF="#cv-BIBTEXCOM"
44497
><CODE
44498
CLASS="envar"
44499
>$BIBTEXCOM</CODE
44500
></A
44501
>, <A
44502
HREF="#cv-BIBTEXFLAGS"
44503
><CODE
44504
CLASS="envar"
44505
>$BIBTEXFLAGS</CODE
44506
></A
44507
>, <A
44508
HREF="#cv-LATEX"
44509
><CODE
44510
CLASS="envar"
44511
>$LATEX</CODE
44512
></A
44513
>, <A
44514
HREF="#cv-LATEXCOM"
44515
><CODE
44516
CLASS="envar"
44517
>$LATEXCOM</CODE
44518
></A
44519
>, <A
44520
HREF="#cv-LATEXFLAGS"
44521
><CODE
44522
CLASS="envar"
44523
>$LATEXFLAGS</CODE
44524
></A
44525
>, <A
44526
HREF="#cv-MAKEINDEX"
44527
><CODE
44528
CLASS="envar"
44529
>$MAKEINDEX</CODE
44530
></A
44531
>, <A
44532
HREF="#cv-MAKEINDEXCOM"
44533
><CODE
44534
CLASS="envar"
44535
>$MAKEINDEXCOM</CODE
44536
></A
44537
>, <A
44538
HREF="#cv-MAKEINDEXFLAGS"
44539
><CODE
44540
CLASS="envar"
44541
>$MAKEINDEXFLAGS</CODE
44542
></A
44543
>, <A
44544
HREF="#cv-TEX"
44545
><CODE
44546
CLASS="envar"
44547
>$TEX</CODE
44548
></A
44549
>, <A
44550
HREF="#cv-TEXCOM"
44551
><CODE
44552
CLASS="envar"
44553
>$TEXCOM</CODE
44554
></A
44555
>, <A
44556
HREF="#cv-TEXFLAGS"
44557
><CODE
44558
CLASS="envar"
44559
>$TEXFLAGS</CODE
44560
></A
44561
>.
44562
</P
44563
><P
44564
> Uses: <A
44565
HREF="#cv-BIBTEXCOMSTR"
44566
><CODE
44567
CLASS="envar"
44568
>$BIBTEXCOMSTR</CODE
44569
></A
44570
>, <A
44571
HREF="#cv-LATEXCOMSTR"
44572
><CODE
44573
CLASS="envar"
44574
>$LATEXCOMSTR</CODE
44575
></A
44576
>, <A
44577
HREF="#cv-MAKEINDEXCOMSTR"
44578
><CODE
44579
CLASS="envar"
44580
>$MAKEINDEXCOMSTR</CODE
44581
></A
44582
>, <A
44583
HREF="#cv-TEXCOMSTR"
44584
><CODE
44585
CLASS="envar"
44586
>$TEXCOMSTR</CODE
44587
></A
44588
>.
44589
</P
44590
></DD
44591
><DT
44592
><A
44593
NAME="t-tlib"
44594
></A
44595
><TT
44596
CLASS="literal"
44597
>tlib</TT
44598
></DT
44599
><DD
44600
><P
44601
> Sets construction variables for the Borlan
44602
<SPAN
44603
CLASS="application"
44604
>tib</SPAN
44605
> library archiver.
44606
</P
44607
><P
44608
> Sets: <A
44609
HREF="#cv-AR"
44610
><CODE
44611
CLASS="envar"
44612
>$AR</CODE
44613
></A
44614
>, <A
44615
HREF="#cv-ARCOM"
44616
><CODE
44617
CLASS="envar"
44618
>$ARCOM</CODE
44619
></A
44620
>, <A
44621
HREF="#cv-ARFLAGS"
44622
><CODE
44623
CLASS="envar"
44624
>$ARFLAGS</CODE
44625
></A
44626
>, <A
44627
HREF="#cv-LIBPREFIX"
44628
><CODE
44629
CLASS="envar"
44630
>$LIBPREFIX</CODE
44631
></A
44632
>, <A
44633
HREF="#cv-LIBSUFFIX"
44634
><CODE
44635
CLASS="envar"
44636
>$LIBSUFFIX</CODE
44637
></A
44638
>.
44639
</P
44640
><P
44641
> Uses: <A
44642
HREF="#cv-ARCOMSTR"
44643
><CODE
44644
CLASS="envar"
44645
>$ARCOMSTR</CODE
44646
></A
44647
>.
44648
</P
44649
></DD
44650
><DT
44651
><A
44652
NAME="t-yacc"
44653
></A
44654
><TT
44655
CLASS="literal"
44656
>yacc</TT
44657
></DT
44658
><DD
44659
><P
44660
> Sets construction variables for the <SPAN
44661
CLASS="application"
44662
>yacc</SPAN
44663
> parse generator.
44664
</P
44665
><P
44666
> Sets: <A
44667
HREF="#cv-YACC"
44668
><CODE
44669
CLASS="envar"
44670
>$YACC</CODE
44671
></A
44672
>, <A
44673
HREF="#cv-YACCCOM"
44674
><CODE
44675
CLASS="envar"
44676
>$YACCCOM</CODE
44677
></A
44678
>, <A
44679
HREF="#cv-YACCFLAGS"
44680
><CODE
44681
CLASS="envar"
44682
>$YACCFLAGS</CODE
44683
></A
44684
>, <A
44685
HREF="#cv-YACCHFILESUFFIX"
44686
><CODE
44687
CLASS="envar"
44688
>$YACCHFILESUFFIX</CODE
44689
></A
44690
>, <A
44691
HREF="#cv-YACCHXXFILESUFFIX"
44692
><CODE
44693
CLASS="envar"
44694
>$YACCHXXFILESUFFIX</CODE
44695
></A
44696
>, <A
44697
HREF="#cv-YACCVCGFILESUFFIX"
44698
><CODE
44699
CLASS="envar"
44700
>$YACCVCGFILESUFFIX</CODE
44701
></A
44702
>.
44703
</P
44704
><P
44705
> Uses: <A
44706
HREF="#cv-YACCCOMSTR"
44707
><CODE
44708
CLASS="envar"
44709
>$YACCCOMSTR</CODE
44710
></A
44711
>.
44712
</P
44713
></DD
44714
><DT
44715
><A
44716
NAME="t-zip"
44717
></A
44718
><TT
44719
CLASS="literal"
44720
>zip</TT
44721
></DT
44722
><DD
44723
><P
44724
> Sets construction variables for the <SPAN
44725
CLASS="application"
44726
>zip</SPAN
44727
> archiver.
44728
</P
44729
><P
44730
> Sets: <A
44731
HREF="#cv-ZIP"
44732
><CODE
44733
CLASS="envar"
44734
>$ZIP</CODE
44735
></A
44736
>, <A
44737
HREF="#cv-ZIPCOM"
44738
><CODE
44739
CLASS="envar"
44740
>$ZIPCOM</CODE
44741
></A
44742
>, <A
44743
HREF="#cv-ZIPCOMPRESSION"
44744
><CODE
44745
CLASS="envar"
44746
>$ZIPCOMPRESSION</CODE
44747
></A
44748
>, <A
44749
HREF="#cv-ZIPFLAGS"
44750
><CODE
44751
CLASS="envar"
44752
>$ZIPFLAGS</CODE
44753
></A
44754
>, <A
44755
HREF="#cv-ZIPSUFFIX"
44756
><CODE
44757
CLASS="envar"
44758
>$ZIPSUFFIX</CODE
44759
></A
44760
>.
44761
</P
44762
><P
44763
> Uses: <A
44764
HREF="#cv-ZIPCOMSTR"
44765
><CODE
44766
CLASS="envar"
44767
>$ZIPCOMSTR</CODE
44768
></A
44769
>.
44770
</P
44771
></DD
44772
></DL
44773
></DIV
44774
></DIV
44775
><DIV
44776
CLASS="appendix"
44777
><HR><H1
44778
><A
44779
NAME="app-tasks"
44780
></A
44781
>Appendix D. Handling Common Tasks</H1
44782
><P
44783
> There is a common set of simple tasks that many build configurations rely
44784
on as they become more complex. Most build tools have special
44785
purpose constructs for performing these tasks, but since <TT
44786
CLASS="filename"
44787
>SConscript</TT
44788
>
44789
files are <SPAN
44790
CLASS="application"
44791
>Python</SPAN
44792
> scripts, you can use more flexible built-in <SPAN
44793
CLASS="application"
44794
>Python</SPAN
44795
>
44796
services to perform these tasks. This appendix lists a number of these
44797
tasks and how to implement them in <SPAN
44798
CLASS="application"
44799
>Python</SPAN
44800
>.
44801
</P
44802
><DIV
44803
CLASS="example"
44804
><A
44805
NAME="AEN10745"
44806
></A
44807
><P
44808
><B
44809
>Example D-1. Wildcard globbing to create a list of filenames</B
44810
></P
44811
><PRE
44812
CLASS="programlisting"
44813
> import glob
44814
files = glob.glob(wildcard)
44815
</PRE
44816
></DIV
44817
><DIV
44818
CLASS="example"
44819
><A
44820
NAME="AEN10748"
44821
></A
44822
><P
44823
><B
44824
>Example D-2. Filename extension substitution</B
44825
></P
44826
><PRE
44827
CLASS="programlisting"
44828
> import os.path
44829
filename = os.path.splitext(filename)[0]+extension
44830
</PRE
44831
></DIV
44832
><DIV
44833
CLASS="example"
44834
><A
44835
NAME="AEN10751"
44836
></A
44837
><P
44838
><B
44839
>Example D-3. Appending a path prefix to a list of filenames</B
44840
></P
44841
><PRE
44842
CLASS="programlisting"
44843
> import os.path
44844
filenames = [os.path.join(prefix, x) for x in filenames]
44845
</PRE
44846
><P
44847
>or in Python 1.5.2:</P
44848
><PRE
44849
CLASS="programlisting"
44850
> import os.path
44851
new_filenames = []
44852
for x in filenames:
44853
new_filenames.append(os.path.join(prefix, x))
44854
</PRE
44855
></DIV
44856
><DIV
44857
CLASS="example"
44858
><A
44859
NAME="AEN10756"
44860
></A
44861
><P
44862
><B
44863
>Example D-4. Substituting a path prefix with another one</B
44864
></P
44865
><PRE
44866
CLASS="programlisting"
44867
> if filename.find(old_prefix) == 0:
44868
filename = filename.replace(old_prefix, new_prefix)
44869
</PRE
44870
><P
44871
>or in Python 1.5.2:</P
44872
><PRE
44873
CLASS="programlisting"
44874
> import string
44875
if string.find(filename, old_prefix) == 0:
44876
filename = string.replace(filename, old_prefix, new_prefix)
44877
</PRE
44878
></DIV
44879
><DIV
44880
CLASS="example"
44881
><A
44882
NAME="AEN10761"
44883
></A
44884
><P
44885
><B
44886
>Example D-5. Filtering a filename list to exclude/retain only a specific set
44887
of extensions</B
44888
></P
44889
><PRE
44890
CLASS="programlisting"
44891
> import os.path
44892
filenames = [x for x in filenames if os.path.splitext(x)[1] in extensions]
44893
</PRE
44894
><P
44895
>or in Python 1.5.2:</P
44896
><PRE
44897
CLASS="programlisting"
44898
> import os.path
44899
new_filenames = []
44900
for x in filenames:
44901
if os.path.splitext(x)[1] in extensions:
44902
new_filenames.append(x)
44903
</PRE
44904
></DIV
44905
><DIV
44906
CLASS="example"
44907
><A
44908
NAME="AEN10766"
44909
></A
44910
><P
44911
><B
44912
>Example D-6. The "backtick function": run a shell command and capture the
44913
output</B
44914
></P
44915
><PRE
44916
CLASS="programlisting"
44917
>import os
44918
output = os.popen(command).read()
44919
</PRE
44920
></DIV
44921
></DIV
44922
></DIV
44923
><H3
44924
CLASS="FOOTNOTES"
44925
>Notes</H3
44926
><TABLE
44927
BORDER="0"
44928
CLASS="FOOTNOTES"
44929
WIDTH="100%"
44930
><TR
44931
><TD
44932
ALIGN="LEFT"
44933
VALIGN="TOP"
44934
WIDTH="5%"
44935
><A
44936
NAME="FTN.AEN380"
44937
HREF="#AEN380"
44938
><SPAN
44939
CLASS="footnote"
44940
>[1]</SPAN
44941
></A
44942
></TD
44943
><TD
44944
ALIGN="LEFT"
44945
VALIGN="TOP"
44946
WIDTH="95%"
44947
><P
44948
>In programming parlance,
44949
the <TT
44950
CLASS="filename"
44951
>SConstruct</TT
44952
> file is
44953
<SPAN
44954
CLASS="emphasis"
44955
><I
44956
CLASS="emphasis"
44957
>declarative</I
44958
></SPAN
44959
>,
44960
meaning you tell <SPAN
44961
CLASS="application"
44962
>SCons</SPAN
44963
> what you want done
44964
and let it figure out the order in which to do it,
44965
rather than strictly <SPAN
44966
CLASS="emphasis"
44967
><I
44968
CLASS="emphasis"
44969
>imperative</I
44970
></SPAN
44971
>,
44972
where you specify explicitly the order in
44973
which to do things.
44974
</P
44975
></TD
44976
></TR
44977
><TR
44978
><TD
44979
ALIGN="LEFT"
44980
VALIGN="TOP"
44981
WIDTH="5%"
44982
><A
44983
NAME="FTN.AEN1019"
44984
HREF="#AEN1019"
44985
><SPAN
44986
CLASS="footnote"
44987
>[2]</SPAN
44988
></A
44989
></TD
44990
><TD
44991
ALIGN="LEFT"
44992
VALIGN="TOP"
44993
WIDTH="95%"
44994
><P
44995
> This easily-overlooked distinction between
44996
how <SPAN
44997
CLASS="application"
44998
>SCons</SPAN
44999
> decides if the target itself must be rebuilt
45000
and how the target is then used to decide if a different
45001
target must be rebuilt is one of the confusing
45002
things that has led to the <CODE
45003
CLASS="function"
45004
>TargetSignatures</CODE
45005
>
45006
and <CODE
45007
CLASS="function"
45008
>SourceSignatures</CODE
45009
> functions being
45010
replaced by the simpler <CODE
45011
CLASS="function"
45012
>Decider</CODE
45013
> function.
45014
</P
45015
></TD
45016
></TR
45017
><TR
45018
><TD
45019
ALIGN="LEFT"
45020
VALIGN="TOP"
45021
WIDTH="5%"
45022
><A
45023
NAME="FTN.AEN2335"
45024
HREF="#AEN2335"
45025
><SPAN
45026
CLASS="footnote"
45027
>[3]</SPAN
45028
></A
45029
></TD
45030
><TD
45031
ALIGN="LEFT"
45032
VALIGN="TOP"
45033
WIDTH="95%"
45034
><P
45035
> The <CODE
45036
CLASS="function"
45037
>AddOption</CODE
45038
> function is,
45039
in fact, implemented using a subclass
45040
of the <CODE
45041
CLASS="classname"
45042
>optparse.OptionParser</CODE
45043
>.
45044
</P
45045
></TD
45046
></TR
45047
><TR
45048
><TD
45049
ALIGN="LEFT"
45050
VALIGN="TOP"
45051
WIDTH="5%"
45052
><A
45053
NAME="FTN.AEN2910"
45054
HREF="#AEN2910"
45055
><SPAN
45056
CLASS="footnote"
45057
>[4]</SPAN
45058
></A
45059
></TD
45060
><TD
45061
ALIGN="LEFT"
45062
VALIGN="TOP"
45063
WIDTH="95%"
45064
><P
45065
> Unfortunately, in the early days of SCons design,
45066
we used the name <CODE
45067
CLASS="function"
45068
>Copy</CODE
45069
> for the function that
45070
returns a copy of the environment,
45071
otherwise that would be the logical choice for
45072
a Builder that copies a file or directory tree
45073
to a target location.
45074
</P
45075
></TD
45076
></TR
45077
><TR
45078
><TD
45079
ALIGN="LEFT"
45080
VALIGN="TOP"
45081
WIDTH="5%"
45082
><A
45083
NAME="FTN.AEN4110"
45084
HREF="#AEN4110"
45085
><SPAN
45086
CLASS="footnote"
45087
>[5]</SPAN
45088
></A
45089
></TD
45090
><TD
45091
ALIGN="LEFT"
45092
VALIGN="TOP"
45093
WIDTH="95%"
45094
><P
45095
> Actually, the MD5 signature is used as the name of the file
45096
in the shared cache directory in which the contents are stored.
45097
</P
45098
></TD
45099
></TR
45100
></TABLE
45101
></BODY
45102
></HTML
45103
>