1 # 2 # CDDL HEADER START 3 # 4 # The contents of this file are subject to the terms of the 5 # Common Development and Distribution License, Version 1.0 only 6 # (the "License"). You may not use this file except in compliance 7 # with the License. 8 # 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 # or http://www.opensolaris.org/os/licensing. 11 # See the License for the specific language governing permissions 12 # and limitations under the License. 13 # 14 # When distributing Covered Code, include this CDDL HEADER in each 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 # If applicable, add the following below this CDDL HEADER, with the 17 # fields enclosed by brackets "[]" replaced with your own identifying 18 # information: Portions Copyright [yyyy] [name of copyright owner] 19 # 20 # CDDL HEADER END 21 # 22 # Copyright 2008 Sine Nomine Associates. All rights reserved. 23 # Use is subject to license terms. 24 # 25 # 26 # Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. 27 # Use is subject to license terms. 28 # 29 # Makefile.msg.targ 30 # 31 32 # 33 # This file contains common targets for building message catalogues. 34 # Over time, existing Makefiles should be rewritten to include this file 35 # rather than use their own private copy of these rules. 36 # 37 38 .PARALLEL: $(POFILES) $(MSGFILES) 39 40 $(MSGDOMAIN) $(DCMSGDOMAIN): 41 $(INS.dir) 42 43 $(MSGDOMAINPOFILE): $(MSGDOMAIN) $(POFILE) 44 $(RM) $@; $(CP) $(POFILE) $@ 45 46 $(DCMSGDOMAINPOFILE): $(DCMSGDOMAIN) $(DCFILE) 47 $(RM) $@; $(CP) $(DCFILE) $@ 48 49 BUILDPO.msgfiles = \ 50 $(RM) messages.po $(TEXT_DOMAIN).po; \ 51 $(TOUCH) $(TEXT_DOMAIN).po; \ 52 $(XGETTEXT) $(XGETFLAGS) $(MSGFILES); \ 53 $(SED) -e '/^\# msgid/,/^\# msgstr/d' -e '/^domain/d' \ 54 messages.po $(TEXT_DOMAIN).po > $(POFILE); \ 55 $(RM) messages.po $(TEXT_DOMAIN).po 56 57 BUILDPO.pofiles = \ 58 $(RM) $(POFILE); \ 59 $(NAWK) '\ 60 FNR == 1 { print "\# Messages from " FILENAME; } \ 61 /^domain/ { next; } \ 62 /^msgid/, /^msgstr/ { msg = msg "\n" $$0; \ 63 if ( $$0 !~ /^msgstr/ ) next; \ 64 if (msg in messages) { \ 65 gsub(/\n/, "\n\# ", msg); \ 66 } else { \ 67 messages[msg] = 1; \ 68 } \ 69 sub(/^\n/, "", msg); \ 70 print msg; \ 71 msg = ""; \ 72 next; \ 73 } \ 74 /^\# [\.]*Messages/ { sub(/Messages/, "...Messages"); } \ 75 { print; }' $(POFILES) > $(POFILE) 76 77 pofile_MSGFILES: 78 $(BUILDPO.msgfiles) 79 80 pofile_POFILES: 81 $(BUILDPO.pofiles) 82