1### ocaml.lex.mk -- Support for the OCaml lexer generator 2 3# Author: Michael Grünewald 4# Date: Wed Aug 1 11:38:01 CEST 2007 5 6# BSD Owl Scripts (https://bitbucket.org/michipili/bsdowl) 7# This file is part of BSD Owl Scripts 8# 9# Copyright © 2005–2014 Michael Grünewald 10# 11# This file must be used under the terms of the CeCILL-B. 12# This source file is licensed as described in the file COPYING, which 13# you should have received as part of this distribution. The terms 14# are also available at 15# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt 16 17 18### SYNOPSIS 19 20# .include "ocaml.lex.mk" 21 22 23### DESCRIPTION 24 25# We analyse each list of sources appearing in _OCAML_SRCS and when we 26# spot an OCaml lexer input file, require it to be processed by 27# ocamllex. 28# 29# This module is intended to be included by other modules rather than 30# to serve as is to the end user. 31 32 33# Variables: 34# 35# 36# OCAMLLEX 37# Command used to run the lexer generator 38# 39# 40# _OCAML_MLL 41# Detected lexers are added to this list 42# 43# 44# _OMCAML_MLI 45# Interfaces associated to detected lexers are added to this list 46 47.if !target(__<ocaml.lex.mk>__) 48__<ocaml.lex.mk>__: 49 50 51OCAMLLEX?= ocamllex 52 53.for src in ${_OCAML_SRCS} 54.if defined(${src}) 55.if !empty(${src}:M*.mll) 56.for lexer in ${${src}:M*.mll} 57.if empty(_OCAML_MLL)||empty(_OCAML_MLL:M${lexer}) 58_OCAML_MLL+=${lexer} 59.endif 60.endfor 61.endif 62.endif 63.endfor 64 65.if defined(_OCAML_MLL)&&!empty(_OCAML_MLL) 66.for unit in ${_OCAML_MLL:.mll=.ml} 67.if empty(CLEANFILES)||empty(CLEANFILES:M${unit}) 68CLEANFILES+=${unit} 69.endif 70.if empty(_OCAML_ML)||empty(_OCAML_ML:M${unit}) 71_OCAML_ML+=${unit} 72.endif 73.endfor 74.endif 75 76.if defined(_OCAML_MLL)&&!empty(_OCAML_MLL) 77.for if in ${_OCAML_MLL:.mll=.mli} 78.if exists(${if}) && empty(_OCAML_MLI:M${if}) 79_OCAML_MLI+=${if} 80.endif 81.endfor 82.for lexer in ${_OCAML_MLL} 83 84${lexer:.mll=.ml}: ${lexer} 85 ${OCAMLLEX} -o ${.TARGET} ${.ALLSRC} 86 87.endfor 88.endif 89 90.endif # !target(__<ocaml.lex.mk>__) 91 92### End of file `ocaml.lex.mk' 93