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