aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/dr_build_scaffold.org
blob: 815be8858ac85bd7e7d7abd5f079be5081dbcf37 (plain)
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
-*- mode: org -*-
#+TITLE:       doc_reform (project) makefile
#+DESCRIPTION: makefile for doc_reform
#+FILETAGS:    :doc_reform:makefile:
#+AUTHOR:      Ralph Amissah
#+EMAIL:       [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
#+COPYRIGHT:   Copyright (C) 2015 - 2019 Ralph Amissah
#+LANGUAGE:    en
#+STARTUP:     indent content
#+OPTIONS:     H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t
#+OPTIONS:     TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+OPTIONS:     author:nil email:nil creator:nil timestamp:nil
#+PROPERTY:    header-args :padline no :exports code :noweb yes
#+EXPORT_SELECT_TAGS:  export
#+EXPORT_EXCLUDE_TAGS: noexport
#+TAGS: assert(a) class(c) debug(d) mixin(m) doc_reform(s) tangle(T) template(t) WEB(W) noexport(n)

[[./org/doc_reform.org][doc_reform.org]]  [[./org/][org/]]

* makefile                                                         :makefile:
** settings [+2]                                                  :settings:
*** git version stamp                                         :git:version:

#+BEGIN_SRC makefile :tangle ../makefile
PROJECT_VERSION :=$(shell echo `git describe --long --tags | sed -e "s/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g"`)
#+END_SRC

*** dub (build tool)                                                  :dub:

#+BEGIN_SRC makefile :tangle ../makefile
DUB=dub
DUB_FLAGS=-v --force --compiler=
#+END_SRC

*** Project Details                                           :project:sdp:

#+BEGIN_SRC makefile :tangle ../makefile
PRG_NAME=doc-reform
PRG_NICKAME=rad
PRG_NAME_DIR=$(shell echo `echo $(PRG_NAME) | sed -e "s/-/_/g"`)
PRG_SRC=$(PRG_NAME).d
PRG_SRCDIR=./src
PRG_BIN=$(PRG_NAME)
PRG_BINDIR=./bin
PRG_DOCDIR=./docs
#+END_SRC

*** Emacs Org settings                          :settings:emacs:org:tangle:

#+BEGIN_SRC makefile :tangle ../makefile
EMACSLISP=/usr/share/emacs/site-lisp
ORG_VER_AVAILABLE=$(shell echo `ls -d ~/.emacs.d/elpa/org-???????? | cut -d '-' -f2`)
EMACSLISP_ORG=~/.emacs.d/elpa/org-$($(shell echo $(ORG_VER_AVAILABLE)))
ORG_CONTRIB_VER_AVAILABLE=$(shell echo `ls -d ~/.emacs.d/elpa/org-plus-???????? | cut -d '-' -f2`)
EMACSLISP_ORG_CONTRIB=~/.emacs.d/elpa/org-plus-contrib-$($(shell echo $(ORG_CONTRIB_VER_AVAILABLE)))
ORGFILELIST=$(shell echo `ls -1 org/*.org`)
ORGFILES=""
ORGDIR :=$(shell echo `pwd`)
#+END_SRC

*** Markup Samples
**** pods

#+BEGIN_SRC makefile :tangle ../makefile
SiSU_MARKUP_SAMPLES_FIND_PODS= \
find data/pod -maxdepth 2 -name pod.manifest | cut -f 1-3 -d / | sort

SiSU_MARKUP_SAMPLES_PODS_FOUND= \
$(SiSU_MARKUP_SAMPLES_FIND_PODS) | xargs

SiSU_MARKUP_SAMPLES_POD = \
data/pod/accelerando.charles_stross \
data/pod/alices_adventures_in_wonderland.lewis_carroll \
data/pod/content.cory_doctorow \
data/pod/democratizing_innovation.eric_von_hippel \
data/pod/down_and_out_in_the_magic_kingdom.cory_doctorow \
data/pod/for_the_win.cory_doctorow \
data/pod/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman \
data/pod/free_culture.lawrence_lessig \
data/pod/free_for_all.peter_wayner \
data/pod/gpl2.fsf \
data/pod/gpl3.fsf \
data/pod/gullivers_travels.jonathan_swift \
data/pod/little_brother.cory_doctorow \
data/pod/live-manual \
data/pod/sisu-manual \
data/pod/the_autonomous_contract.ralph_amissah \
data/pod/the_cathedral_and_the_bazaar.eric_s_raymond \
data/pod/the_public_domain.james_boyle \
data/pod/the_wealth_of_networks.yochai_benkler \
data/pod/through_the_looking_glass.lewis_carroll \
data/pod/two_bits.christopher_kelty \
data/pod/un_contracts_international_sale_of_goods_convention_1980 \
data/pod/viral_spiral.david_bollier
#+END_SRC

**** dir

#+BEGIN_SRC makefile :tangle ../makefile
SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND = \
find data/sisudir/media/text -name *.ss[tm] | sort | xargs

SiSU_MARKUP_SAMPLES_DIR = \
data/sisudir/media/text/accelerando.charles_stross.sst \
data/sisudir/media/text/alices_adventures_in_wonderland.lewis_carroll.sst \
data/sisudir/media/text/content.cory_doctorow.sst \
data/sisudir/media/text/democratizing_innovation.eric_von_hippel.sst \
data/sisudir/media/text/down_and_out_in_the_magic_kingdom.cory_doctorow.sst \
data/sisudir/media/text/ffa_tmp.sst \
data/sisudir/media/text/for_the_win.cory_doctorow.sst \
data/sisudir/media/text/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst \
data/sisudir/media/text/free_culture.lawrence_lessig.sst \
data/sisudir/media/text/free_for_all.peter_wayner.sst \
data/sisudir/media/text/gpl2.fsf.sst \
data/sisudir/media/text/gpl3.fsf.sst \
data/sisudir/media/text/gullivers_travels.jonathan_swift.sst \
data/sisudir/media/text/little_brother.cory_doctorow.sst \
data/sisudir/media/text/sisu_markup.sst \
data/sisudir/media/text/sisu_markup_stress_test.sst \
data/sisudir/media/text/sisu_markup_test.sst \
data/sisudir/media/text/table_special_markup.sst \
data/sisudir/media/text/the_autonomous_contract.ralph_amissah.sst \
data/sisudir/media/text/the_cathedral_and_the_bazaar.eric_s_raymond.sst \
data/sisudir/media/text/the_public_domain.james_boyle.sst \
data/sisudir/media/text/the_wealth_of_networks.yochai_benkler.sst \
data/sisudir/media/text/through_the_looking_glass.lewis_carroll.sst \
data/sisudir/media/text/two_bits.christopher_kelty.sst \
data/sisudir/media/text/un_contracts_international_sale_of_goods_convention_1980.sst \
data/sisudir/media/text/viral_spiral.david_bollier.sst
#+END_SRC

** _make_ commands [+2]                                        :make:commands:

- build commands
  - build
  - debug
  - release
- init, clean, distclean etc.
  - init
  - clean
  - expunge
  - distclean
  - distclean_and_init
- org babel tangle
  - tangle
- git snapshot
  - gitsnapshot

*** build commands [+1]                                     :build:compile:
**** _dub_ build rebuild                                               :dub:
***** all compiler builds                               :all:dmd:gdc:ldc:
****** all builds
******* default

#+BEGIN_SRC makefile :tangle ../makefile
default: ldc
#+END_SRC

******* sample markup file list

#+BEGIN_SRC makefile :tangle ../makefile
markup_samples:
	find data/pod -name pod.manifest | cut -f 1-3 -d / | sort; \
find data/sisudir/media/text -name *.ss[tm] | sort
#+END_SRC

#+BEGIN_SRC makefile :tangle ../makefile
markup_pod_samples:
	find data/pod -name pod.manifest | cut -f 1-3 -d / | sort
#+END_SRC

#+BEGIN_SRC makefile :tangle ../makefile
markup_dir_samples:
	find data/sisudir/media/text -name *.ss[tm] | sort
#+END_SRC

******* quick                                                   :quick:
******** default                                             :default:

#+BEGIN_SRC makefile :tangle ../makefile
all: dmd ldc gdc
#+END_SRC

******** version                                             :version:

#+BEGIN_SRC makefile :tangle ../makefile
all_ver: dmd_ver ldc_ver gdc_ver
#+END_SRC

******** debug                                                 :debug:

#+BEGIN_SRC makefile :tangle ../makefile
all_debug: dmd_debug gdc_debug ldc_debug
#+END_SRC

******** _meson_ build                                           :meson:

#+BEGIN_SRC makefile :tangle ../makefile
meson:
	rm -r build && mkdir build
	meson --buildtype=debugoptimized build
	ninja -C build
mesonredo:
	rm -r build && mkdir build
	meson --buildtype=debugoptimized build
	ninja -C build
mesonclean: clean skel tangle
	meson --buildtype=debugoptimized build
	ninja -C build
#+END_SRC

******* clean & tangle                                   :clean:tangle:
******** default                                             :default:

#+BEGIN_SRC makefile :tangle ../makefile
all_clean: clean tangle dmd ldc gdc
#+END_SRC

******** version                                             :version:

#+BEGIN_SRC makefile :tangle ../makefile
all_ver_clean: clean tangle dmd_ver ldc_ver gdc_ver
#+END_SRC

******** debug                                                 :debug:

#+BEGIN_SRC makefile :tangle ../makefile
all_debug_ver: dmd_debug_ver gdc_debug_ver ldc_debug_ver
all_debug_clean_ver: clean tangle dmd_debug_ver gdc_debug_ver ldc_debug_ver
#+END_SRC

***** individual compiler builds                                   :each:
****** dmd                                                         :dmd:
******* quick                                                   :quick:
******** default                                             :default:

#+BEGIN_SRC makefile :tangle ../makefile
dmd:
	$(DUB) --compiler=dmd --config=dmd -b release
#+END_SRC

******** debug                                                 :debug:

#+BEGIN_SRC makefile :tangle ../makefile
dmd_debug:
	$(DUB) --compiler=dmd --config=dmd -b debug
#+END_SRC

******** version                                             :version:

- assumes git tags with program version

#+BEGIN_SRC makefile :tangle ../makefile
dmd_ver:
	$(DUB) --compiler=dmd --config=dmd-version
	mv bin/doc-reform-dmd-ver bin-archive/doc-reform-$(PROJECT_VERSION)-dmd
	notify-send -t 0 'D dmd compiled test release executable ready' 'doc-reform-$(PROJECT_VERSION)-dmd'
dmd_clean_ver: clean tangle dmd_ver
#+END_SRC

******* clean & tangle                                   :clean:tangle:

#+BEGIN_SRC makefile :tangle ../makefile
dmd_rel: expunge skel tangle
	$(DUB) --compiler=dmd --config=doc-reform-release
dmd_rel_tangle: tangle
	$(DUB) --compiler=dmd --config=doc-reform-dmd
dmd_rel_expunge_tangle: expunge skel tangle dmd_rel_tangle
dmd_debug_tangle: tangle
	$(DUB) --compiler=dmd --config=doc-reform-dmd-debug
#+END_SRC

****** gdc                                                         :gdc:
******* quick                                                   :quick:
******** default                                             :default:

#+BEGIN_SRC makefile :tangle ../makefile
gdc:
	$(DUB) --compiler=gdc --config=gdc -b release
#+END_SRC

******** debug                                                 :debug:

#+BEGIN_SRC makefile :tangle ../makefile
gdc_debug:
	$(DUB) --compiler=gdc --config=gdc -b debug
#+END_SRC

******** version                                             :version:

- assumes git tags with program version

#+BEGIN_SRC makefile :tangle ../makefile
gdc_ver:
	$(DUB) --compiler=gdc --config=gdc-version
	mv bin/doc-reform-gdc-ver bin-archive/doc-reform-$(PROJECT_VERSION)-gdc
	notify-send -t 0 'D gdc compiled test release executable ready' 'doc-reform-$(PROJECT_VERSION)-gdc'
gdc_clean_ver: clean tangle gdc_ver
#+END_SRC

******* clean & tangle                                   :clean:tangle:

#+BEGIN_SRC makefile :tangle ../makefile
gdc_rel: expunge skel tangle
	$(DUB) --compiler=gdc --config=doc-reform-release
gdc_rel_tangle: tangle
	$(DUB) --compiler=gdc --config=doc-reform-gdc
gdc_rel_expunge_tangle: expunge skel tangle gdc_rel_tangle
gdc_debug_tangle: tangle
	$(DUB) --compiler=gdc --config=doc-reform-gdc-debug
#+END_SRC

****** ldc                                                         :ldc:
******* quick                                                   :quick:
******** default                                             :default:

#+BEGIN_SRC makefile :tangle ../makefile
ldc:
	$(DUB) --compiler=ldc2 --config=ldc -b release
#+END_SRC

******** debug                                                 :debug:

#+BEGIN_SRC makefile :tangle ../makefile
ldc_debug:
	$(DUB) --compiler=ldc2 --config=ldc -b debug
#+END_SRC

******** version                                             :version:

- assumes git tags with program version

#+BEGIN_SRC makefile :tangle ../makefile
ldc_ver:
	$(DUB) --compiler=ldc2 --config=ldc-version
	mv bin/doc-reform-ldc-ver bin-archive/doc-reform-$(PROJECT_VERSION)-ldc
	notify-send -t 0 'D ldc2 compiled test release executable ready' 'doc-reform-$(PROJECT_VERSION)-ldc'
ldc_clean_ver: clean tangle ldc_ver
#+END_SRC

******* clean & tangle                                   :clean:tangle:

#+BEGIN_SRC makefile :tangle ../makefile
ldc_rel: expunge skel tangle
	$(DUB) --compiler=ldc2 --config=doc-reform-release
ldc_rel_tangle: tangle
	$(DUB) --compiler=ldc2 --config=doc-reform-ldc
ldc_rel_expunge_tangle: expunge skel tangle ldc_rel_tangle
ldc_debug_tangle: tangle
	$(DUB) --compiler=ldc2 --config=doc-reform-ldc-debug
#+END_SRC

***** generic
****** init clean distclean etc.                                 :clean:

#+BEGIN_SRC makefile :tangle ../makefile
reinit: clean skel tangle
skel:
	mkdir -p $(PRG_BINDIR); \
	mkdir -p $(PRG_BINDIR)-archive; \
	mkdir -p build; \
	mkdir -p subprojects; \
	mkdir -p views; \
	mkdir -p data; \
	mkdir -p util; \
	mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR)/conf; \
	mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR)/meta; \
	mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR)/output; \
	mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR)/share; \
	mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR)/source; \
	mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR); \
	mkdir -p $(PRG_BINDIR);
init: skel
clean:
	rm -rf build; \
	rm -rf subprojects; \
	rm -rf $(PRG_SRCDIR); \
	rm -rf $(PRG_DOCDIR);
clean_bin:
	rm $(PRG_BINDIR)/*
clean_src:
	rm -rf $(PRG_SRCDIR);
clean_docs:
	rm -rf $(PRG_DOCDIR)
expunge:
	rm -f dub.selections.json; \
	rm -rf build; \
	rm -rf subprojects; \
	rm -rf $(PRG_SRCDIR); \
	rm -rf $(PRG_BINDIR); \
	rm -rf $(PRG_DOCDIR);
distclean: expunge
distclean_and_init: expunge
	mkdir -p views; \
	mkdir -p util; \
	mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR); \
	mkdir -p $(PRG_BINDIR);
#+END_SRC

****** version                                                 :version:

#+BEGIN_SRC makefile :tangle ../makefile
ver:
	echo doc-reform-$(PROJECT_VERSION)
#+END_SRC

****** tangle build rebuild                         :clean:tangle:build:

#+BEGIN_SRC makefile :tangle ../makefile
clean_tangle_build: clean tangle build
tangle_build: tangle build
build: $(PRG_SRCDIR)/$(PRG_SRC)
	$(DC) $(DC_FLAGS) \
	$(DC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \
	$(PRG_SRCDIR)/$(PRG_SRC)
rebuild: $(PRG_SRCDIR)/$(PRG_SRC) $(PRG_BINDIR)/$(PRG_BIN).o clean build
makefile_new:
	make -k tangle_maker
restart: clean tangle
#+END_SRC

*** testrun (program against document markup)
**** pods
****** find files

#+BEGIN_SRC makefile :tangle ../makefile
find_pods:
	$(SiSU_MARKUP_SAMPLES_FIND_PODS)
#+END_SRC

***** dmd
****** find files

#+BEGIN_SRC makefile :tangle ../makefile
dmd_testrun_find:
	./bin/doc-reform-dmd -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_pod \
data/pod/sisu-manual
dmd_testrun_find_pod_source:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
./bin/doc-reform-ldc -v --source --html --epub \
--output-dir=tmp/program_output_pod
dmd_testrun_find_pod_pod:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
./bin/doc-reform-dmd -v --pod \
--output-dir=tmp/program_output_pod
dmd_testrun_find_pod_html:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
./bin/doc-reform-dmd -v --html \
--output-dir=tmp/program_output_pod
dmd_testrun_find_pod_epub:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
./bin/doc-reform-dmd -v --epub \
--output-dir=tmp/program_output_pod
dmd_testrun_find_pod_all:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
./bin/doc-reform-dmd -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_pod
#+END_SRC

****** path list

#+BEGIN_SRC makefile :tangle ../makefile
dmd_testrun_paths_pod_source:
	./bin/doc-reform-dmd -v --source \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
dmd_testrun_paths_pod_pod:
	./bin/doc-reform-dmd -v --pod \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
dmd_testrun_paths_pod_html:
	./bin/doc-reform-dmd -v --html \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
dmd_testrun_paths_pod_epub:
	./bin/doc-reform-dmd -v --epub \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
dmd_testrun_paths_pod_all:
	./bin/doc-reform-dmd -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
#+END_SRC

***** gdc
****** find files

#+BEGIN_SRC makefile :tangle ../makefile
gdc_testrun_find:
	./bin/doc-reform-gdc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_pod \
data/pod/sisu-manual
gdc_testrun_find_pod_source:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
./bin/doc-reform-gdc -v --source \
--output-dir=tmp/program_output_pod
gdc_testrun_find_pod_pod:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
./bin/doc-reform-gdc -v --pod \
--output-dir=tmp/program_output_pod
gdc_testrun_find_pod_html:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
./bin/doc-reform-gdc -v --html \
--output-dir=tmp/program_output_pod
gdc_testrun_find_pod_epub:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
./bin/doc-reform-gdc -v --epub \
--output-dir=tmp/program_output_pod
gdc_testrun_find_pod_all:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
./bin/doc-reform-gdc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_pod
#+END_SRC

****** path list

#+BEGIN_SRC makefile :tangle ../makefile
gdc_testrun_paths:
	./bin/doc-reform-gdc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_pod \
data/pod/sisu-manual
gdc_testrun_paths_pod_source:
	./bin/doc-reform-gdc -v --source \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
gdc_testrun_paths_pod_pod:
	./bin/doc-reform-gdc -v --pod \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
gdc_testrun_paths_pod_html:
	./bin/doc-reform-gdc -v --html \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
gdc_testrun_paths_pod_epub:
	./bin/doc-reform-gdc -v --epub \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
gdc_testrun_paths_pod_all:
	./bin/doc-reform-gdc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
#+END_SRC

***** ldc
****** find files

#+BEGIN_SRC makefile :tangle ../makefile
ldc_testrun_find:
	./bin/doc-reform-ldc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_pod \
data/pod/sisu-manual
ldc_testrun_find_pod_source:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
	./bin/doc-reform-ldc -v --source \
--output-dir=tmp/program_output_pod
ldc_testrun_find_pod_pod:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
	./bin/doc-reform-ldc -v --pod \
--output-dir=tmp/program_output_pod
ldc_testrun_find_pod_html:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
	./bin/doc-reform-ldc -v --html \
--output-dir=tmp/program_output_pod
ldc_testrun_find_pod_epub:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
	./bin/doc-reform-ldc -v --epub \
--output-dir=tmp/program_output_pod
ldc_testrun_find_pod_all:
	$(SiSU_MARKUP_SAMPLES_PODS_FOUND) \
	./bin/doc-reform-ldc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_pod
#+END_SRC

****** path list

#+BEGIN_SRC makefile :tangle ../makefile
ldc_testrun_paths:
	./bin/doc-reform-ldc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_pod \
data/pod/sisu-manual
ldc_testrun_paths_pod_source:
	./bin/doc-reform-ldc -v --source \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
ldc_testrun_paths_pod_pod:
	./bin/doc-reform-ldc -v --pod \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
ldc_testrun_paths_pod_html:
	./bin/doc-reform-ldc -v --html \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
ldc_testrun_paths_pod_epub:
	./bin/doc-reform-ldc -v --epub \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
ldc_testrun_paths_pod_all:
	./bin/doc-reform-ldc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_pod \
$(SiSU_MARKUP_SAMPLES_POD)
#+END_SRC

**** dir
***** dmd
****** find files

#+BEGIN_SRC makefile :tangle ../makefile
dmd_testrun_find_dir_source:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-dmd -v --source \
--output-dir=tmp/program_output_dir
dmd_testrun_find_dir_pod:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-dmd -v --pod \
--output-dir=tmp/program_output_dir
dmd_testrun_find_dir_html:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-dmd -v --html \
--output-dir=tmp/program_output_dir
dmd_testrun_find_dir_epub:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-dmd -v --epub \
--output-dir=tmp/program_output_dir
dmd_testrun_find_dir_all:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-dmd -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_dir
#+END_SRC

****** file list

#+BEGIN_SRC makefile :tangle ../makefile
dmd_testrun_filelist_dir_source:
	./bin/doc-reform-dmd -v --source \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
dmd_testrun_filelist_dir_pod:
	./bin/doc-reform-dmd -v --pod \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
dmd_testrun_filelist_dir_html:
	./bin/doc-reform-dmd -v --html \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
dmd_testrun_filelist_dir_epub:
	./bin/doc-reform-dmd -v --epub \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
dmd_testrun_filelist_dir_all:
	./bin/doc-reform-dmd -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
#+END_SRC

***** gdc
****** find files

#+BEGIN_SRC makefile :tangle ../makefile
gdc_testrun_find_dir_source:
	./bin/doc-reform-gdc -v --source \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
gdc_testrun_find_dir_pod:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-gdc -v --pod \
--output-dir=tmp/program_output_dir
gdc_testrun_find_dir_html:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-gdc -v --html \
--output-dir=tmp/program_output_dir
gdc_testrun_find_dir_epub:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-gdc -v --epub \
--output-dir=tmp/program_output_dir
gdc_testrun_find_dir_all:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-gdc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_dir
#+END_SRC

****** file list

#+BEGIN_SRC makefile :tangle ../makefile
gdc_testrun_filelist_dir_source:
	./bin/doc-reform-gdc -v --source \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
gdc_testrun_filelist_dir_pod:
	./bin/doc-reform-gdc -v --pod \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
gdc_testrun_filelist_dir_html:
	./bin/doc-reform-gdc -v --html \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
gdc_testrun_filelist_dir_epub:
	./bin/doc-reform-gdc -v --epub \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
gdc_testrun_filelist_dir_all:
	./bin/doc-reform-gdc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
#+END_SRC

***** ldc
****** find files

#+BEGIN_SRC makefile :tangle ../makefile
ldc_testrun_find_dir_source:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-ldc -v --source \
--output-dir=tmp/program_output_dir
ldc_testrun_find_dir_pod:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-ldc -v --pod \
--output-dir=tmp/program_output_dir
ldc_testrun_find_dir_html:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-ldc -v --html \
--output-dir=tmp/program_output_dir
ldc_testrun_find_dir_epub:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-ldc -v --epub \
--output-dir=tmp/program_output_dir
ldc_testrun_find_dir_all:
	$(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \
./bin/doc-reform-ldc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_dir
#+END_SRC

****** file list

#+BEGIN_SRC makefile :tangle ../makefile
ldc_testrun_filelist_dir_source:
	./bin/doc-reform-ldc -v --source \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
ldc_testrun_filelist_dir_pod:
	./bin/doc-reform-ldc -v --pod \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
ldc_testrun_filelist_dir_html:
	./bin/doc-reform-ldc -v --html \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
ldc_testrun_filelist_dir_epub:
	./bin/doc-reform-ldc -v --epub \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
ldc_testrun_filelist_dir_all:
	./bin/doc-reform-ldc -v --source --html --epub --sqlite-discrete \
--sqlite-create --sqlite-update \
--output-dir=tmp/program_output_dir \
$(SiSU_MARKUP_SAMPLES_DIR)
#+END_SRC

*** org babel tangle batch process command                         :tangle:
**** tangle: org babel tangle *.org

#+BEGIN_SRC makefile :tangle ../makefile
tangle: skel
	for f in $(ORGFILELIST); do \
		ORGFILES="$$ORGFILES \"$$f\""; \
	done; \
	emacs --batch -Q -q \
	--eval "(progn \
		(add-to-list 'load-path \
			(expand-file-name \"$(EMACSLISP)\")) \
		(add-to-list 'load-path \
			(expand-file-name \"$(EMACSLISP_ORG)\" t)) \
		(add-to-list 'load-path \
			(expand-file-name \"$(EMACSLISP_ORG_CONTRIB)\" t)) \
		(require 'org)(require 'ob)(require 'ob-tangle) \
		(mapc (lambda (file) \
			(find-file (expand-file-name file \"$(ORGDIR)\")) \
				(setq-local org-src-preserve-indentation t) \
			(org-babel-tangle) \
			(kill-buffer)) '($$ORGFILES)))" 2>&1
#+END_SRC

**** tangle maker: org babel tangle maker.org, makefile new

#+BEGIN_SRC makefile :tangle ../makefile
tangle_maker:
	for f in $(ORGFILELIST); do \
		ORGFILES="\"org/dr_build_scaffold.org\""; \
	done; \
	emacs --batch -Q -q \
	--eval "(progn \
		(add-to-list 'load-path \
			(expand-file-name \"$(EMACSLISP)\")) \
		(add-to-list 'load-path \
			(expand-file-name \"$(EMACSLISP_ORG)\" t)) \
		(add-to-list 'load-path \
			(expand-file-name \"$(EMACSLISP_ORG_CONTRIB)\" t)) \
		(require 'org)(require 'ob)(require 'ob-tangle) \
		(mapc (lambda (file) \
			(find-file (expand-file-name file \".\")) \
				(setq-local org-src-preserve-indentation t) \
			(org-babel-tangle) \
			(kill-buffer)) '($$ORGFILES)))" 2>&1
#+END_SRC

*** git snapshot

#+BEGIN_SRC makefile :tangle ../makefile
gitsnapshot: distclean tangle
	git commit -a
#+END_SRC

** phony                                                             :phony:

#+BEGIN_SRC makefile :tangle ../makefile
.PHONY : all build rebuild debug release \
	distclean init \
	tangle gitsnapshot
#+END_SRC

* dub.sdl                                                    :dub:sdl:config:
Every DUB package should contain a [[http://code.dlang.org/package-format?lang=json][dub.json]] (or [[http://code.dlang.org/package-format?lang=sdl][dub.sdl]])
** header (including dependencies)                                  :header:

#+BEGIN_SRC sh  :tangle ../dub.sdl
name                "doc-reform"
description         "sisu document parser"
homepage            "http://sisudoc.org"
authors             "Ralph Amissah"
copyright           "Copyright (C) 2016 - 2019 Ralph Amissah"
license             "AGPL-3.0+"
targetPath          "./bin"
#sourcePath          "./src/doc_reform"
stringImportPaths   "./views"
buildRequirements   "allowWarnings"
targetType          "executable"
platforms           "posix"
dependency          "d2sqlite3"      version="~>0.18.3"      # https://code.dlang.org/packages/d2sqlite3     http://biozic.github.io/d2sqlite3/d2sqlite3.html
  subconfiguration  "d2sqlite3"      "all-included"
dependency          "imageformats"   version="~>7.0.1"       # https://code.dlang.org/packages/imageformats  https://github.com/lgvz/imageformats
dependency          "toml"           version="~>1.0.0-rc.3"  # https://code.dlang.org/packages/toml          https://github.com/toml-lang/toml/wiki
dependency          "toml:json"      version="~>1.0.0-rc.3"
dependency          "dyaml"          version="~>0.8.0"
dependency          "tinyendian"     version="~>0.2.0" // for dyaml
#+END_SRC

** default

time (dub --compiler=dmd -b release)
time (dub --compiler=ldc2 -b release)
time (dub --compiler=gdc -b release)

#+BEGIN_SRC sh  :tangle ../dub.sdl
configuration "default" {
  targetName           "doc-reform"
  postGenerateCommands "/usr/bin/notify-send -t 0 'D executable ready' 'doc-reform'"
}
#+END_SRC

** dmd

time (dub --compiler=dmd --config=dmd -b dmd)
time (dub --compiler=dmd --config=dmd -b dmd-release)

#+BEGIN_SRC sh  :tangle ../dub.sdl
configuration "dmd" {
  targetName           "doc-reform-dmd"
  postGenerateCommands "/usr/bin/notify-send -t 0 'D executable ready' 'doc-reform-dmd'"
}
buildType     "dmd" {
  dflags               "-J=views" "-I=src/doc_reform"
  buildOptions         "verbose" "inline"
  buildRequirements    "allowWarnings"
}
buildType     "dmd-release" {
  dflags               "-J=views" "-I=src/doc_reform"
  buildOptions         "verbose" "releaseMode" "optimize" "inline"
}
configuration "dmd-version" {
  dflags               "-J=views" "-I=src/doc_reform"
  buildOptions         "verbose" "releaseMode" "optimize" "inline"
  targetName           "doc-reform-dmd-ver"
  postGenerateCommands "/usr/bin/notify-send -t 0 'D executable ready' 'doc-reform-dmd-ver'"
}
#+END_SRC

** ldc

time (dub --compiler=ldc2 --config=ldc -b ldc)
time (dub --compiler=ldc2 --config=ldc -b ldc-release)

#+BEGIN_SRC sh  :tangle ../dub.sdl
configuration "ldc" {
  targetName           "doc-reform-ldc"
  postGenerateCommands "/usr/bin/notify-send -t 0 'D executable ready' 'doc-reform-ldc'"
}
buildType     "ldc" {
  dflags            "-O2" "-J=views" "-I=src/doc_reform"
  buildOptions      "verbose" "optimize" "inline"
  buildRequirements "allowWarnings"
}
buildType     "ldc-release" {
  dflags               "-O2" "-J=views" "-I=src/doc_reform"
  buildOptions         "verbose" "optimize" "inline" "releaseMode"
}
configuration "ldc-version" {
  dflags               "-O2" "-J=views" "-I=src/doc_reform"
  buildOptions         "verbose" "optimize" "inline" "releaseMode"
  targetName           "doc-reform-ldc-ver"
  postGenerateCommands "/usr/bin/notify-send -t 0 'D executable ready' 'doc-reform-ldc-ver'"
}
#+END_SRC

** gdc

time (dub --compiler=gdc --config=gdc -b gdc)
time (dub --compiler=gdc --config=gdc -b gdc-release)

#+BEGIN_SRC sh  :tangle ../dub.sdl
configuration "gdc" {
  targetName           "doc-reform-gdc"
  postGenerateCommands "/usr/bin/notify-send -t 0 'D executable ready' 'doc-reform-gdc'"
}
buildType     "gdc" {
  dflags               "-O2" "-J=views" "-I=src/doc_reform"
  lflags               "-lz"
  buildOptions         "optimize" "inline"
  buildRequirements    "allowWarnings"
}
buildType     "gdc-release" {
  dflags               "-O2" "-J=views" "-I=src/doc_reform"
  lflags               "-lz"
  buildOptions         "verbose" "optimize" "inline" "releaseMode"
}
configuration "gdc-version" {
  dflags               "-O2" "-J=views" "-I=src/doc_reform"
  lflags               "-lz"
  buildOptions         "verbose" "optimize" "inline" "releaseMode"
  targetName           "doc-reform-gdc-ver"
  postGenerateCommands "/usr/bin/notify-send -t 0 'D executable ready' 'doc-reform-gdc-ver'"
}
#+END_SRC

*** generic                                                       :generic:
**** build (sdp)                                                 :release:

#+BEGIN_SRC sh
configuration "build" {
  name                 "build"
  targetType           "executable"
  platforms            "posix"
  targetName           "bin/doc-reform"
  dflags               "-J=views" "-I=src/doc_reform"
  buildOptions         "verbose" "releaseMode" "optimize" "inline"
  postGenerateCommands "/usr/bin/notify-send -t 0 'D release executable ready' 'doc-reform'"
}
#+END_SRC

* meson
** notes

http://mesonbuild.com/D.html
http://mesonbuild.com/Dependencies.html#Dub
- create and move to subdirectory
  rm -r build; mkdir build && cd build

- build

  - regular build (faster compile time):
    meson && ninja

  - optimized build (faster program run time):
    meson --buildtype=debugoptimized && ninja

  - time build
    time ( meson --buildtype=debugoptimized && ninja )

- other
  - flags
    DFLAGS= DC=ldc2 meson ..

*** projects

tree -fi ./src |rg "\.d$"

#+BEGIN_SRC sh :tangle ../meson.build
project('doc-reform', 'd',
  license: 'AGPL3',
  version: '0.26.5',
  meson_version: '>=0.46'
)
doc_reform_sources = [
  'src/doc_reform/doc_reform.d',
  'src/doc_reform/conf/compile_time_info.d',
  'src/doc_reform/meta/conf_make_meta_json.d',
  'src/doc_reform/meta/conf_make_meta_structs.d',
  'src/doc_reform/meta/conf_make_meta_toml.d',
  'src/doc_reform/meta/conf_make_meta_yaml.d',
  'src/doc_reform/meta/defaults.d',
  'src/doc_reform/meta/doc_debugs.d',
  'src/doc_reform/meta/metadoc.d',
  'src/doc_reform/meta/metadoc_from_src.d',
  'src/doc_reform/meta/metadoc_harvest.d',
  'src/doc_reform/meta/metadoc_harvests_authors.d',
  'src/doc_reform/meta/metadoc_harvests_topics.d',
  'src/doc_reform/meta/metadochead.d',
  'src/doc_reform/meta/metadoc_show_summary.d',
  'src/doc_reform/meta/object_setter.d',
  'src/doc_reform/meta/package.d',
  'src/doc_reform/meta/rgx.d',
  'src/doc_reform/output/create_zip_file.d',
  'src/doc_reform/output/defaults.d',
  'src/doc_reform/output/epub3.d',
  'src/doc_reform/output/html.d',
  'src/doc_reform/output/hub.d',
  'src/doc_reform/output/latex.d',
  'src/doc_reform/output/odt.d',
  'src/doc_reform/output/package.d',
  'src/doc_reform/output/paths_output.d',
  'src/doc_reform/output/rgx.d',
  'src/doc_reform/output/source_pod.d',
  'src/doc_reform/output/sqlite.d',
  'src/doc_reform/output/xmls_css.d',
  'src/doc_reform/output/xmls.d',
  'src/doc_reform/share/defaults.d',
  'src/doc_reform/source/paths_source.d',
  'src/doc_reform/source/read_config_files.d',
  'src/doc_reform/source/read_source_files.d',
]
source_root = meson.source_root()
sources_dir = include_directories('src/')
# Dependencies
dep_d2sqlite3    = dependency('d2sqlite3',      version: '>= 0.16.2', fallback: ['d2sqlite3',      'd2sqlite3_dep'])
dep_imageformats = dependency('imageformats-d', version: '>= 7.0.0',  fallback: ['imageformats-d', 'imageformats_dep'])
dep_toml         = dependency('toml-d',         version: '>= 1.0.0',  fallback: ['toml-d',         'toml_dep'])
# executable
doc_reform_exe = executable('rad',
  [doc_reform_sources],
  include_directories : [sources_dir],
  d_import_dirs: [include_directories('views')],
  dependencies : [
    dep_d2sqlite3,
    dep_imageformats,
    dep_toml
  ],
  install : true
)
#+END_SRC

** subprojects

#+BEGIN_SRC sh :tangle ../subprojects/README
d2sqlite3
- dub
  - https://code.dlang.org/packages/d2sqlite3
- upstream
  - https://github.com/biozic/d2sqlite3
- mathias
  - https://github.com/ximion/d2sqlite3.git

imageformats
- dub
  - https://code.dlang.org/packages/imageformats
- upstream
  - https://github.com/lgvz/imageformats
- mathias
  - https://github.com/ximion/imageformats.git

toml
- dub
  - https://code.dlang.org/packages/toml
- upstream
  - https://github.com/Kripth/toml
- mathias
  - https://github.com/ximion/toml.git
#+END_SRC

*** d2sqlite3

#+BEGIN_SRC sh :tangle ../subprojects/d2sqlite3.wrap
[wrap-git]
directory = d2sqlite3
url       = https://github.com/ximion/d2sqlite3.git
revision  = head
#+END_SRC

*** imageformats-d

#+BEGIN_SRC sh :tangle ../subprojects/imageformats-d.wrap
[wrap-git]
directory = imageformats-d
url       = https://github.com/ximion/imageformats.git
revision  = head
#+END_SRC

*** toml-d

#+BEGIN_SRC sh :tangle ../subprojects/toml-d.wrap
[wrap-git]
directory = toml-d
url       = https://github.com/ximion/toml.git
revision  = head
#+END_SRC

* .gitignore                                                      :gitignore:

#+BEGIN_SRC sh :tangle ../.gitignore
# git ls-files --others --exclude-from=.git/info/exclude
#./.dub/**
*
!.gitignore
!COPYRIGHT
!README
!makefile
!version.txt
!dub*.json
!dub.sdl
!meson.build
!tangle
!*.org
!*.d
!*.rb
!conf.sdl
!org
!util
!src
!src/doc_reform
!src/doc_reform/*
!src_toml
!src_toml/doc_reform
!src_toml/doc_reform/*
!src_yaml
!src_yaml/doc_reform
!src_yaml/doc_reform/*
!data
!data/*
!data/src/**
!data/src_toml/**
!data/src_yaml/**
!data/pod/**
!data/pod_toml/**
!data/pod_yaml/**
!*.sst
!*.ssm
!**/*.sst
!**/*.ssm
!subprojects
!**/*.wrap
!subprojects/*.wrap
!pod.manifest
!sisu_document_make
!config_local_site
!sisu_document_make.toml
!config_local_site.toml
!sisudoc
!views
!docs/*.html
!notes
notes/**
!notes/*.org
!notes/sisu-description.sst
!notes/reminders
!notes/reminders/**
.dub/**
tmp/**
*_.org
*_.d
*_.txt
*_
*~
\#*
*.\#*
#!*/
#*~
#\#*
#*.\#*
#!debian
#!debian/*
#.reggae/**
#+END_SRC

* sh script to batch process _emacs org babel tangle_     :shell_script:tangle:
  [[http://orgmode.org/manual/Batch-execution.html]]
creates a shell batch script called "tangle", that will tangle (emacs org
babel tangle) org files in ./org/ to create .d source files in ./src/doc_reform/
(similar functionality is contained within the "makefile" created by this
"dr_build_scaffold.org" file make tangle)

#+BEGIN_SRC sh :tangle ../tangle :tangle-mode (identity #o755) :shebang #!/bin/sh
# -*- mode: shell-script -*-
# tangle files with org-mode
DIR=`pwd`
ORGFILES=""
EMACSLISP=/usr/share/emacs/site-lisp
ORG_VER_AVAILABLE=$(shell echo `ls -d ~/.emacs.d/elpa/org-???????? | cut -d '-' -f2`)
EMACSLISP_ORG=~/.emacs.d/elpa/org-$($(shell echo $(ORG_VER_AVAILABLE)))
ORG_CONTRIB_VER_AVAILABLE=$(shell echo `ls -d ~/.emacs.d/elpa/org-plus-???????? | cut -d '-' -f2`)
EMACSLISP_ORG_CONTRIB=~/.emacs.d/elpa/org-plus-contrib-$($(shell echo $(ORG_CONTRIB_VER_AVAILABLE)))
# wrap each argument in the code required to call tangle on it
for i in $@; do
  ORGFILES="$ORGFILES \"$i\""
done
emacs --batch -Q -q \
--eval "(progn
(add-to-list 'load-path (expand-file-name \"$EMACSLISP\"))
(add-to-list 'load-path (expand-file-name \"$EMACSLISP_ORG\" t))
(add-to-list 'load-path (expand-file-name \"$EMACSLISP_ORG_CONTRIB\" t))
(require 'org)(require 'ob)(require 'ob-tangle)
(mapc (lambda (file)
  (find-file (expand-file-name file \"$DIR\"))
  (setq-local org-src-preserve-indentation t)
  (org-babel-tangle)
  (kill-buffer)) '($ORGFILES)))" 2>&1 #|grep tangled
#+END_SRC

* __END__
** build
*** dub

#+BEGIN_SRC sh  :tangle no
dub build -h
#+END_SRC

#+BEGIN_SRC sh
time (dub --compiler=dmd --config=doc-reform-dmd --debug=steps)
time (dub --compiler=ldc2 --config=doc-reform-ldc --debug=steps)
time (dub --compiler=gdc --config=doc-reform-gdc --debug=steps)

time (dub --compiler=ldc2 --config=doc-reform-ldc --debug=checkdoc --debug=summary --debug=dumpdoc)
time (dub --compiler=ldc2 --config=doc-reform-ldc --debug=io)
time (dub --compiler=ldc2 --config=doc-reform-ldc --debug=checkdoc --debug=summary --debug=dumpdoc --debug=io)
time (dub --compiler=ldc2 --config=doc-reform-ldc-debug --debug=io)
time (dub --compiler=gdc --config=doc-reform-gdc-debug --debug=io)
time (dub --compiler=dmd --config=doc-reform-dmd-debug --debug=io)
#+END_SRC

*** make

#+BEGIN_SRC sh
time make dmd
time make gdc
time make ldc
time make gdc ldc
time make all
time make all_ver
time make dmd_ver ldc_ver gdc_ver

time make restart
time make restart ldc
time make tangle ldc

time make ldc_testrun_find_pod_epub
#+END_SRC

** dub zfunc                                                         :zfunc:
*** ,dubdmd                                                           :dmd:

#+BEGIN_SRC sh  :tangle no
time dub --compiler=dmd -v --force
#+END_SRC

*** ,dubldc                                                           :ldc:

#+BEGIN_SRC sh  :tangle no
time dub --compiler=ldc2 -v --force
#+END_SRC

*** ,dubgdc                                                           :gdc:

#+BEGIN_SRC sh  :tangle no
time dub --compiler=gdc -v --force
#+END_SRC

** git
*** project version

echo $(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g')

*** what files changed
git whatchanged --since="1 day ago" --oneline --name-only --pretty=format: | sort -u
git log --since="1 day ago" --name-only --pretty=format: | sort -u

** test run
*** e.g.
time (./bin/doc-reform-ldc --source --html -v --output-dir=tmp/program-output data/pod/sisu-manual/media/text/en/sisu_markup.sst )

time (./bin/doc-reform-ldc --source --html -v --output-dir=tmp/program-output data/pod/sisu-manual )
time (./bin/doc-reform-ldc --source --html -v --output-dir=tmp/program-output data/pod/the_wealth_of_networks.yochai_benkler )
time (./bin/doc-reform-ldc --source --html -v --output-dir=tmp/program-output data/pod/live-manual )

time (~sdp2/bin/doc-reform-ldc --pod --source --html --epub --sqlite-create --sqlite-update -v sisudoc/media/text/en/sisu_markup_stress_test.sst sisudoc/media/text/en/the_wealth_of_networks.yochai_benkler.sst )

can point to directory containing sisudoc.txt file (listing which files to process)

time (~sdp2/bin/doc-reform-ldc --html -v sisudoc)
# will process source files listed in sisudoc.txt for appropriate files and dir structure

e.g. live-manual a multilingual document (with source file inserts .ssi)

time (~sdp2/bin/doc-reform-ldc --html --lang=en,es -v sisudoc)

time ( find data/pod -name pod.manifest | sort | xargs ./bin/doc-reform-ldc --source --html --epub -v --output-dir=tmp/program-output )

time ( find data/pod -maxdepth 2 -name pod.manifest | sort | xargs ./bin/doc-reform-ldc --source --html --epub -v --output-dir=tmp/program-output )
time ( find data/sisudir/media/text -name *.ss[tm] | sort | xargs ./bin/doc-reform-ldc --source --html --epub -v --output-dir=tmp/program-output )

find data/pod -maxdepth 2 -name pod.manifest | sort | xargs

find data/sisudir/media/text -name *.ss[tm] | sort | xargs

*** list markup files
find data/pod -name pod.manifest | sort
find data/sisudir/media/text -name *.ss[tm] | sort

time make ldc_testrun_paths_pod_pod
time make ldc_testrun_paths_pod_pod | ag "^\".+\"|NOT found"
time make ldc_testrun_find_pod_pod
time make ldc_testrun_find_dir_pod
time make ldc_testrun_filelist_dir_pod
** misc
*** compilers

- [X] Set D_COMPILER (one of DMD LDC or GDC)
- [X] Set debug flags (using DMD standard flag -deb

[[http://wiki.dlang.org/Compilers][D Compilers wiki https://wiki.dlang.org/Compilers]]
[[http://dlang.org/download.html][D Compilers download http://dlang.org/download.html]]

*** dub                                                               :dub:

https://github.com/dlang/dub/
http://code.dlang.org/getting_started
http://code.dlang.org/docs/commandline

**** setup
***** dub json or sdlang

Every DUB package should contain a [[http://code.dlang.org/package-format?lang=json][dub.json]] or [[http://code.dlang.org/package-format?lang=sdl][dub.sdl]]
https://code.dlang.org/package-format?lang=sdl
https://code.dlang.org/packages/sdlang-d
https://github.com/Abscissa/SDLang-D/blob/master/HOWTO.md

https://code.dlang.org/docs/commandline

***** dub dependencies

dub list
dub upgrade
dub fetch taggedalgebraic
dub fetch libinputvisitor
dub fetch unit-threaded ?

sdp ~master: /home/ralph/grotto/repo/git.repo/utils/doc-reform-x/
/home/ralph/.dub/packages/*

**** build
***** debug flags

#+BEGIN_SRC sh
biblio
biblio_sorted
bibliosorted
block
bookindex
bookindexmatch
bookindexraw
check
checkdoc
code
comment
dumpdoc                    write out document contents, with object type and ocn
endnotes
endnotes_build
footnotes
footnotesdone
group
header
header_and_content
header1
headerjson
headermakejson
headermetadatajson
heading
headings
headingsfound
insert
io
munge
node
objectrelated1
objectrelated2
objects
ocnoff
para
parabullet
parabulletindent
paraindent
paraindenthang
parent
poem
quote
raw
source
srclines
structattrib
summary
table
toc
#+END_SRC