1# 2# Locale file makefile for CUPS. 3# 4# Copyright © 2007-2019 by Apple Inc. 5# Copyright © 1993-2007 by Easy Software Products. 6# 7# Licensed under Apache License v2.0. See the file "LICENSE" for more 8# information. 9# 10 11include ../Makedefs 12 13 14OBJS = checkpo.o po2strings.o strings2po.o 15TARGETS = checkpo po2strings strings2po 16 17 18# 19# Make everything... 20# 21 22all: $(TARGETS) 23 24 25# 26# Make library targets... 27# 28 29libs: 30 31 32# 33# Make unit tests... 34# 35 36unittests: 37 38 39# 40# Clean all config and object files... 41# 42 43clean: 44 $(RM) $(TARGETS) $(OBJS) 45 46 47# 48# Update dependencies (without system header dependencies...) 49# 50 51depend: 52 $(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies 53 54 55# 56# Install all targets... 57# 58 59install: all install-data install-headers install-libs install-exec 60 61 62# 63# Install data files... 64# 65 66install-data: $(INSTALL_LANGUAGES) 67 68install-languages: 69 $(INSTALL_DIR) -m 755 $(LOCALEDIR) 70 for loc in en $(LANGUAGES) ; do \ 71 if test -f cups_$$loc.po; then \ 72 $(INSTALL_DIR) -m 755 $(LOCALEDIR)/$$loc ; \ 73 $(INSTALL_DATA) cups_$$loc.po $(LOCALEDIR)/$$loc/cups_$$loc.po ; \ 74 fi ; \ 75 done 76 77install-langbundle: 78 $(INSTALL_DIR) -m 755 "$(BUILDROOT)$(RESOURCEDIR)" 79 $(INSTALL_DATA) cups.strings "$(BUILDROOT)$(RESOURCEDIR)" 80 81 82# 83# Install programs... 84# 85 86install-exec: 87 88 89# 90# Install headers... 91# 92 93install-headers: 94 95 96# 97# Install libraries... 98# 99 100install-libs: 101 102 103# 104# Uninstall files... 105# 106 107uninstall: $(UNINSTALL_LANGUAGES) 108 109uninstall-languages: 110 -for loc in en $(LANGUAGES) ; do \ 111 $(RM) $(LOCALEDIR)/$$loc/cups_$$loc.po ; \ 112 done 113 114uninstall-langbundle: 115 $(RM) "$(BUILDROOT)$(RESOURCEDIR)/cups.strings" 116 117 118# 119# pot - Creates/updates the cups.pot template file, merges changes into existing 120# message catalogs, and updates the cups.strings file. We don't use 121# xgettext to update the cups.strings file due to known xgettext bugs. 122# 123 124pot: checkpo po2strings 125 echo Updating cups.pot... 126 mv cups.pot cups.pot.bck 127 touch cups.pot 128 cd ..; xgettext -o locale/cups.pot -cTRANSLATORS -s \ 129 --keyword=_ --no-wrap --from-code utf-8 \ 130 --copyright-holder="Apple Inc." \ 131 --package-name="CUPS" --package-version="$(CUPS_VERSION)" \ 132 --msgid-bugs-address="https://github.com/apple/cups/issues" \ 133 */*.c */*.cxx 134 (cat cups.header; tail +6 cups.pot) > cups.pot.N 135 mv cups.pot.N cups.pot 136 echo Checking cups.pot... 137 ./checkpo cups.pot 138 for loc in *.po ; do \ 139 if test $$loc = '*.po'; then \ 140 break; \ 141 fi; \ 142 echo Merging changes into $$loc... ; \ 143 msgmerge -o $$loc -s -N --no-location $$loc cups.pot ; \ 144 done 145 echo Updating cups.strings... 146 ./po2strings cups_en.po cups.strings 147 148cups.strings: cups_en.po po2strings 149 echo Updating cups.strings... 150 ./po2strings cups_en.po cups.strings 151 152 153# 154# checkpo - A simple utility to check PO files for correct translation 155# strings. Dependency on static library is deliberate. 156# 157# checkpo filename.po [... filenameN.po] 158# 159 160checkpo: checkpo.o ../cups/$(LIBCUPSSTATIC) 161 echo Linking $@... 162 $(LD_CC) $(ARCHFLAGS) $(ALL_LDFLAGS) -o checkpo checkpo.o \ 163 $(LINKCUPSSTATIC) 164 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 165 166checkall: checkpo 167 ./checkpo *.po *.strings 168 169 170# 171# po2strings - A simple utility which uses iconv to convert GNU gettext 172# message catalogs to macOS .strings files. 173# 174# po2strings filename.po filename.strings 175# 176 177po2strings: po2strings.o ../cups/$(LIBCUPSSTATIC) 178 echo Linking $@... 179 $(LD_CC) $(ARCHFLAGS) $(ALL_LDFLAGS) -o po2strings po2strings.o \ 180 $(LINKCUPSSTATIC) 181 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 182 183 184# 185# strings2po - A simple utility which uses iconv to convert macOS .strings files 186# to GNU gettext message catalogs. 187# 188# strings2po filename.strings filename.po 189# 190 191strings2po: strings2po.o 192 echo Linking $@... 193 $(LD_CC) $(ARCHFLAGS) $(ALL_LDFLAGS) -o strings2po strings2po.o 194 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 195 196 197# 198# Dependencies... 199# 200 201include Dependencies 202