2017-01-23 01:05:27 +01:00
#! /usr/bin/make
# Designed to be run one level up
doc-wrongdir :
$( MAKE) -C .. doc-all
2024-03-04 03:30:24 +01:00
GENERATE_MARKDOWN := doc/lightning-addgossip.7 \
doc/lightning-addpsbtoutput.7 \
2024-11-07 07:36:35 +01:00
doc/lightning-askrene-age.7 \
2024-11-08 04:09:59 +01:00
doc/lightning-askrene-bias-channel.7 \
2024-10-04 01:23:53 +02:00
doc/lightning-askrene-create-layer.7 \
doc/lightning-askrene-remove-layer.7 \
2024-08-07 03:49:52 +02:00
doc/lightning-askrene-create-channel.7 \
2024-10-04 01:37:53 +02:00
doc/lightning-askrene-update-channel.7 \
2024-08-07 03:49:52 +02:00
doc/lightning-askrene-disable-node.7 \
doc/lightning-askrene-inform-channel.7 \
doc/lightning-askrene-listlayers.7 \
2024-10-04 01:27:53 +02:00
doc/lightning-askrene-listreservations.7 \
2024-08-07 03:49:52 +02:00
doc/lightning-askrene-reserve.7 \
doc/lightning-askrene-unreserve.7 \
2022-12-05 20:05:01 +01:00
doc/lightning-autoclean-once.7 \
2022-09-19 02:53:00 +02:00
doc/lightning-autoclean-status.7 \
2022-09-19 02:54:23 +02:00
doc/lightning-batching.7 \
2022-07-19 09:34:39 +02:00
doc/lightning-bkpr-channelsapy.7 \
doc/lightning-bkpr-dumpincomecsv.7 \
doc/lightning-bkpr-inspect.7 \
doc/lightning-bkpr-listaccountevents.7 \
doc/lightning-bkpr-listbalances.7 \
doc/lightning-bkpr-listincome.7 \
2023-07-21 03:25:45 +02:00
doc/lightning-blacklistrune.7 \
2018-12-07 18:31:16 +01:00
doc/lightning-check.7 \
2019-10-13 07:19:37 +02:00
doc/lightning-checkmessage.7 \
2023-07-21 03:25:45 +02:00
doc/lightning-checkrune.7 \
2018-04-10 08:03:15 +02:00
doc/lightning-close.7 \
2023-03-31 03:56:18 +02:00
doc/lightning-commando-blacklist.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-commando.7 \
2023-03-31 03:56:18 +02:00
doc/lightning-commando-listrunes.7 \
2022-07-16 15:18:27 +02:00
doc/lightning-commando-rune.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-connect.7 \
2020-12-14 02:21:48 +01:00
doc/lightning-createinvoice.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-createonion.7 \
2023-07-21 03:25:45 +02:00
doc/lightning-createrune.7 \
2021-08-25 04:50:12 +02:00
doc/lightning-datastore.7 \
2023-07-24 20:47:46 +02:00
doc/lightning-datastoreusage.7 \
2021-01-07 19:48:47 +01:00
doc/lightning-decode.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-decodepay.7 \
2021-08-25 04:50:12 +02:00
doc/lightning-deldatastore.7 \
2022-09-19 02:52:58 +02:00
doc/lightning-delforward.7 \
2017-01-23 01:05:27 +01:00
doc/lightning-delinvoice.7 \
2020-08-08 17:47:53 +02:00
doc/lightning-delpay.7 \
2024-01-25 01:28:54 +01:00
doc/lightning-deprecations.7 \
2024-02-06 06:56:24 +01:00
doc/lightning-dev-forget-channel.7 \
2024-11-11 03:50:06 +01:00
doc/lightning-dev-splice.7 \
2023-03-06 04:00:58 +01:00
doc/lightning-disableinvoicerequest.7 \
2021-02-18 00:56:19 +01:00
doc/lightning-disableoffer.7 \
2018-12-03 06:20:25 +01:00
doc/lightning-disconnect.7 \
2022-06-24 03:39:12 +02:00
doc/lightning-emergencyrecover.7 \
2024-09-06 07:37:57 +02:00
doc/lightning-exposesecret.7 \
2020-07-12 05:30:35 +02:00
doc/lightning-feerates.7 \
2021-01-07 19:45:47 +01:00
doc/lightning-fetchinvoice.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-fundchannel_cancel.7 \
doc/lightning-fundchannel_complete.7 \
2018-05-03 16:54:39 +02:00
doc/lightning-fundchannel.7 \
2019-06-06 01:32:04 +02:00
doc/lightning-fundchannel_start.7 \
2021-07-15 18:48:36 +02:00
doc/lightning-funderupdate.7 \
2020-07-15 07:39:47 +02:00
doc/lightning-fundpsbt.7 \
2024-08-08 07:49:25 +02:00
doc/lightning-getemergencyrecoverdata.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-getinfo.7 \
doc/lightning-getlog.7 \
2017-01-23 01:05:27 +01:00
doc/lightning-getroute.7 \
2024-08-07 03:49:52 +02:00
doc/lightning-getroutes.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-help.7 \
2024-10-22 04:59:47 +02:00
doc/lightning-injectpaymentonion.7 \
2017-01-23 01:05:27 +01:00
doc/lightning-invoice.7 \
2023-03-06 04:00:58 +01:00
doc/lightning-invoicerequest.7 \
2020-07-01 13:35:58 +02:00
doc/lightning-keysend.7 \
2024-11-09 07:28:20 +01:00
doc/lightning-listaddresses.7 \
2019-01-07 20:09:59 +01:00
doc/lightning-listchannels.7 \
2023-03-20 01:21:50 +01:00
doc/lightning-listclosedchannels.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-listconfigs.7 \
2021-08-25 04:50:12 +02:00
doc/lightning-listdatastore.7 \
2019-01-11 23:05:46 +01:00
doc/lightning-listforwards.7 \
2018-04-26 12:22:09 +02:00
doc/lightning-listfunds.7 \
2022-09-19 02:49:53 +02:00
doc/lightning-listhtlcs.7 \
2023-03-06 04:00:58 +01:00
doc/lightning-listinvoicerequests.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-listinvoices.7 \
doc/lightning-listnodes.7 \
2021-02-18 00:56:19 +01:00
doc/lightning-listoffers.7 \
2019-02-23 06:00:04 +01:00
doc/lightning-listpays.7 \
2023-01-12 02:16:10 +01:00
doc/lightning-listpeerchannels.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-listpeers.7 \
2019-02-23 06:00:04 +01:00
doc/lightning-listsendpays.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-listtransactions.7 \
2022-06-24 03:39:12 +02:00
doc/lightning-makesecret.7 \
2020-09-09 05:11:37 +02:00
doc/lightning-multifundchannel.7 \
2020-09-09 12:26:14 +02:00
doc/lightning-multiwithdraw.7 \
2018-04-26 12:22:09 +02:00
doc/lightning-newaddr.7 \
2020-10-12 07:33:50 +02:00
doc/lightning-notifications.7 \
2021-01-07 19:45:47 +01:00
doc/lightning-offer.7 \
2021-03-09 22:14:08 +01:00
doc/lightning-openchannel_abort.7 \
2021-03-11 05:33:47 +01:00
doc/lightning-openchannel_bump.7 \
2020-09-03 20:01:45 +02:00
doc/lightning-openchannel_init.7 \
2020-09-10 21:43:40 +02:00
doc/lightning-openchannel_signed.7 \
doc/lightning-openchannel_update.7 \
2021-06-23 21:31:47 +02:00
doc/lightning-parsefeerate.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-pay.7 \
doc/lightning-ping.7 \
2019-08-10 01:22:23 +02:00
doc/lightning-plugin.7 \
2022-09-13 18:37:05 +02:00
doc/lightning-preapproveinvoice.7 \
2022-12-06 05:11:36 +01:00
doc/lightning-preapprovekeysend.7 \
2024-08-05 19:13:18 +02:00
doc/lightning-reckless.7 \
2022-06-24 03:39:12 +02:00
doc/lightning-recoverchannel.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-recover.7 \
2023-08-07 11:30:20 +02:00
doc/lightning-renepay.7 \
doc/lightning-renepaystatus.7 \
2020-06-10 02:20:18 +02:00
doc/lightning-reserveinputs.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-sendcustommsg.7 \
2021-01-07 19:45:47 +01:00
doc/lightning-sendinvoice.7 \
2019-11-14 17:51:28 +01:00
doc/lightning-sendonion.7 \
2017-01-23 01:05:27 +01:00
doc/lightning-sendpay.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-sendpsbt.7 \
2022-03-21 01:58:28 +01:00
doc/lightning-setchannel.7 \
2023-06-06 02:38:52 +02:00
doc/lightning-setconfig.7 \
2023-03-02 21:45:40 +01:00
doc/lightning-setpsbtversion.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-showrunes.7 \
2022-11-07 01:45:47 +01:00
doc/lightning-signinvoice.7 \
2019-10-13 07:19:37 +02:00
doc/lightning-signmessage.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-signpsbt.7 \
2023-08-03 21:34:14 +02:00
doc/lightning-splice_init.7 \
doc/lightning-splice_signed.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-splice_update.7 \
2024-03-25 01:37:45 +01:00
doc/lightning-staticbackup.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-stop.7 \
2019-06-05 09:00:05 +02:00
doc/lightning-txdiscard.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-txprepare.7 \
2019-06-05 09:00:05 +02:00
doc/lightning-txsend.7 \
2020-06-10 02:20:18 +02:00
doc/lightning-unreserveinputs.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-upgradewallet.7 \
2020-08-18 04:22:53 +02:00
doc/lightning-utxopsbt.7 \
2018-03-08 01:19:55 +01:00
doc/lightning-waitanyinvoice.7 \
2019-12-26 11:19:09 +01:00
doc/lightning-waitblockheight.7 \
2024-03-04 03:30:24 +01:00
doc/lightning-waitinvoice.7 \
doc/lightning-wait.7 \
2018-04-26 12:12:17 +02:00
doc/lightning-waitsendpay.7 \
2024-11-17 06:41:06 +01:00
doc/lightning-withdraw.7 \
doc/lightning-xpay.7
2017-01-23 01:05:27 +01:00
2023-02-06 02:51:30 +01:00
i f e q ( $( HAVE_SQLITE 3) , 1 )
2024-03-04 03:30:24 +01:00
GENERATE_MARKDOWN += doc/lightning-listsqlschemas.7 \
doc/lightning-sql.7
2023-02-06 02:51:30 +01:00
e n d i f
2024-03-04 03:30:24 +01:00
MANPAGES := $( GENERATE_MARKDOWN) \
doc/lightning-cli.1 \
doc/lightningd.8 \
doc/lightningd-config.5 \
doc/lightningd-rpc.7 \
doc/lightning-hsmtool.8 \
doc/reckless.7
MARKDOWN_WITH_SCHEMA := $( GENERATE_MARKDOWN:= .md)
2024-02-23 06:45:08 +01:00
# - Read the json template from schemas/lightning-sql-template.json
# - Generate the tables schema via plugins/sql
# - Merge both and generate final schemas/lightning-sql.json
doc/schemas/lightning-sql.json : doc /schemas /lightning -sql -template .json plugins /sql
@plugins/sql --print-docs | jq --arg sqldata " $$ (awk '{printf " %s\n " , $$ 0}') " '.tables += [$$sqldata]' $< > " $@ .tmp " && mv " $@ .tmp " " $@ " ;
2024-03-04 03:30:24 +01:00
2021-12-06 01:03:52 +01:00
doc-all : $( MANPAGES ) doc /index .rst
2021-11-04 15:13:43 +01:00
2024-06-28 03:46:40 +02:00
SCHEMAS := $( wildcard doc/schemas/lightning-*.json) $( wildcard doc/schemas/notification/*.json)
2024-03-04 03:30:24 +01:00
# Don't try to build lightning-sql.json tables with plugins/sql if we don't have sqlite3
i f e q ( $( HAVE_SQLITE 3) , 0 )
SCHEMAS := $( filter-out doc/schemas/lightning-sql.json, $( SCHEMAS) )
e n d i f
2021-12-06 01:03:52 +01:00
check-fmt-schemas : $( SCHEMAS :%=check -fmt -schema /%)
2022-02-05 14:38:18 +01:00
fmt-schemas : $( SCHEMAS :%=fmt -schema /%)
2021-11-04 15:13:43 +01:00
2021-12-06 01:03:52 +01:00
check-fmt-schema/% : %
@jq . < " $* " > " $* " .fmt && diff -u " $* " " $* .fmt " && rm " $* .fmt "
2022-02-05 14:38:18 +01:00
fmt-schema/% : %
@jq . < " $* " > " $* " .fmt && cat " $* " .fmt > " $* " && rm " $* .fmt "
2021-12-06 01:03:52 +01:00
check-doc : check -config -docs check -manpages check -fmt -schemas
2017-01-23 01:05:27 +01:00
2021-05-26 07:49:01 +02:00
# These are hard to use in $(call) functions.
LBRACKET = (
RBRACKET = )
2024-03-04 03:30:24 +01:00
$(MARKDOWN_WITH_SCHEMA) : doc /lightning -%.7.md : doc /schemas /lightning -%.json tools /fromschema .py
@tools/fromschema.py --markdownfile= $@ $< > $@ .tmp && mv $@ .tmp $@
2021-05-26 07:49:01 +02:00
2022-09-06 06:10:32 +02:00
# If we need to build lowdown, make tools/md2man.sh depend on it.
# That way it's not used in SHA256STAMP (which only uses direct
# dependencies), but make will be forced to build it.
i f e q ( $( HAVE_LOWDOWN ) , 0 )
LOWDOWN := $( TARGET_DIR) /lowdown-build/bin/lowdown
tools/md2man.sh : $( LOWDOWN )
touch $@
e l s e
LOWDOWN := lowdown
e n d i f
2024-07-02 04:02:07 +02:00
# For versions in documentation, we don't change with every git version, to
2024-09-24 03:37:42 +02:00
# save build time. We build them on new tags or keep them on pre-next-release version.
2024-07-02 04:02:07 +02:00
doc/.doc_version : version_gen .h
2024-09-24 03:37:42 +02:00
@case " $( VERSION) " in \
*-*-g*) \
DOC_VERSION = " pre- $( CLN_NEXT_VERSION) " ; ; \
*) \
DOC_VERSION = " $( VERSION) " ; ; \
esac ; \
echo $$ DOC_VERSION > $@ .new
2024-07-02 04:02:07 +02:00
@if cmp $@ .new $@ >/dev/null 2>& 1; then rm -f $@ .new; else mv $@ .new $@ ; $( ECHO) Documentation version updated to ` cat doc/.doc_version` ; fi
$(MANPAGES) : doc /%: doc /%.md tools /md 2man .sh doc /.doc_version
@VERSION= ` cat doc/.doc_version` tools/md2man.sh $( LOWDOWN) $< > $@
2017-01-23 01:05:27 +01:00
doc/protocol-%.svg : test /test_protocol
test/test_protocol --svg < test/commits/$* .script > $@
protocol-diagrams : $( patsubst %.script , doc /protocol -%.svg , $ ( notdir $ ( wildcard test /commits /*.script ) ) )
doc/deployable-lightning.pdf : doc /deployable -lightning .lyx doc /bitcoin .bib
lyx -E pdf $@ $<
doc/deployable-lightning.tex : doc /deployable -lightning .lyx
lyx -E latex $@ $<
state-diagrams : doc /normal -states .svg doc /simplified -states .svg doc /error -states .svg doc /full -states .svg
%.svg : %.dot
dot -Tsvg $< > $@ || ( rm -f $@ ; false )
doc/simplified-states.dot : test /test_state_coverage
test/test_state_coverage --dot --dot-simplify > $@
doc/normal-states.dot : test /test_state_coverage
test/test_state_coverage --dot > $@
doc/error-states.dot : test /test_state_coverage
test/test_state_coverage --dot-all --dot-include-errors > $@
doc/full-states.dot : test /test_state_coverage
test/test_state_coverage --dot-all --dot-include-errors --dot-include-nops > $@
clean : doc -clean
2018-05-17 06:46:22 +02:00
check : check -manpages
2019-08-22 08:17:24 +02:00
# This needs plugins, too.
2022-04-12 06:59:30 +02:00
check-manpages : all -programs check -config -docs default -targets
2019-08-10 12:50:31 +02:00
@tools/check-manpage.sh cli/lightning-cli doc/lightning-cli.1.md
@tools/check-manpage.sh "lightningd/lightningd --lightning-dir=/tmp/" doc/lightningd-config.5.md
2022-11-11 02:49:29 +01:00
@awk '/^$$/ { do { getline } while ($$0 ~ /^( {4,}|\t)/) } /^\s*```/ { do { getline } while ($$0 !~ /^\s*```/) } /^([^`_\\]|`([^`\\]|\\.)*`|\b_|_\b|\\.)*\B_\B/ { print "" ; print "Unescaped underscore at " FILENAME ":" NR ":" ; print ; ret = 1 } ENDFILE { NR = 0 } END { exit ret }' doc/*.[ 0-9] .md
2017-01-23 01:05:27 +01:00
2021-06-16 03:12:17 +02:00
# Makes sure that fields mentioned in schema are in man page, and vice versa.
check-config-docs :
2024-03-04 03:30:24 +01:00
@for c in ` sed -n 's/^ "\(.*\)": {/\1/p' doc/schemas/lightning-listconfigs.json | grep -v '^# version$$' | grep -v '^plugins$$' | grep -v '^important-plugins$$' ` ; do if ! grep -q " ^ \*\* $$ c\*\* " doc/lightningd-config.5.md; then echo " $$ c undocumented! " ; exit 1; fi ; done
@for c in ` grep -v '\[plugin ' doc/lightningd-config.5.md | sed -n 's/^ \*\*\([^*]*\)\*\*.*/\1/p' | grep -v '^\(help\|version\|mainnet\|testnet\|signet\|plugin\|important-plugin\|plugin-dir\|clear-plugins\)$$' ` ; do if ! grep -q '"' " $$ c " '"' doc/schemas/lightning-listconfigs.json; then echo " $$ c documented but not in schema! " ; exit 1; fi ; done
2021-06-16 03:12:17 +02:00
2017-01-23 01:05:27 +01:00
doc-clean :
2024-07-02 04:02:07 +02:00
$( RM) $( MANPAGES) $( MARKDOWN_WITH_SCHEMA) doc/.doc_version
2017-01-23 01:05:27 +01:00
$( RM) doc/deployable-lightning.{ aux,bbl,blg,dvi,log,out,tex}
2024-11-06 04:19:12 +01:00
doc/index.rst : $( MANPAGES :=.md ) Makefile
2022-12-01 13:31:30 +01:00
@$( call VERBOSE, " genidx $@ " , \
2024-11-06 04:19:12 +01:00
for m in $( MANPAGES) ; do basename $$ m; done | \
LC_ALL = C sort | \
sed "s/\(.*\)\.\(.*\)/\1 <\1.\2.md>/" | \
2023-08-28 04:12:08 +02:00
$( PYTHON) devtools/blockreplace.py doc/index.rst manpages --language= rst --indent " " \
2022-12-01 13:31:30 +01:00
)
2023-01-10 00:53:26 +01:00
2023-06-01 08:17:20 +02:00
# Overridden by GH CI if necessary.
BASE_REF = master
2023-10-03 16:16:44 +02:00
check-source :