diff src/po/Makefile @ 34178:c5a10c03afb8 v9.1.0044

patch 9.1.0044: po Makefiles can be improved Commit: https://github.com/vim/vim/commit/76ba724e1d56b00e72834a9203855f0656dcbb58 Author: RestorerZ <restorer@mail2k.ru> Date: Mon Jan 22 20:28:12 2024 +0100 patch 9.1.0044: po Makefiles can be improved Problem: po Makefiles can be improved Solution: Improve the style of the Makefiles, update Makefile variables, update documentation (RestorerZ) closes: #13858 closes: #13857 Signed-off-by: RestorerZ <restorer@mail2k.ru> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Mon, 22 Jan 2024 20:45:03 +0100
parents 2b222b99faec
children 748a8a413816
line wrap: on
line diff
--- a/src/po/Makefile
+++ b/src/po/Makefile
@@ -26,7 +26,14 @@ MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_
 
 .SUFFIXES:
 .SUFFIXES: .po .mo .pot .ck
-.PHONY: all install uninstall prefixcheck converted check clean checkclean distclean update-po $(LANGUAGES)
+.PHONY: all install uninstall prefixcheck originals converted check clean \
+	checkclean distclean update-po $(LANGUAGES)
+
+all: $(MOFILES) $(MOCONVERTED) $(MSGFMT_DESKTOP)
+
+originals: $(MOFILES)
+
+converted: $(MOCONVERTED)
 
 .po.mo:
 	$(MSGFMTCMD) -o $@ $<
@@ -36,8 +43,6 @@ MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_
 		-c "if error == 0 | q | else | num 2 | cq | endif" $<
 	touch $@
 
-all: $(MOFILES) $(MOCONVERTED) $(MSGFMT_DESKTOP)
-
 check: $(CHECKFILES)
 
 # installing for real
@@ -84,12 +89,10 @@ tryoutinstall: $(MOFILES) $(MOCONVERTED)
 	  fi; \
 	done
 
-converted: $(MOCONVERTED)
-
 # nl.po was added later, if it does not exist use a file with just a # in it
 # (an empty file doesn't work with old msgfmt).
 nl.po:
-	@( echo \# > nl.po )
+	@( echo \# >> nl.po )
 
 # Norwegian/Bokmal: "nb" is an alias for "no".
 # Copying the file is not efficient, but I don't know of another way to make
@@ -102,75 +105,75 @@ nb.po: no.po
 # ja.sjis.po is outdated.
 ja.sjis.po: ja.po
 	@$(MAKE) sjiscorr
-	rm -f ja.sjis.po
-	iconv -f UTF-8 -t CP932 ja.po | ./sjiscorr > ja.sjis.po
+	rm -f $@
+	iconv -f UTF-8 -t CP932 $< | ./sjiscorr > $@
 
 sjiscorr: sjiscorr.c
 	$(CC) -o sjiscorr sjiscorr.c
 
 ja.euc-jp.po: ja.po
-	iconv -f UTF-8 -t EUC-JP ja.po | \
+	iconv -f UTF-8 -t EUC-JP $< | \
 		$(SED) -e 's/charset=[uU][tT][fF]-8/charset=EUC-JP/' \
-			-e 's/# Original translations/# Generated from ja.po, DO NOT EDIT/' \
-			> ja.euc-jp.po
+			-e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \
+			> $@
 
 # Convert cs.po to create cs.cp1250.po.
 cs.cp1250.po: cs.po
-	rm -f cs.cp1250.po
-	iconv -f ISO-8859-2 -t CP1250 cs.po | \
+	rm -f $@
+	iconv -f ISO-8859-2 -t CP1250 $< | \
 		$(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=CP1250/' \
-			-e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' \
-			> cs.cp1250.po
+			-e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \
+			> $@
 
 # Convert pl.po to create pl.cp1250.po.
 pl.cp1250.po: pl.po
-	rm -f pl.cp1250.po
-	iconv -f ISO-8859-2 -t CP1250 pl.po | \
+	rm -f $@
+	iconv -f ISO-8859-2 -t CP1250 $< | \
 		$(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=CP1250/' \
-			-e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' \
-			> pl.cp1250.po
+			-e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \
+			> $@
 
 # Convert pl.po to create pl.UTF-8.po.
 pl.UTF-8.po: pl.po
-	rm -f pl.UTF-8.po
-	iconv -f ISO-8859-2 -t UTF-8 pl.po | \
+	rm -f $@
+	iconv -f ISO-8859-2 -t UTF-8 $< | \
 		$(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=UTF-8/' \
-			-e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' \
-			> pl.UTF-8.po
+			-e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \
+			> $@
 
 # Convert sk.po to create sk.cp1250.po.
 sk.cp1250.po: sk.po
-	rm -f sk.cp1250.po
-	iconv -f ISO-8859-2 -t CP1250 sk.po | \
+	rm -f $@
+	iconv -f ISO-8859-2 -t CP1250 $< | \
 		$(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=CP1250/' \
-			-e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' \
-			> sk.cp1250.po
+			-e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \
+			> $@
 
 # Convert zh_CN.UTF-8.po to create zh_CN.po.
 zh_CN.po: zh_CN.UTF-8.po
-	rm -f zh_CN.po
-	iconv -f UTF-8 -t GB2312 zh_CN.UTF-8.po | \
+	rm -f $@
+	iconv -f UTF-8 -t GB2312 $< | \
 		$(SED) -e 's/charset=[uU][tT][fF]-8/charset=GB2312/' \
-			-e 's/# Original translations/# Generated from zh_CN.UTF-8.po, DO NOT EDIT/' \
-			> zh_CN.po
+			-e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \
+			> $@
 
 # Convert zh_CN.UTF-8.po to create zh_CN.cp936.po.
 # Set 'charset' to gbk to avoid that msfmt generates a warning.
 # This used to convert from zh_CN.po, but that results in a conversion error.
 zh_CN.cp936.po: zh_CN.UTF-8.po
-	rm -f zh_CN.cp936.po
-	iconv -f UTF-8 -t CP936 zh_CN.UTF-8.po | \
+	rm -f $@
+	iconv -f UTF-8 -t CP936 $< | \
 		$(SED) -e 's/charset=[uU][tT][fF]-8/charset=GBK/' \
-			-e 's/# Original translations/# Generated from zh_CN.UTF-8.po, DO NOT EDIT/' \
-			> zh_CN.cp936.po
+			-e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \
+			> $@
 
 # Convert zh_TW.UTF-8.po to create zh_TW.po
 zh_TW.po: zh_TW.UTF-8.po
-	rm -f zh_TW.po
-	iconv -f UTF-8 -t BIG5 zh_TW.UTF-8.po | \
+	rm -f $@
+	iconv -f UTF-8 -t BIG5 $< | \
 		$(SED) -e 's/charset=[uU][tT][fF]-8/charset=BIG5/' \
-			-e 's/# Original translations/# Generated from zh_TW.UTF-8.po, DO NOT EDIT/' \
-			> zh_TW.po
+			-e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \
+			> $@
 
 
 # Convert zh_TW.UTF-8.po to create zh_TW.po with backslash characters
@@ -192,8 +195,8 @@ zh_TW.po: zh_TW.UTF-8.po
 
 #zh_TW.po: zh_TW.UTF-8.po
 #	@$(MAKE) big5corr
-#	rm -f zh_TW.po
-#	iconv -f UTF-8 -t BIG5 zh_TW.UTF-8.po | ./big5corr > zh_TW.po
+#	rm -f $@
+#	iconv -f UTF-8 -t BIG5 $< | ./big5corr > $@
 
 
 # 06.11.23, added by Restorer
@@ -204,32 +207,32 @@ zh_TW.po: zh_TW.UTF-8.po
 
 # Convert ko.UTF-8.po to create ko.po.
 ko.po: ko.UTF-8.po
-	rm -f ko.po
-	iconv -f UTF-8 -t EUC-KR ko.UTF-8.po | \
+	rm -f $@
+	iconv -f UTF-8 -t EUC-KR $< | \
 		$(SED) -e 's/charset=[uU][tT][fF]-8/charset=EUC-KR/' \
-			-e 's/# Original translations/# Generated from ko.UTF-8.po, DO NOT EDIT/' \
-			> ko.po
+			-e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \
+			> $@
 
 # Convert ru.po to create ru.cp1251.po.
 ru.cp1251.po: ru.po
-	rm -f ru.cp1251.po
-	iconv -f UTF-8 -t CP1251 ru.po | \
+	rm -f $@
+	iconv -f UTF-8 -t CP1251 $< | \
 		$(SED) -e 's/charset=[uU][tT][fF]-8/charset=CP1251/' \
-			-e 's/# Original translations/# Generated from ru.po, DO NOT EDIT/' \
-			> ru.cp1251.po
+			-e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \
+			> $@
 
 # Convert uk.po to create uk.cp1251.po.
 uk.cp1251.po: uk.po
-	rm -f uk.cp1251.po
-	iconv -f UTF-8 -t CP1251 uk.po | \
+	rm -f $@
+	iconv -f UTF-8 -t CP1251 $< | \
 		$(SED) -e 's/charset=[uU][tT][fF]-8/charset=CP1251/' \
-			-e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' \
-			> uk.cp1251.po
+			-e 's/# Original translations/# Generated from $<, DO NOT EDIT/' \
+			> $@
 
 prefixcheck:
 	@if test "x" = "x$(prefix)"; then \
 	  echo "******************************************"; \
-	  echo "  please use make from the src directory  "; \
+	  echo "  Please use make from the src directory  "; \
 	  echo "******************************************"; \
 	  exit 1; \
 	fi
@@ -283,7 +286,7 @@ gvim.desktop: gvim.desktop.in $(POFILES)
 	if command -v desktop-file-validate; then desktop-file-validate tmp_gvim.desktop; fi
 	mv tmp_gvim.desktop gvim.desktop
 
-# When updating ja.sjis.po there are a bunch of errors and a crash.
+# Only original translations with default encoding should be updated.
 # The files that are converted to a different encoding clearly state "DO NOT EDIT".
 update-po: $(MOFILES:.mo=)