-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcommand_line_options.html
More file actions
946 lines (538 loc) · 43.9 KB
/
command_line_options.html
File metadata and controls
946 lines (538 loc) · 43.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
<!DOCTYPE HTML>
<html lang="ko" >
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-161001174-4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-161001174-4');
</script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Command-line Options | Introduction</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="">
<meta name="generator" content="GitBook 2.6.7">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="gitbook/style.css">
<link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-fontsettings/website.css">
<link rel="next" href="./debugging.html" />
<link rel="prev" href="./builtin_functions/shell_function.html" />
</head>
<body>
<div class="book"
data-level="12"
data-chapter-title="Command-line Options"
data-filepath="command_line_options.md"
data-basepath="."
data-innerlanguage="">
<div class="book-summary">
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="0" data-path="index.html">
<a href="./index.html">
<i class="fa fa-check"></i>
Introduction
</a>
</li>
<li class="chapter " data-level="1" data-path="bug_reports.html">
<a href="./bug_reports.html">
<i class="fa fa-check"></i>
<b>1.</b>
Bug reports
</a>
</li>
<li class="chapter " data-level="2" data-path="variables_and_functions.html">
<a href="./variables_and_functions.html">
<i class="fa fa-check"></i>
<b>2.</b>
Variables and Functions
</a>
<ul class="articles">
<li class="chapter " data-level="2.1" data-path="multiline_variables.html">
<a href="./multiline_variables.html">
<i class="fa fa-check"></i>
<b>2.1.</b>
Multi-Line Variables
</a>
</li>
<li class="chapter " data-level="2.2" data-path="target_specific_variables.html">
<a href="./target_specific_variables.html">
<i class="fa fa-check"></i>
<b>2.2.</b>
Target-Specific Variables
</a>
</li>
<li class="chapter " data-level="2.3" data-path="automatic_variables.html">
<a href="./automatic_variables.html">
<i class="fa fa-check"></i>
<b>2.3.</b>
Automatic Variables
</a>
</li>
<li class="chapter " data-level="2.4" data-path="substitution_references.html">
<a href="./substitution_references.html">
<i class="fa fa-check"></i>
<b>2.4.</b>
Substitution References
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="3" data-path="special_variables.html">
<a href="./special_variables.html">
<i class="fa fa-check"></i>
<b>3.</b>
Special Variables
</a>
</li>
<li class="chapter " data-level="4" data-path="directives.html">
<a href="./directives.html">
<i class="fa fa-check"></i>
<b>4.</b>
Directives
</a>
<ul class="articles">
<li class="chapter " data-level="4.1" data-path="conditional_directives.html">
<a href="./conditional_directives.html">
<i class="fa fa-check"></i>
<b>4.1.</b>
Conditional Directives
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="5" data-path="rules.html">
<a href="./rules.html">
<i class="fa fa-check"></i>
<b>5.</b>
Rules
</a>
<ul class="articles">
<li class="chapter " data-level="5.1" data-path="double_colon_rules.html">
<a href="./double_colon_rules.html">
<i class="fa fa-check"></i>
<b>5.1.</b>
Double-Colon Rules
</a>
</li>
<li class="chapter " data-level="5.2" data-path="pattern_rules.html">
<a href="./pattern_rules.html">
<i class="fa fa-check"></i>
<b>5.2.</b>
Pattern Rules
</a>
</li>
<li class="chapter " data-level="5.3" data-path="static_pattern_rules.html">
<a href="./static_pattern_rules.html">
<i class="fa fa-check"></i>
<b>5.3.</b>
Static Pattern Rules
</a>
</li>
<li class="chapter " data-level="5.4" data-path="recipes.html">
<a href="./recipes.html">
<i class="fa fa-check"></i>
<b>5.4.</b>
Recipes
</a>
</li>
<li class="chapter " data-level="5.5" data-path="DAG.html">
<a href="./DAG.html">
<i class="fa fa-check"></i>
<b>5.5.</b>
DAG
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="6" data-path="special_targets.html">
<a href="./special_targets.html">
<i class="fa fa-check"></i>
<b>6.</b>
Special Targets
</a>
</li>
<li class="chapter " data-level="7" data-path="recursive_make.html">
<a href="./recursive_make.html">
<i class="fa fa-check"></i>
<b>7.</b>
Recursive Make
</a>
</li>
<li class="chapter " data-level="8" data-path="include.html">
<a href="./include.html">
<i class="fa fa-check"></i>
<b>8.</b>
Include
</a>
</li>
<li class="chapter " data-level="9" data-path="one_DAG.html">
<a href="./one_DAG.html">
<i class="fa fa-check"></i>
<b>9.</b>
One DAG
</a>
</li>
<li class="chapter " data-level="10" data-path="parallel_execution.html">
<a href="./parallel_execution.html">
<i class="fa fa-check"></i>
<b>10.</b>
Parallel Execution
</a>
</li>
<li class="chapter " data-level="11" data-path="builtin_functions.html">
<a href="./builtin_functions.html">
<i class="fa fa-check"></i>
<b>11.</b>
Built-in Functions
</a>
<ul class="articles">
<li class="chapter " data-level="11.1" data-path="builtin_functions/text_functions.html">
<a href="./builtin_functions/text_functions.html">
<i class="fa fa-check"></i>
<b>11.1.</b>
Text Functions
</a>
</li>
<li class="chapter " data-level="11.2" data-path="builtin_functions/file_name_functions.html">
<a href="./builtin_functions/file_name_functions.html">
<i class="fa fa-check"></i>
<b>11.2.</b>
File Name Functions
</a>
</li>
<li class="chapter " data-level="11.3" data-path="builtin_functions/conditional_functions.html">
<a href="./builtin_functions/conditional_functions.html">
<i class="fa fa-check"></i>
<b>11.3.</b>
Conditional Functions
</a>
</li>
<li class="chapter " data-level="11.4" data-path="builtin_functions/foreach_function.html">
<a href="./builtin_functions/foreach_function.html">
<i class="fa fa-check"></i>
<b>11.4.</b>
Foreach Function
</a>
</li>
<li class="chapter " data-level="11.5" data-path="builtin_functions/file_function.html">
<a href="./builtin_functions/file_function.html">
<i class="fa fa-check"></i>
<b>11.5.</b>
File Function
</a>
</li>
<li class="chapter " data-level="11.6" data-path="builtin_functions/call_function.html">
<a href="./builtin_functions/call_function.html">
<i class="fa fa-check"></i>
<b>11.6.</b>
Call Function
</a>
</li>
<li class="chapter " data-level="11.7" data-path="builtin_functions/eval_function.html">
<a href="./builtin_functions/eval_function.html">
<i class="fa fa-check"></i>
<b>11.7.</b>
Eval Function
</a>
</li>
<li class="chapter " data-level="11.8" data-path="builtin_functions/value_function.html">
<a href="./builtin_functions/value_function.html">
<i class="fa fa-check"></i>
<b>11.8.</b>
Value Function
</a>
</li>
<li class="chapter " data-level="11.9" data-path="builtin_functions/origin_function.html">
<a href="./builtin_functions/origin_function.html">
<i class="fa fa-check"></i>
<b>11.9.</b>
Origin Function
</a>
</li>
<li class="chapter " data-level="11.10" data-path="builtin_functions/flavor_function.html">
<a href="./builtin_functions/flavor_function.html">
<i class="fa fa-check"></i>
<b>11.10.</b>
Flavor Function
</a>
</li>
<li class="chapter " data-level="11.11" data-path="builtin_functions/make_control_functions.html">
<a href="./builtin_functions/make_control_functions.html">
<i class="fa fa-check"></i>
<b>11.11.</b>
Make Control Functions
</a>
</li>
<li class="chapter " data-level="11.12" data-path="builtin_functions/shell_function.html">
<a href="./builtin_functions/shell_function.html">
<i class="fa fa-check"></i>
<b>11.12.</b>
Shell Function
</a>
</li>
</ul>
</li>
<li class="chapter active" data-level="12" data-path="command_line_options.html">
<a href="./command_line_options.html">
<i class="fa fa-check"></i>
<b>12.</b>
Command-line Options
</a>
</li>
<li class="chapter " data-level="13" data-path="debugging.html">
<a href="./debugging.html">
<i class="fa fa-check"></i>
<b>13.</b>
Debugging
</a>
</li>
<li class="chapter " data-level="14" data-path="tips.html">
<a href="./tips.html">
<i class="fa fa-check"></i>
<b>14.</b>
Tips
</a>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Actions Left -->
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="./" >Introduction</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<section class="normal" id="section-">
<h1 id="commandline-options">Command-line Options</h1>
<p>make 은 작업을 컨트롤하거나 디버깅에 사용할 수 있는 다양한 옵션들을 제공합니다.</p>
<p>make 명령의 종료 상태 값은 다음 3 가지 중에 하나가 됩니다.</p>
<table>
<tr><td> <b>0</b> </td><td> make 이 정상 종료하였을 때 </td></tr>
<tr><td> <b>2</b> </td><td> make 이 오류로 종료하였을 때입니다. 이때는 관련 메시지도 함께 프린트됩니다.</td></tr>
<tr><td> <b>1</b> </td><td> 이것은 "-q" 옵션을 사용하여 make 을 실행했을 때 갱신해야 될 타겟이 존재하는 것을 의미합니다. </td></tr>
</table>
<h4 id="b--m">-b , -m</h4>
<p>이 옵션은 단순히 다른 make 버전과 호환성을 위한 것으로 ignored 됩니다.</p>
<h4 id="b--alwaysmake">-B , --always-make</h4>
<p>모든 타겟을 out-of-date 상태로 간주하고 무조건 다시 빌드합니다.</p>
<h4 id="c-dir--directorydir">-C dir , --directory=dir</h4>
<p>주로 recursive make 에서 사용되는 옵션인데 make 명령을 실행하기 전에 먼저 <code>cd</code> 합니다.
옵션을 여러개 사용할 수 있는데 이때는 서로 연결됩니다.
따라서 다음은 모두 같은 결과가 됩니다.</p>
<pre><code>1. make -C foo/bar
2. make -C foo/ -C bar
3. cd foo/bar && make
</code></pre><h4 id="d">-d</h4>
<p>make 이 실행될 때 디버깅 정보도 함께 출력합니다.
어떤 파일이 비교되는지, 어떤 implicit rule 이 검색되는지, 어떤 파일이 remake 되는지 등
make 실행시 일어나는 전반에 대한 정보를 볼 수 있습니다.
이것은 <code>--debug=a</code> 옵션과 같은것 입니다.</p>
<h4 id="debugoptions">--debug[=options]</h4>
<p>make 이 실행될 때 디버깅 정보도 함께 출력합니다.
옵션 인수로 다음과 같은 값을 사용할 수 있는데 여러 개를 사용할 경우는 <code>,</code> 로 분리하면 됩니다.
옵션 인수를 주지 않으면 기본적으로 <code>basic</code> 이 사용됩니다.</p>
<table>
<tr><td nowrap=""> <b>a</b> (all) </td><td>
모든 디버깅 정보를 enable 합니다. 이것은 make 명령 실행시 "-d" 옵션을 사용하는 것과 같습니다.
</td></tr>
<tr><td nowrap=""> <b>b</b> (basic) </td><td>
basic 디버깅 정보를 출력합니다 ( 갱신해야될 타겟, 빌드가 성공했는지 등 )
</td></tr>
<tr><td nowrap=""> <b>v</b> (verbose) </td><td>
basic 정보에 더해서 어떤 makefile 을 파싱하는지, 어떤 prerequisites 은 빌드할 필요가 없는지
등 정보를 출력합니다.
</td></tr>
<tr><td nowrap=""> <b>i</b> (implicit) </td><td>
basic 정보에 더해서 implicit rule 검색에 대한 정보를 출력합니다.
</td></tr>
<tr><td nowrap=""> <b>j</b> (jobs) </td><td>
<p>make 실행시 호출되는 sub-commands 관련 정보를 출력합니다.</p>
Putting child 0x564c96ee6e40 (all) PID 31478 on the chain.<br>
Live child 0x564c96ee6e40 (all) PID 31478<br>
Reaping winning child 0x564c96ee6e40 PID 31478 <br>
Removing child 0x564c96ee6e40 PID 31478 from chain....<br>
</td></tr>
<tr><td nowrap=""> <b>m</b> (makefile) </td><td>
위 옵션들을 사용했을 때 출력되는 정보들는 makefile remake 시에는 출력되지 않는데
이 옵션을 사용하면 출력됩니다. "all" 옵션에는 이 옵션이 기본적으로 포함됩니다.
</td></tr>
<tr><td nowrap=""> <b>n</b> (none) </td><td>
디버깅 정보 출력을 disable 합니다.
</td></tr>
</table>
<h4 id="e--environmentoverrides">-e , --environment-overrides</h4>
<p>이 옵션을 사용하면 makefile 에서 설정한 변수값 대신에 환경 변수에서 설정한 값이 사용됩니다.</p>
<h4 id="evalstring">--eval=string</h4>
<p>명령 라인에서 make script 를 작성해 전달할 수 있습니다.
그러면 make 의 builtin 룰과 변수들이 정의된 후 makefile 을 읽어들이기 전에 실행됩니다.</p>
<pre><code class="lang-makefile">print-%:
@echo $* = $($*) from $(origin $*)
<span class="hljs-comment">############ 실행 결과 #############</span>
sh$ make --eval='AA := 100' print-AA
<span class="hljs-constant">AA</span> = 100 from file
sh$ make --eval='XX := AA' --eval='$(XX) := 100' print-AA
<span class="hljs-constant">AA</span> = 100 from file
</code></pre>
<h4 id="f-file--filefile--makefilefile">-f file , --file=file , --makefile=file</h4>
<p>실행할 makefile 을 지정합니다.</p>
<h4 id="i--ignoreerrors">-i , --ignore-errors</h4>
<p>recipe 실행시 오류가 발생하면 make 실행이 중단되는데 이 옵션을 사용하면 오류가 ignore 됩니다.</p>
<h4 id="i-dir--includedirdir">-I dir , --include-dir=dir</h4>
<p>이것은 <code>include</code> 지시자 에서 사용되는 옵션인데
만약에 파일이 <code>/</code> 로 시작하지 않고, 현재 디렉토리에서도 찾을 수 없다면
이 옵션으로 지정한 디렉토리에서 찾게 됩니다.
이 옵션은 여러 개를 사용할 수 있습니다.</p>
<h4 id="j-n--jobsn">-j [N] , --jobs[=N]</h4>
<p>rule 단위로 recipe 들을 병렬 실행할 때 사용하는 옵션입니다.
최대 몇 개까지 병렬 실행할지 개수( N )를 지정할 수 있는데
만약에 개수를 지정하지 않고 단독으로 사용하면 as many recipes as possible 실행합니다.</p>
<h4 id="l-load--loadaverageload--maxloadload">-l [load] , --load-average[=load] , --max-load[=load]</h4>
<p>병렬 실행시 현재 시스템 로드에 따라서 새로 실행되는 job 을 제한할 수 있습니다.
기본적으로 1 개의 job 은 항상 실행되지만 새로 job 을 생성할 때는 먼저 <code>-l</code> 옵션에 설정한 값을
비교하여 현재 시스템 로드가 해당 값보다 작을 경우에만 새로 job 을 생성합니다.
기본값은 no limit 입니다.</p>
<pre><code># 시스템 로드가 2.5 이상이면 새로 job 을 생성하지 않습니다.
sh$ make -j8 -l 2.5
</code></pre><h4 id="k--keepgoing">-k , --keep-going</h4>
<p>recipe 실행시 오류가 발생하면 make 실행이 종료되는데
이 옵션을 사용하면 오류가 발생한 타겟과 의존관계가 없는 타겟들은 계속 진행됩니다.</p>
<h4 id="l--checksymlinktimes">-L , --check-symlink-times</h4>
<p>파일명으로 symbolic link 를 사용할 경우는
파일의 timestamp 를 체크할 때 기본적으로 symbolic link 에 연결된 파일의 값이
사용되지만 이 옵션을 사용하면 symbolic link 자체 값도 포함해서 그중 최신 값이 사용됩니다.</p>
<h4 id="n--justprint--dryrun--recon">-n , --just-print , --dry-run , --recon</h4>
<p>이 옵션은 recipe 에서 실행되는 명령문을 출력만 하고 실제 실행하지는 않습니다.
명령문 앞에 <code>@</code> prefix 가 붙은 경우에도 출력이 됩니다.
이 옵션이 사용되어도 명령문 앞에 <code>+</code> prefix 가 붙은 경우나 makefile remake 에
사용되는 recipe 는 실행됩니다.</p>
<h4 id="o-file--oldfilefile--assumeoldfile">-o file , --old-file=file , --assume-old=file</h4>
<p>이 옵션은 최신 상태의 파일을 old 상태로 간주하여 실행할 수 있게 해줍니다
( 실제 old 상태로 만드는 것은 아님 ).
반대로 old 상태의 파일을 최신 상태의 파일로 간주하여 실행할 수 있는 <code>-W</code> 옵션도 있습니다.</p>
<p><a name="sync"></a></p>
<h4 id="otype--outputsynctype">-O[type] , --output-sync[=type]</h4>
<p><code>-j</code> 옵션을 이용해 여러 타겟의 recipe 가 병렬로 실행되면 출력이 서로 겹치게 됩니다.
이와 같은 문제를 해결하기 위한 출력 동기화 옵션입니다.
출력은 특정 type 단위로 모아져서 한번에 출력되는데 여기에는 다음과 같이 4 가지
종류를 사용할 수 있습니다.
type 을 지정하지 않으면 기본값은 target 이 되고 해당 타겟의 recipe 에서
발생한 출력이 모두 모아져서 한번에 출력됩니다.
좀더 자세한 내용은 <a href="parallel_execution.html#sync">여기</a>를 참고 하세요</p>
<pre><code>1. none ( no synchronization )
2. line ( recipe 라인 단위 )
3. target ( rule 단위 )
4. recurse ( recursive make 실행시 sub-make 단위 )
</code></pre><h4 id="p--printdatabase">-p , --print-data-base</h4>
<p>makefile 을 읽어들여 실행한 후에 make 이 가지고 있는 룰과 변수 database 정보를 출력합니다.</p>
<pre><code class="lang-sh"><span class="hljs-comment"># make 에 builtin 으로 설정되어 있는 룰과 변수 database 정보를 보려면 다음과 같이하면 됩니다.</span>
sh$ make -p <span class="hljs-operator">-f</span> /dev/null
<span class="hljs-comment"># remake 은 하지 않고 database 를 출력하려면 다음과 같이 합니다.</span>
sh$ make -qp
</code></pre>
<h4 id="q--question">-q , --question</h4>
<p>갱신해야 될 타겟이 있는지 알아볼 때 사용합니다.
아무런 recipe 도 실행하지 않고 출력도 하지 않습니다.
단지 make 명령의 종료 상태 값만 설정됩니다.</p>
<ol>
<li>모든 타겟이 up to date 상태면 종료 상태 값은 <code>0</code> 입니다.</li>
<li>갱신해야 될 타겟이 존재하면 종료 상태 값은 <code>1</code> 입니다.</li>
<li>실행 중 오류가 발생하면 종료 상태 값은 <code>2</code> 가 됩니다.</li>
</ol>
<h4 id="r--nobuiltinrules">-r , --no-builtin-rules</h4>
<p>make 에 builtin 돼서 제공되는 implicit rules ( pattern rules, suffix rules ) 들을 disable 합니다.</p>
<h4 id="r--nobuiltinvariables">-R , --no-builtin-variables</h4>
<p>make 의 builtin 변수들 ( builtin implicit rules 과 관련됨 ) 을 disable 합니다.
이 변수들이 disable 되면 관련 builtin rules 들도 사용할 수 없기 때문에 자동으로 <code>-r</code> 옵션도 설정됩니다.</p>
<h4 id="s--silent--quiet">-s , --silent , --quiet</h4>
<p>recipe 에서 명령이 실행되기 전에 명령문이 출력되는 것을 disable 합니다.
이것은 모든 recipe 라인 앞에 <code>@</code> prefix 를 붙인 것과 같습니다.
또한 <code>--print-directory</code> 옵션도 disable 되어 출력되지 않습니다.</p>
<h4 id="s--nokeepgoing--stop">-S , --no-keep-going , --stop</h4>
<p>이것은 디폴트 설정이기 때문에 보통의 경우는 이 옵션이 필요 없지만
recursive make 에서 <code>-k</code> 옵션이 사용될 경우 상속되는 것을 방지하려면 이 옵션을 사용합니다.</p>
<h4 id="t--touch">-t , --touch</h4>
<p>모든 타겟 파일을 recipe 실행 없이 touch 명령을 사용해 up to date 상태로 만듭니다.
예를 들어 특정 헤더 파일을 수정한 후에 불필요하게 재 컴파일되는 것을 방지하기 위해 사용할 수 있습니다.
특정 타겟 파일이 touch 에의해 생성되는 것을 방지하려면 .PHONY 타겟에 등록하면 됩니다.</p>
<blockquote>
<p>.PHONY 타겟은 touch 에서 제외됩니다.</p>
</blockquote>
<h4 id="trace">--trace</h4>
<p>makefile 실행 중에 tracing 정보도 함께 출력합니다.
여기에는 makefile 이름, recipe 라인 넘버, 왜 타겟이 빌드가 되는지 같은 정보가 출력됩니다.
이때 silent 옵션이나 <code>@</code> prefix 는 무시됩니다.</p>
<pre><code>sh$ make --trace all
Makefile:19: target 'zoo' does not exist
echo target zoo : all
target zoo : all
Makefile:17: update target 'bar' due to: zoo
echo target bar : all
target bar : all
Makefile:15: update target 'foo' due to: bar
echo target foo : all
target foo : all
</code></pre><h4 id="w--printdirectory">-w , --print-directory</h4>
<p>recursive make 사용시 makefile 실행 전, 후에 디렉토리 정보를 표시해줍니다.
이 옵션은 자동으로 설정되므로 직접 설정할 필요는 없습니다.
<code>--silent</code> 옵션을 사용하거나 <code>--no-print-directory</code> 옵션을 사용하면 disable 됩니다.</p>
<pre><code class="lang-makefile">make[1]: Entering directory '/home/mug896/tmp/foo'
. . .
make[2]: Entering directory '/home/mug896/tmp/foo/bar'
. . .
make[2]: Leaving directory '/home/mug896/tmp/foo/bar'
. . .
make[1]: Leaving directory '/home/mug896/tmp/foo'
</code></pre>
<h4 id="noprintdirectory">--no-print-directory</h4>
<p><code>--print-directory</code> 옵션이 설정되어 있는 상태에서 이 옵션이 사용되면
디렉토리 정보 출력이 disable 됩니다.</p>
<h4 id="w-file--whatiffile--newfilefile--assumenewfile">-W file , --what-if=file , --new-file=file , --assume-new=file</h4>
<p>이 옵션은 old 상태의 파일을 최신 상태의 파일로 간주하여 실행할 수 있게 해줍니다
( 실제 최신 상태로 만드는 것은 아님 ).
따라서 <code>-n</code> 옵션과 함께 사용하면 특정 파일이 update 되었을 때 어떤 작업이 일어나는지
테스트해볼 수 있습니다.</p>
<h4 id="warnundefinedvariables">--warn-undefined-variables</h4>
<p>makefile 작성시 undefined 변수를 사용할 경우 warning 메시지를 출력합니다.</p>
</section>
</div>
</div>
</div>
<a href="./builtin_functions/shell_function.html" class="navigation navigation-prev " aria-label="Previous page: Shell Function"><i class="fa fa-angle-left"></i></a>
<a href="./debugging.html" class="navigation navigation-next " aria-label="Next page: Debugging"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="gitbook/app.js"></script>
<script src="gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
<script src="gitbook/plugins/gitbook-plugin-search/search.js"></script>
<script src="gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
<script src="gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
<script>
require(["gitbook"], function(gitbook) {
var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
gitbook.start(config);
});
</script>
</body>
</html>