Improve how the help lines are harvested from the md file.
authorWayne Davison <wayne@opencoder.net>
Fri, 12 Jun 2020 15:42:59 +0000 (08:42 -0700)
committerWayne Davison <wayne@opencoder.net>
Fri, 12 Jun 2020 15:50:51 +0000 (08:50 -0700)
Makefile.in
rsync.1.md

index 7cf73a388c813c9b6bacaad8001883351abd78dd..f6dd515ba12eee9456b46a57c13bcbd8dee5352e 100644 (file)
@@ -103,25 +103,15 @@ options.o: latest-year.h help-rsync.h help-rsyncd.h
 
 flist.o: rounding.h
 
-help-rsync.h: rsync.1.md
-       @sed -e '1,/^# OPTIONS SUMMARY/d' \
-           -e '1,/^```/d' \
-           -e '/^```/,$$d' \
-           -e 's/"/\\"/g' \
-           -e 's/^/  rprintf(F,"/' \
-           -e 's/$$/\\n");/' \
-           <"$(srcdir)/$<" >$@
-
-help-rsyncd.h: rsync.1.md
-       @sed -e '1,/^# OPTIONS SUMMARY/d' \
-           -e '1,/^```/d' \
-           -e '1,/^```/d' \
+help-rsync.h help-rsyncd.h: rsync.1.md
+       @sed -e '1,/^\[comment\].*$@/d' \
            -e '1,/^```/d' \
            -e '/^```/,$$d' \
            -e 's/"/\\"/g' \
            -e 's/^/  rprintf(F,"/' \
            -e 's/$$/\\n");/' \
            <"$(srcdir)/$<" >$@
+       @if ! test -s $@; then rm -f $@ ; echo "The Makefile generated an empty file: $@" ; exit 1 ; fi
 
 rounding.h: rounding.c rsync.h proto.h
        @for r in 0 1 3; do \
index 47b16acb61e36044e042c6ebe6908fe7d24e48c9..0af45bdaeb1cf39bdd1308098114816701504eae 100644 (file)
@@ -322,11 +322,12 @@ I mirror a directory between my "old" and "new" ftp sites with the command:
 
 This is launched from cron every few hours.
 
-# OPTIONS SUMMARY
+# OPTION SUMMARY
 
 Here is a short summary of the options available in rsync.  Please refer to the
 detailed description below for a complete description.
 
+[comment]: # (help-rsync.h)
 [comment]: # (Keep these short enough that they'll be under 80 chars when indented by 8 chars.)
 
 ```
@@ -468,6 +469,8 @@ detailed description below for a complete description.
 Rsync can also be run as a daemon, in which case the following options are
 accepted:
 
+[comment]: # (help-rsyncd.h)
+
 ```
 --daemon                 run as an rsync daemon
 --address=ADDRESS        bind to the specified address