mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-03-10 18:37:40 -04:00
Add a warning header to the generated help-*.h files.
This commit is contained in:
@@ -104,14 +104,7 @@ options.o: latest-year.h help-rsync.h help-rsyncd.h
|
||||
flist.o: rounding.h
|
||||
|
||||
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
|
||||
./help-from-md "$(srcdir)/$<" $@
|
||||
|
||||
rounding.h: rounding.c rsync.h proto.h
|
||||
@for r in 0 1 3; do \
|
||||
|
||||
33
help-from-md
Executable file
33
help-from-md
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ "$#" != 2 ]]; then
|
||||
echo "Usage: $0 MD_FILE HELP_FILE.h"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mdfile="$1"
|
||||
helpfile="$2"
|
||||
newfile="$helpfile.new"
|
||||
findfile="${helpfile/./\\.}"
|
||||
|
||||
sed -e '1,/^\[comment\].*'"$findfile"'/d' \
|
||||
-e '1,/^```/d' \
|
||||
-e '/^```/,$d' \
|
||||
-e 's/"/\\"/g' \
|
||||
-e 's/^/ rprintf(F,"/' \
|
||||
-e 's/$/\\n");/' \
|
||||
<"$mdfile" >"$newfile"
|
||||
|
||||
if [[ ! -s "$newfile" ]]; then
|
||||
rm "$newfile"
|
||||
echo "Discarding empty output for $helpfile file from $mdfile"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(cat <<EOT
|
||||
/* DO NOT EDIT THIS FILE! It is auto-generated from the option list in $mdfile! */
|
||||
|
||||
EOT
|
||||
cat "$newfile"
|
||||
) >"$helpfile"
|
||||
rm "$newfile"
|
||||
Reference in New Issue
Block a user