Commit 6da128724764dded972c6870936d22665ed4c136

Thomas de Grivel 2024-08-13T16:38:17

fix Makefile and add json

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
diff --git a/Makefile b/Makefile
index 1684914..04aa32b 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,7 @@ all:
 	${MAKE} -C ikc3 all
 	${MAKE} -C kc3s all
 	${MAKE} -C ekc3 all
+	${MAKE} -C json all
 	${MAKE} -C http all
 	${MAKE} -C httpd all
 	${MAKE} -C test all
@@ -30,6 +31,7 @@ asan:
 	${MAKE} -C ikc3 asan
 	${MAKE} -C kc3s asan
 	${MAKE} -C ekc3 asan
+	${MAKE} -C json asan
 	${MAKE} -C http asan
 	${MAKE} -C httpd asan
 	${MAKE} -C test asan
@@ -43,6 +45,7 @@ build:
 	${MAKE} -C ikc3 build
 	${MAKE} -C kc3s build
 	${MAKE} -C ekc3 build
+	${MAKE} -C json build
 	${MAKE} -C http build
 	${MAKE} -C httpd build
 	${MAKE} -C test build
@@ -55,6 +58,7 @@ clean:
 	${MAKE} -C ikc3 clean
 	${MAKE} -C kc3s clean
 	${MAKE} -C ekc3 clean
+	${MAKE} -C json clean
 	${MAKE} -C http clean
 	${MAKE} -C httpd clean
 	${MAKE} -C test clean
@@ -66,6 +70,7 @@ clean_cov:
 	${MAKE} -C ikc3 clean_cov
 	${MAKE} -C kc3s clean_cov
 	${MAKE} -C ekc3 clean_cov
+	${MAKE} -C json clean_cov
 	${MAKE} -C http clean_cov
 	${MAKE} -C httpd clean_cov
 	${MAKE} -C test clean_cov
@@ -78,6 +83,7 @@ cov:
 	${MAKE} -C ikc3 cov
 	${MAKE} -C kc3s cov
 	${MAKE} -C ekc3 cov
+	${MAKE} -C json cov
 	${MAKE} -C http cov
 	${MAKE} -C httpd cov
 	${MAKE} -C test cov
@@ -90,6 +96,7 @@ debug:
 	${MAKE} -C ikc3 debug
 	${MAKE} -C kc3s debug
 	${MAKE} -C ekc3 debug
+	${MAKE} -C json debug
 	${MAKE} -C http debug
 	${MAKE} -C httpd debug
 	${MAKE} -C test debug
@@ -128,6 +135,7 @@ distclean:
 	${MAKE} -C ikc3 distclean
 	${MAKE} -C kc3s distclean
 	${MAKE} -C ekc3 distclean
+	${MAKE} -C json distclean
 	${MAKE} -C http distclean
 	${MAKE} -C httpd distclean
 	${MAKE} -C test distclean
@@ -138,6 +146,7 @@ gcovr:
 	${MAKE} -C ikc3 gcovr
 	${MAKE} -C kc3s gcovr
 	${MAKE} -C ekc3 gcovr
+	${MAKE} -C json gcovr
 	${MAKE} -C http gcovr
 	${MAKE} -C httpd gcovr
 	${MAKE} -C test gcovr
@@ -152,26 +161,6 @@ gdb_demo_gl:
 	${MAKE} debug
 	${MAKE} -C libkc3 gdb_demo_gl
 
-gdb_httpd:
-	${MAKE} -C libtommath debug
-	${MAKE} -C ucd2c
-	${MAKE} -C libkc3 debug
-	${MAKE} -C ikc3 debug
-	${MAKE} -C kc3s debug
-	${MAKE} -C http debug
-	${MAKE} -C httpd debug
-	${MAKE} -C test gdb_httpd
-
-gdb_httpd_asan:
-	${MAKE} -C libtommath asan
-	${MAKE} -C ucd2c
-	${MAKE} -C libkc3 asan
-	${MAKE} -C ikc3 asan
-	${MAKE} -C kc3s asan
-	${MAKE} -C http asan
-	${MAKE} -C httpd asan
-	${MAKE} -C test gdb_httpd_asan
-
 gdb_ikc3:
 	${MAKE} -C libtommath debug
 	${MAKE} -C ucd2c
@@ -198,6 +187,7 @@ gdb_test_http:
 	${MAKE} -C libkc3 debug
 	${MAKE} -C ikc3 debug
 	${MAKE} -C kc3s debug
+	${MAKE} -C json debug
 	${MAKE} -C http debug
 	${MAKE} -C test gdb_test_http
 
@@ -207,9 +197,32 @@ gdb_test_http_asan:
 	${MAKE} -C libkc3 asan
 	${MAKE} -C ikc3 asan
 	${MAKE} -C kc3s asan
+	${MAKE} -C json asan
 	${MAKE} -C http asan
 	${MAKE} -C test gdb_test_http_asan
 
+gdb_test_httpd:
+	${MAKE} -C libtommath debug
+	${MAKE} -C ucd2c
+	${MAKE} -C libkc3 debug
+	${MAKE} -C ikc3 debug
+	${MAKE} -C kc3s debug
+	${MAKE} -C json debug
+	${MAKE} -C http debug
+	${MAKE} -C httpd debug
+	${MAKE} -C test gdb_test_httpd
+
+gdb_test_httpd_asan:
+	${MAKE} -C libtommath asan
+	${MAKE} -C ucd2c
+	${MAKE} -C libkc3 asan
+	${MAKE} -C ikc3 asan
+	${MAKE} -C kc3s asan
+	${MAKE} -C json asan
+	${MAKE} -C http asan
+	${MAKE} -C httpd asan
+	${MAKE} -C test gdb_test_httpd_asan
+
 gdb_test_ikc3:
 	${MAKE} -C libtommath debug
 	${MAKE} -C ucd2c
@@ -217,6 +230,13 @@ gdb_test_ikc3:
 	${MAKE} -C ikc3 debug
 	${MAKE} -C test gdb_test_ikc3
 
+gdb_test_json:
+	${MAKE} -C libtommath debug
+	${MAKE} -C ucd2c
+	${MAKE} -C libkc3 debug
+	${MAKE} -C ikc3 debug
+	${MAKE} -C test gdb_test_json
+
 gen:
 	${MAKE} -C libkc3 gen
 
@@ -227,6 +247,7 @@ http:
 	${MAKE} -C ikc3 build
 	${MAKE} -C kc3s build
 	${MAKE} -C ekc3 build
+	${MAKE} -C json build
 	${MAKE} -C http build
 
 httpd:
@@ -236,6 +257,7 @@ httpd:
 	${MAKE} -C ikc3 build
 	${MAKE} -C kc3s build
 	${MAKE} -C ekc3 build
+	${MAKE} -C json build
 	${MAKE} -C http build
 	${MAKE} -C httpd build
 
@@ -272,13 +294,43 @@ ikc3_gcovr:
 	${MAKE} ikc3_test_cov
 	${MAKE} gcovr
 
+json:
+	${MAKE} -C libtommath build
+	${MAKE} -C ucd2c
+	${MAKE} -C libkc3 build
+	${MAKE} -C ikc3 build
+	${MAKE} -C json build
+
+json_asan:
+	${MAKE} -C libtommath asan
+	${MAKE} -C ucd2c
+	${MAKE} -C libkc3 asan
+	${MAKE} -C ikc3 asan
+	${MAKE} -C json asan
+
+json_cov:
+	${MAKE} -C libtommath cov
+	${MAKE} -C ucd2c
+	${MAKE} -C libkc3 cov
+	${MAKE} -C ikc3 cov
+	${MAKE} -C json cov
+
+json_debug:
+	${MAKE} -C libtommath debug
+	${MAKE} -C ucd2c
+	${MAKE} -C libkc3 debug
+	${MAKE} -C ikc3 debug
+	${MAKE} -C json debug
+
 install:
 	${MAKE} -C libkc3 install
 	${MAKE} -C ikc3 install
 	${MAKE} -C kc3s install
 	${MAKE} -C ekc3 install
+	${MAKE} -C json install
 	${MAKE} -C http install
 	${MAKE} -C httpd install
+	${MAKE} -C json install
 	${MAKE} -C window install
 
 kc3-${KC3_VERSION}.tar.gz: kc3.index
@@ -307,25 +359,39 @@ kc3.index: sources.mk Makefile
 	sort -u < kc3.index.tmp > kc3.index
 	rm kc3.index.tmp
 
+lib_links:
+	${MAKE} lib_links_${ARCH}
+
+lib_links_asan:
+	${MAKE} lib_links_${ARCH}_asan
+
+lib_links_debug:
+	${MAKE} lib_links_${ARCH}_debug
+
+lib_links_bsd:
+	ln -sf ../../../ekc3/.libs/libekc3.so.0.0 lib/kc3/0.1/ekc3.so
+	ln -sf ../../../http/.libs/libkc3_http.so.0.0 lib/kc3/0.1/http.so
+	ln -sf ../../../json/.libs/libkc3_json.so.0.0 lib/kc3/0.1/json.so
+
+lib_links_bsd_debug:
+	ln -sf ../../../ekc3/.libs/libekc3_debug.so.0.0 lib/kc3/0.1/ekc3.so
+	ln -sf ../../../http/.libs/libkc3_http_debug.so.0.0 lib/kc3/0.1/http.so
+	ln -sf ../../../json/.libs/libkc3_json_debug.so.0.0 lib/kc3/0.1/json.so
+
 lib_links_linux:
 	ln -sf ../../../ekc3/.libs/libekc3.so lib/kc3/0.1/ekc3.so
 	ln -sf ../../../http/.libs/libkc3_http.so lib/kc3/0.1/http.so
+	ln -sf ../../../json/.libs/libkc3_json.so lib/kc3/0.1/json.so
 
 lib_links_linux_asan:
 	ln -sf ../../../ekc3/.libs/libekc3_asan.so lib/kc3/0.1/ekc3.so
 	ln -sf ../../../http/.libs/libkc3_http_asan.so lib/kc3/0.1/http.so
+	ln -sf ../../../json/.libs/libkc3_json_asan.so lib/kc3/0.1/json.so
 
 lib_links_linux_debug:
 	ln -sf ../../../ekc3/.libs/libekc3_debug.so lib/kc3/0.1/ekc3.so
 	ln -sf ../../../http/.libs/libkc3_http_debug.so lib/kc3/0.1/http.so
-
-lib_links_bsd:
-	ln -sf ../../../ekc3/.libs/libekc3.so.0.0 lib/kc3/0.1/ekc3.so
-	ln -sf ../../../http/.libs/libkc3_http.so.0.0 lib/kc3/0.1/http.so
-
-lib_links_bsd_debug:
-	ln -sf ../../../ekc3/.libs/libekc3_debug.so.0.0 lib/kc3/0.1/ekc3.so
-	ln -sf ../../../http/.libs/libkc3_http_debug.so.0.0 lib/kc3/0.1/http.so
+	ln -sf ../../../json/.libs/libkc3_json_debug.so lib/kc3/0.1/json.so
 
 libkc3_gcovr:
 	${MAKE} clean_cov
@@ -360,6 +426,7 @@ test:
 	${MAKE} -C ikc3 build
 	${MAKE} -C kc3s build
 	${MAKE} -C ekc3 build
+	${MAKE} -C json build
 	${MAKE} -C http build
 	${MAKE} -C httpd build
 	${MAKE} -C test test
@@ -372,6 +439,7 @@ test_asan:
 	${MAKE} -C ikc3 asan
 	${MAKE} -C kc3s asan
 	${MAKE} -C ekc3 asan
+	${MAKE} -C json asan
 	${MAKE} -C http asan
 	${MAKE} -C httpd asan
 	${MAKE} -C test test_asan
@@ -383,6 +451,7 @@ test_cov:
 	${MAKE} -C ikc3 cov clean_cov
 	${MAKE} -C kc3s cov clean_cov
 	${MAKE} -C ekc3 cov clean_cov
+	${MAKE} -C json cov clean_cov
 	${MAKE} -C http cov clean_cov
 	${MAKE} -C httpd cov clean_cov
 	${MAKE} -C test test_cov
@@ -394,6 +463,7 @@ test_debug:
 	${MAKE} -C ikc3 debug
 	${MAKE} -C kc3s debug
 	${MAKE} -C ekc3 debug
+	${MAKE} -C json debug
 	${MAKE} -C http debug
 	${MAKE} -C httpd debug
 	${MAKE} -C test test_debug
@@ -447,6 +517,7 @@ test_http:
 	${MAKE} -C libkc3 build
 	${MAKE} -C ikc3 build
 	${MAKE} -C kc3s build
+	${MAKE} -C json build
 	${MAKE} -C http build
 	${MAKE} -C test test_http
 
@@ -456,6 +527,7 @@ test_http_asan:
 	${MAKE} -C libkc3 asan
 	${MAKE} -C ikc3 asan
 	${MAKE} -C kc3s asan
+	${MAKE} -C json asan
 	${MAKE} -C http asan
 	${MAKE} -C test test_http_asan
 
@@ -465,6 +537,7 @@ test_http_cov:
 	${MAKE} -C libkc3 cov
 	${MAKE} -C ikc3 cov
 	${MAKE} -C kc3s cov
+	${MAKE} -C json cov
 	${MAKE} -C http cov
 	${MAKE} -C test test_http_cov
 
@@ -474,6 +547,7 @@ test_http_debug:
 	${MAKE} -C libkc3 debug
 	${MAKE} -C ikc3 debug
 	${MAKE} -C kc3s debug
+	${MAKE} -C json debug
 	${MAKE} -C http debug
 	${MAKE} -C test test_http_debug
 
@@ -483,6 +557,7 @@ test_httpd:
 	${MAKE} -C libkc3 build
 	${MAKE} -C ikc3 build
 	${MAKE} -C kc3s build
+	${MAKE} -C json build
 	${MAKE} -C http build
 	${MAKE} -C httpd build
 	${MAKE} -C test test_httpd
@@ -493,6 +568,7 @@ test_httpd_asan:
 	${MAKE} -C libkc3 asan
 	${MAKE} -C ikc3 asan
 	${MAKE} -C kc3s asan
+	${MAKE} -C json asan
 	${MAKE} -C http asan
 	${MAKE} -C httpd asan
 	${MAKE} -C test test_httpd_asan
@@ -503,6 +579,7 @@ test_httpd_cov:
 	${MAKE} -C libkc3 cov
 	${MAKE} -C ikc3 cov
 	${MAKE} -C kc3s cov
+	${MAKE} -C json cov
 	${MAKE} -C http cov
 	${MAKE} -C httpd cov
 	${MAKE} -C test test_httpd_cov
@@ -513,6 +590,7 @@ test_httpd_debug:
 	${MAKE} -C libkc3 debug
 	${MAKE} -C ikc3 debug
 	${MAKE} -C kc3s debug
+	${MAKE} -C json debug
 	${MAKE} -C http debug
 	${MAKE} -C httpd debug
 	${MAKE} -C test test_httpd_debug
@@ -545,6 +623,38 @@ test_ikc3_debug:
 	${MAKE} -C ikc3 debug
 	${MAKE} -C test test_ikc3_debug
 
+test_json:
+	${MAKE} -C libtommath build
+	${MAKE} -C ucd2c
+	${MAKE} -C libkc3 build
+	${MAKE} -C ikc3 build
+	${MAKE} -C json build
+	${MAKE} -C test test_json
+
+test_json_asan:
+	${MAKE} -C libtommath asan
+	${MAKE} -C ucd2c
+	${MAKE} -C libkc3 asan
+	${MAKE} -C ikc3 asan
+	${MAKE} -C json asan
+	${MAKE} -C test test_json_asan
+
+test_json_cov:
+	${MAKE} -C libtommath cov
+	${MAKE} -C ucd2c
+	${MAKE} -C libkc3 cov
+	${MAKE} -C ikc3 cov
+	${MAKE} -C json cov
+	${MAKE} -C test test_json_cov
+
+test_json_debug:
+	${MAKE} -C libtommath debug
+	${MAKE} -C ucd2c
+	${MAKE} -C libkc3 debug
+	${MAKE} -C ikc3 debug
+	${MAKE} -C json debug
+	${MAKE} -C test test_json_debug
+
 test_libkc3:
 	${MAKE} -C libtommath build
 	${MAKE} -C ucd2c
@@ -583,10 +693,48 @@ test_libkc3_debug:
 	demo_gl_debug \
 	dist \
 	gcovr \
+	gdb_test \
+	gdb_test_asan \
+	gdb_test_debug \
+	gdb_test_gcovr \
+	gdb_test_ekc3 \
+	gdb_test_ekc3_asan \
+	gdb_test_ekc3_debug \
+	gdb_test_http \
+	gdb_test_http_asan \
+	gdb_test_http_debug \
+	gdb_test_httpd \
+	gdb_test_httpd_asan \
+	gdb_test_httpd_debug \
+	gdb_test_ikc3 \
+	gdb_test_ikc3_asan \
+	gdb_test_ikc3_debug \
+	gdb_test_json \
+	gdb_test_json_asan \
+	gdb_test_json_debug \
+	gdb_test_kc3s \
+	gdb_test_kc3s_asan \
+	gdb_test_kc3s_debug
+	gdb_test_libkc3 \
+	gdb_test_libkc3_asan \
+	gdb_test_libkc3_debug
 	http \
 	httpd \
 	ikc3 \
 	install \
+	json \
+	json_asan \
+	json_cov \
+	json_debug \
+	lib_links \
+	lib_links_asan \
+	lib_links_debug \
+	lib_links_bsd \
+	lib_links_bsd_asan \
+	lib_links_bsd_debug \
+	lib_links_linux \
+	lib_links_linux_asan \
+	lib_links_linux_debug \
 	libkc3 \
 	libtommath \
 	license \
@@ -595,7 +743,34 @@ test_libkc3_debug:
 	test_cov \
 	test_debug \
 	test_gcovr \
-	test_ikc3
+	test_ekc3 \
+	test_ekc3_asan \
+	test_ekc3_cov \
+	test_ekc3_debug \
+	test_http \
+	test_http_asan \
+	test_http_cov \
+	test_http_debug \
+	test_httpd \
+	test_httpd_asan \
+	test_httpd_cov \
+	test_httpd_debug \
+	test_ikc3 \
+	test_ikc3_asan \
+	test_ikc3_cov \
+	test_ikc3_debug \
+	test_json \
+	test_json_asan \
+	test_json_cov \
+	test_json_debug \
+	test_kc3s \
+	test_kc3s_asan \
+	test_kc3s_cov \
+	test_kc3s_debug
+	test_libkc3 \
+	test_libkc3_asan \
+	test_libkc3_cov \
+	test_libkc3_debug
 
 include config.mk
 include sources.mk
diff --git a/configure b/configure
index 29a8b0b..4f5b180 100755
--- a/configure
+++ b/configure
@@ -36,6 +36,16 @@ echo "kc3-${KC3_VERSION}.tar.gz: $(tr '\n' ' ' < kc3.index)" \
 config_asan
 echo "HAVE_ASAN = ${HAVE_ASAN}" >> ${CONFIG_MK}
 
+ARCH="unknown"
+if uname | grep -iq bsd; then
+    ARCH=bsd
+elif uname | grep -q Linux; then
+    ARCH=linux
+elif uname | grep -q Darwin; then
+    ARCH=darwin
+fi
+echo "ARCH = $ARCH" >> ${CONFIG_MK}
+
 update_config_mk
 env_reset
 
@@ -46,6 +56,7 @@ config_subdirs \
     ikc3 \
     kc3s \
     ekc3 \
+    json \
     http \
     httpd \
     test \
diff --git a/json/Makefile b/json/Makefile
new file mode 100644
index 0000000..a4db491
--- /dev/null
+++ b/json/Makefile
@@ -0,0 +1,78 @@
+## kc3
+## Copyright 2022-2024 kmx.io <contact@kmx.io>
+##
+## Permission is hereby granted to use this software granted the above
+## copyright notice and this permission paragraph are included in all
+## copies and substantial portions of this software.
+##
+## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+## THIS SOFTWARE.
+
+CLEANFILES = *.a *.gcno *.la .libs *.lo *.o
+
+CLEANFILES_COV = *.css *.gcda *.html .libs/*.gcda
+
+CLEANFILES += ${CLEANFILES_COV}
+
+DISTCLEANFILES = .build ${CLEANFILES} config.h config.mk
+
+all:
+	${MAKE} build
+	${MAKE} debug
+	if ${HAVE_ASAN}; then ${MAKE} asan; fi
+	if ${HAVE_GCOV}; then ${MAKE} cov; fi
+
+asan:
+	${MAKE} ${LIB_ASAN}
+
+build:
+	${MAKE} ${LIB}
+
+clean:
+	rm -rf ${CLEANFILES}
+
+clean_cov:
+	rm -rf ${CLEANFILES_COV}
+
+cov:
+	${MAKE} ${LIB_COV}
+
+debug:
+	${MAKE} ${LIB_DEBUG}
+
+distclean:
+	rm -rf ${DISTCLEANFILES}
+
+gcovr:
+	gcovr --gcov-executable ${GCOV} --html-details libkc3_web.html
+
+install:
+	${INSTALL} -o ${OWNER} -g ${GROUP} -m 0755 -d ${prefix}/include/libkc3/ekc3
+	${LIBTOOL} --tag=CC --mode=install ${INSTALL} -o ${OWNER} -g ${GROUP} -m 0644 ${HEADERS} ${prefix}/include/libkc3/ekc3
+	${INSTALL} -o ${OWNER} -g ${GROUP} -m 0755 -d ${prefix}/lib
+	${LIBTOOL} --tag=CC --mode=install ${INSTALL} -o ${OWNER} -g ${GROUP} -m 0644 ${LIB} ${prefix}/lib
+	${LIBTOOL} --tag=CC --mode=install ${INSTALL} -o ${OWNER} -g ${GROUP} -m 0644 ${LIB_DEBUG} ${prefix}/lib
+	${LIBTOOL} --finish ${prefix}/lib
+
+test:
+
+update_sources:
+	./update_sources
+
+.PHONY: \
+	all \
+	asan \
+	build \
+	clean \
+	cov \
+	debug \
+	distclean \
+	gen \
+	install \
+	test \
+	update_sources \
+
+include config.mk
+include sources.mk
diff --git a/json/configure b/json/configure
new file mode 100755
index 0000000..150a098
--- /dev/null
+++ b/json/configure
@@ -0,0 +1,119 @@
+#!/bin/sh
+## kc3
+## Copyright 2022-2024 kmx.io <contact@kmx.io>
+##
+## Permission is hereby granted to use this software granted the above
+## copyright notice and this permission paragraph are included in all
+## copies and substantial portions of this software.
+##
+## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+## THIS SOFTWARE.
+
+set -e
+
+echo "$PWD/configure"
+
+export SRC_TOP="$(dirname "$PWD")"
+
+CONFIG_H_PREFIX=KC3_JSON_
+
+. ../config.subr
+
+LIB=libkc3_json.la
+LIB_ASAN=libkc3_json_asan.la
+LIB_COV=libkc3_json_cov.la
+LIB_DEBUG=libkc3_json_debug.la
+
+echo "LIB = $LIB" >> ${CONFIG_MK}
+echo "LIB_ASAN = $LIB_ASAN" >> ${CONFIG_MK}
+echo "LIB_COV = $LIB_COV" >> ${CONFIG_MK}
+echo "LIB_DEBUG = $LIB_DEBUG" >> ${CONFIG_MK}
+
+. ./sources.sh
+
+OBJECTS="$(c2ext .main.lo "$SOURCES")"
+echo "OBJECTS = $OBJECTS" >> ${CONFIG_MK}
+OBJECTS_ASAN="$(c2ext .asan.lo "$SOURCES")"
+OBJECTS_COV="$(c2ext .cov.lo "$SOURCES")"
+OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
+
+# Common config for all targets
+CPPFLAGS="-I.. $CPPFLAGS"
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -pipe"
+LDFLAGS="-export-dynamic $LDFLAGS -rdynamic"
+config_asan
+config_gnu
+config_i386
+pkg_config libbsd-overlay
+pkg_config libevent
+pkg_config libffi
+pkg_config libmd
+config_define PREFIX "\"${PREFIX}\""
+update_config_h
+LIBS="$LIBS -lm -rpath ${PREFIX}/lib"
+
+# Address Sanitizer config
+CPPFLAGS_ASAN="$CPPFLAGS"
+CFLAGS_ASAN="$CFLAGS -DDEBUG -O1 -g"
+CFLAGS_ASAN="$CFLAGS_ASAN -fsanitize=address -fno-omit-frame-pointer"
+LDFLAGS_ASAN="$LDFLAGS"
+LIBS_LOCAL_ASAN="../libkc3/libkc3_asan.la"
+LIBS_ASAN="$LIBS $LIBS_LOCAL_ASAN"
+
+# Coverage config
+CPPFLAGS_COV="$CPPFLAGS"
+CFLAGS_COV="$CFLAGS -fprofile-arcs -ftest-coverage"
+LDFLAGS_COV="$LDFLAGS --coverage"
+LIBS_LOCAL_COV="../libkc3/libkc3_cov.la"
+LIBS_COV="$LIBS $LIBS_LOCAL_COV -lgcov"
+
+# Debug config
+CPPFLAGS_DEBUG="$CPPFLAGS"
+CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
+LDFLAGS_DEBUG="$LDFLAGS"
+LIBS_LOCAL_DEBUG="../libkc3/libkc3_debug.la"
+LIBS_DEBUG="$LIBS $LIBS_LOCAL_DEBUG"
+
+# Main config
+DEFAULT_CFLAGS="-O2 -fPIC"
+if [ "x$ENV_CFLAGS" = "x" ]; then
+    CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
+fi
+CFLAGS="$CFLAGS -DNDEBUG"
+LIBS_LOCAL="../libkc3/libkc3.la"
+LIBS="$LIBS $LIBS_LOCAL"
+
+echo "LIB = $LIB" >> ${CONFIG_MK}
+echo "HAVE_ASAN = $HAVE_ASAN" >> ${CONFIG_MK}
+echo "CPPFLAGS = $CPPFLAGS" >> ${CONFIG_MK}
+echo "CFLAGS = $CFLAGS" >> ${CONFIG_MK}
+echo "LDFLAGS = $LDFLAGS" >> ${CONFIG_MK}
+echo "LIBS = $LIBS" >> ${CONFIG_MK}
+echo >> ${CONFIG_MK}
+echo "LIB_ASAN = $LIB_ASAN" >> ${CONFIG_MK}
+echo "CPPFLAGS_ASAN = $CPPFLAGS_ASAN" >> ${CONFIG_MK}
+echo "CFLAGS_ASAN = $CFLAGS_ASAN" >> ${CONFIG_MK}
+echo "LDFLAGS_ASAN = $LDFLAGS_ASAN" >> ${CONFIG_MK}
+echo "LIBS_ASAN = $LIBS_ASAN" >> ${CONFIG_MK}
+echo >> ${CONFIG_MK}
+echo "LIB_COV = $LIB_COV" >> ${CONFIG_MK}
+echo "CPPFLAGS_COV = $CPPFLAGS_COV" >> ${CONFIG_MK}
+echo "CFLAGS_COV = $CFLAGS_COV" >> ${CONFIG_MK}
+echo "LDFLAGS_COV = $LDFLAGS_COV" >> ${CONFIG_MK}
+echo "LIBS_COV = $LIBS_COV" >> ${CONFIG_MK}
+echo >> ${CONFIG_MK}
+echo "LIB_DEBUG = $LIB_DEBUG" >> ${CONFIG_MK}
+echo "CPPFLAGS_DEBUG = $CPPFLAGS_DEBUG" >> ${CONFIG_MK}
+echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
+echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
+echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
+
+update_build
+update_build_lib
+
+build_lo
+build_lib
+
+update_config_mk
diff --git a/json/json.c b/json/json.c
index cdb595a..0fe9a55 100644
--- a/json/json.c
+++ b/json/json.c
@@ -12,9 +12,6 @@
  */
 #include <libkc3/kc3.h>
 #include "json.h"
-#include "buf.h"
-#include "buf_parse.h"
-#include "tag.h"
 
 static bool parse_json(const s_buf *buf, s_tag *dest) {
   assert(buf);
@@ -34,4 +31,4 @@ s_tag *json_parse(const s_buf *buf, s_tag *dest) {
     return NULL;
   }
   return dest;
-}
\ No newline at end of file
+}
diff --git a/json/sources.mk b/json/sources.mk
new file mode 100644
index 0000000..7fccffe
--- /dev/null
+++ b/json/sources.mk
@@ -0,0 +1,7 @@
+# sources.mk generated by update_sources
+HEADERS = \
+	"json.h" \
+
+SOURCES = \
+	"json.c" \
+
diff --git a/json/sources.sh b/json/sources.sh
new file mode 100644
index 0000000..d8ed55d
--- /dev/null
+++ b/json/sources.sh
@@ -0,0 +1,3 @@
+# sources.sh generated by update_sources
+HEADERS='json.h '
+SOURCES='json.c '
diff --git a/json/update_sources b/json/update_sources
new file mode 100755
index 0000000..a4101fe
--- /dev/null
+++ b/json/update_sources
@@ -0,0 +1,28 @@
+#!/bin/sh
+## kc3
+## Copyright 2022-2024 kmx.io <contact@kmx.io>
+##
+## Permission is hereby granted to use this software granted the above
+## copyright notice and this permission paragraph are included in all
+## copies and substantial portions of this software.
+##
+## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+## THIS SOFTWARE.
+
+. ../config.subr
+
+echo "$PWD/update_sources"
+
+echo "# sources.mk generated by update_sources" > ${SOURCES_MK}
+echo "# sources.sh generated by update_sources" > ${SOURCES_SH}
+
+HEADERS="$(ls *.h | grep -v '^config.h$')"
+sources HEADERS "$HEADERS"
+
+SOURCES="$(ls *.c)"
+sources SOURCES "$SOURCES"
+
+update_sources_mk
+update_sources_sh
diff --git a/test/Makefile b/test/Makefile
index 5f9c40b..caf73a7 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -71,12 +71,6 @@ distclean:
 gcovr:
 	gcovr --gcov-executable ${GCOV} --html-details test.html
 
-gdb_httpd:
-	cd httpd && ${GDB} ../../httpd/.libs/kc3_httpd_debug
-
-gdb_httpd_asan:
-	cd httpd && ${GDB} ../../httpd/.libs/kc3_httpd_asan
-
 gdb_test: debug
 	if [ -f libkc3_test_debug.core ]; then ${GDB} .libs/libkc3_test_debug libkc3_test_debug.core; else ${GDB} .libs/libkc3_test_debug; fi
 
@@ -89,9 +83,18 @@ gdb_test_http:
 gdb_test_http_asan:
 	cd http && ${GDB} ../../ikc3/.libs/ikc3_asan
 
+gdb_test_httpd:
+	cd httpd && ${GDB} ../../httpd/.libs/kc3_httpd_debug
+
+gdb_test_httpd_asan:
+	cd httpd && ${GDB} ../../httpd/.libs/kc3_httpd_asan
+
 gdb_test_ikc3:
 	cd ikc3 && ${GDB} ../../ikc3/.libs/ikc3_debug
 
+gdb_test_json:
+	cd json && ${GDB} ../../ikc3/.libs/ikc3_debug
+
 lldb_test: debug
 	if [ -f libkc3_test_debug.core ]; then lldb .libs/libkc3_test_debug libkc3_test_debug.core; else lldb .libs/libkc3_test_debug; fi
 
@@ -167,6 +170,18 @@ test_ikc3_cov:
 test_ikc3_debug:
 	IKC3=${SRC_TOP}/ikc3/ikc3_debug time ./ikc3_test
 
+test_json:
+	IKC3=${SRC_TOP}/ikc3/ikc3 time ./json_test
+
+test_json_asan:
+	IKC3=${SRC_TOP}/ikc3/ikc3_asan time ./json_test
+
+test_json_cov:
+	IKC3=${SRC_TOP}/ikc3/ikc3_cov time ./json_test
+
+test_json_debug:
+	IKC3=${SRC_TOP}/ikc3/ikc3_debug time ./json_test
+
 test_libkc3: libkc3_test
 	time ./libkc3_test
 
@@ -176,7 +191,29 @@ test_libkc3_cov: libkc3_test_cov
 test_valgrind: libkc3_test
 	valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes ./libkc3_test
 
-.PHONY: all asan cov debug clean clean_cov distclean ikc3_test_cov libkc3_test_cov test test_asan test_cov test_debug test_ikc3 test_valgrind
+.PHONY: all \
+	asan \
+	cov \
+	debug \
+	clean \
+	clean_cov \
+	distclean_test_cov \
+	gdb_test \
+	gdb_test_ekc3 \
+	gdb_test_http \
+	gdb_test_http_asan \
+	gdb_test_httpd \
+	gdb_test_httpd_asan \
+	gdb_test_ikc3 \
+	gdb_test_json \
+	libkc3_test_cov \
+	test \
+	test_asan \
+	test_cov \
+	test_debug \
+	test_ikc3 \
+	test_ikc3 \
+	test_valgrind
 
 include config.mk
 include sources.mk
diff --git a/test/json_test b/test/json_test
new file mode 100755
index 0000000..8a6f018
--- /dev/null
+++ b/test/json_test
@@ -0,0 +1,92 @@
+#!/bin/sh
+cd "$(dirname $0)/json" || exit
+
+TEST_COLOR_KO=""
+TEST_COLOR_OK=""
+TEST_COLOR_RESET=""
+TEST_COUNT=0
+TEST_KO=0
+TEST_OK=0
+
+if [ "x$IKC3" = "x" ]; then
+    if [ -f ../../ikc3/ikc3 ]; then
+	IKC3=../../ikc3/ikc3
+    elif [ -f ../../ikc3 ]; then
+	IKC3=../../ikc3
+    fi
+fi
+
+test_ko() {
+    printf "%s" "${TEST_COLOR_KO}F${TEST_COLOR_RESET}"
+    echo $@ >> .test_ko
+    echo $@ >> .test
+}
+
+test_ok() {
+    printf "%s" "${TEST_COLOR_OK}.${TEST_COLOR_RESET}"
+    echo $@ >> .test_ok
+    echo $@ >> .test
+}
+
+if [ $# = 0 ]; then
+    if [ "x${IKC3_TEST}" = "x" ]; then
+        TARGETS="$(ls -1 *.kc3 | sed -e 's/[.]kc3$//')"
+    else
+        TARGETS="${IKC3_TEST}"
+    fi
+else
+    TARGETS="$@"
+fi
+
+rm -f *.diff *.out *.ret
+rm -f .test .test_ko .test_ok
+touch .test .test_ko .test_ok
+for TARGET in $TARGETS; do
+    (
+        RESULT=test_ok
+        echo $TARGET > current_test
+        $IKC3 --load ${TARGET}.kc3 --quit > ${TARGET}.out 2>&1
+        echo $? > ${TARGET}.ret
+        if ! diff -abu ${TARGET}.out.expected ${TARGET}.out \
+             > ${TARGET}.diff
+        then
+            RESULT=test_ko
+        fi
+        if ! diff -abu ${TARGET}.ret.expected ${TARGET}.ret \
+             >> ${TARGET}.diff
+        then
+            RESULT=test_ko
+        fi
+        if [ "x$RESULT" = "xtest_ok" ]; then
+            rm ${TARGET}.diff
+            test_ok ${TARGET}
+        else
+            test_ko ${TARGET}
+        fi
+    )
+    sleep 2
+done
+wait
+TEST_COUNT=$(echo $(wc -l .test) | cut -f 1 -d ' ')
+TEST_KO=$(echo $(wc -l .test_ko) | cut -f 1 -d ' ')
+TEST_OK=$(echo $(wc -l .test_ok) | cut -f 1 -d ' ')
+echo
+DIFFS="$(for TARGET in $TARGETS; do
+    if [ -f "${TARGET}.diff" ]; then
+        printf "%s " "${TARGET}.diff"
+    fi
+done)"
+if [ "x$DIFFS" != "x" ]; then
+    ls $DIFFS
+    less $DIFFS || cat $DIFFS
+fi
+echo
+printf "%s" "Total $TEST_COUNT tests. "
+printf "%s" "${TEST_COLOR_OK}OK $TEST_OK ($(($TEST_OK * 100 / $TEST_COUNT))%)${TEST_COLOR_RESET}. "
+echo "${TEST_COLOR_KO}KO $TEST_KO ($(($TEST_KO * 100 / $TEST_COUNT))%)${TEST_COLOR_RESET}."
+
+if [ "x$TEST_KO" = "x0" ]; then
+    exit 0
+fi
+
+exit 1
diff --git a/update_sources b/update_sources
index 7920de2..fea9748 100755
--- a/update_sources
+++ b/update_sources
@@ -84,6 +84,7 @@ update_sources_sh
 ( cd ikc3       && ./update_sources; )
 ( cd kc3s       && ./update_sources; )
 ( cd ekc3       && ./update_sources; )
+( cd json       && ./update_sources; )
 ( cd http       && ./update_sources; )
 ( cd httpd      && ./update_sources; )
 ( cd test       && ./update_sources; )