#
#  Makefile for the lexer generator, that emits codes in N. 
#  Adapted from the Objective Caml's Lex.
#   
#  Kwangkeun Yi
#
#  Copyright(c) 2000-2004 Research On Program Analysis System
#  http://ropas.snu.ac.kr/n
#
#  All rights reserved. This file is distributed under the terms of
#  the Q Public License version 1.0. (http://www.troll.no/qpl/)
#   

# The lexer generator

include ../../config/Makefile

NCAMLC=../../boot/ncamlrun ../../boot/nmlc -I ../../boot
NCAMLOPT=../../boot/ncamlrun ../../nmlo -I ../../stdlib
COMPFLAGS=
LINKFLAGS=
CAMLYACC=../../boot/ocamlyacc
CAMLLEX=../../boot/ncamlrun ../../boot/ocamllex
YACCFLAGS=
CAMLDEP=../../boot/ncamlrun ../../ocaml/tools/ocamldep
DEPFLAGS=
OBJS=parser.cmo lexer.cmo lexgen.cmo compact.cmo output.cmo main.cmo
NMLMAKE=nmlmake

all: nlex

nlex:	$(OBJS)
	$(NCAMLC) $(LINKFLAGS) -o nlex $(OBJS)

opt: $(OBJS:.cmo=.cmx)
	$(NCAMLOPT) $(LINKFLAGS) -o nlex $(OBJS:.cmo=.cmx)

clean::
	rm -f nlex
	rm -f *.cm[oix] *.[so]

parser.ml parser.mli: parser.mly
	$(CAMLYACC) $(YACCFLAGS) parser.mly

clean::
	rm -f parser.ml parser.mli

beforedepend:: parser.ml parser.mli

lexer.ml: lexer.mll
	$(CAMLLEX) lexer.mll

clean::
	rm -f lexer.ml

beforedepend:: lexer.ml


install::
	if test -f nlex.exe; then mv nlex.exe nlex; else :; fi
	cp nlex $(BINDIR)/nlex$(EXE)

.SUFFIXES:
.SUFFIXES: .ml .cmo .mli .cmi .cmx

.ml.cmo:
	$(NCAMLC) -c $(COMPFLAGS) $<

.mli.cmi:
	$(NCAMLC) -c $(COMPFLAGS) $<

.ml.cmx:
	$(NCAMLOPT) -c $(COMPFLAGS) $<

depend: beforedepend
	$(NMLMAKE)

include .depend


syntax highlighted by Code2HTML, v. 0.9.1