Import Upstream version 20180207
[hcoop/debian/mlton.git] / mllex / Makefile
CommitLineData
7f918cf1
CE
1## Copyright (C) 2009,2013,2018 Matthew Fluet.
2 # Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
3 # Jagannathan, and Stephen Weeks.
4 # Copyright (C) 1997-2000 NEC Research Institute.
5 #
6 # MLton is released under a BSD-style license.
7 # See the file MLton-LICENSE for details.
8 ##
9
10MLTON_RUNTIME_ARGS :=
11MLTON_COMPILE_ARGS :=
12
13DIFF := diff
14
15######################################################################
16######################################################################
17
18SRC := $(shell cd .. && pwd)
19BUILD := $(SRC)/build
20BIN := $(BUILD)/bin
21
22PATH := $(BIN):$(shell echo $$PATH)
23
24TARGET := self
25
26######################################################################
27
28MLTON := mlton
29NAME := mllex
30
31all: $(NAME)
32
33$(NAME): $(NAME).mlb $(shell PATH="$(BIN):$$PATH" && "$(MLTON)" -stop f $(NAME).mlb)
34 @echo 'Compiling $(NAME)'
35 "$(MLTON)" @MLton $(MLTON_RUNTIME_ARGS) -- $(MLTON_COMPILE_ARGS) -target $(TARGET) $(NAME).mlb
36
37.PHONY: clean
38clean:
39 ../bin/clean
40
41
42PDFLATEX := pdflatex
43
44lexgen.pdf: lexgen.tex
45 $(PDFLATEX) lexgen.tex
46 $(PDFLATEX) lexgen.tex
47 $(PDFLATEX) lexgen.tex
48
49mllex.pdf: lexgen.pdf
50 cp lexgen.pdf mllex.pdf
51
52DOCS :=
53ifneq ($(shell which $(PDFLATEX) 2> /dev/null),)
54DOCS += mllex.pdf
55endif
56
57.PHONY: docs
58docs: $(DOCS)
59
60
61.PHONY: test
62test: $(NAME)
63 cp -p ../mlton/front-end/ml.lex . \
64 $(NAME) ml.lex && \
65 $(DIFF) ml.lex.sml ../mlton/front-end/ml.lex.sml \
66 rm -f ml.lex ml.lex.sml