# **************************************************************************** #
# This makefile builds one lang's components for MS Office 2011 proofing tools #
# **************************************************************************** #

# Needed to get the correct hyphenation pattern file:
LANG       := $(shell pwd | rev | cut -d '/' -f1 | rev)

# Language-specific paths:
SHAREDLIB   = $(TOOLLIBS)/shared/$(LANG)
RESOURCES   = $(TOOLLIBS)/mac/MSOffice/2011/$(LANG)

##################################################
#***** start of language-specific variables: *****
WINSPELL     = mssp3samiNorthern.lex
HYPHPATTERNS = SamiNorthy-patlx

SPELLIB = SamiNortAsCatalanSpeller
HYPHLIB = SamiNortAsCatalanHyphenation

SPELROOT = SamiNortAsCatalan\ Speller.proofingtool
HYPHROOT = SamiNortAsCatalan\ Hyphenator.proofingtool

SPELSUBDIR = SamiNortAsCatalan\ Speller.lexicon/Contents/Resources
HYPHSUBDIR = SamiNortAsCatalan\ Hyphenation.lexicon/Contents/Resources
#****** end of language-specific variables: ******
##################################################

FULLSPELDIR = $(SPELROOT)/Contents/SharedSupport/$(SPELSUBDIR)
FULLHYPHDIR = $(HYPHROOT)/Contents/SharedSupport/$(HYPHSUBDIR)

all: dirs lex lib res

dirs:
	@echo "*** Setting up dirs ***"
	$(MKDIR) $(COMPONENTDIR)/$(FULLSPELDIR)
	$(MKDIR) $(COMPONENTDIR)/$(FULLHYPHDIR)
	$(MKDIR) $(COMPONENTDIR)/$(SPELROOT)/Contents/MacOS
	$(MKDIR) $(COMPONENTDIR)/$(HYPHROOT)/Contents/MacOS

lex:
	@echo "*** Copying lexicon files ***"
	$(CP) $(DOWNLOADDIR)/$(WINSPELL)        $(COMPONENTDIR)/$(FULLSPELDIR)/LexiconData
	$(CP) $(DOWNLOADDIR)/$(WINSPELL)        $(COMPONENTDIR)/$(FULLHYPHDIR)/LexiconData-dic
	$(CP) $(SHAREDLIB)/hyph/$(HYPHPATTERNS) $(COMPONENTDIR)/$(FULLHYPHDIR)/LexiconData

lib:
	@echo "*** Copying library files ***"
	$(CP) $(RESOURCES)/spell/$(SPELLIB) $(COMPONENTDIR)/$(SPELROOT)/Contents/MacOS/
	$(CP) $(RESOURCES)/hyph/$(HYPHLIB)  $(COMPONENTDIR)/$(HYPHROOT)/Contents/MacOS/

res:
	@echo "*** Copying resource files ***"
	$(CP) $(RESOURCES)/spell/Info.plist $(COMPONENTDIR)/$(SPELROOT)/Contents/
	$(CP) $(RESOURCES)/hyph/Info.plist  $(COMPONENTDIR)/$(HYPHROOT)/Contents/
	$(CP) $(RESOURCES)/spell/PkgInfo    $(COMPONENTDIR)/$(SPELROOT)/Contents/
	$(CP) $(RESOURCES)/hyph/PkgInfo     $(COMPONENTDIR)/$(HYPHROOT)/Contents/