[go: up one dir, main page]

File: Howto.cook

package info (click to toggle)
cook 2.19-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 7,316 kB
  • ctags: 3,969
  • sloc: ansic: 50,331; sh: 13,190; makefile: 4,542; yacc: 3,174; perl: 224; awk: 154
file content (1494 lines) | stat: -rw-r--r-- 36,056 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
/*
 *	cook - file construction tool
 *	Copyright (C) 1994-1999, 2001 Peter Miller;
 *	All rights reserved.
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the Free Software
 *	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
 *
 * MANIFEST: instructions to cook, how to build project
 */

/*
 * remove targets before running recipe bodies
 */
set unlink;

/*
 * make directories above targets before running recipe bodies
 */
set mkdir;

/*
 * Update file times if necessary, to ensure outputs are newer then inputs.
 * On fast machines, that happens frequently for transitive dependencies.
 */
set time-adjust;

/*
 * You may want to change some of these options.
 * ([debug] must be defined, even if empty, use comments.)
 *
 * If you want to turn the DEBUG compile flag on,
 * edit the common/main.h file.
 */
debug = /* -g */ ;

/*
 * Make sure the [project], [change], [version] and [arch] variables are set.
 */
#ifndef project
echo "The [project] variable was not set from the command line." set silent;
echo "If you want to do a build which is not a development build" set silent;
echo "or an integration build, use the make command, not cook." set silent;
fail;
#endif
#ifndef change
echo "The [change] variable was not set from the command line." set silent;
echo "If you want to do a build which is not a development build" set silent;
echo "or an integration build, use the make command, not cook." set silent;
fail;
#endif
#ifndef version
echo "The [version] variable was not set from the command line." set silent;
echo "If you want to do a build which is not a development build" set silent;
echo "or an integration build, use the make command, not cook." set silent;
fail;
#endif
#ifndef arch
echo "The [arch] variable was not set from the command line." set silent;
echo "If you want to do a build which is not a development build" set silent;
echo "or an integration build, use the make command, not cook." set silent;
fail;
#endif
#ifndef search_path
echo "The [search_path] variable was not set from the command line." set silent;
echo "If you want to do a build which is not a development build" set silent;
echo "or an integration build, use the make command, not cook." set silent;
fail;
#endif

/*
 * The first item in search list should be the absolute path of the
 * current directory.  Assume that it is.
 */
search_list = .;
search_tmp = [tail [split ':' [search_path]]];

/*
 * Try to shorten the search path in command lines, too.
 *
 * This takes a little getting used to....
 * 1. For development builds, the search path is dev dir, then branch bl,
 *    then ... project bl.  Thus, bl in a dev dir winds up pointing to
 *    the branch repository.
 * 2. For integration builds, aegis deliberately omits the branch
 *    baseline from the path, but include's the branch's parents and
 *    ancestors.  Thus, bl in an int dir winds up pointing to the
 *    branch's parent's reporitory.
 * The idea is that integration builds in a branch are like a
 * development build of the branch's dev dir.
 */
search_name = bl;
loop
{
	search_dir = [head [search_tmp]];
	if [not [search_dir]] then
		loopstop;
	search_tmp = [tail [search_tmp]];

	if [not [exists [search_name]]] then
		ln -s [search_dir] [search_name]
			set clearstat;
	search_list = [search_list] [search_name];
	search_name = [search_name]bl;
}

/*
 * If this is a development build, the version will be x.y.Czzz,
 * so look to see if there is a C in the version string.
 */
if [match_mask %1C%2 [version]] then
{
	/*
	 * The develop_begin_command in the config file
	 * always creates the "bl" symbolic link.
	 */
	baseline = bl;
}

if [not [defined baseline]] then
{
	/*
	 * Turn on aggressive updating to ensure the smallest possible
	 * range of mod times at aeipass.  This also ensures mod time
	 * consistency on fast machines.
	 */
	set time-adjust-back;
}
else
{
	/*
	 * Use finger prints for development builds.
	 * They avoid much of the tedium.
	 */
	set fingerprint;
}

/*
 * determine the short version:
 * no change or delta number
 */
version_short = [fromto %1.C%2 %1 [subst D C [version]]];

version_shorter = [split "." [version_short]] _ _;
version_shorter = [unsplit "." [word 1 [version_shorter]]
	[word 2 [version_shorter]]];
project_short = [fromto %.[version_short] % [project]];
project_minus = [project_short]-[version_short];

/*
 * This file is generated by autoconf.
 * It is architecture specific.
 * If it is not found (not cooked yet) the following
 * symbols will be undefined.
 *
 *	Must be included *after* the search_list is defined.
 */
#include-cooked-nowarn [arch]/etc/Howto.conf
if [not [defined prefix]] then
	prefix = /usr/local;
if [not [defined exec_prefix]] then
	exec_prefix = [prefix];
if [not [defined yacc]] then
	yacc = yacc;
if [not [defined libs]] then
	libs = ;
if [not [defined cc]] then
	cc = ['if' [find_command gcc] 'then' gcc 'else' cc];

awk = gawk;

/*
 * The source files.
 * This is given to us by aegis.
 */
vs_file = common/patchlevel.h;
change_files = ;
#include-cooked-nowarn etc/cook/change_files.[version]
etc/cook/change_files.[version]:
	set shallow nodefault
{
	echo "'change_files ='" > [target];
	aegis -l cf -p [project] -c [change] -unf
		| [awk] "'/^build/{next};$2==\"remove\"{next};{print $NF}'"
		>> [target];
	echo "';'" >> [target];
}
project_files = ;
#include-cooked-nowarn etc/cook/project_files.[version]
etc/cook/project_files.[version]:
	set shallow nodefault
{
	echo "'project_files ='" > [target];
	aegis -l pf -p [project] -c [change] -unf
		| [awk] "'/^build/{next};$2==\"remove\"{next};{print $NF}'"
		>> [target];
	echo "';'" >> [target];
}
source_files =
	[sort [stringset [project_files] [change_files]]]
	[vs_file] etc/version.so
	;

/*
 * Speed up graph building by stating the leaves explictly.
 * This also gives more useful error messages.
 */
if [count [project_files]] then
if [count [change_files]] then
{
	/* obsolete */ leaf_file_accept = [project_files] [change_files];
	graph_leaf_file = [project_files] [change_files];
	/* obsolete */ leaf_pattern_accept = /%0%;
	graph_leaf_pattern = /%0%;
}

source_files = [source_files]
	[fromto
		lib/%1/readme/main.%2 lib/%1/readme/new.so
		[match_mask lib/%1/readme/main.%2 [source_files]]
	]
	[fromto
		lib/%1/refman/main.%2 lib/%1/refman/index.so
		[match_mask lib/%1/refman/main.%2 [source_files]]
	]
	[fromto
		lib/%1/refman/main.%2 lib/%1/refman/parts.so
		[match_mask lib/%1/refman/main.%2 [source_files]]
	]
	[fromto
		lib/%1/user-guide/main.%2 lib/%1/user-guide/function.so
		[match_mask lib/%1/user-guide/main.%2 [source_files]]
	]
	[fromto
		lib/%1/user-guide/main.%2 lib/%1/user-guide/system.list.so
		[match_mask lib/%1/user-guide/main.%2 [source_files]]
	];

/*
 * There is a special list of files you must use, in preference to the
 * standard C files.  This ensures appropriate operating system insulation
 * is always in place.
 */
c_incl_excludes =
	[fromto common/ac/%0%.h -ex\=%0%.h
		[match_mask common/ac/%0%.h [source_files]]
	];

/*
 * determine the list of commands,
 * and their object file lists
 */

commands =
	[stringset
		[fromto %1/%0%2 %1 [match_mask %1/%0%2.c [source_files]]]
		[fromto %1/%0%2 %1 [match_mask %1/%0%2.y [source_files]]]
	-
		common
	];

cmd_list = [commands];
loop
{
	cmd = [head [cmd_list]];
	if [not [cmd]] then
		loopstop;
	cmd_list = [tail [cmd_list]];

	[cmd]_obj =
		[fromto [cmd]/%0%.y [arch]/[cmd]/%0%.gen.o
			[match_mask [cmd]/%0%.y [source_files]]
		]
		[fromto [cmd]/%0%.c [arch]/[cmd]/%0%.o
			[match_mask [cmd]/%0%.c [source_files]]
		]
		[arch]/common/lib.a
		[arch]/common/version-stmp.o
		;
	[cmd],I =
		[fromto [cmd]/%0%.y [cmd]/%0%.gen.c,I
			[match_mask [cmd]/%0%.y [source_files]]
		]
		[fromto [cmd]/%0%.c [cmd]/%0%.c,I
			[match_mask [cmd]/%0%.c [source_files]]
		]
		;
}
all,I =
	[fromto %0%.y %0%.gen.c,I [match_mask %0%.y [source_files]]]
	[fromto %0%.c %0%.c,I [match_mask %0%.c [source_files]]]
	;

/*
 * The default recipe
 */
all =
	doc.targets
	[prepost [arch]/bin/ "" [commands]]
	internationalization
	[fromto script/%.in [arch]/bin/%
		[match_mask script/%.in [source_files]]
	]
	;

/*
 * Integration builds also make the files for distribution.
 */
if [not [defined baseline]] then
{
	all += integration-build-targets;

	/*
	 * Adjust the mtime of recipe targets to be exactly 1 second
	 * younger than the youngest ingredient.  This helps aeipass
	 * compress the mtimes.
	 */
	set time-adjust-back;
}

if [in [fromto %1.D%2 %2 [version]] 001 002] then
	all += RPM;

all: [all]
	set default;

integration-build-targets:
	archive/[project_minus].tar.gz
	/* archive/[project_minus].shar.01.gz */
	/* archive/[project_minus].patch.gz */
	archive/[project_short].html
	archive/[project_short].gif
	archive/[project_minus].ug.ps.gz
	archive/[project_minus].rm.ps.gz
	/* archive/[project_minus].faq */
	archive/[project_minus].lsm
	archive/[project_minus].spec
	archive/[project_minus].README
	;

common_obj = [arch]/common/lib.a [arch]/common/version-stmp.o;
lib_obj =
	[stringset
		[fromto
			common/%0%.c
			[arch]/common/%0%.o
			[match_mask common/%0%.c [source_files]]
		]
		[fromto
			common/%0%.y
			[arch]/common/%0%.gen.o
			[match_mask common/%0%.y [source_files]]
		]
	-
		[common_obj]
	];
lib_srcs =
	[match_mask lib/% [source_files]]
	;
common,I =
	[fromto
		common/%0%.c
		common/%0%.c,I
		[match_mask common/%0%.c [source_files]]
	]
	[fromto
		common/%0%.y
		common/%0%.gen.c,I
		[match_mask common/%0%.y [source_files]]
	];

/*
 * how to compile C sources
 */
cc_flags = -O2 [debug];
cc_include_flags = ;

/*
 * this next section is for gcc
 *	comment it out if you don't have gcc
 *
 * The gcc include files MUST be first.
 */
if [in [cc] gcc] then
{
	cc_flags = [cc_flags]
		-ansi -Wall -Wstrict-prototypes -Wmissing-prototypes
		-Wshadow -Wmissing-declarations -Wpointer-arith;
	if [in [arch] linux-i486 sun5] then
	if [defined baseline] then
		cc_flags = [cc_flags] -Werror -fno-builtin;
}

/*
 * include files from the common directory.
 */
cc_include_flags =
	[cc_include_flags]
	[prepost -I /[arch]/common [search_list]]
	[prepost "-I" "/common" [search_list]]
	;

/*
 * Build %.o from %.c
 */
[arch]/%1/%0%2.o: %1/%0%2.c
	single-thread %2.o
{
	extra = [cc_flags];
	if [defined %2_flags] then
		extra = [extra] [%2_flags];
	if [match %%.gen %2] then
	{
		/*
		 * Generated files may have warnings, because we have no
		 * control over the quality of generated code (usually
		 * warnings about missing prototypes or unreferenced
		 * labels).
		 */
		extra = [stringset [extra] - -Werror];
	}
	[cc] [extra]
		[stringset
			[cc_include_flags]
			[prepost "-I" "/%1" [search_list]]
		]
		-c [resolve %1/%0%2.c]
		['if' [in gcc [cc]] 'then' -o [target]];
	if [not [in gcc [cc]]] then
		mv %2.o [target];
}

%0%.y,M:: %0%.gen.c,Md;
%0%.c,M:: %0%.c,Md;

%1/%0%2.c,Md: %1/%0%2.c
{
	c_incl
		-nc /* no cache */
		-ns /* no system */
		-eia /* empty if absent */
		[stringset
			[cc_include_flags]
			[prepost "-I" "/%1" [search_list]]
		]
		[resolve %1/%0%2.c]
		-nsri /* no source relative includes */
		[prepost "-rlp=" "" [search_list]] /* remove leading path */
		-rlp [arch] /* remove leading architecture */
		-o [target];
}

%1/%0%2.c.d: %1/%0%2.c
	set no-cascade
{
	c_incl
		-nc /* no cache */
		-ns /* no system */
		-eia /* empty if absent */
		-nrec /* no recursion */
		[stringset
			[cc_include_flags]
			[prepost "-I" "/%1" [search_list]]
		]
		-prefix "'cascade %1/%0%2.c ='"
		-suffix "';'" [resolve %1/%0%2.c]
		-nsri /* no source relative includes */
		[prepost "-rlp=" "" [search_list]] /* remove leading path */
		-slp [arch] "'[arch]'" /* substitute leading path */
		['if' [not [filter common/ac/%%0%% %1/%0%2.c]]
		'then'
			[c_incl_excludes]
		]
		-o [target];
}

%1/%0%2.h.d: %1/%0%2.h
	set no-cascade
{
	c_incl
		-nc /* no cache */
		-ns /* no system */
		-eia /* empty if absent */
		-nrec /* no recursion */
		[stringset
			[cc_include_flags]
			[prepost "-I" "/%1" [search_list]]
		]
		-prefix "'cascade %1/%0%2.h ='"
		-suffix "';'" [resolve %1/%0%2.h]
		-nsri /* no source relative includes */
		[prepost "-rlp=" "" [search_list]] /* remove leading path */
		-slp [arch] "'[arch]'" /* substitute leading path */
		['if' [not [filter common/ac/%%0%% %1/%0%2.h]]
		'then'
			[c_incl_excludes]
		]
		-o [target];
}

c-dep-files =
	[fromto %0% %0%.d [match_mask %0%.c [source_files]]]
	[fromto %0%.y %0%.gen.c.d [match_mask %0%.y [source_files]]]
	;
h-dep-files =
	[fromto %0% %0%.d [match_mask %0%.h [source_files]]]
	[fromto %0%.y %0%.gen.h.d [match_mask %0%.y [source_files]]]
	;

ac-h-files = [match_mask common/ac/%0%.h [source_files]] ;
#if [count [ac-h-files]]
cascade [ac-h-files] = [arch]/common/config.h;
#endif

#include-cooked-nowarn [c-dep-files] [h-dep-files]

/*
 * Dependencies on generated files are impossible to determine a priori.
 * Catch 22: you need the files to exist to determine whether you need
 * them to exist.  Sigh.
 */
cascade common/libdir.c = [arch]/etc/libdir-h;
cascade common/sub/expr_lex.c = common/sub/expr_gram.gen.h;
cascade common/version-stmp.c = [vs_file];
cascade cook/fingerprint/lex.c = cook/fingerprint/gram.gen.h;
cascade cook/lex.c = cook/parse.gen.h cook/hashline.gen.h;
cascade lib/en/readme/main.man = lib/en/readme/new.so;
cascade make2cook/lex.c = make2cook/gram.gen.h;
cascade make2cook/variable.c = make2cook/vargram.gen.h;
cascade cook/builtin/expr_lex.c = cook/builtin/expr_parse.gen.h;

/*
 * How to use yacc sources.
 */
yacc = bison -y;
yacc_flags = -v;

%1/%0%2.gen.c %1/%0%2.gen.h: %1/%0%2.y
	single-thread y.tab.c y.tab.h y.output
{
	rm -f %1/%0%2.list y.output
		set silent;
	if [exists %1/%0%2.gen.c] then
		rm %1/%0%2.gen.c
			set clearstat;
	if [exists %1/%0%2.gen.h] then
		rm %1/%0%2.gen.h
			set clearstat;
	[yacc] -d [yacc_flags] [resolve %1/%0%2.y];
	yy = [collect echo %0%2 | sed "'s/[^a-zA-Z0-9]/_/g'"];
	sed	-e "'s/\[yY\]\[yY\]/"[yy]"_/g'"
		-e "'/<stdio.h>/d'"
		y.tab.c > %1/%0%2.gen.c;
	rm y.tab.c;
	sed	-e \'s/\[yY\]\[yY\]/[yy]_/g\'
		-e \'s/Y_TAB_H/[yy]_TAB_H/\'
		y.tab.h > %1/%0%2.gen.h;
	rm y.tab.h;
	if [exists y.output] then
		mv y.output %1/%0%2.list
			set clearstat;
}

/*
 * build the scripts
 */
[arch]/bin/%: script/%.in [arch]/config.status
	single-thread conftest.subs
{
	CONFIG_FILES\=[target]\:[resolve script/%.in] CONFIG_HEADERS\=
		[resolve [arch]/config.status];
	chmod a+rx [target];
}

/*
 * build the programs
 */
[arch]/bin/%: [%_obj]
{
	[cc] -o [target] [resolve [%_obj]] [libs];
	chmod 755 [target];
}


/*
 * The version stamp is to be updated for every
 * integration and development build.
 * (The integrate_begin_command in the config file
 * deletes them for integration builds.)
 */

[vs_file]:
	set shallow
{
	copyright_years =
		[collect
			aegis -list version -p [project] -c [change]
			| [awk] "-F'[[\\\\]]'" "'/^copyright_years/{print $2}'"
		];
	echo "'#define PATCHLEVEL \""[version]"\"'" > [target];
	echo "'#define COPYRIGHT_YEARS \""[copyright_years]"\"'" >> [target];
}


/*
 * Not a shallow recipe because content changes according to Aegis, not
 * cookable.
 */
etc/version.so:
	set ['if' [or [not [defined baseline] ] [not [exists bl/etc/version.so
		] ] ] 'then' shallow]
{
	copyright_years =
		[collect
			aegis -list version -p [project] -c [change]
			| [awk] "-F'[[\\\\]]'" "'/^copyright_years/{print $2}'"
		];
	echo "'.ds V) "[version]"'" > [target];
	echo "'.ds v) "[version_short]"'" >> [target];
	aegis -list version -p [project] -c [change]
		| [awk] -F'\'"\'' "'/previous/{print $2}'"
		| [awk] -F. "'{print \".ds w) \"$1\".\"$2}'"
		>> [target];
	echo "'.ds Y) "[copyright_years]"'" >> [target];
}


/*
 * These recipes build a Makefile for a user.  They do not build a
 * Makefile useful for a development build, because no arch
 * information is included in the Makefile.
 */

makefile-per-file = [prepost "" ",M" [source_files]];

Makefile.in: etc/Makefile.head etc/Makefile.sh etc/Makefile.awk [vs_file]
	[makefile-per-file]
{
	cat [resolve etc/Makefile.head [makefile-per-file]] > [target];
	sh [resolve etc/Makefile.sh] [source_files]
		| [awk] -f [resolve etc/Makefile.awk]
		>> [target];
}

%0%,M: etc/Makefi.file.sh etc/Makefile.awk
{
	depfile = [match_mask %%0%%,Md [need]];
	sh [resolve etc/Makefi.file.sh] %0% [resolve %0%]
			[resolve [depfile]]
		| [awk] -f [resolve etc/Makefile.awk]
		> [target];
}

CHANGES = etc/CHANGES.[version_short];

source_file_order =
	README
	[sort
		[stringset
			[CHANGES] [source_files]
			install-sh
			BUILDING
			MANIFEST
			Makefile.in
			etc/version.so
			common/config.h.in
			common/patchlevel.h
			configure
			[project_short].spec
			[project_short].gif
		-
			README
		]
	]
	;

archive/[project_minus].shar.01.gz: [source_file_order]
	set shallow
{
	parts = [glob archive/[project_minus].shar.*];
	if [parts] then
		rm [parts]
			set clearstat;
	/* assumes shar.3.49 available */
	shar -n[project_minus] -a -c -oarchive/[project_minus].shar -L200
		-s "'Peter Miller <millerp@canb.auug.org.au>'"
		[resolve [source_file_order]];
	gzip -9 -v archive/[project_minus].shar.*;
}

archive/[project_minus].tar.gz: [source_file_order]
	set shallow
{
	tar cf - [resolve [source_file_order]] |
	tardy -unu 0 -gnu 0 -una Peter -gna Miller -p [project_minus] -ms 0644
		-mc 07022 -now [prepost "-rp=" "" [search_list]]
		> archive/[project_minus].tar;
	gzip -9 -v archive/[project_minus].tar;
}

[CHANGES]: etc/CHANGES.sh [vs_file]
{
	sh [resolve etc/CHANGES.sh] [project] > [target];
}

/*
 * formatting documents and manual entries
 */
doc.targets: cat txt special;

/*
 * manual entries
 */
cat =
	[fromto lib/%3/man%1/%2.%1 lib/%3/cat%1/%2.%1
		[match_mask lib/%3/man%1/%2.%1 [source_files]]
	];
cat: [cat];

lib/%3/cat%1/%2.%1: lib/%3/man%1/%2.%1
{
	roffpp
		[prepost "-I" "/lib/%3/man%1" [search_list]]
		[prepost -I /[arch]/etc [search_list]]
		[prepost "-I" "/etc" [search_list]]
		[resolve lib/%3/man%1/%2.%1]
	| groff -Tascii -P-h -t -man
	> [target];
}

lib/%3/man%1/%2.%1,M:: lib/%3/man%1/%2.%1,Md;

lib/%3/man%1/%2.%1,Md: lib/%3/man%1/%2.%1
{
	c_incl -nc -ns -eia -r
		[stringset
			[prepost "-I" "/lib/%3/man%1" [search_list]]
			[prepost "-I" /[arch]/etc [search_list]]
			[prepost "-I" "/etc" [search_list]]
			[cc_include_flags]
		]
		[resolve lib/%3/man%1/%2.%1]
		[prepost "-rlp=" "" [search_list]] /* remove leading path */
		-rlp [arch] /* remove leading architecture */
		-o [target];
}

lib/%3/man%1/%2.%1.d: lib/%3/man%1/%2.%1
	set no-cascade
{
	c_incl -nc -ns -eia -r
		-nrec /* no recursion */
		[stringset
			[cc_include_flags]
			[prepost "-I" "/lib/%3/man%1" [search_list]]
			[prepost "-I" /[arch]/etc [search_list]]
			[prepost "-I" "/etc" [search_list]]
		]
		-prefix "'cascade lib/%3/man%1/%2.%1 ='"
		-suffix "';'"
		[resolve lib/%3/man%1/%2.%1]
		[prepost "-rlp=" "" [search_list]] /* remove leading path */
		-slp [arch] "'[arch]'" /* substitute leading path */
		-o [target];
}

%0%.so.d: %0%.so
	set no-cascade
{
	c_incl -nc -ns -eia -r
		-nrec /* no recursion */
		[stringset
			[cc_include_flags]
			[prepost "-I"
				"/"[unsplit /
					[wordlist 1 3
						[split / [dirname %0%.so]]
					]
				]
				[search_list]
			]
			[prepost "-I" /[arch]/etc [search_list]]
			[prepost "-I" "/etc" [search_list]]
		]
		-prefix "'cascade %0%.so ='"
		-suffix "';'"
		[resolve %0%.so]
		[prepost "-rlp=" "" [search_list]] /* remove leading path */
		-slp [arch] "'[arch]'" /* substitute leading path */
		-o [target];
}

man-dep-files =
	[fromto %0% %0%.d
		[match_mask lib/%3/man%1/%2.%1 [source_files]]
	]
	[fromto %0% %0%.d
		[match_mask %0%.so [source_files]]
	];

cascade lib/en/man1/cook.1 = [arch]/etc/libdir.so;
cascade lib/en/user-guide/main.mm = [arch]/etc/libdir.so;

#include-cooked-nowarn [man-dep-files]


/*
 * user manuals
 */

txt =
	[fromto lib/%1/%2/main.ms lib/%1/%2/%2.ps.gz
		[match_mask lib/%1/%2/main.ms [source_files]]]
	[fromto lib/%1/%2/main.mm lib/%1/%2/%2.ps.gz
		[match_mask lib/%1/%2/main.mm [source_files]]]
	[fromto lib/%1/%2/main.roff lib/%1/%2/%2.txt
		[match_mask lib/%1/%2/main.roff [source_files]]]
	[fromto lib/%1/%2/main.man lib/%1/%2/%2.txt
		[match_mask lib/%1/%2/main.man [source_files]]]
	[fromto lib/%1/%2/main.man lib/%1/%2/%2.ps.gz
		[match_mask lib/%1/%2/main.man [source_files]]]
	;
txt =
	[stringset
		[txt]
	-
		[fromto lib/%1/refman/main.man lib/%1/refman/refman.txt
                	[match_mask lib/%1/refman/main.man [source_files]]
		]
	];
txt: [txt];

lib/%1/%2/%2.ps.gz: lib/%1/%2/main.ms
{
	roffpp
		[prepost "-I" "/lib/%1/%2" [search_list]]
		[prepost "-I" "/lib/%1/man1" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/man5" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/readme" [search_list]] /* for refman */
		[prepost "-I" /[arch]/etc [search_list]]
		[prepost "-I" "/etc" [search_list]]
		[resolve lib/%1/%2/main.ms]
	| groff -p -t -mpic -mpspic -mgs
		-rD1 /* headers and footers assuming double sided */
	| gzip -9
	> [target]
		set meter;
}

lib/%1/%2/%2.ps.gz: lib/%1/%2/main.mm
{
	roffpp
		[prepost "-I" "/lib/%1/%2" [search_list]]
		[prepost "-I" "/lib/%1/man1" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/man5" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/readme" [search_list]] /* for refman */
		[prepost "-I" /[arch]/etc [search_list]]
		[prepost "-I" "/etc" [search_list]]
		[resolve lib/%1/%2/main.mm]
	| groff -p -t -mpic -mpspic -mm
		-rD1 /* headers and footers assuming double sided */
	| gzip -9
		> [target]
		set meter;
}

lib/%1/%2/%2.ps.gz: lib/%1/%2/main.man
{
	roffpp
		[prepost "-I" "/lib/%1/%2" [search_list]]
		[prepost "-I" "/lib/%1/man1" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/man5" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/readme" [search_list]] /* for refman */
		[prepost "-I" /[arch]/etc [search_list]]
		[prepost "-I" "/etc" [search_list]]
		[resolve lib/%1/%2/main.man]
	| groff -p -t -mpic -mpspic -man
		-rD1 /* headers and footers assuming double sided */
	| gzip -9
	> [target]
		set meter;
}

lib/%1/%2/%2.txt: lib/%1/%2/main.roff: etc/ssp.awk
{
	roffpp
		[prepost "-I" "/lib/%1/%2" [search_list]]
		[prepost "-I" "/lib/%1/man1" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/man5" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/readme" [search_list]] /* for refman */
		[prepost "-I" /[arch]/etc [search_list]]
		[prepost "-I" "/etc" [search_list]]
		[resolve lib/%1/%2/main.roff]
	| groff -Tascii -t -P-hub
	| [awk] -f [resolve etc/ssp.awk]
	> [target];
}

lib/%1/%2/%2.txt: lib/%1/%2/main.man: etc/ssp.awk
{
	roffpp
		[prepost "-I" "/lib/%1/%2" [search_list]]
		[prepost "-I" "/lib/%1/man1" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/man5" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/readme" [search_list]] /* for refman */
		[prepost "-I" /[arch]/etc [search_list]]
		[prepost "-I" "/etc" [search_list]]
		[resolve lib/%1/%2/main.man]
	| groff -Tascii -t -P-hub -man
	| [awk] -f [resolve etc/ssp.awk]
	> [target];
}


/* Sigh.  Must be before the next recipe, and before the generic .d's. */
cascade lib/en/user-guide/builtin.so = lib/en/user-guide/function.so;
cascade lib/en/user-guide/system.so = lib/en/user-guide/system.list.so;

lib/%/user-guide/function.so: : etc/system.sh
	[match_mask lib/%/user-guide/function/%%.so [source_files]]
{
	sh [resolve etc/system.sh]
		[fromto lib/%/user-guide/function/%%.so function/%%.so
			[match_mask lib/%/user-guide/function/%%.so
				[source_files]
			]
		]
		> [target];
}


lib/%/user-guide/system.list.so: : etc/system.sh
	[match_mask lib/%/user-guide/system/%%.so [source_files]]
{
	sh [resolve etc/system.sh]
		[fromto lib/%/user-guide/system/%%.so system/%%.so
			[match_mask lib/%/user-guide/system/%%.so
				[source_files]
			]
		]
		> [target];
}


lib/%/readme/new.so: : etc/system.sh
	[match_mask lib/%/readme/new.%%.so [source_files]]
{
	sh [resolve etc/system.sh] -r
		[fromto lib/%/readme/new.%%.so new.%%.so
			[match_mask lib/%/readme/new.%%.so [source_files]]
		]
		> [target];
}


/* Sigh.  Must be before the next recipe, and before the generic .d's. */
cascade lib/en/refman/main.man =
	lib/en/refman/index.so lib/en/refman/parts.so;

lib/%/refman/index.so: [match_mask lib/%/man%%1/%%2.%%1 [source_files]]
		etc/ptx1.awk etc/ptx.ignore etc/ptx2.awk
	set no-cascade
{
	[awk] -f [resolve etc/ptx1.awk]
		[resolve [match_mask lib/%/man%%1/%%2.%%1 [source_files]]]
	| ptx -O -r -w1000 -i[resolve etc/ptx.ignore]
	| sort -t'\'"\'' -f -d +5 -6 +3 -4
	| [awk] -F'\'"\'' -f [resolve etc/ptx2.awk]
	> [target];
}

lib/%/refman/parts.so: [match_mask lib/%/man%%1/%%2.%%1 [source_files]]
		etc/ptx.sh
	set no-cascade
{
	sh -f [resolve etc/ptx.sh]
		[match_mask lib/%/man%%1/%%2.%%1 [source_files]]
	> [target];
}


lib/%1/%2/main.%3,M:: lib/%1/%2/main.%3,Md;

lib/%1/%2/main.%3,Md: lib/%1/%2/main.%3
{
	c_incl -nc -ns -eia -r
		[prepost "-I" "/lib/%1/%2" [search_list]]
		[prepost "-I" "/lib/%1/man1" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/man5" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/readme" [search_list]] /* for refman */
		[prepost "-I" /[arch]/etc [search_list]]
		[prepost "-I" "/etc" [search_list]]
		[resolve lib/%1/%2/main.%3]
		[prepost "-rlp=" "" [search_list]] /* remove leading path */
		-rlp [arch] /* remove leading architecture */
		-o [target];
}


/* Sigh.  Must be before the next recipe. */
lib/%/faq/main.roff.d:: lib/%/faq/toc.so;

lib/%1/%2/main.%3.d: lib/%1/%2/main.%3
	set no-cascade
{
	c_incl -nc -ns -eia -r
		-nrec /* no recursion */
		[prepost "-I" "/lib/%1/%2" [search_list]]
		[prepost "-I" "/lib/%1/man1" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/man5" [search_list]] /* for refman */
		[prepost "-I" "/lib/%1/readme" [search_list]] /* for refman */
		[prepost "-I" /[arch]/etc [search_list]]
		[prepost "-I" "/etc" [search_list]]
		-prefix "'cascade lib/%1/%2/main.%3 ='"
		-suffix "';'"
		[resolve lib/%1/%2/main.%3]
		[prepost "-rlp=" "" [search_list]] /* remove leading path */
		-slp [arch] "'[arch]'" /* substitute leading path */
		-o [target];
}

doc-dep-files =
	[addsuffix .d
		[match_mask lib/%1/%2/main.%3 [source_files]]
	];

#include-cooked-nowarn [doc-dep-files]


/*
 * specials
 */

special:
	README
	BUILDING
	;

archive/[project_minus].ug.ps.gz: lib/en/user-guide/user-guide.ps.gz
	set shallow
{
	cp [resolve [need]] [target];
}

archive/[project_minus].rm.ps.gz: lib/en/refman/refman.ps.gz
	set shallow
{
	cp [resolve [need]] [target];
}

archive/[project_minus].faq: lib/en/faq/faq.txt
	set shallow
{
	cp [resolve [need]] [target];
}

archive/[project_minus].lsm: lib/en/lsm/lsm.txt
	set shallow
{
	cp [resolve [need]] [target];
}

README: lib/en/readme/readme.txt
{
	cp [resolve [need]] [target];
}

BUILDING: lib/en/building/building.txt
{
	cp [resolve [need]] [target];
}

archive/[project_minus].README: lib/en/readme/readme.txt
	set shallow
{
	cp [resolve [need]] [target];
}

%0%,m: %0%: etc/MANIFEST.sh
{
	sh [resolve etc/MANIFEST.sh] %0% [resolve %0%] > [target];
}

MANIFEST: etc/MANIFEST.head
	[addsuffix ",m" [stringset [source_files] - MANIFEST] [CHANGES]]
{
	cat [resolve [need]] > [target];
}

patch-files =
	[prepost "" ",P"
		common/patchlevel.h
		[stringset
			[source_file_order]
		-
			common/patchlevel.h
		]
	];

archive/[project_minus].patch.gz: etc/patches.sh [patch-files]
	set shallow
{
	sh [resolve [need]] | gzip -9 > [target];
}

%0%,P: %0%: etc/patch.file.sh
{
	sh [resolve etc/patch.file.sh] [project] [change] %0% [resolve %0%]
		> [target];
}


/*
 * building things which require txt2c to build
 *
 * Build %.h from %.1
 */

man1/%.h: man1/%.1: etc/txt2c.awk
{
	[awk] -f [resolve etc/txt2c.awk] < [resolve man1/%.1] > [target];
}

man1/%.h: man1/%.so: etc/txt2c.awk
{
	[awk] -f [resolve etc/txt2c.awk] < [resolve man1/%.so] > [target];
}


ranlib = [find_command ranlib];

[arch]/common/lib.a: [lib_obj]
	set ingredients-fingerprint
{
	ar qc [target] [resolve [lib_obj]];
	if [ranlib] then
		[ranlib] [target];
}


configure: etc/configure.in install-sh
{
	if [not [exists install-sh]] then
	{
		/*
		 * Cook says it is up-to-date, so it must be in the
		 * baseline; autoconf needs it in the current directory.
		 */
		cp [resolve install-sh] .
			set clearstat;
	}
	autoconf [resolve etc/configure.in] > [target];
	chmod 755 [target];
}

/*
 * Different Linux install methods put the packages in different places.
 * We need to find the autoconf package to get the linstall-sh script.
 */
if [exists /usr/share/autoconf/install-sh] then
	install-sh = /usr/share/autoconf/install-sh;
else if [exists /usr/lib/autoconf/install-sh] then
	install-sh = /usr/lib/autoconf/install-sh;
else if [exists /usr/local/share/autoconf/install-sh] then
	install-sh = /usr/local/share/autoconf/install-sh;
else if [exists /usr/local/lib/autoconf/install-sh] then
	install-sh = /usr/local/lib/autoconf/install-sh;

install-sh: [install-sh]
{
	cp [need] [target];
	chmod 755 [target];
}


[arch]/config.status: configure install-sh
{
	if [not [exists install-sh]] then
	{
		/*
		 * Cook says it is up-to-date, so it must be in the
		 * baseline; autoconf needs it in the current directory.
		 */
		cp [resolve install-sh] .
			set clearstat;
	}
	./[resolve configure] --cache-file\=/dev/null --verbose --no-create;
	mv config.status [arch]/config.status;
}

common/config.h.in: etc/configure.in etc/config.h.in
	etc/config.h.in1 etc/config.h.in2
	single-thread acconfig.h
{
	if [exists acconfig.h] then
		rm acconfig.h
			set clearstat;
	if [not [exists etc]] then
		mkdir etc
			set clearstat;
	cat [resolve etc/config.h.in1] > [target];
	cp [resolve etc/config.h.in] acconfig.h;
	autoheader [resolve etc/configure.in] >> [target];
	rm acconfig.h;
	cat [resolve etc/config.h.in2] >> [target];
}


[arch]/%0%.h: %0%.h.in [arch]/config.status
	single-thread conftest.subs
{
	CONFIG_FILES\= CONFIG_HEADERS\=[target]\:[resolve %0%.h.in]
		[resolve [arch]/config.status];
}

[arch]/%0%: %0%.in [arch]/config.status
	single-thread conftest.subs
{
	CONFIG_FILES\=[target]\:[resolve %0%.in] CONFIG_HEADERS\=
		[resolve [arch]/config.status];
}


/*
 * need this so that ../man1/???.h includes work properly
 */
if [not [exists [arch]/common]] then
	mkdir -p [arch]/common
		set clearstat;

/*
 * Translate the locatization files into their binary form.  This will
 * be different for each architecture and operating system (in theory,
 * if not in practice).
 */

internationalization:
	lib/common.ok
	[fromto lib/%0%.po [arch]/lib/%0%.mo
		[match_mask lib/%0%.po [source_files]]
	]
	[fromto lib/%0%.po lib/%0%.merge
		[match_mask lib/%0%.po [source_files]]
	]
	LICENSE
	;

lib/common.ok: lib/common.pot etc/zer-len-msg.sh
{
	sh [resolve etc/zer-len-msg.sh lib/common.pot];
	touch [target];
}

msgcomm = msgcomm;

lib/common.pot: [prepost "lib/" ".po" [commands]]
{
	[msgcomm]
		--force-po
		--omit-header
		--sort-output
		--add-location
		--indent
		--width\=75
		-o [target]
		[prepost "--dir=" "" [search_list]]
		[need];
}


msgmerge = msgmerge;

lib/%0%.merge: lib/%0%.po lib/%.po
{
	[msgmerge]
		--indent
		--sort-output
		--width\=75
		-v -v
		--no-location
		--force-po
		-o [target]
		[resolve lib/%0%.po lib/%.po]
		;

	/*
	 * There should be no differences.
	 * If there are, this next command will show them.
	 */
	diff -c [resolve lib/%0%.po] [target];
}


msgfmt = msgfmt;

[arch]/lib/%0%.mo: lib/%0%.po: lib/%0common.po
	set ['if' [not [defined baseline]] 'then' shallow]
{
	/*
	 * This only works for GNU gettext (and Solaris).
	 * The SunOS msgfmt program does not grok the -o option.
	 */
	[msgfmt] -o [target] [resolve lib/%0%.po lib/%0common.po];
}


xgettext = xgettext;

/*
 * These files act as a "header files" to check the lib/%0%.po files
 * against.  There should not be any extras or omitions.
 */

lib/common.po: [all,I] [prepost "lib/en/LC_MESSAGES/" ".po" [commands]]
{
	/*
	 * The author only speaks English, so the master translation is
	 * "en", hence lib/en/LC_MESSAGES/....po are the files intended.
	 */
	[xgettext]
		--sort-output
		--indent
		--omit-header
		--add-location
		--force-po
		--width\=75
		-o [target]
		[prepost "--dir=" "" [search_list]]
		[prepost "--exclude-file=lib/en/LC_MESSAGES/" ".po" [commands]]
		--language\=PO
		[all,I];
}

lib/%.po: [%,I]: lib/en/LC_MESSAGES/common.po
{
	/*
	 * The author only speaks English, so the master translation is
	 * "en", hence lib/en/LC_MESSAGES/common.po is the file
	 * intended.
	 */
	[xgettext]
		--sort-output
		--indent
		--omit-header
		--add-location
		--force-po
		-o [target]
		[prepost "--dir=" "" [search_list]]
		--exclude-file\=lib/en/LC_MESSAGES/common.po
		--language\=PO
		[%,I];
}

%0%.c,I: %0%.c
	set no-cascade
{
	[xgettext]
		--sort-output
		--indent
		--omit-header
		--force-po
		--add-location
		-o [target]
		--msgstr-prefix\=
		--msgstr-suffix\=
		--keyword\=i18n
		--keyword\=error_intl
		--keyword\=fatal_intl
		--keyword\=verbose_intl
		--keyword\=subst_intl
		--keyword\=fngrprnt_error
		--keyword\=lex_error
		--keyword\=lex_warning
		[prepost "--dir=" "" [search_list]]
		%0%.c;
}

LICENSE: lib/en/cat1/cook_lic.1
{
	cp [need] [target];
}


etc/[project_short].html.d: etc/[project_short].html
{
	c_incl -nc -ns -eia -r
		[prepost "-I" /[arch]/etc [search_list]]
		[prepost "-I" "/etc" [search_list]]
		-prefix
       "'"[target]" archive/"[project_short]".html: etc/"[project_short]".html'"
		-suffix "'set nodefault;'" [resolve etc/[project_short].html]
		[prepost "-rlp=" "" [search_list]] /* remove leading path */
		-slp [arch] "'[arch]'" /* substitute leading path */
		-o [target];
}
#include-cooked-nowarn etc/[project_short].html.d

/* Sigh */
cascade etc/[project_short].html = etc/version.so;
cascade lib/en/building/main.man = etc/version.so;
cascade lib/en/lsm/main.roff = etc/version.so;
cascade lib/en/man1/copyright.so = etc/version.so;
cascade lib/en/readme/main.man = etc/version.so;
cascade lib/en/refman/main.man = etc/version.so;
cascade lib/en/release/main.man = etc/version.so;
cascade lib/en/user-guide/main.mm = etc/version.so;

archive/[project_short].html: etc/[project_short].html etc/ssp.awk
	set shallow
{
	roffpp
		[prepost "-I" /[arch]/etc [search_list]]
		[prepost "-I" "/etc" [search_list]]
		[resolve etc/[project_short].html]
	| groff -Tascii -t -P-hub -man
	| [awk] -f [resolve etc/ssp.awk]
	> [target];
}


[project_short].spec: etc/spec.sh [source_files]
{
	version\=[version_short]
	sh [resolve etc/spec.sh] [source_files]
		> [target];
}


archive/[project_minus].spec: [project_short].spec
	set shallow
{
	cat [need] > [target];
}

archive/%.gif: etc/%.gif.uue
	set shallow
{
	uudecode [resolve [need]] -o [target];
}

%.gif: etc/%.gif.uue
	set shallow
{
	uudecode [resolve [need]] -o [target];
}


/*
 * This is not in the integration build taregs because it takes far too
 * long to do.
 */

RPM: archive/[project_minus]-1.i386.rpm;

archive/[project_minus]-1.i386.rpm archive/[project_minus]-1.src.rpm:
		archive/[project_minus].tar.gz etc/rpm-build.sh
		archive/[project_short].gif
	set shallow
{
	sh [resolve etc/rpm-build.sh]
		RPM-temporary
		[resolve archive/[project_minus].tar.gz]
		;
	mv RPM-temporary/RPMS/i386/[project_minus]-1.i386.rpm
		archive/[project_minus]-1.i386.rpm
		;
	mv RPM-temporary/SRPMS/[project_minus]-1.src.rpm
		archive/[project_minus]-1.src.rpm
		;
	rm -r RPM-temporary;
}


all += file_check/.done;

file_check/.done: [arch]/bin/file_check
	[project_files] [change_files]
{
	[resolve [arch]/bin/file_check] /* -w */
		[resolve [change_files] [project_files]]
		;
	touch [target];
}