# -*-mode: Makefile -*-

# Copyright 2002 by Eric House (fixin@peak.org).  All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

LANG=Catalan
LANGCODE=ct_CT
TARGET_TYPE ?= FRANK

ifeq ($(TARGET_TYPE),PALM)
PBITMS = ./bmps/palm
else
ifeq ($(TARGET_TYPE),FRANK)
PBITMS = ./bmps/franklin
endif
endif

LL_FILES = $(PBITMS)/large_ldotl.pbitm $(PBITMS)/small_ldotl.pbitm
NY_FILES = $(PBITMS)/large_ny.pbitm $(PBITMS)/small_ny.pbitm
QU_FILES = $(PBITMS)/large_qu.pbitm $(PBITMS)/small_qu.pbitm
BMPFILES = $(LL_FILES) $(NY_FILES) $(QU_FILES)

LANG_SPECIAL_INFO = \
		"L.L" $(LL_FILES) \
		"NY" $(NY_FILES) \
		"QU" $(QU_FILES)

include ../Makefile.2to8

include ../Makefile.langcommon


# Capitalize all, remove words where Q isn't followed by U and where Y
# is proceeded by other than N.  Finally remove words with illegal
# letters in them, translate letters to specials.

$(LANG)Main.dict.gz: XavSample.dict Makefile
	cat $< \
	| tr 'ça-z' 'ÇA-Z' \
	| grep -v 'Q[^U]' \
	| grep -v '[^N]Y' \
	| grep -v '^Y' \
	| grep '^[ÇA-JL-VXYZ\.]*$$' \
	| sed 's/L\.L/1/g' \
	| sed 's/NY/2/g' \
	| sed 's/QU/3/g' \
	| tr '123' '\001\002\003' \
	| gzip - > $@ 


clean: clean_common
	rm -rf *.saved