~sircmpwn/hare

ref: bc6041a4fbc18f4cc66670109732941c948be1db hare/scripts/gen-stdlib -rwxr-xr-x 14.1 KiB
bc6041a4Umar Getagazov unix: add umask wrapper for Linux 3 months ago
                                                                                
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
#!/bin/sh
# The purpose of this script is to generate make targets for the Hare standard
# library. If you are adding new modules to the standard library, write a
# function for that module (e.g. encoding_utf8), and call the following helper
# commands:
#
# gen_srcs module::name list.ha of.ha sources.ha
# gen_ssa module::name list of module::names yours depends on
#
# Then add your module to the list of modules at the bottom.
#
# Then run ./scripts/gen-stdlib > stdlib.mk to generate new rules.

srcdir="$(dirname "$0")"
eval ". $srcdir/gen-stdlib.sh"

gensrcs_rt() {
	gen_srcs rt \
		'$(PLATFORM)/abort.ha' \
		'$(PLATFORM)/env.ha' \
		'$(PLATFORM)/errno.ha' \
		'$(PLATFORM)/types.ha' \
		'$(PLATFORM)/segmalloc.ha' \
		'$(PLATFORM)/platformstart.ha' \
		'$(PLATFORM)/$(ARCH).ha' \
		'$(PLATFORM)/syscallno$(ARCH).ha' \
		'$(PLATFORM)/syscalls.ha' \
		'$(PLATFORM)/signal.ha' \
		'$(PLATFORM)/stat.ha' \
		'$(PLATFORM)/socket.ha' \
		'$(ARCH)/jmp.ha' \
		'$(ARCH)/backtrace.ha' \
		ensure.ha \
		jmp.ha \
		malloc.ha \
		memcpy.ha \
		memmove.ha \
		memset.ha \
		strcmp.ha \
		$*
}

rt() {
	# This one is complicated, don't use it as a reference for other modules
	if [ $testing -eq 0 ]
	then
		printf '%s\n' 'rtscript=$(STDLIB)/rt/hare.sc'
		gensrcs_rt \
			abort.ha \
			start.ha
	else
		gensrcs_rt \
			start+test.ha \
			abort+test.ha \
			'+test/$(PLATFORM).ha' \
			+test/cstring.ha \
			+test/run.ha \
			+test/ztos.ha
	fi
	gen_ssa rt
	cat <<EOF
\$($cache)/rt/start.o: \$(STDLIB)/rt/\$(PLATFORM)/start\$(ARCH).s
	@printf 'AS \t\$@\n'
	@mkdir -p \$($cache)/rt
	@\$(AS) -o \$@ \$<

${stdlib}_asm=\$($cache)/rt/syscall.o \\
	\$($cache)/rt/setjmp.o \\
	\$($cache)/rt/longjmp.o \\
	\$($cache)/rt/restore.o \\
	\$($cache)/rt/getfp.o \\
	\$($cache)/rt/start.o

\$($cache)/rt/syscall.o: \$(STDLIB)/rt/\$(PLATFORM)/syscall\$(ARCH).s
	@printf 'AS \t\$@\n'
	@mkdir -p \$($cache)/rt
	@\$(AS) -o \$@ \$<

\$($cache)/rt/setjmp.o: \$(STDLIB)/rt/\$(ARCH)/setjmp.s
	@printf 'AS \t\$@\n'
	@mkdir -p \$($cache)/rt
	@\$(AS) -o \$@ \$<

\$($cache)/rt/longjmp.o: \$(STDLIB)/rt/\$(ARCH)/longjmp.s
	@printf 'AS \t\$@\n'
	@mkdir -p \$($cache)/rt
	@\$(AS) -o \$@ \$<

\$($cache)/rt/restore.o: \$(STDLIB)/rt/\$(ARCH)/restore.s
	@printf 'AS \t\$@\n'
	@mkdir -p \$($cache)/rt
	@\$(AS) -o \$@ \$<

\$($cache)/rt/getfp.o: \$(STDLIB)/rt/\$(ARCH)/getfp.s
	@printf 'AS \t\$@\n'
	@mkdir -p \$($cache)/rt
	@\$(AS) -o \$@ \$<

\$($cache)/rt/rt.a: \$($cache)/rt/rt.o \$(${stdlib}_asm)
	@printf 'AR\t\$@\n'
	@\$(AR) -csr \$@ \$($cache)/rt/rt.o \$(${stdlib}_asm)

${stdlib}_rt=\$($cache)/rt/rt.a
hare_${stdlib}_deps+=\$(${stdlib}_rt)

EOF
}

ascii() {
	gen_srcs ascii \
		ctype.ha \
		strcmp.ha
	gen_ssa ascii strings
}

bufio() {
	gen_srcs bufio \
		buffered.ha \
		memstream.ha \
		scanner.ha
	gen_ssa bufio io bytes strings encoding::utf8 errors types
}

bytes() {
	gen_srcs bytes \
		contains.ha \
		copy.ha \
		equal.ha \
		index.ha \
		reverse.ha \
		tokenize.ha \
		two_way.ha
	gen_ssa bytes types
}

compress_flate() {
	gen_srcs compress::flate \
		inflate.ha
	gen_ssa compress::flate bufio bytes endian errors io fmt
}

compress_zlib() {
	if [ $testing -eq 0 ]
	then
		gen_srcs compress::zlib \
			reader.ha
	else
		gen_srcs compress::zlib \
			data+test.ha \
			reader.ha
	fi
	gen_ssa compress::zlib bufio bytes compress::flate endian errors hash \
		hash::adler32 io fmt
}

gensrcs_crypto_blake2b() {
	gen_srcs crypto::blake2b \
		blake2b.ha \
		$*
}

crypto_blake2b() {
	if [ $testing -eq 0 ]
	then
		gensrcs_crypto_blake2b
	else
		gensrcs_crypto_blake2b +test.ha vectors+test.ha
	fi
	gen_ssa crypto::blake2b encoding::hex fmt hash io strings strio \
		crypto::math endian
}

crypto_math() {
	gen_srcs crypto::math \
		bits.ha
	gen_ssa crypto::math
}

crypto_random() {
	gen_srcs crypto::random \
		'$(PLATFORM).ha' \
		random.ha
	gen_ssa crypto::random rt io errors
}

gensrcs_crypto_sha256() {
	gen_srcs crypto::sha256 \
		sha256.ha \
		$*
}

genssa_crypto_sha256() {
	gen_ssa crypto::sha256 hash io endian $*
}

crypto_sha256() {
	if [ $testing -eq 0 ]
	then
		gensrcs_crypto_sha256
		genssa_crypto_sha256
	else
		gensrcs_crypto_sha256 \
			+test.ha
		genssa_crypto_sha256 fmt strio strings
	fi
}

crypto_sha1() {
	if [ $testing -eq 0 ]
	then
		gen_srcs crypto::sha1 sha1.ha
		gen_ssa crypto::sha1 hash io endian
	else
		gen_srcs crypto::sha1 sha1.ha +test.ha
		gen_ssa crypto::sha1 hash io endian fmt strio strings
	fi
}

crypto_sha512() {
	if [ $testing -eq 0 ]
	then
		gen_srcs crypto::sha512 sha512.ha
		gen_ssa crypto::sha512 hash io endian
	else
		gen_srcs crypto::sha512 sha512.ha +test.ha
		gen_ssa crypto::sha512 hash io endian fmt strio strings
	fi
}

crypto_md5() {
	if [ $testing -eq 0 ]
	then
		gen_srcs crypto::md5 md5.ha
		gen_ssa crypto::md5 hash io endian
	else
		gen_srcs crypto::md5 md5.ha +test.ha
		gen_ssa crypto::md5 hash io endian fmt strio strings
	fi
}

dirs() {
	gen_srcs dirs \
		xdg.ha
	gen_ssa dirs fs os path
}

encoding_hex() {
	gen_srcs encoding::hex \
		hex.ha
	gen_ssa encoding::hex ascii bytes fmt io strconv strio strings
}

encoding_utf8() {
	gen_srcs encoding::utf8 \
		decode.ha \
		encode.ha \
		rune.ha
	gen_ssa encoding::utf8 types
}

endian() {
	gen_srcs endian \
		big.ha \
		network.ha \
		little.ha \
		endian.ha \
		'host$(ARCH).ha'
	gen_ssa endian
}

errors() {
	gen_srcs errors \
		common.ha \
		opaque.ha \
		string.ha \
		rt.ha
	gen_ssa errors
}

fmt() {
	gen_srcs fmt \
		fmt.ha
	gen_ssa fmt bufio io os strconv strings types
}

format_elf() {
	gen_srcs format::elf \
		'$(ARCH).ha' \
		'$(PLATFORM).ha' \
		types.ha
	gen_ssa format::elf
}

format_html() {
	gen_srcs format::html \
		escape.ha
	gen_ssa format::html encoding::utf8 io strings strio
}

gensrcs_format_xml() {
	gen_srcs format::xml \
		types.ha \
		parser.ha \
		chars.ha \
		$*
}

format_xml() {
	if [ $testing -eq 0 ]
	then
		gensrcs_format_xml
	else
		gensrcs_format_xml +test.ha
	fi
	gen_ssa format::xml io bufio strings ascii strio os
}

fs() {
	gen_srcs fs \
		types.ha \
		fs.ha \
		util.ha
	gen_ssa fs io strings path time errors
}

gensrcs_fs_mem() {
	gen_srcs fs::mem \
		mem.ha \
		stream.ha \
		util.ha \
		$*
}

fs_mem() {
	if [ $testing -eq 0 ]
	then
		gensrcs_fs_mem
	else
		gensrcs_fs_mem +test.ha
	fi
	gen_ssa fs::mem bufio errors fs hash hash::fnv io path strconv strings
}

getopt() {
	gen_srcs getopt \
		getopts.ha
	gen_ssa getopt encoding::utf8 fmt io os strings
}

hare_ast() {
	gen_srcs hare::ast \
		decl.ha \
		expr.ha \
		ident.ha \
		import.ha \
		type.ha \
		unit.ha
	gen_ssa hare::ast hare::lex strings
}

gensrcs_hare_types() {
	gen_srcs hare::types \
		arch.ha \
		hash.ha \
		store.ha \
		types.ha \
		$*
}

hare_types() {
	if [ $testing -eq 1 ]
	then
		gensrcs_hare_types +test.ha
	else
		gensrcs_hare_types
	fi
	gen_ssa hare::types hare::ast hare::parse hash hash::fnv endian
}

hare_unparse() {
	gen_srcs hare::unparse \
		expr.ha \
		decl.ha \
		ident.ha \
		import.ha \
		type.ha \
		unit.ha \
		util.ha
	gen_ssa hare::unparse fmt io strio hare::ast
}

gensrcs_hare_lex() {
	gen_srcs hare::lex \
		token.ha \
		lex.ha \
		$*
}

hare_lex() {
	if [ $testing -eq 0 ]
	then
		gensrcs_hare_lex
	else
		gensrcs_hare_lex \
			+test.ha
	fi
	gen_ssa hare::lex io bufio strings types fmt sort strio
}

hare_module() {
	gen_srcs hare::module \
		types.ha \
		context.ha \
		scan.ha \
		manifest.ha
	gen_ssa hare::module \
		hare::ast hare::lex hare::parse hare::unparse strio fs io strings hash \
		crypto::sha256 dirs bytes encoding::utf8 ascii fmt time slice bufio \
		strconv os encoding::hex sort errors temp
}

gensrcs_hare_parse() {
	gen_srcs hare::parse \
		decl.ha \
		expr.ha \
		ident.ha \
		import.ha \
		parse.ha \
		type.ha \
		unit.ha \
		$*
}

hare_parse() {
	if [ $testing -eq 0 ]
	then
		gensrcs_hare_parse
		gen_ssa hare::parse hare::ast hare::lex hare::unparse fmt
	else
		gensrcs_hare_parse \
			+test/expr.ha \
			+test/ident.ha \
			+test/loc.ha \
			+test/roundtrip.ha \
			+test/types.ha \
			+test/unit.ha
		gen_ssa hare::parse bufio fmt hare::ast hare::lex hare::unparse io \
			strings strio fmt
	fi
}

hash() {
	gen_srcs hash \
		hash.ha
	gen_ssa hash io fmt
}

hash_adler32() {
	gen_srcs hash::adler32 \
		adler32.ha
	gen_ssa hash::adler32 endian hash io strings
}

hash_crc16() {
	gen_srcs hash::crc16 \
		crc16.ha
	gen_ssa hash::crc16 endian hash io strings
}

hash_crc32() {
	gen_srcs hash::crc32 \
		crc32.ha
	gen_ssa hash::crc32 endian hash io strings
}

hash_crc64() {
	gen_srcs hash::crc64 \
		crc64.ha
	gen_ssa hash::crc64 endian hash io strings
}

hash_fnv() {
	gen_srcs hash::fnv \
		fnv.ha
	gen_ssa hash::fnv hash io strings
}

gensrcs_io() {
	gen_srcs io \
		'arch$(ARCH).ha' \
		copy.ha \
		drain.ha \
		limit.ha \
		'println$(PLATFORM).ha' \
		stream.ha \
		tee.ha \
		types.ha \
		$*
}

io() {
	if [ $testing -eq 0 ]
	then
		gensrcs_io
	else
		gensrcs_io \
			+test/copy.ha \
			+test/limit.ha \
			+test/stream.ha
	fi
	gen_ssa io strings errors
}

linux() {
	gen_srcs linux \
		start.ha \
		env.ha
	gen_ssa linux format::elf
}

linux_signalfd() {
	gen_srcs linux::signalfd \
		signalfd.ha
	gen_ssa linux::signalfd errors
}

linux_io_uring() {
	gen_srcs linux::io_uring \
		cqe.ha \
		queue.ha \
		register.ha \
		setup.ha \
		sqe.ha \
		uring.ha
	gen_ssa linux::io_uring errors types
}

linux_vdso() {
	gen_srcs linux::vdso \
		vdso.ha
	gen_ssa linux::vdso linux strings format::elf
}

math() {
	printf '# math\n'
	gen_srcs math \
		floats.ha
	gen_ssa math
}

net() {
	printf '# net\n'
	gen_srcs net \
		'$(PLATFORM).ha' \
		errors.ha \
		listener.ha
	gen_ssa net io os strings net::ip errors rt fmt
}

net_dial() {
	printf '# net::dial\n'
	gen_srcs net::dial \
		registry.ha \
		dial.ha \
		ip.ha \
		resolve.ha
	gen_ssa net::dial io net net::ip net::tcp net::udp net::dns \
		crypto::random strconv strings unix::hosts
}

net_dns() {
	printf '# net::dns\n'
	gen_srcs net::dns \
		decode.ha \
		error.ha \
		encode.ha \
		query.ha \
		types.ha
	gen_ssa net::dns ascii endian net net::udp net::ip fmt strings \
		unix::resolvconf rt time errors
}

gensrcs_net_ip() {
	gen_srcs net::ip \
		ip.ha \
		'$(PLATFORM).ha' \
		$*
}

net_ip() {
	if [ $testing -eq 0 ]
	then
		gensrcs_net_ip
	else
		gensrcs_net_ip \
			+test.ha
	fi
	gen_ssa net::ip bytes io strconv strings strio fmt
}

net_tcp() {
	printf '# net::tcp\n'
	gen_srcs net::tcp \
		'$(PLATFORM).ha' \
		listener.ha \
		options.ha
	gen_ssa net::tcp io net net::ip os rt
}

net_udp() {
	printf '# net::udp\n'
	gen_srcs net::udp \
		'$(PLATFORM).ha' \
		options.ha
	gen_ssa net::udp net net::ip errors rt os io
}

net_unix() {
	printf '# net::unix\n'
	gen_srcs net::unix \
		'$(PLATFORM).ha' \
		addr.ha \
		dial.ha \
		listener.ha \
		options.ha
	gen_ssa net::unix net errors os io strings types fmt net::dial
}

math_random() {
	gen_srcs math::random \
		random.ha
	gen_ssa math::random
}

os() {
	gen_srcs os \
		'$(PLATFORM)/environ.ha' \
		'$(PLATFORM)/exit.ha' \
		'$(PLATFORM)/dirfdfs.ha' \
		'$(PLATFORM)/fdstream.ha' \
		'$(PLATFORM)/stdfd.ha' \
		'$(PLATFORM)/fs.ha' \
		stdfd.ha \
		fs.ha
	gen_ssa os io strings types fs encoding::utf8 bytes bufio errors
}

os_exec() {
	gen_srcs os::exec \
		'exec$(PLATFORM).ha' \
		'process$(PLATFORM).ha' \
		types.ha \
		cmd.ha
	gen_ssa os::exec os strings fmt bytes path errors
}

path() {
	gen_srcs path \
		'$(PLATFORM).ha' \
		util.ha \
		join.ha \
		names.ha \
		iter.ha
	gen_ssa path strings bufio bytes
}

gensrcs_strconv() {
	gen_srcs strconv \
		types.ha \
		itos.ha \
		utos.ha \
		stou.ha \
		stoi.ha \
		numeric.ha \
		ftos.ha \
		stof.ha \
		$*
}

slice() {
	gen_srcs slice \
		reverse.ha \
		void.ha
	gen_ssa slice types
}

gensrcs_sort() {
	gen_srcs sort \
		search.ha \
		sort.ha \
		$*
}

sort() {
	if [ $testing -eq 0 ]
	then
		gensrcs_sort
	else
		gensrcs_sort \
			+test.ha
	fi
	gen_ssa sort
}

strconv() {
	if [ $testing -eq 0 ]
	then
		gensrcs_strconv
	else
		gensrcs_strconv \
			+test/stou.ha \
			+test/stoi.ha
	fi
	gen_ssa strconv types strings ascii math
}

strings() {
	gen_srcs strings \
		concat.ha \
		contains.ha \
		cstrings.ha \
		dup.ha \
		iter.ha \
		sub.ha \
		suffix.ha \
		tokenize.ha \
		utf8.ha \
		index.ha \
		trim.ha
	gen_ssa strings bytes encoding::utf8 types
}

strio() {
	gen_srcs strio \
		dynamic.ha \
		fixed.ha \
		ops.ha
	gen_ssa strio io strings encoding::utf8 errors
}

time() {
	gen_srcs time \
		'$(PLATFORM)/functions.ha' \
		'$(PLATFORM)/$(ARCH).ha' \
		arithm.ha \
		types.ha
	gen_ssa time linux::vdso
}

temp() {
	gen_srcs temp \
		'$(PLATFORM).ha'
	gen_ssa temp crypto::random encoding::hex fs io os path strio fmt
}

types() {
	gen_srcs types \
		limits.ha \
		classes.ha \
		'arch$(ARCH).ha'
	gen_ssa types
}

unicode() {
	gen_srcs unicode \
		properties.ha
	gen_ssa unicode
}

unix() {
	# XXX: getuid and setuid are probably platform-specific too
	gen_srcs unix \
		'$(PLATFORM)/nice.ha' \
		'$(PLATFORM)/umask.ha' \
		getuid.ha \
		setuid.ha
	gen_ssa unix errors
}

unix_hosts() {
	gen_srcs unix::hosts \
        lookup.ha
	gen_ssa unix::hosts os io bufio net::ip strings
}

unix_passwd() {
	gen_srcs unix::passwd \
		group.ha \
		passwd.ha \
		types.ha
	gen_ssa unix::passwd bufio io os strconv strings
}

unix_resolvconf() {
	gen_srcs unix::resolvconf \
        load.ha
	gen_ssa unix::resolvconf os io bufio net::ip strings
}

unix_tty() {
	gen_srcs unix::tty \
        types.ha \
		'$(PLATFORM)/isatty.ha' \
		'$(PLATFORM)/open.ha' \
		'$(PLATFORM)/winsize.ha'
	gen_ssa unix::tty rt fs io os
}

uuid() {
	gen_srcs uuid \
		uuid.ha
	gen_ssa uuid crypto::random strio fmt endian io bytes bufio strings strconv
}

printf '# This file is generated by the gen-stdlib script, do not edit it by hand\n\n'

modules="ascii
bufio
bytes
compress::flate
compress::zlib
crypto::blake2b
crypto::math
crypto::random
crypto::md5
crypto::sha1
crypto::sha256
crypto::sha512
dirs
encoding::hex
encoding::utf8
endian
errors
fmt
format::elf
format::html
format::xml
fs
fs::mem
getopt
hare::ast
hare::lex
hare::module
hare::parse
hare::types
hare::unparse
hash
hash::adler32
hash::crc16
hash::crc32
hash::crc64
hash::fnv
io
linux
linux::signalfd
linux::io_uring
linux::vdso
math
net
net::dial
net::dns
net::ip
net::tcp
net::udp
net::unix
math::random
os
os::exec
path
slice
sort
strconv
strings
strio
temp
time
types
unicode
unix
unix::hosts
unix::passwd
unix::resolvconf
unix::tty
uuid"
stdlib() {
	rt
	for module in $modules; do
		gen_lib "$module"
	done
	for module in $modules; do
		"$(mod_file "$module")"
	done
}

genrules
genrules test