-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Submakefile
665 lines (575 loc) · 24.7 KB
/
Submakefile
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
.PHONY: docs docsclean checkref checkref_en checkref_es checkref_fr checkref_vi checkref_zh_CN
.PHONY: pdfdocs htmldocs install-doc install-doc-pdf install-doc-html
# To make linuxcnc-checklink widely available
export PATH:=$(BASEPWD)/../scripts:$(PATH)
DOC_DIR=../docs
DOC_SRCDIR=../docs/src
LOC_HL_DIR=../docs/src/source-highlight
LOC_LANG_MAP=$(LOC_HL_DIR)/local/lang.map
GENERATED_MANPAGES += ../docs/man/man1/linuxcnc.1
ifeq ($(BUILD_DOCS),yes)
GENERATED_MANPAGES += $(patsubst ../docs/src/man/%.adoc, ../docs/man/%, $(wildcard ../docs/src/man/*/*.adoc))
endif
MAN_SRCS = $(sort \
$(wildcard $(DOC_DIR)/man/man1/*.1) \
$(wildcard $(DOC_DIR)/man/man3/*.3*) \
$(wildcard $(DOC_DIR)/man/man9/*.9) \
$(wildcard $(DOC_DIR)/man/es/man1/*.1) \
$(wildcard $(DOC_DIR)/man/es/man3/*.3*) \
$(wildcard $(DOC_DIR)/man/es/man9/*.9) \
$(GENERATED_MANPAGES))
../docs/man/man1/linuxcnc.1: $(DOC_SRCDIR)/man/man1/linuxcnc.1.in config.status
./config.status --file=$@:$<
ifneq ($(MANDB),)
default: $(DOC_DIR)/man/index.db
$(DOC_DIR)/man/index.db: $(MAN_SRCS)
@echo "Updating 'whatis' database"
$(Q)$(MANDB) $(DOC_DIR)/man
endif
ifeq ($(BUILD_DOCS),yes)
DOC_SRCS_EN := \
code/code-notes.adoc \
code/style-guide.adoc \
code/nml-messages.adoc \
code/rs274.adoc \
code/adding-configs.adoc \
code/contributing-to-linuxcnc.adoc \
code/building-linuxcnc.adoc \
common/emc-history.adoc \
common/glossary.adoc \
common/gpld-copyright.adoc \
common/overleaf.adoc \
config/core-components.adoc \
config/ini-config.adoc \
config/ini-homing.adoc \
config/iov2.adoc \
config/integrator-concepts.adoc \
config/lathe-config.adoc \
config/moveoff.adoc \
config/pncconf.adoc \
config/python-interface.adoc \
config/stepconf.adoc \
config/stepper-diagnostics.adoc \
config/stepper.adoc \
config/stepper-quickstart.adoc \
drivers/ax5214h.adoc \
drivers/vfs11.adoc \
drivers/mitsub-vfd.adoc \
drivers/gm.adoc \
drivers/gs2.adoc \
drivers/hostmot2.adoc \
drivers/mb2hal.adoc \
drivers/motenc.adoc \
drivers/opto22.adoc \
drivers/pico-ppmc.adoc \
drivers/pluto-p.adoc \
drivers/pmx485.adoc \
drivers/servo-to-go.adoc \
drivers/shuttle.adoc \
examples/gcode.adoc \
examples/gs2-example.adoc \
examples/mpg.adoc \
examples/pci-parallel-port.adoc \
examples/spindle.adoc \
gcode/coordinates.adoc \
gcode/g-code.adoc \
gcode/machining-center.adoc \
gcode/m-code.adoc \
gcode/o-code.adoc \
gcode/other-code.adoc \
gcode/overview.adoc \
gcode/rs274ngc.adoc \
gcode/tool-compensation.adoc \
getting-started/about-linuxcnc.adoc \
getting-started/getting-linuxcnc.adoc \
common/linux-faq.adoc \
getting-started/running-linuxcnc.adoc \
getting-started/system-requirements.adoc \
getting-started/updating-linuxcnc.adoc \
gui/axis.adoc \
gui/filter-programs.adoc \
gui/gladevcp.adoc \
gui/gmoccapy.adoc \
gui/gscreen.adoc \
gui/qtdragon.adoc \
gui/qtvcp.adoc \
gui/qtvcp-VCPpanels.adoc \
gui/qtvcp-widgets.adoc \
gui/qtvcp-libraries.adoc \
gui/qtvcp-vismach.adoc \
gui/qtvcp-custom-widgets.adoc \
gui/qtvcp-code-snippets.adoc \
gui/qtvcp-development.adoc \
gui/panelui.adoc \
gui/halui.adoc \
gui/image-to-gcode.adoc \
gui/ngcgui.adoc \
gui/tklinuxcnc.adoc \
gui/tooledit.adoc \
gui/touchy.adoc \
gui/GStat.adoc \
gui/vismach.adoc \
hal/basic-hal.adoc \
hal/canonical-devices.adoc \
hal/comp.adoc \
hal/components.adoc \
hal/general-ref.adoc \
hal/hal-examples.adoc \
hal/halmodule.adoc \
hal/halshow.adoc \
hal/haltcl.adoc \
hal/halui-examples.adoc \
hal/intro.adoc \
hal/parallel-port.adoc \
gui/pyvcp.adoc \
gui/pyvcp-examples.adoc \
hal/rtcomps.adoc \
hal/tools.adoc \
hal/tutorial.adoc \
hal/twopass.adoc \
install/latency-test.adoc \
integrator/steppers.adoc \
integrator/stepper-timing.adoc \
integrator/wiring.adoc \
ladder/classic-ladder.adoc \
ladder/ladder-examples.adoc \
ladder/ladder-intro.adoc \
lathe/lathe-user.adoc \
motion/kinematics.adoc \
motion/dh-parameters.adoc \
motion/pid-theory.adoc \
motion/tweaking-steppers.adoc \
motion/5-axis-kinematics.adoc \
motion/external-offsets.adoc \
motion/switchkins.adoc \
tooldatabase/tooldatabase.adoc \
plasma/qtplasmac.adoc \
plasma/plasma-cnc-primer.adoc \
remap/remap.adoc \
user/starting-linuxcnc.adoc \
user/user-concepts.adoc \
user/user-foreword.adoc \
user/user-intro.adoc \
Master-Getting-Started.adoc \
Master-Documentation.adoc \
Master-Integrator.adoc \
Master-Developer.adoc
DOC_SRCS_FR := $(subst $(DOC_SRCDIR)/,, \
$(wildcard $(DOC_SRCDIR)/*_fr.adoc) \
$(wildcard $(DOC_SRCDIR)/*/*_fr.adoc))
DOC_SRCS_ES := $(subst $(DOC_SRCDIR)/,, \
$(wildcard $(DOC_SRCDIR)/*_es.adoc) \
$(wildcard $(DOC_SRCDIR)/*/*_es.adoc))
DOC_SRCS_HU := $(subst $(DOC_SRCDIR)/,, \
$(wildcard $(DOC_SRCDIR)/*_hu.adoc) \
$(wildcard $(DOC_SRCDIR)/*/*_hu.adoc))
DOC_SRCS_ZH_CN := $(subst $(DOC_SRCDIR)/,, \
$(wildcard $(DOC_SRCDIR)*_zh_CN.adoc) \
$(wildcard $(DOC_SRCDIR)*/*_zh_CN.adoc))
DOC_SRCS = $(DOC_SRCS_EN) $(DOC_SRCS_FR) $(DOC_SRCS_ES) $(DOC_SRCS_HU) $(DOC_SRCS_ZH_CN)
DOC_SRCS_ES_SMALL := $(filter-out Master-%,$(DOC_SRCS_ES))
DOC_SRCS_FR_SMALL := $(filter-out Master-%,$(DOC_SRCS_FR))
DOC_SRCS_EN_SMALL := $(filter-out Master-%,$(DOC_SRCS_EN))
DOC_SRCS_HU_SMALL := $(filter-out Master-%,$(DOC_SRCS_HU))
DOC_SRCS_ZH_CN_SMALL := $(filter-out Master-%,$(DOC_SRCS_ZH_CN))
DOC_SRCS_HTML := $(patsubst %.adoc, %.html, $(filter-out Master-%, $(DOC_SRCS)))
DOC_TARGETS_HTML := $(addprefix $(DOC_DIR)/html/,$(DOC_SRCS_HTML)) #$(subst /,_,$(DOC_SRCS_HTML)))
DOC_TARGETS_XML := $(patsubst $(DOC_DIR)/html/%.html, objects/%.xml, $(DOC_TARGETS_HTML))
DOC_TARGETS_XML_ES := $(filter %_es.xml, $(DOC_TARGETS_XML))
DOC_TARGETS_XML_FR := $(filter %_fr.xml, $(DOC_TARGETS_XML))
DOC_TARGETS_XML_HU := $(filter %_hu.xml, $(DOC_TARGETS_XML))
DOC_TARGETS_XML_ZH_CN := $(filter %_zh_CN.xml, $(DOC_TARGETS_XML))
DOC_TARGETS_XML_EN := $(filter-out $(DOC_TARGETS_XML_ZH_CN), $(filter-out$(DOC_TARGETS_XML_ES), $(filter-out $(DOC_TARGETS_XML_FR), $(filter-out $(DOC_TARGETS_XML_HU), $(DOC_TARGETS_XML)))))
DOC_TARGETS_HTML_ES := $(filter %_es.html, $(DOC_TARGETS_HTML))
DOC_TARGETS_HTML_ZH_CN := $(filter %_zh_CN.html, $(DOC_TARGETS_HTML))
DOC_TARGETS_HTML_FR := $(filter %_fr.html, $(DOC_TARGETS_HTML))
DOC_TARGETS_HTML_HU := $(filter %_hu.html, $(DOC_TARGETS_HTML))
DOC_TARGETS_HTML_VI := $(filter %_vi.html, $(DOC_TARGETS_HTML))
DOC_TARGETS_HTML_EN := $(filter-out $(DOC_TARGETS_HTML_ZH_CN), $(filter-out $(DOC_TARGETS_HTML_ES), $(filter-out $(DOC_TARGETS_HTML_FR), $(filter-out $(DOC_TARGETS_HTML_HU), $(filter-out $(DOC_TARGETS_HTML_VI), $(DOC_TARGETS_HTML))))))
MAN_HTML_TARGETS = $(patsubst $(DOC_DIR)/man/%, $(DOC_DIR)/html/man/%.html, $(MAN_SRCS))
PDF_TARGETS_EN := $(addprefix $(DOC_DIR)/, $(patsubst %.adoc,%.pdf, \
$(subst Master-,LinuxCNC-, $(filter Master-%,$(DOC_SRCS_EN))))\
LinuxCNC-Manual-Pages.pdf \
) \
PDF_TARGETS_FR := $(addprefix $(DOC_DIR)/, $(patsubst %.adoc,%.pdf, \
$(subst Master-,LinuxCNC-, $(filter Master-%,$(DOC_SRCS_FR)))))
PDF_TARGETS_ES := $(addprefix $(DOC_DIR)/, $(patsubst %.adoc,%.pdf, \
$(subst Master-,LinuxCNC-, $(filter Master-%,$(DOC_SRCS_ES)))))
PDF_TARGETS_ZH_CN := $(addprefix $(DOC_DIR)/, $(patsubst %.adoc,%.pdf, \
$(subst Master-,LinuxCNC-, $(filter Master-%,$(DOC_SRCS_ZN_CN)))))
# Chinese PDFs only build with latex, which is missing in stretch
ifneq (, $(shell command -v xetex))
USING_XETEX = true
endif
ifdef USING_XETEX
PDF_TARGETS := $(PDF_TARGETS_EN) $(PDF_TARGETS_FR) $(PDF_TARGETS_ES) $(PDF_TARGETS_ZH_CN)
DBLATEX_OPTS=--backend xetex
else
PDF_TARGETS := $(PDF_TARGETS_EN) $(PDF_TARGETS_FR) $(PDF_TARGETS_ES)
endif
# It's better to keep the above on separate lines for troubleshooting by swapping
HTML_TARGETS := \
$(DOC_TARGETS_HTML) \
$(MAN_HTML_TARGETS) \
$(DOC_DIR)/html/index.html \
$(DOC_DIR)/html/index_es.html \
$(DOC_DIR)/html/index_fr.html \
$(DOC_DIR)/html/index_zh_CN.html \
A2X = a2x --xsltproc-opts "--nonet \
--stringparam toc.section.depth 3 \
--stringparam toc.max.depth 2 \
--stringparam generate.section.toc.level 2 \
--stringparam generate.toc 'book toc,title chapter toc'" \
-a "scriptdir=$(DOC_SRCDIR)/" \
--asciidoc-opts="-f $(DOC_SRCDIR)/docbook.conf" \
--asciidoc-opts="-f $(DOC_SRCDIR)/asciidoc-dont-replace-arrows.conf" \
--dblatex-opts "-P doc.publisher.show=0 -P latex.output.revhistory=0 -s $(DOC_SRCDIR)/emc2.sty \
-P latex.hyperparam=colorlinks,linkcolor=blue,filecolor=blue,urlcolor=blue,citecolor=blue \
$(A2X_LATEX_ENCODING) $(DBLATEX_OPTS)"
ifeq ($(TRIVIAL_BUILD),no)
-include $(patsubst %.adoc, depends/%.d, $(DOC_SRCS))
Makefile: $(patsubst %.adoc, depends/%.d, $(DOC_SRCS))
endif
docs: manpages
manpages: $(GENERATED_MANPAGES)
clean: clean-manpages
clean-manpages:
-rm -f $(GENERATED_MANPAGES)
DOTFILES=$(shell find . -name "*.dot") $(shell find ../docs/src/ -name "*.dot")
.PHONY: svgs_made_from_dots
svgs_made_from_dots: $(DOTFILES:.dot=.svg)
ifeq ($(BUILD_DOCS_PDF),yes)
docs: pdfdocs
install-doc: install-doc-pdf
endif
ifeq ($(BUILD_DOCS_HTML),yes)
docs: htmldocs
install-doc: install-doc-html
endif
pdfdocs: svgs_made_from_dots $(PDF_TARGETS)
htmldocs: svgs_made_from_dots .htmldoc-stamp checkref
.htmldoc-stamp: copy_asciidoc_files $(HTML_TARGETS) .html-images-stamp
touch $@
.PHONY: copy_asciidoc_files
copy_asciidoc_files:
cp -f /etc/asciidoc/stylesheets/*.css $(DOC_DIR)/html
cp -f /etc/asciidoc/javascripts/*.js $(DOC_DIR)/html
checkref: checkref_en checkref_es checkref_fr checkref_hu checkref_vi checkref_zh_CN
checkref_en: $(DOC_TARGETS_HTML_EN) $(DOC_DIR)/html/index.html $(DOC_DIR)/html/gcode.html .htmldoc-stamp
@$(DOC_SRCDIR)/checkref English $^
checkref_fr: $(DOC_TARGETS_HTML_FR) $(DOC_DIR)/html/gcode_fr.html .htmldoc-stamp
@$(DOC_SRCDIR)/checkref French $^
checkref_hu: $(DOC_TARGETS_HTML_HU) .htmldoc-stamp
@$(DOC_SRCDIR)/checkref Hungarian $^
checkref_es: $(DOC_TARGETS_HTML_ES) $(DOC_DIR)/html/gcode_es.html .htmldoc-stamp
@$(DOC_SRCDIR)/checkref Spanish $^
checkref_zh_CN: $(DOC_TARGETS_HTML_ZH_CN) .htmldoc-stamp
@$(DOC_SRCDIR)/checkref Chinese $^
checkref_vi: $(DOC_TARGETS_HTML_VI) $(DOC_DIR)/html/gcode_vi.html .htmldoc-stamp
@$(DOC_SRCDIR)/checkref Vietnamese $^
MAN_SRCS_NOSO = $(patsubst $(DOC_DIR)/man/%,%, \
$(shell grep -L '^\.so ' $(sort $(MAN_SRCS))))
PDF_MAN_ORDER := man1/linuxcnc.1 $(filter-out %/linuxcnc.1, $(filter man1/%, $(MAN_SRCS_NOSO))) \
man3/intro.3hal $(filter-out %/undocumented.3hal %/intro.3hal, $(filter man3/%.3hal, $(MAN_SRCS_NOSO))) \
man3/undocumented.3hal man3/intro.3rtapi $(filter-out %/undocumented.3rtapi %/intro.3rtapi, $(filter man3/%.3rtapi, $(MAN_SRCS_NOSO))) \
man3/undocumented.3rtapi $(filter man9/%, $(MAN_SRCS_NOSO))
$(DOC_DIR)/LinuxCNC-Manual-Pages.pdf: $(MAN_SRCS) objects/var-PDF_MAN_ORDER
@echo Formatting manual pages as PDF
(cd $(DOC_DIR)/man; groff -t -rC1 -rD1 -Tps -man $(PDF_MAN_ORDER)) \
| ps2pdf - $@
$(DOC_DIR)/LinuxCNC-Getting-Started.pdf: $(DOC_SRCDIR)/Master-Getting-Started.pdf
@ln -f $< $@
$(DOC_DIR)/LinuxCNC-Getting-Started_es.pdf: $(DOC_SRCDIR)/Master-Getting-Started_es.pdf
@ln -f $< $@
# Chinese PDFs only build when xetex is available.
$(DOC_DIR)/LinuxCNC-Getting-Started_zh_CN.pdf:$(DOC_SRCDIR)/Master-Getting-Started_zh_CN.pdf
@ln -f $< $@
$(DOC_DIR)/LinuxCNC-Getting-Started_fr.pdf: $(DOC_SRCDIR)/Master-Getting-Started_fr.pdf
@ln -f $< $@
$(DOC_DIR)/LinuxCNC-Integrator.pdf: $(DOC_SRCDIR)/Master-Integrator.pdf
@ln -f $< $@
$(DOC_DIR)/LinuxCNC-Integrator_fr.pdf: $(DOC_SRCDIR)/Master-Integrator_fr.pdf
@ln -f $< $@
$(DOC_DIR)/LinuxCNC-Documentation.pdf: $(DOC_SRCDIR)/Master-Documentation.pdf
@ln -f $< $@
$(DOC_DIR)/LinuxCNC-Documentation_es.pdf: $(DOC_SRCDIR)/Master-Documentation_es.pdf
@ln -f $< $@
$(DOC_DIR)/LinuxCNC-Documentation_fr.pdf: $(DOC_SRCDIR)/Master-Documentation_fr.pdf
@ln -f $< $@
$(DOC_DIR)/LinuxCNC-Developer.pdf: $(DOC_SRCDIR)/Master-Developer.pdf
@ln -f $< $@
$(DOC_DIR)/LinuxCNC-Developer_es.pdf: $(DOC_SRCDIR)/Master-Developer_es.pdf
@ln -f $< $@
$(DOC_DIR)/LinuxCNC-Developer_fr.pdf: $(DOC_SRCDIR)/Master-Developer_fr.pdf
@ln -f $< $@
$(DOC_DIR)/html/man/%.html: $(DOC_DIR)/man/%
@echo Formatting $(notdir $<) as HTML
@mkdir -p $(dir $@)
@(cd $(DOC_DIR)/man; groff -Thtml -man stylesheet.9 $(patsubst $(DOC_DIR)/man/%,%,$<)) > $@
SA := <p><a onclick=\"return toggle('man_
SB := ')\"><img id=\"man_
SC := _image\" src=\"plus.png\" alt=\"plus\" style=\"border:0;margin-right:5px;vertical-align:middle\"/>
SD := <div id=\"man_
SE := \" style=\"-moz-column-width: 25ex; \
-moz-column-gap: 4ex; \
-webkit-column-width: \
25ex; -webkit-column-gap: 4ex;\">
#
# This function appends a section to the "manpages" HTML fragment called
# index.incl, listing all the specified manpages. It takes 2 arguments:
# * the part of the manpage space, for example "1" or "3rtapi"
# * the manpage section title
#
ADD_HTML_MANPAGES = \
@echo "Adding manpages: man$(strip $(1)): $(strip $(2))"; \
echo "$(SA)$(strip $(1))$(SB)$(strip $(1))$(SC)$(strip $(2))</a></p>" >> objects/index.incl; \
echo "$(SD)$(strip $(1))$(SE)" >> objects/index.incl; \
echo "<ul>" >> objects/index.incl; \
for HTML_FILE in $(filter $(DOC_DIR)/html/man/man$(strip $(1))/%.html, $(MAN_HTML_TARGETS)); do \
BASENAME=$$(basename $$HTML_FILE .html); \
echo "<li><a href=\"$${HTML_FILE\#$(DOC_DIR)/html/}\">$${BASENAME%.*}</a></li>"; \
done >> objects/index.incl; \
echo "</ul></div>" >> objects/index.incl
objects/index.incl: $(GENERATED_MANPAGES) objects/var-MAN_HTML_TARGETS $(DOC_SRCDIR)/Submakefile
rm -f $@
$(call ADD_HTML_MANPAGES, 1, Commands and userspace components)
$(call ADD_HTML_MANPAGES, 9, Realtime components and kernel modules)
$(call ADD_HTML_MANPAGES, 3hal, API calls: HAL)
$(call ADD_HTML_MANPAGES, 3rtapi, API calls: RTAPI)
$(call ADD_HTML_MANPAGES, 3hm2, API calls: Hostmot2)
$(call ADD_HTML_MANPAGES, 3, API calls: General)
# now make sure all manpages made it into the html index
FAIL=0; \
for F in $$(find $(DOC_DIR)/man/? -type f); do \
B=$$(basename $$F); \
if ! grep -q $$B $@; then \
echo stray manpage not added to index: $$B; \
FAIL=1; \
fi; \
done; \
if [ $$FAIL -ne 0 ]; then false; fi
mkdir -p $(DOC_DIR)/html/man/man/images/
find $(DOC_DIR)/man -name "*.png" ! -name "grohtml*" -exec mv {} "$(DOC_DIR)/html/man/man/images/" \;
$(DOC_DIR)/html/index_%.html: $(DOC_SRCDIR)/index_%.tmpl ../VERSION $(DOC_SRCDIR)/index.foot
cat $(filter-out ../VERSION, $^) | \
sed "s/@VERSION@/`cat ../VERSION`/" > $@
$(DOC_DIR)/html/index.html: $(DOC_SRCDIR)/index.tmpl objects/index.incl $(DOC_SRCDIR)/index.foot ../VERSION $(DOC_SRCDIR)/Submakefile
(cat $(DOC_SRCDIR)/index.tmpl objects/index.incl $(DOC_SRCDIR)/index.foot) | sed "s/@VERSION@/`cat ../VERSION`/" > $@
$(DOC_SRCDIR)/%.pdf: $(DOC_SRCDIR)/%.adoc
$(ECHO) Building $@
@rm -f $@
$(A2X) -L -d book -vf pdf $< || (X=$$?; rm -f $@; exit $$X)
@test -f $@
depends/%.d: $(DOC_SRCDIR)/%.adoc $(DOC_SRCDIR)/asciideps
$(ECHO) Depending $<
@mkdir -p $(dir $@)
$(Q)$(DOC_SRCDIR)/asciideps $< > $@.tmp
@mv $@.tmp $@
objects/%.links-stamp: $(DOC_SRCDIR)/%.adoc $(DOC_SRCDIR)/links.xslt
@mkdir -p `dirname $@`
asciidoc -f $(DOC_SRCDIR)/attribute-colon.conf -a "scriptdir=$(DOC_SRCDIR)/" -d book -o- -b docbook $< | xsltproc $(DOC_SRCDIR)/links.xslt - > $@.tmp || (X=$$?; rm -f $@; exit $$X)
sh move-if-change $@.tmp $(patsubst %-stamp,%,$@)
touch $@
objects/%.links: objects/%.links-stamp
@:
# Secondary is not working here.
# See http://www.gnu.org/software/make/manual/make.html#Chained-Rules
.PRECIOUS: objects/%.links-stamp
objects/xref_en.links: $(patsubst %.adoc,objects/%.links,$(DOC_SRCS_EN_SMALL))
$(PYTHON) $(DOC_SRCDIR)/links_db_gen.py objects/ $^ > $@
objects/xref_es.links: $(patsubst %.adoc,objects/%.links,$(DOC_SRCS_ES_SMALL))
$(PYTHON) $(DOC_SRCDIR)/links_db_gen.py objects/ $^ > $@
objects/xref_fr.links: $(patsubst %.adoc,objects/%.links,$(DOC_SRCS_FR_SMALL))
$(PYTHON) $(DOC_SRCDIR)/links_db_gen.py objects/ $^ > $@
objects/xref_hu.links: $(patsubst %.adoc,objects/%.links,$(DOC_SRCS_HU_SMALL))
$(PYTHON) $(DOC_SRCDIR)/links_db_gen.py objects/ $^ > $@
objects/xref_zh_CN.links: $(patsubst %.adoc,objects/%.links,$(DOC_SRCS_ZH_CN_SMALL))
$(PYTHON) $(DOC_SRCDIR)/links_db_gen.py objects/ $^ > $@
$(DOC_TARGETS_HTML): $(DOC_DIR)/html/%.html: $(DOC_SRCDIR)/%.html
@d=`dirname $*`; \
mkdir -p $(shell dirname $@)
@cp $< $@
.html-images-stamp: $(DOC_TARGETS_HTML)
set -e; for HTML_FILE in $^; do \
HTML_DIR=$$(basename $$(dirname $$HTML_FILE)); \
for IMAGE_FILE in $$(xsltproc --novalid --nonet $(DOC_SRCDIR)/html-images.xslt $$HTML_FILE); do \
IMAGE_DIR=$$(dirname $$IMAGE_FILE); \
mkdir -p $(DOC_DIR)/html/$$HTML_DIR/$$IMAGE_DIR; \
cp -f $(DOC_SRCDIR)/$$HTML_DIR/$$IMAGE_FILE $(DOC_DIR)/html/$$HTML_DIR/$$IMAGE_FILE; \
done; \
mkdir -p objects/image-cache; \
HTML_LATEX_CACHE=objects/image-cache $(DOC_SRCDIR)/html-latex-images $$HTML_FILE || (X=$$?; rm $$HTML_FILE; exit $$X); \
done
cp -f ../src/hal/user_comps/mb2hal/mb2hal_HOWTO.ini $(DOC_DIR)/html/drivers/
touch $@
# Define a target-specific variable called STYLES_SCRIPTS_DIR, which has
# the relative path from this html target to the root of the generated
# document tree (docs/html in the git repo). This is where the CSS files
# and javascript files will be installed.
$(DOC_SRCDIR)/%.html: STYLES_SCRIPTS=$(shell \
D=$$(python3 -c "print('../' * '$*'.count('/'))"); \
if [ ! -z $$D ]; then \
echo "-a 'scriptsdir=$$D' -a 'stylesdir=$$D'"; \
fi \
)
$(patsubst %.adoc,$(DOC_SRCDIR)/%.html,$(DOC_SRCS_EN_SMALL)): $(DOC_SRCDIR)/%.html: $(DOC_SRCDIR)/%.adoc objects/xref_en.links $(LOC_LANG_MAP)
asciidoc -f $(DOC_SRCDIR)/xhtml11.conf \
-f $(DOC_SRCDIR)/asciidoc-dont-replace-arrows.conf \
-f $(LOC_HL_DIR)/emc-langs-source-highlight.conf \
-a "source_highlight_dir=$(LOC_HL_DIR)/local" \
-a linkcss \
$(STYLES_SCRIPTS) \
-a "scriptdir=$(DOC_SRCDIR)/" \
-a "relindir=$(shell dirname $*)" \
-a "linksfile=objects/xref_en.links" \
-a stylesheet=linuxcnc.css \
-d book -a toc -a numbered -b xhtml11 $< || (X=$$?; rm -f $@; exit $$X)
$(patsubst %.adoc,$(DOC_SRCDIR)/%.html,$(DOC_SRCS_FR_SMALL)): $(DOC_SRCDIR)/%.html: $(DOC_SRCDIR)/%.adoc objects/xref_fr.links $(LOC_LANG_MAP)
asciidoc -f $(DOC_SRCDIR)/xhtml11.conf \
-f $(DOC_SRCDIR)/asciidoc-dont-replace-arrows.conf \
-f $(LOC_HL_DIR)/emc-langs-source-highlight.conf \
-a "source_highlight_dir=$(LOC_HL_DIR)/local" \
-a linkcss \
$(STYLES_SCRIPTS) \
-a "scriptdir=$(DOC_SRCDIR)/" \
-a "relindir=$(shell dirname $*)" \
-a "linksfile=objects/xref_fr.links" \
-a stylesheet=linuxcnc.css \
-d book -a toc -a numbered -b xhtml11 $< || (X=$$?; rm -f $@; exit $$X)
$(patsubst %.adoc,$(DOC_SRCDIR)/%.html,$(DOC_SRCS_HU_SMALL)): $(DOC_SRCDIR)/%.html: $(DOC_SRCDIR)/%.adoc objects/xref_hu.links $(LOC_LANG_MAP)
asciidoc -f $(DOC_SRCDIR)/xhtml11.conf \
-f $(DOC_SRCDIR)/asciidoc-dont-replace-arrows.conf \
-f $(LOC_HL_DIR)/emc-langs-source-highlight.conf \
-a "source_highlight_dir=$(LOC_HL_DIR)/local" \
-a linkcss \
$(STYLES_SCRIPTS) \
-a "scriptdir=$(DOC_SRCDIR)/" \
-a "relindir=$(shell dirname $*)" \
-a "linksfile=objects/xref_hu.links" \
-a stylesheet=linuxcnc.css \
-d book -a toc -a numbered -b xhtml11 $< || (X=$$?; rm -f $@; exit $$X)
$(patsubst %.adoc,$(DOC_SRCDIR)/%.html,$(DOC_SRCS_ES_SMALL)): $(DOC_SRCDIR)/%.html: $(DOC_SRCDIR)/%.adoc objects/xref_es.links $(LOC_LANG_MAP)
asciidoc -f $(DOC_SRCDIR)/xhtml11.conf \
-f $(DOC_SRCDIR)/asciidoc-dont-replace-arrows.conf \
-f $(LOC_HL_DIR)/emc-langs-source-highlight.conf \
-a "source_highlight_dir=$(LOC_HL_DIR)/local" \
-a linkcss \
$(STYLES_SCRIPTS) \
-a "scriptdir=$(DOC_SRCDIR)/" \
-a "relindir=$(shell dirname $*)" \
-a "linksfile=objects/xref_es.links" \
-a stylesheet=linuxcnc.css \
-d book -a toc -a numbered -b xhtml11 $< || (X=$$?; rm -f $@; exit $$X)
$(patsubst %.adoc,$(DOC_SRCDIR)/%.html,$(DOC_SRCS_ZH_CN_SMALL)): $(DOC_SRCDIR)/%.html: $(DOC_SRCDIR)/%.adoc objects/xref_zh_CN.links $(LOC_LANG_MAP)
asciidoc -f $(DOC_SRCDIR)/xhtml11.conf \
-f $(DOC_SRCDIR)/asciidoc-dont-replace-arrows.conf \
-a linkcss \
$(STYLES_SCRIPTS) \
-a "scriptdir=$(DOC_SRCDIR)/" \
-a "relindir=$(shell dirname $*)" \
-a "linksfile=objects/xref_zh_CN.links" \
-a stylesheet=linuxcnc.css \
-d book -a toc -a numbered -b xhtml11 $< || (X=$$?; rm -f $@; exit $$X)
default: docs
$(DOC_DIR)/html/xref_fr.html: objects/xref_fr.xml $(DOC_SRCDIR)/xref.xsl $(DOC_SRCDIR)/docs.xml $(DOC_SRCDIR)/terms.xml
$(ECHO) Converting $< to HTML
@xsltproc --stringparam docname "xref_fr" --stringparam language french --path objects -o $@ $(DOC_SRCDIR)/xref.xsl $<
$(DOC_DIR)/html/xref_hu.html: objects/xref_hu.xml $(DOC_SRCDIR)/xref.xsl $(DOC_SRCDIR)/docs.xml $(DOC_SRCDIR)/terms.xml
$(ECHO) Converting $< to HTML
@xsltproc --stringparam docname "xref_hu" --stringparam language hungarien --path objects -o $@ $(DOC_SRCDIR)/xref.xsl $<
$(DOC_DIR)/html/xref_es.html: objects/xref_es.xml $(DOC_SRCDIR)/xref.xsl $(DOC_SRCDIR)/docs.xml $(DOC_SRCDIR)/terms.xml
$(ECHO) Converting $< to HTML
@xsltproc --stringparam docname "xref_es" --stringparam language spanish --path objects -o $@ $(DOC_SRCDIR)/xref.xsl $<
$(DOC_DIR)/html/xref_cb.html: objects/xref_zh_CN.xml $(DOC_SRCDIR)/xref.xsl $(DOC_SRCDIR)/docs.xml $(DOC_SRCDIR)/terms.xml
$(ECHO) Converting $< to HTML
@xsltproc --stringparam docname "xref_zh_CN" --stringparam language cjinese --path objects -o $@ $(DOC_SRCDIR)/xref.xsl $<
default: docs
install-doc-pdf:
$(DIR) $(DESTDIR)$(docsdir)
$(FILE) $(PDF_TARGETS) $(DESTDIR)$(docsdir)
install-doc-html:
$(DIR) $(DESTDIR)$(docsdir)
cp -a $(DOC_DIR)/html $(DESTDIR)$(docsdir)
install-kernel-indep: install-doc
docclean:
-rm -f $(DOC_DIR)/LinuxCNC-Getting-Started.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Getting-Started_es.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Getting-Started_fr.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Getting-Started_zh_CN.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Documentation.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Documentation_es.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Documentation_fr.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Integrator.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Integrator_fr.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Developer.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Developer_es.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Developer_fr.pdf
-rm -f $(DOC_DIR)/LinuxCNC-Manual-Pages.pdf
-rm -f $(DOC_SRCDIR)/*.d
-rm -f $(DOC_SRCDIR)/*.pdf
-rm -f $(DOC_SRCDIR)/*/*.html
-rm -f $(DOC_DIR)/html/code/*.*
-rm -f $(DOC_DIR)/html/common/images/*.*
-rm -f $(DOC_DIR)/html/config/images/*.*
-rm -f $(DOC_DIR)/html/drivers/images/*.*
-rm -f $(DOC_DIR)/html/examples/images/*.*
-rm -f $(DOC_DIR)/html/gcode/images/*.*
-rm -f $(DOC_DIR)/html/getting-started/images/*.*
-rm -f $(DOC_DIR)/html/gui/images/*.*
-rm -f $(DOC_DIR)/html/hal/images/*.*
-rm -f $(DOC_DIR)/html/install/images/*.*
-rm -f $(DOC_DIR)/html/ladder/images/*.*
-rm -f $(DOC_DIR)/html/lathe/images/*.*
-rm -f $(DOC_DIR)/html/motion/images/*.*
-rm -f $(DOC_DIR)/html/plasma/images/*.*
-rm -f $(DOC_DIR)/html/remap/images/*.*
-rm -f $(DOC_DIR)/html/man/man1/*.*
-rm -f $(DOC_DIR)/html/man/man3/*.*
-rm -f $(DOC_DIR)/html/man/man9/*.*
-rm -f $(DOC_TARGETS_HTML) $(DOC_DIR)/html/xref*.html $(DOC_DIR)/html/index*.html $(DOC_DIR)/*.png $(DOC_DIR)/man/*.png
-rm -f .htmldoc-stamp
-rm -f .html-images-stamp
-rm -f $(DOTFILES:.dot=.svg)
MAN_DEPS := $(patsubst $(DOC_DIR)/man/%, depends/%.d, $(MAN_SRCS))
$(MAN_DEPS): depends/%.d: $(DOC_DIR)/man/%
@echo Depending $(notdir $<)
@mkdir -p $(dir $@)
$(Q)echo -n "$(DOC_DIR)/html/man/$*.html: $<" > $@.tmp
$(Q)grep '^\.so ' $< | awk '{printf " \\\n\t$(DOC_DIR)/man/%s", $$2}' >> $@.tmp
$(Q)echo >> $@.tmp
$(Q)mv -f $@.tmp $@
ifeq ($(TRIVIAL_BUILD),no)
-include $(MAN_DEPS)
Makefile: $(MAN_DEPS)
endif
%.png: %.dot
dot -Tpng -o$@ $<
%.svg: %.dot
dot -Tsvg -o$@ $<
%.png:; $(error Required image file $@ does not exist)
%.jpg:; $(error Required image file $@ does not exist)
%.svg:; $(error Required image file $@ does not exist)
%.dxf:; $(error Required image file $@ does not exist)
%.ps:; $(error Required image file $@ does not exist)
%.eps:; $(error Required image file $@ does not exist)
# make manpages from all the asciidoc manpage-sources
# Note that in some versions of asciidoc, including the one in Debian Jessie,
# a2x spuriously warns that this --destination-dir is ignored. It is *NOT*
# ignored, don't remove it trying to fix the diagnostic.
# For more information, see https://github.com/asciidoc/asciidoc/issues/44
GENERATED_MANPAGES += $(patsubst $(DOC_DIR)/src/man/%.adoc, $(DOC_DIR)/man/%, $(wildcard $(DOC_DIR)/src/man/man?/*.adoc))
$(DOC_DIR)/man/%: $(DOC_DIR)/src/man/%.adoc
@mkdir -p `dirname $@`
a2x -v --doctype manpage \
--format manpage \
--destination-dir `dirname $@` \
--xsltproc-opts="--nonet" \
-a mansource=LinuxCNC \
-a manmanual='LinuxCNC Documentation' \
$<
else
:
@:
docs:
$(error Cannot build documents, missing AsciiDoc or some other required program, or explicitly disabled in configure)
endif