runtime(doc): improve doc makefiles, add clean rule (#13855)

Signed-off-by: RestorerZ <restorer@mail2k.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/Makefile b/runtime/doc/Makefile
index fc04287..eecce55 100644
--- a/runtime/doc/Makefile
+++ b/runtime/doc/Makefile
@@ -18,6 +18,7 @@
 
 .SUFFIXES:
 .SUFFIXES: .c .o .txt .html
+.PHONY: all vimtags noerrors perlhtml clean test_urls
 
 all: tags vim.man evim.man vimdiff.man vimtutor.man xxd.man $(CONVERTED)
 
@@ -28,26 +29,26 @@
 
 # Use "doctags" to generate the tags file.  Only works for English!
 tags: doctags $(DOCS)
-	./doctags $(DOCS) | LANG=C LC_ALL=C sort >tags
+	./doctags $(DOCS) | LANG=C LC_ALL=C sort >$@
 	uniq -d -2 tags
 
 doctags: doctags.c
 	$(CC) doctags.c -o doctags
 
 vim.man: vim.1
-	nroff -man vim.1 | sed -e s/.//g > vim.man
+	nroff -man $< | sed -e s/.//g > $@
 
 evim.man: evim.1
-	nroff -man evim.1 | sed -e s/.//g > evim.man
+	nroff -man $< | sed -e s/.//g > $@
 
 vimdiff.man: vimdiff.1
-	nroff -man vimdiff.1 | sed -e s/.//g > vimdiff.man
+	nroff -man $< | sed -e s/.//g > $@
 
 vimtutor.man: vimtutor.1
-	nroff -man vimtutor.1 | sed -e s/.//g > vimtutor.man
+	nroff -man $< | sed -e s/.//g > $@
 
 xxd.man: xxd.1
-	nroff -man xxd.1 | sed -e s/.//g > xxd.man
+	nroff -man $< | sed -e s/.//g > $@
 
 uganda.nsis.txt: uganda.txt
 	sed -e 's/[ 	]*\*[-a-zA-Z0-9.]*\*//g' -e 's/vim:tw=78:.*//' \
@@ -68,10 +69,10 @@
 # index.html is the starting point for HTML, but for the help files it is
 # help.txt.  Therefore use vimindex.html for index.txt.
 index.html: help.txt
-	$(AWK) -f makehtml.awk help.txt >index.html
+	$(AWK) -f makehtml.awk $< >$@
 
 vimindex.html: index.txt
-	$(AWK) -f makehtml.awk index.txt >vimindex.html
+	$(AWK) -f makehtml.awk $< >$@
 
 tags.ref tags.html: tags
 	$(AWK) -f maketags.awk tags >tags.html
@@ -84,7 +85,7 @@
 
 # Check URLs in the help with "curl".
 test_urls:
-	vim -S test_urls.vim
+	$(VIMEXE) --clean -S test_urls.vim
 
 clean:
 	-rm -f doctags *.html tags.ref
@@ -92,58 +93,58 @@
 # These files are in the extra archive, skip if not present
 
 arabic.txt:
-	touch arabic.txt
+	touch $@
 
 farsi.txt:
-	touch farsi.txt
+	touch $@
 
 hebrew.txt:
-	touch hebrew.txt
+	touch $@
 
 russian.txt:
-	touch russian.txt
+	touch $@
 
 gui_w32.txt:
-	touch gui_w32.txt
+	touch $@
 
 if_ole.txt:
-	touch if_ole.txt
+	touch $@
 
 os_390.txt:
-	touch os_390.txt
+	touch $@
 
 os_amiga.txt:
-	touch os_amiga.txt
+	touch $@
 
 os_beos.txt:
-	touch os_beos.txt
+	touch $@
 
 os_dos.txt:
-	touch os_dos.txt
+	touch $@
 
 os_haiku.txt:
-	touch os_haiku.txt
+	touch $@
 
 os_mac.txt:
-	touch os_mac.txt
+	touch $@
 
 os_mint.txt:
-	touch os_mint.txt
+	touch $@
 
 os_msdos.txt:
-	touch os_msdos.txt
+	touch $@
 
 os_os2.txt:
-	touch os_os2.txt
+	touch $@
 
 os_qnx.txt:
-	touch os_qnx.txt
+	touch $@
 
 os_risc.txt:
-	touch os_risc.txt
+	touch $@
 
 os_win32.txt:
-	touch os_win32.txt
+	touch $@
 
 # Note that $< works with GNU make while $> works for BSD make.
 # Is there a solution that works for both??