# Copyright (C) 2003 Mikolaj Konarski
#
# This file is part of the Dule compiler.
# The Dule compiler is released under the GNU General Public License (GPL).
# Please see the file Dule-LICENSE for license information.
#
# $Id: Makefile,v 1.40 2005/05/27 18:03:55 mikon Exp $

SOURCES := \
tools.ml error_rep.ml \
\
core_back.ml core_middle.ml core_front.ml \
\
middle_middle.ml \
\
mod_back.ml mod_middle.ml mod_front.ml \
\
main_common.ml parser.mly lexer.mll main.ml

all: nc #bcnl #nc #pnc
RESULT := dule

#OCAMLFLAGS := -noassert
OCAMLNCFLAGS := -inline 100 -dtypes

OCAMLC := ocamlc.opt
OCAMLOPT := ocamlopt.opt

.PHONY: test
test: 
	bash -c "time ./dule --no-prelude --composition --debugging \
	../test/strange_commented.dul"

.PHONY: test-good
test-good: 
	bash -c "time ./dule --composition ../test/strange_commented.dul \
	../test/regression_short.dul \
	--no-composition ../test/tutorial_modules.dul"

.PHONY: test-good-no
test-good-no: 
	bash -c "time ./dule --no-execution \
	--composition ../test/strange_commented.dul \
	../test/regression_short.dul \
	--no-composition ../test/tutorial_modules.dul"

.PHONY: test-all
test-all: 
	bash -c "time ./dule -c ../test/core.dul \
	--composition ../test/strange_commented.dul \
	../test/regression_short.dul \
	../test/regression_long.dul \
	--no-composition ../test/tutorial_modules.dul \
	../test/old_compiler1.dul \
	../test/old_compiler2.dul \
	../test/old_compiler3.dul \
	../test/compiler.dul "

.PHONY: tests-all
tests-all: 
	bash -c "time ./dule -c ../test/core.dul && \
	time ./dule --no-prelude --composition ../test/strange_commented.dul&&\
	time ./dule --no-prelude --composition ../test/regression_short.dul&& \
	time ./dule ../test/tutorial_modules.dul && \
	time ./dule ../test/old_compiler1.dul && \
	time ./dule --no-prelude --composition ../test/regression_long.dul && \
	time ./dule ../test/old_compiler2.dul && \
	time ./dule ../test/old_compiler3.dul && \
	time ./dule ../test/compiler.dul "

.PHONY: test-core
test-core: 
	bash -c "time ./dule -c ../test/core.dul"

.PHONY: test-strange
test-strange: 
	bash -c "time ./dule --no-prelude --composition \
	../test/strange_commented.dul"

.PHONY: test-short
test-short: 
	bash -c "time ./dule --no-prelude --composition \
	../test/regression_short.dul"

.PHONY: test-long
test-long: 
	bash -c "time ./dule --no-prelude --composition \
	../test/regression_long.dul"

.PHONY: test-tutorial
test-tutorial: 
	bash -c "time ./dule ../test/tutorial_modules.dul"

.PHONY: test-old1
test-old1: 
	bash -c "time ./dule ../test/old_compiler1.dul"

.PHONY: test-old2
test-old2: 
	bash -c "time ./dule ../test/old_compiler2.dul"

.PHONY: test-old3
test-old3: 
	bash -c "time ./dule ../test/old_compiler3.dul"

.PHONY: test-compiler
test-compiler: 
	bash -c "time ./dule ../test/compiler.dul"

.PHONY: test-errors
test-errors: 
	for i in ../test/error_reporting/*.dul; do \
          if echo; ./dule --no-prelude --composition $$i; \
		then echo; echo "The file "; echo $$i; \
                     echo " is not erroneous! Aborting!"; \
                     break; fi \
	done

.PHONY: test-performance
test-performance: 
	bash -c "time ../test/performance.sh dags3.ml"

ll:     top
	$(OCAMLC) -I +camlp4 -pp "camlp4o pa_extend.cmo q_MLast.cmo" \
	-c ll_parser.ml


OCAMLMAKEFILE := OCamlMakefile
-include $(OCAMLMAKEFILE)
