Skip to content
Snippets Groups Projects
Makefile 3.9 KiB
Newer Older
Erwan Jahier's avatar
Erwan Jahier committed

Pascal Raymond's avatar
Pascal Raymond committed
all: doit

OBJDIR=./obj$(HOSTTYPE)
SRCDIR=./src

LN=ln -s
$(OBJDIR)/% : $(SRCDIR)/%
	rm -f $@; cd $(OBJDIR) && $(LN) ../$(SRCDIR)/$* . 

$(OBJDIR):
	mkdir $(OBJDIR)

OCAMLMAKEFILE = ./OCamlMakefile
RESULT=$(OBJDIR)/lus2lic$(EXE)

LIBS = str unix

OCAMLC=ocamlc
OCAMLOPT=ocamlopt

ifeq ($(HOSTTYPE),cross-win32)
  OCAMLC=/usr/i586-mingw32msvc/bin/ocamlc
  OCAMLOPT=/usr/i586-mingw32msvc/bin/ocamlopt
  OCAMLDEP=/usr/i586-mingw32msvc/bin/ocamldep
  OCAMLRUN=/usr/i586-mingw32msvc/bin/ocamlrun
  OCAMLLIB = `/usr/i586-mingw32msvc/bin/ocamlc -where`
endif

ifeq ($(HOSTTYPE),cygwin)
CFLAGS=-mno-cygwin
endif

SOURCES =  \
	$(OBJDIR)/version.ml \
	$(OBJDIR)/verbose.mli \
	$(OBJDIR)/verbose.ml \
	$(OBJDIR)/filenameExtras.mli \
	$(OBJDIR)/filenameExtras.ml \
	$(OBJDIR)/global.ml \
	$(OBJDIR)/ident.mli \
	$(OBJDIR)/ident.ml \
	$(OBJDIR)/lxm.mli \
	$(OBJDIR)/lxm.ml \
	$(OBJDIR)/errors.ml \
	$(OBJDIR)/predef.ml \
	$(OBJDIR)/syntaxTreeCore.ml \
	$(OBJDIR)/syntaxTree.ml \
	$(OBJDIR)/syntaxTreeDump.mli \
	$(OBJDIR)/syntaxTreeDump.ml \
Pascal Raymond's avatar
Pascal Raymond committed
	$(OBJDIR)/solveIdent.mli \
	$(OBJDIR)/solveIdent.ml \
	$(OBJDIR)/parserUtils.ml \
	$(OBJDIR)/parser.mly \
	$(OBJDIR)/lexer.mll \
	$(OBJDIR)/syntaxTabUtils.mli \
	$(OBJDIR)/syntaxTabUtils.ml \
	$(OBJDIR)/instanciateModel.mli \
	$(OBJDIR)/instanciateModel.ml \
	$(OBJDIR)/symbolTab.mli \
	$(OBJDIR)/symbolTab.ml \
	$(OBJDIR)/eff.ml \
	$(OBJDIR)/name.mli \
	$(OBJDIR)/name.ml \
	$(OBJDIR)/licDump.ml \
	$(OBJDIR)/licPrg.mli \
	$(OBJDIR)/licPrg.ml \
Pascal Raymond's avatar
Pascal Raymond committed
	$(OBJDIR)/unifyType.mli \
	$(OBJDIR)/unifyType.ml \
	$(OBJDIR)/unifyClock.mli \
	$(OBJDIR)/unifyClock.ml \
	$(OBJDIR)/syntaxTab.mli \
	$(OBJDIR)/syntaxTab.ml \
	$(OBJDIR)/uglyStuff.ml \
Pascal Raymond's avatar
Pascal Raymond committed
	$(OBJDIR)/predefEvalType.mli \
	$(OBJDIR)/predefEvalType.ml \
	$(OBJDIR)/predefEvalConst.mli \
	$(OBJDIR)/predefEvalConst.ml \
	$(OBJDIR)/predefEvalClock.mli \
	$(OBJDIR)/predefEvalClock.ml \
	$(OBJDIR)/builtIn.ml \
Pascal Raymond's avatar
Pascal Raymond committed
	$(OBJDIR)/evalConst.mli \
	$(OBJDIR)/evalConst.ml \
	$(OBJDIR)/evalType.mli \
	$(OBJDIR)/evalType.ml \
	$(OBJDIR)/evalClock.mli \
	$(OBJDIR)/evalClock.ml \
	$(OBJDIR)/structArrayExpand.mli \
	$(OBJDIR)/structArrayExpand.ml \
	$(OBJDIR)/uniqueOutput.mli \
	$(OBJDIR)/uniqueOutput.ml \
	$(OBJDIR)/getEff.mli \
	$(OBJDIR)/getEff.ml \
	$(OBJDIR)/nodesExpand.mli \
	$(OBJDIR)/nodesExpand.ml \
	$(OBJDIR)/doNoPoly.ml \
pascal's avatar
pascal committed
	$(OBJDIR)/doAliasTypes.ml \
Pascal Raymond's avatar
Pascal Raymond committed
	$(OBJDIR)/doSplit.ml \
Pascal Raymond's avatar
Pascal Raymond committed
	$(OBJDIR)/lazyCompiler.ml \
	$(OBJDIR)/lazyCompiler.mli \
	$(OBJDIR)/compile.ml \
	$(OBJDIR)/mainArgs.ml \
	$(OBJDIR)/mainArgs.mli \
Pascal Raymond's avatar
Pascal Raymond committed
	$(OBJDIR)/main.ml

Pascal Raymond's avatar
Pascal Raymond committed
# Be sure to build those files before doing something else
# since they are needed by $(RESULT)
PRE_TARGETS=$(OBJDIR)/version.ml

MLONLY_SOURCES=$(filter %.ml %.mll %.mly, $(SOURCES))

ln: $(OBJDIR) $(SOURCES)

doit: ln
	make nc

include $(OCAMLMAKEFILE)

# Specific rule (version)

.PRECIOUS: $(OBJDIR)/version.ml

$(OBJDIR)/version.ml: 
	echo "(* Automatically generated from Makefile *) " > $@
Pascal Raymond's avatar
Pascal Raymond committed
	echo "let tool = \"lus2lic\"" >> $@
	echo "let branch = \"$(shell utils/get_branch_name)\"" >> $@
	echo "let commit = \"$(shell utils/get_commit_number)\"" >> $@
	echo "let sha_1 = \"$(shell utils/get_sha_1)"\">> $@
	echo "let str = (branch ^ \".\" ^ commit)">> $@
Pascal Raymond's avatar
Pascal Raymond committed
	make all
	make test


Pascal Raymond's avatar
Pascal Raymond committed
# TEST, NON REGR. ETC...
Pascal Raymond's avatar
Pascal Raymond committed
TESTDIR=./tests
Erwan Jahier's avatar
Erwan Jahier committed

.PHONY: diff test log

diff:
	rm -f diff_lv6.diff; git diff --ignore-all-space > diff_lv6.diff ; ls -l diff_lv6.diff
Erwan Jahier's avatar
Erwan Jahier committed

log:
	rm -f lv6.log; git log > lv6.log

Pascal Raymond's avatar
Pascal Raymond committed
	cd $(TESTDIR) ; make test

test: clean all test_nc
Pascal Raymond's avatar
Pascal Raymond committed
	cd $(TESTDIR) ; make test_ec
Erwan Jahier's avatar
Erwan Jahier committed
test_lic:
Pascal Raymond's avatar
Pascal Raymond committed
	cd $(TESTDIR) ; make test_lic
Pascal Raymond's avatar
Pascal Raymond committed
	cd $(TESTDIR) ; make test_lv4
Pascal Raymond's avatar
Pascal Raymond committed
	cd $(TESTDIR) ; make utest
Erwan Jahier's avatar
Erwan Jahier committed
utest_lic:
Pascal Raymond's avatar
Pascal Raymond committed
	cd $(TESTDIR) ; make utest_lic
Pascal Raymond's avatar
Pascal Raymond committed
	cd $(TESTDIR) ; make utest_ec
Pascal Raymond's avatar
Pascal Raymond committed
	cd $(TESTDIR) ; make utest_lv4

Erwan Jahier's avatar
Erwan Jahier committed

Pascal Raymond's avatar
Pascal Raymond committed
ci: $(OBJDIR)/version.ml
	make test && git commit -F log && rm -f $(OBJDIR)/version.ml
Erwan Jahier's avatar
Erwan Jahier committed

Pascal Raymond's avatar
Pascal Raymond committed
cia: $(OBJDIR)/version.ml
	git commit -a -F log && rm -f $(OBJDIR)/version.ml
Erwan Jahier's avatar
Erwan Jahier committed

	git commit -a -F log --amend  && rm -f $(OBJDIR)/version.ml