# # Copyright (C) 2001 Jean-Christophe FILLIATRE # 2002, 2003, 2004, 2005, 2006 Yamagata Yoriyuki # # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License version 2, as published by the Free Software Foundation. # # This library 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 Library General Public License version 2 for more details # (enclosed in the file COPYING). # where to install the binaries prefix=@prefix@ exec_prefix=@exec_prefix@ BINDIR=@bindir@ # where to install the data files DATADIR=@datadir@ # other variables set by ./configure CPP = @CPP@ OCAMLC = @OCAMLC@ OCAMLOPT = @OCAMLOPT@ OCAMLYACC = @OCAMLYACC@ OCAMLLEX = @OCAMLLEX@ OCAMLDEP = @OCAMLDEP@ OCAMLLIB = @OCAMLLIB@ OCAMLBEST= @OCAMLBEST@ OCAMLVERSION = @OCAMLVERSION@ CAMLP4O = -pp "@CAMLP4O@ -I $(OCAMLLIB)" INSTALL = @OCAMLINSTALL@ UNINSTALL = un@OCAMLINSTALL@ OCAMLDOC = @OCAMLDOC@ OCAMLMKLIB = @OCAMLMKLIB@ # compiler options BOPTIONS = @DEBUG@ OOPTIONS = @PROFILE@ # PACKAGE = camomile VERSION = @VERSION@ ################################################################### # Build procedure ################################################################### .PHONY : all byte opt tools toolslib test test.opt unimaps chamap_data unidata dist SUBDIR = -I internal -I public -I toolslib -I . INCLUDES = $(SUBDIR) BFLAGS = $(BOPTIONS) $(INCLUDES) OFLAGS = -for-pack CamomileLibrary $(OOPTIONS) $(INCLUDES) # Generic targets ################# all : byte $(OCAMLBEST) opt unidata unimaps charmap_data locale_data # Build the library ################### lib : byte $(OCAMLBEST) opt NOOBJ_INT= \ public/unicodeString.cmi configInt.cmi internal/uReStrParserType.cmi #Modules without configuration OBJNOINI= \ configInt.cmo\ internal/bitsvect.cmo internal/bytesvect.cmo \ internal/avlTree.cmo public/iSet.cmo public/iMap.cmo \ internal/tbl31.cmo internal/byte_labeled_dag.cmo \ public/xArray.cmo public/oOChannel.cmo \ public/uChar.cmo public/uSet.cmo \ public/uMap.cmo public/uCharTbl.cmo \ public/unicodeString.cmo \ public/uText.cmo public/xString.cmo \ public/subText.cmo public/uLine.cmo public/locale.cmo \ internal/hangul.cmo internal/unidata.cmo \ internal/charmap.cmo internal/unimap.cmo public/charEncoding.cmo \ public/uTF8.cmo public/uTF16.cmo public/uCS4.cmo \ public/uPervasives.cmo \ camomileDefaultConfig.cmo OBJECTS_WITH_CONFIG =\ public/uCharInfo.cmo public/uNF.cmo public/uCol.cmo \ public/caseMap.cmo public/uRe.cmo\ internal/uReStrParserType.cmo\ internal/uReStrParser.cmo internal/uReStrLexer.cmo public/uReStr.cmo\ public/main.cmo public/default.cmo OBJECTS = $(OBJNOINI) $(OBJECTS_WITH_CONFIG) OPTOBJECTS= $(OBJECTS:.cmo=.cmx) internal/uReStrParser.cmo : internal/uReStrParser.cmi internal/uReStrParser.cmx : internal/uReStrParser.cmi byte : camomile.cma opt : camomile.cmxa $(NOOBJ_INT:.cmi=.cmo) : %.cmo : %.mli %.cmi $(OCAMLC) -c $(BFLAGS) -impl $< $(NOOBJ_INT:.cmi=.cmx) : %.cmx : %.mli %.cmi $(OCAMLOPT) -c $(OFLAGS) -impl $< public/main.ml : public/main.mlp public/main.cmi $(CPP) -P -I $(SUBDIR) -o public/main.ml -x c public/main.mlp public/main.mli : public/main.mlip $(CPP) -P -I $(SUBDIR) -o public/main.mli -x c public/main.mlip camomileDefaultConfig.ml : Makefile (echo "(* This file is automatically generated *)" && \ echo let datadir = \"@datadir@/camomile/database\" && \ echo let localedir = \"@datadir@/camomile/locales\" && \ echo let charmapdir = \"@datadir@/camomile/charmaps\" && \ echo let unimapdir = \"@datadir@/camomile/mappings\") > \ camomileDefaultConfig.ml camomileLibrary.cmo camomileLibrary.cmi : $(OBJECTS) $(OCAMLC) $(BOPTIONS) -pack -o camomileLibrary.cmo $(OBJECTS) $(INCLUDES) camomileLibrary.cmx camomileLibrary.o : $(NOOBJ_INT:.cmi=.cmx) $(OPTOBJECTS) $(OCAMLOPT) $(OOPTIONS) -pack -o camomileLibrary.cmx $(OPTOBJECTS) $(INCLUDES) camomile.cma : camomileLibrary.cmo $(OCAMLC) -a -o camomile.cma camomileLibrary.cmo camomile.cmxa : camomileLibrary.cmx $(OCAMLOPT) -a -o camomile.cmxa camomileLibrary.cmx # Documentation .PHONY : dochtml doclatex doctexi man htdoc : dochtml dochtml : mkdir -p dochtml $(OCAMLDOC) $(INCLUDES) -html -d dochtml public/*.mli doclatex : mkdir -p doclatex $(OCAMLDOC) $(INCLUDES) -latex -o doclatex/camomile.tex public/*.mli doctexi : mkdir -p doctexi $(OCAMLDOC) $(INCLUDES) -texi -o doctexi/camomile.texi public/*.mli man : mkdir -p man $(OCAMLDOC) $(INCLUDES) -man -d man public/*.mli # Build procedures for tools ############################ CAMOMILE_DATADIR=./database export CAMOMILE_DATADIR CAMOMILE_LOCALEDIR=./locales export CAMOMILE_LOCALEDIR CAMOMILE_CHARMAPDIR=./charmaps export CAMOMILE_CHARMAPDIR CAMOMILE_UNIMAPDIR=./mappings export CAMOMILE_UNIMAPDIR TOOLSOBJ =\ $(OBJECTS) toolslib/camomileconfig.cmo toolslib/toolslib.cmo\ toolslib/absOrd.cmo toolslib/absCe.cmo\ toolslib/colParser.cmo toolslib/colLexer.cmo OPTTOOLSOBJ = $(TOOLSOBJ:.cmo=.cmx) toolslib : toolslib.cma toolslib.cma : $(TOOLSOBJ) $(OCAMLC) $(BFLAGS) -a -o toolslib.cma $(TOOLSOBJ) toolslib.cmxa : $(OPTTOOLSOBJ) $(OCAMLOPT) $(OFLAGS) -a -o toolslib.cmxa $(OPTTOOLSOBJ) toolslib/colParser.cmo : toolslib/colParser.cmi toolslib/colParser.cmx : toolslib/colParser.cmi TOOLS = \ tools/parse_unidata.byte tools/parse_uniset.byte tools/camomilecharmap.byte \ tools/parse_specialcasing.byte tools/parse_casefolding.byte \ tools/parse_scripts.byte tools/parse_allkeys.byte mappings/gen_mappings.byte\ tools/camomilelocaledef.byte OPTTOOLS = $(TOOLS:.byte=.opt) TOOLSLIB=bigarray.cma str.cma toolslib.cma OPTTOOLSLIB=$(TOOLSLIB:.cma=.cmxa) tools : $(TOOLS) $(TOOLS) : %.byte : toolslib.cma %.cmo $(OCAMLC) $(BFLAGS) -o $@ $(TOOLSLIB) $*.cmo $(OPTTOOLS) : %.opt : toolslib.cmxa %.cmx $(OCAMLOPT) $(OFLAGS) -o $@ $(OPTTOOLSLIB) $*.cmx tools/camomilelocaledef.cmo : tools/camomilelocaledef.ml $(OCAMLC) $(CAMLP4O) -c $(BFLAGS) tools/camomilelocaledef.ml tools/camomilelocaledef.cmx : tools/camomilelocaledef.ml $(OCAMLOPT) $(CAMLP4O) -c $(OFLAGS) tools/camomilelocaledef.ml # Compile unidata ################################################################### UNIDATA_DIR = unidata TR10DATA_DIR = unidata/tr10 FROM_UNIDATA = \ database/combined_class.mar database/composition.mar \ database/decomposition.mar database/general_category.mar \ database/to_lower1.mar database/to_title1.mar database/to_upper1.mar \ database/general_category_map.mar PROPS = \ White_Space Bidi_Control Join_Control \ Hyphen Quotation_Mark Terminal_Punctuation Other_Math Hex_Digit \ ASCII_Hex_Digit Other_Alphabetic Ideographic Diacritic Extender \ Other_Lowercase Other_Uppercase Noncharacter_Code_Point \ Other_Grapheme_Extend Grapheme_Link IDS_Binary_Operator \ IDS_Trinary_Operator Radical Unified_Ideograph \ Other_Default_Ignorable_Code_Point Deprecated Soft_Dotted \ Logical_Order_Exception CORE_DERIVED_PROPS = \ Math Alphabetic Lowercase Uppercase ID_Start ID_Continue \ XID_Start XID_Continue Default_Ignorable_Code_Point Grapheme_Extend \ Grapheme_Base PROP_TBLS = $(patsubst %, database/%.mar, $(PROPS)) PROP_SETS = $(patsubst %, database/%_set.mar, $(PROPS)) CORE_DERIVED_PROP_TBLS = $(patsubst %, database/%.mar, $(CORE_DERIVED_PROPS)) CORE_DERIVED_PROP_SETS = $(patsubst %, database/%_set.mar, \ $(CORE_DERIVED_PROPS)) DATABASE = \ $(FROM_UNIDATA) $(PROP_TBLS) $(PROP_SETS) \ $(CORE_DERIVED_PROP_TBLS) $(CORE_DERIVED_PROP_TBL_SETS) \ database/case_folding.mar database/composition_exclusion.mar \ database/special_casing.mar database/scripts.mar database/allkeys.mar unidata : $(DATABASE) $(DATABASE) : database database : mkdir -p database $(PROP_TBLS) : database/%.mar : $(UNIDATA_DIR)/PropList.txt tools/parse_uniset.$(OCAMLBEST) grep $* $< | tools/parse_uniset.$(OCAMLBEST) database $* $(PROP_SETS) : database/%_set.mar : $(UNIDATA_DIR)/PropList.txt tools/parse_uniset.$(OCAMLBEST) grep $* $< | tools/parse_uniset.$(OCAMLBEST) database $* $(CORE_DERIVED_PROP_TBLS) : database/%.mar : $(UNIDATA_DIR)/DerivedCoreProperties.txt tools/parse_uniset.$(OCAMLBEST) grep $* $< | tools/parse_uniset.$(OCAMLBEST) database $* $(CORE_DERIVED_PROP_SETS) : database/%_set.mar : $(UNIDATA_DIR)/DerivedCoreProperties.txt tools/parse_uniset.$(OCAMLBEST) grep $* $< | tools/parse_uniset.$(OCAMLBEST) database $* $(FROM_UNIDATA) : tools/parse_unidata.$(OCAMLBEST) $(UNIDATA_DIR)/UnicodeData.txt tools/parse_unidata.$(OCAMLBEST) database < $(UNIDATA_DIR)/UnicodeData.txt database/allkeys.mar : $(FROM_UNIDATA) $(PROP_TBLS) tools/parse_allkeys.$(OCAMLBEST)\ $(TR10DATA_DIR)/allkeys.txt tools/parse_allkeys.$(OCAMLBEST) database < $(TR10DATA_DIR)/allkeys.txt database/case_folding.mar : tools/parse_casefolding.$(OCAMLBEST)\ $(UNIDATA_DIR)/CaseFolding.txt tools/parse_casefolding.$(OCAMLBEST) database < $(UNIDATA_DIR)/CaseFolding.txt database/composition_exclusion.mar : tools/parse_uniset.$(OCAMLBEST) $(UNIDATA_DIR)/CompositionExclusions.txt tools/parse_uniset.$(OCAMLBEST) database composition_exclusion < $(UNIDATA_DIR)/CompositionExclusions.txt database/lowercases.mar : tools/parse_uniset.$(OCAMLBEST) $(UNIDATA_DIR)/DerivedCoreProperties.txt database/special_casing.mar : tools/parse_specialcasing.$(OCAMLBEST) $(UNIDATA_DIR)/SpecialCasing.txt tools/parse_specialcasing.$(OCAMLBEST) database < $(UNIDATA_DIR)/SpecialCasing.txt database/scripts.mar : tools/parse_scripts.$(OCAMLBEST) $(UNIDATA_DIR)/Scripts.txt tools/parse_scripts.$(OCAMLBEST) database < $(UNIDATA_DIR)/Scripts.txt database/scripts_map.mar : tools/parse_scripts.$(OCAMLBEST) $(UNIDATA_DIR)/Scripts.txt tools/parse_scripts.$(OCAMLBEST) database < $(UNIDATA_DIR)/Scripts.txt # Create Unicode mapping tables ############################### # MAPPING_SOURCES = \ # charmaps/GB2312 charmaps/EUC-JP charmaps/EUC-KR charmaps/EUC-TW\ # charmaps/ISO-8859-7 # MAPPINGS = \ # mappings/cns11643.mar mappings/jisx0201.mar mappings/ksc5601.mar\ # mappings/gb2312.mar mappings/jisx0208.mar\ # mappings/iso88597.mar mappings/jisx0212.mar unimaps : mappings/gen_mappings.$(OCAMLBEST) cd mappings && ./gen_mappings.$(OCAMLBEST) # Compilation of charmap files ############################## CHARMAP_DATA := $(patsubst charmaps/%,charmaps/%.mar, \ $(filter-out charmaps/CVS charmaps/%.mar, $(wildcard charmaps/*))) charmap_data : $(CHARMAP_DATA) $(CHARMAP_DATA) : charmaps/%.mar : tools/camomilecharmap.$(OCAMLBEST) charmaps/% tools/camomilecharmap.$(OCAMLBEST) -d charmaps charmaps/$* # Compilation of locale data ############################ LOCALE_DATA := $(patsubst locales/%.txt,locales/%.mar, \ $(wildcard locales/*.txt)) locale_data : $(LOCALE_DATA) $(LOCALE_DATA) : locales/%.mar : database tools/camomilelocaledef.$(OCAMLBEST) locales/%.txt tools/camomilelocaledef.$(OCAMLBEST) --file $(@:.mar=.txt) locales # ################################################################### # # libre # ################################################################### # libre.byte: byte # cd libre && $(MAKE) byte # libre.opt: opt # cd libre && $(MAKE) opt # libre: libre.byte libre.$(OCAMLBEST) # install-libre: libre # cd libre && $(MAKE) install ################################################################### # Installation and export ################################################################### MLI = \ public/xArray.mli public/oOChannel.mli \ public/uChar.mli public/uSet.mli public/uMap.mli public/uCharTbl.mli \ public/unicodeString.mli public/uText.mli public/xString.mli \ public/subText.mli public/uLine.mli public/locale.mli \ public/uCharInfo.mli public/uNF.mli \ public/uCol.mli public/caseMap.mli public/uRe.mli public/uReStr.mli \ public/charEncoding.mli public/uTF8.mli public/uTF16.mli public/uCS4.mli \ public/uPervasives.mli public/main.mli public/default.mli install: $(INSTALL) install-data install-bin install-without-ocamlfind: mkdir -p $(OCAMLLIB) ${BSD_INSTALL_DATA} camomileLibrary.cmi $(OCAMLLIB) if [ -f camomileLibrary.cmx ]; then ${BSD_INSTALL_DATA} camomileLibrary.cmx $(OCAMLLIB); fi if [ -f camomile.cma ]; then ${BSD_INSTALL_DATA} camomile.cma $(OCAMLLIB); fi if [ -f camomile.cmxa ]; then ${BSD_INSTALL_DATA} camomile.cmxa $(OCAMLLIB); fi if [ -f camomile.a ]; then ${BSD_INSTALL_DATA} camomile.a $(OCAMLLIB); fi install-with-ocamlfind: files= &&\ if [ -f camomileLibrary.cmx ]; then files=camomileLibrary.cmx; fi && \ if [ -f camomile.cma ]; then files="camomile.cma $$files"; fi&& \ if [ -f camomile.cmxa ]; then files="camomile.cmxa $$files"; fi&& \ if [ -f camomile.a ]; then files="camomile.a $$files"; fi && \ ocamlfind install camomile $$files META $(MLI) camomileLibrary.cmi install-bin: ${BSD_INSTALL_PROGRAM} tools/camomilecharmap.$(OCAMLBEST) \ $(BINDIR)/camomilecharmap ${BSD_INSTALL_PROGRAM} tools/camomilelocaledef.$(OCAMLBEST) \ $(BINDIR)/camomilelocaledef install-data: mkdir -p $(DATADIR) mkdir -p $(DATADIR)/camomile mkdir -p $(DATADIR)/camomile/database ${BSD_INSTALL_DATA} database/*.mar $(DATADIR)/camomile/database || true mkdir -p $(DATADIR)/camomile/charmaps ${BSD_INSTALL_DATA} charmaps/*.mar $(DATADIR)/camomile/charmaps || true mkdir -p $(DATADIR)/camomile/mappings ${BSD_INSTALL_DATA} mappings/*.mar $(DATADIR)/camomile/mappings || true mkdir -p $(DATADIR)/camomile/locales ${BSD_INSTALL_DATA} locales/*.mar $(DATADIR)/camomile/locales || true uninstall: $(UNINSTALL) uninstall-bin uninstall-without-ocamlfind: rm -f $(OCAMLLIB)/camomile.* rm -f $(OCAMLLIB)/camomileLibrary.cmi rm -f $(OCAMLLIB)/camomileLibrary.cmx uninstall-with-ocamlfind: ocamlfind remove camomile rm -fr $(DATADIR)/camomile uninstall-bin: rm -f $(BINDIR)/camomilecharmap.* rm -f $(BINDIR)/camomilelocaledef.* ################################################################### # Generic rules ################################################################### .SUFFIXES: .mli .ml .cmi .cmo .cmx .mll .mly .mli.cmi: $(OCAMLC) -c $(BFLAGS) $< .ml.cmo: $(OCAMLC) -c $(BFLAGS) $< .ml.o: $(OCAMLOPT) -c $(OFLAGS) $< .ml.cmx: $(OCAMLOPT) -c $(OFLAGS) $< .mll.ml: $(OCAMLLEX) $< .mly.ml: $(OCAMLYACC) -v $< .mly.mli: $(OCAMLYACC) -v $< ################################################################### # distribution ################################################################### dist : camomile.tar.bz2 configure : configure.in autoconf DISTDIR = $(PACKAGE)-$(VERSION) camomile.tar.bz2 : public/main.ml public/main.mli depend configure mkdir -p $(DISTDIR) ${BSD_INSTALL_DATA} --parents \ README Changes META.in COPYING \ .depend Makefile.in configure configInt.mli \ $(CHARMAP_DATA:.mar=) \ locales/*.txt \ unidata/README unidata/*.txt unidata/*.html \ unidata/tr10/README unidata/tr10/*.txt \ internal/*.ml internal/*.ml[ily] \ public/*.ml public/*.mli public/main.mlp public/main.mlip \ mappings/*.ml \ toolslib/*.ml toolslib/*.ml[ily] \ tools/*.ml \ $(DISTDIR) tar -cjvf $(DISTDIR).tar.bz2 $(DISTDIR) rm -Rf $(DISTDIR) ################################################################### # tags, clean, dist and depend : ################################################################### tags:: otags */*.ml */*.mli *.ml *.mli clean:: rm -f *.cm[ioxa] *.cmxa *.o *.so *.a */*.cm[iox] */*.o pocaml\ */*.byte */*.opt rm -f database/*.mar rm -f charmaps/*.mar rm -f mappings/*.mar rm -f locales/*.mar rm -f toolslib/*.cma toolslib/*.cmxa depend:: public/main.ml public/main.mli rm -f .depend $(OCAMLDEP) $(SUBDIR) *.ml *.mli \ internal/*.ml internal/*.mli \ public/*.ml public/*.mli \ mappings/*.ml mappings/*.mli \ toolslib/*.ml toolslib/*.mli \ test/*.ml \ > .depend $(OCAMLDEP) $(CAMLP4O) $(SUBDIR) \ tools/$(TOOLS:.byte=.ml) >> .depend include .depend