#-----------------------------------------------------------------------
#  The Helium Compiler
#-----------------------------------------------------------------------

# make		 - build everything that is needed
# make depend	 - build dependencies for hs files, ag dependencies are	written	by hand
# make clean	 - remove .hi and .o files

default: all

.PHONY : default compiler all coreasm lvmrun libraries clean depend \
         smaller newVersion install movetohome status

#directories
HELIUMBINDIR = ../bin
LVMLIBDIR  = ../../lvm/src/lib
LVMRUNTIMEDIR  = ../../lvm/src/runtime
TOPDIR = ../../Top/src/Top

#the main program you want to generate
MAIN	= helium
UPX	= @UPX@
STRIP   = @STRIP@
EXE	= @EXEEXT@
INSTALL = @INSTALL@
MKDIR   = ../mkinstalldirs
LOGGER  = @logger@

prefix      = @prefix@
exec_prefix = @exec_prefix@
bindir      = @bindir@
libdir      = @prefix@/helium/lib
demodir     = @prefix@/helium/demo

status :
	@echo "*******************************************************************"
	@echo "Build process complete."
	@echo "Type \"make install\" to install."
	@echo "  Binaries will go into  $(bindir)"
	@echo "  Libraries will go into $(libdir)"
	@echo "  Demos will go into     $(demodir)"
	@echo "*******************************************************************"

HC	= @WithHc@
ifdef LOGGER
PACKAGENET = -package net
else
PACKAGENET = 
endif
HC_OPTS = -static -fglasgow-exts -fallow-undecidable-instances -fallow-overlapping-instances \
		$(PACKAGENET) -package lang -package text -i$(IFACES) $(EXTRA_HC_OPTS)

AG      = @WithAG@
AG_OPTS = -mscfr

# Helium sources

PARSER	= \
	parser/CollectFunctionBindings.hs parser/OperatorTable.hs \
	parser/Parser.hs parser/ResolveOperators.hs parser/Lexer.hs \
	parser/ParseLibrary.hs parser/ParseMessage.hs \
	parser/LexerMonad.hs parser/LexerMessage.hs parser/LayoutRule.hs \
	parser/LexerToken.hs

MODULESYSTEM = \
	modulesystem/ImportEnvironment.hs \
	modulesystem/DictionaryEnvironment.hs \
	modulesystem/CoreToImportEnv.hs modulesystem/ExtractImportDecls.hs

STATICANALYSIS = \
	staticanalysis/messages/Messages.hs \
	staticanalysis/messages/HeliumMessages.hs \
	staticanalysis/messages/StaticErrors.hs \
	staticanalysis/messages/TypeErrors.hs \
	staticanalysis/messages/KindErrors.hs \
	staticanalysis/messages/Warnings.hs \
	staticanalysis/messages/Information.hs \
	staticanalysis/heuristics/HeuristicsInfo.hs \
	staticanalysis/heuristics/ListOfHeuristics.hs \
	staticanalysis/heuristics/OnlyResultHeuristics.hs \
	staticanalysis/heuristics/RepairHeuristics.hs \
	staticanalysis/heuristics/TieBreakerHeuristics.hs \
	staticanalysis/heuristics/UnifierHeuristics.hs \
	staticanalysis/staticchecks/StaticChecks.hs \
	staticanalysis/inferencers/TypeInferencing.hs \
	staticanalysis/inferencers/KindInferencing.hs \
	staticanalysis/inferencers/ExpressionTypeInferencer.hs \
	staticanalysis/inferencers/SelectConstraintSolver.hs \
	staticanalysis/inferencers/BindingGroupAnalysis.hs \
	staticanalysis/directives/TS_Parser.hs \
	staticanalysis/directives/TS_Syntax.hs \
	staticanalysis/directives/Matchers.hs \
        staticanalysis/directives/TS_Apply.hs \
        staticanalysis/directives/TS_Messages.hs \
        staticanalysis/directives/TS_Analyse.hs \
        staticanalysis/directives/TS_CoreSyntax.hs \
        staticanalysis/directives/TS_ToCore.hs \
        staticanalysis/directives/TS_Compile.hs \
        staticanalysis/directives/TS_Attributes.hs \
        staticanalysis/miscellaneous/ConstraintInfo.hs \
        staticanalysis/miscellaneous/DoublyLinkedTree.hs \
        staticanalysis/miscellaneous/TypeConstraints.hs \
        staticanalysis/miscellaneous/TypesToAlignedDocs.hs \
        staticanalysis/miscellaneous/TypeConversion.hs \
        staticanalysis/miscellaneous/UHA_Source.hs \
        
UHA = \
	syntax/UHA_Syntax.hs syntax/UHA_Utils.hs syntax/UHA_Range.hs \
        syntax/UHA_Pretty.hs syntax/UHA_OneLine.hs


CODEGENERATION = \
	codegeneration/CoreToLvm.hs codegeneration/PatternMatch.hs \
	codegeneration/DerivingShow.hs codegeneration/DerivingEq.hs codegeneration/CoreUtils.hs \
        codegeneration/CodeGeneration.hs

UTILS = \
	utils/Utils.hs utils/Logger.hs utils/OSSpecific.hs utils/OneLiner.hs \
	utils/Similarity.hs utils/Texts.hs

MAINFILES = \
	main/Main.hs main/Version.hs main/Args.hs main/Compile.hs \
	main/PhaseLexer.hs main/PhaseParser.hs main/PhaseImport.hs main/PhaseResolveOperators.hs \
	main/PhaseStaticChecks.hs main/PhaseTypingStrategies.hs main/PhaseTypeInferencer.hs \
	main/PhaseDesugarer.hs main/PhaseCodeGenerator.hs main/CompileUtils.hs \
	main/PhaseKindInferencer.hs

# Top sources

TOP = \
	$(TOPDIR)/Constraint/Equality.hs $(TOPDIR)/Constraint/Information.hs $(TOPDIR)/Constraint/Polymorphism.hs \
	$(TOPDIR)/Constraint/Qualifier.hs $(TOPDIR)/Constraint.hs $(TOPDIR)/Implementation/Basic.hs \
	$(TOPDIR)/Implementation/FastSubstitution.hs $(TOPDIR)/Implementation/General.hs $(TOPDIR)/Implementation/Overloading.hs \
	$(TOPDIR)/Implementation/SimpleSubstitution.hs $(TOPDIR)/Implementation/TypeGraph/ApplyHeuristics.hs \
	$(TOPDIR)/Implementation/TypeGraph/Basics.hs $(TOPDIR)/Implementation/TypeGraph/Class.hs $(TOPDIR)/Implementation/TypeGraph/ClassMonadic.hs \
	$(TOPDIR)/Implementation/TypeGraph/DefaultHeuristics.hs $(TOPDIR)/Implementation/TypeGraph/EquivalenceGroup.hs $(TOPDIR)/Implementation/TypeGraph/Heuristic.hs \
	$(TOPDIR)/Implementation/TypeGraph/Path.hs $(TOPDIR)/Implementation/TypeGraph/Standard.hs \
	$(TOPDIR)/Implementation/TypeGraphSubstitution.hs $(TOPDIR)/Implementation/TypeInference.hs \
	$(TOPDIR)/Interface/Basic.hs $(TOPDIR)/Interface/Qualification.hs $(TOPDIR)/Interface/Substitution.hs \
	$(TOPDIR)/Interface/TypeInference.hs $(TOPDIR)/Monad/Select.hs $(TOPDIR)/Monad/StateFix.hs \
	$(TOPDIR)/Ordering/Tree.hs $(TOPDIR)/Ordering/TreeWalk.hs $(TOPDIR)/Solver/Greedy.hs \
	$(TOPDIR)/Solver/PartitionCombinator.hs $(TOPDIR)/Solver/SwitchCombinator.hs $(TOPDIR)/Solver/TypeGraph.hs \
	$(TOPDIR)/Solver.hs $(TOPDIR)/Types/Classes.hs $(TOPDIR)/Types/Kinds.hs $(TOPDIR)/Types/Primitive.hs \
	$(TOPDIR)/Types/Qualification.hs $(TOPDIR)/Types/Quantification.hs $(TOPDIR)/Types/Schemes.hs \
	$(TOPDIR)/Types/Substitution.hs $(TOPDIR)/Types/Synonym.hs $(TOPDIR)/Types/Unification.hs \
	$(TOPDIR)/Types.hs $(TOPDIR)/Util/Embedding.hs $(TOPDIR)/Util/Empty.hs $(TOPDIR)/Util/Option.hs
  
# LVM sources

LVMCOMMON = \
	  $(LVMLIBDIR)/common/Id.hs $(LVMLIBDIR)/common/IdMap.hs $(LVMLIBDIR)/common/IdSet.hs $(LVMLIBDIR)/common/IntMap.hs \
	  $(LVMLIBDIR)/common/Byte.hs $(LVMLIBDIR)/common/Standard.hs \
	  $(LVMLIBDIR)/common/TopSort.hs $(LVMLIBDIR)/common/Set.hs \
	  $(LVMLIBDIR)/common/ghc/Special.hs $(LVMLIBDIR)/common/PPrint.hs

LVM	= $(LVMLIBDIR)/lvm/Lvm.hs $(LVMLIBDIR)/lvm/LvmPretty.hs $(LVMLIBDIR)/lvm/LvmWrite.hs $(LVMLIBDIR)/lvm/LvmRead.hs \
	  $(LVMLIBDIR)/lvm/LvmImport.hs $(LVMLIBDIR)/lvm/Module.hs $(LVMLIBDIR)/lvm/ModulePretty.hs \
	  $(LVMLIBDIR)/lvm/Instr.hs $(LVMLIBDIR)/lvm/InstrPretty.hs $(LVMLIBDIR)/lvm/InstrResolve.hs $(LVMLIBDIR)/lvm/InstrRewrite.hs

ASM	= $(LVMLIBDIR)/asm/AsmOptimize.hs $(LVMLIBDIR)/asm/AsmInline.hs $(LVMLIBDIR)/asm/AsmOccur.hs \
	  $(LVMLIBDIR)/asm/Asm.hs $(LVMLIBDIR)/asm/AsmPretty.hs $(LVMLIBDIR)/asm/AsmToLvm.hs

CORE	= $(LVMLIBDIR)/core/Core.hs $(LVMLIBDIR)/core/CorePretty.hs $(LVMLIBDIR)/core/CoreToAsm.hs \
	  $(LVMLIBDIR)/core/CoreParse.hs $(LVMLIBDIR)/core/CoreLexer.hs \
	  $(LVMLIBDIR)/core/CoreNormalize.hs $(LVMLIBDIR)/core/CoreRemoveDead.hs \
	  $(LVMLIBDIR)/core/CoreNoShadow.hs $(LVMLIBDIR)/core/CoreFreeVar.hs $(LVMLIBDIR)/core/CoreLetSort.hs \
	  $(LVMLIBDIR)/core/CoreLift.hs $(LVMLIBDIR)/core/CoreSaturate.hs

IFACES	= $(LVMLIBDIR)/common:$(LVMLIBDIR)/common/ghc:$(LVMLIBDIR)/lvm:$(LVMLIBDIR)/asm:$(LVMLIBDIR)/core:./utils:./parser:./staticanalysis/miscellaneous:./staticanalysis/inferencers:./staticanalysis/directives:./staticanalysis/staticchecks:./staticanalysis/heuristics:./staticanalysis/messages:./syntax:./codegeneration:./main:./modulesystem:$(TOPDIR)/..

# AG sources
AGSOURCES = \
     syntax/UHA_Pretty.hs syntax/UHA_OneLine.hs \
     staticanalysis/staticchecks/StaticChecks.hs staticanalysis/inferencers/TypeInferencing.hs \
     staticanalysis/inferencers/KindInferencing.hs \
     codegeneration/CodeGeneration.hs \
     syntax/UHA_Syntax.hs modulesystem/ExtractImportDecls.hs staticanalysis/directives/TS_Syntax.hs \
     staticanalysis/directives/TS_Apply.hs staticanalysis/directives/TS_Analyse.hs \
     staticanalysis/directives/TS_CoreSyntax.hs \
     staticanalysis/directives/TS_ToCore.hs parser/ResolveOperators.hs

#Sources and object files
SRCS = $(PARSER) $(STATICANALYSIS) $(UHA) $(CODEGENERATION) $(UTILS) $(TOP) $(LVMCOMMON) \
	$(LVM) $(ASM) $(CORE) $(MAINFILES) $(MODULESYSTEM)
OBJS = $(SRCS:.hs=.o)

HELIUMOBJSFILE = heliumObjs.txt

objectsfile: Makefile
	@echo $(OBJS) | \
	sed -e s/main\\/Main.o//g | \
	sed -e s/\\\([^\ ][^\ ]*\\\)/$$\(HELIUMSRCDIR\)\\/\\1/g > $(HELIUMOBJSFILE)

# Puts all objects except main\Main.o in the text file $(HELIUMOBJSFILE), while prepending
# each file path with "$(HELIUMSRCDIR)/"

# The main target
compiler: $(OBJS)
	@echo "****************************************************"
	@echo "  Helium: the Helium compiler"
	@echo "****************************************************"
	$(HC)	-o $(HELIUMBINDIR)/$(MAIN)$(EXE) $(HC_OPTS) $(OBJS)
ifdef STRIP
	$(STRIP) $(HELIUMBINDIR)/$(MAIN)$(EXE)
endif

all: ag compiler coreasm lvmrun libraries texthint status

coreasm:
	@echo "****************************************************"
	@echo "  COREASM: the Core code compiler"
	@echo "****************************************************"
	cd $(LVMLIBDIR); $(MAKE) EXTRA_HC_OPTS="$(EXTRA_HC_OPTS)"

lvmrun:
	@echo "****************************************************"
	@echo "  LVMRUN: the bytecode interpreter"
	@echo "****************************************************"
	cd $(LVMRUNTIMEDIR); $(MAKE)

.SUFFIXES : .o .hs .hi .lhs .hc	.s .ag

$(LVMLIBDIR)/common/ghc/Special.hi: $(LVMLIBDIR)/common/ghc/Special.hs
	# GHC Special.hs
	$(HC) -c $< -fglasgow-exts $(HC_OPTS) 

libraries:
	@echo "****************************************************"
	@echo "  Libraries (with overloading)"
	@echo "****************************************************"
	cd ../lib; $(MAKE) 
	@echo "****************************************************"
	@echo "  Simple libraries (without overloading)"
	@echo "****************************************************"
	cd ../lib/simple; $(MAKE) 

texthint: texthint/Main.o utils/OSSpecific.o
	@echo "****************************************************"
	@echo "  TextHint: the textual Helium interpreter"
	@echo "****************************************************"
	$(HC) $(HC_OPTS) -o $(HELIUMBINDIR)/texthint$(EXE) texthint/Main.o \
                      utils/OSSpecific.o
	$(STRIP) $(HELIUMBINDIR)/texthint$(EXE)

texthint/Main.o: utils/OSSpecific.hi texthint/Main.hs

# AG sources

ag : $(AGSOURCES)

cleanag : 
	$(RM) $(AGSOURCES)

ifdef AG
parser/ResolveOperators.hs : \
		parser/ResolveOperators.ag syntax/UHA_Syntax.ag
	# AG ResolveOperators
	cd parser;$(AG) $(AG_OPTS) --self ResolveOperators.ag;cd ..

syntax/UHA_Pretty.hs : \
		syntax/UHA_Pretty.ag syntax/UHA_Syntax.ag
	# AG UHA_Pretty
	cd syntax;$(AG) $(AG_OPTS) UHA_Pretty.ag;cd ..

syntax/UHA_OneLine.hs : \
		syntax/UHA_OneLine.ag syntax/UHA_Syntax.ag
	# AG UHA_OneLine
	cd syntax;$(AG) $(AG_OPTS) --self UHA_OneLine.ag;cd ..

staticanalysis/staticchecks/StaticChecks.hs : \
		staticanalysis/staticchecks/StaticChecks.ag \
		staticanalysis/staticchecks/KindChecking.ag \
                staticanalysis/staticchecks/TopLevelErrors.ag \
                staticanalysis/staticchecks/MiscErrors.ag \
                staticanalysis/staticchecks/Warnings.ag \
		staticanalysis/staticchecks/ExportErrors.ag \
                staticanalysis/staticchecks/Collect.ag \
                staticanalysis/staticchecks/HeliumPartialSyntax.ag \
                staticanalysis/staticchecks/Scope.ag \
                staticanalysis/staticchecks/ScopeErrors.ag \
		syntax/UHA_Syntax.ag 
                
	# AG StaticAnalysis
	cd staticanalysis/staticchecks;$(AG) $(AG_OPTS) --self StaticChecks.ag;cd ../..

staticanalysis/inferencers/TypeInferencing.hs : \
		staticanalysis/inferencers/TypeInferencing.ag \
                staticanalysis/inferencers/TypeInferenceRules.ag \
                staticanalysis/inferencers/TypeInferenceOverloading.ag \
                staticanalysis/inferencers/TypeInferenceCollect.ag \
                staticanalysis/inferencers/TypeInferenceInfo.ag \
                staticanalysis/inferencers/PatternMatchWarnings.ag \
                staticanalysis/inferencers/LocalInfo.ag \
                staticanalysis/inferencers/GlobalInfo.ag \
                staticanalysis/staticchecks/HeliumPartialSyntax.ag \
		syntax/UHA_Syntax.ag \
                staticanalysis/staticchecks/Scope.ag\
                staticanalysis/directives/TS_PatternMatching.ag
                
	# AG TypeInferencing
	cd staticanalysis/inferencers;$(AG) $(AG_OPTS) --self TypeInferencing.ag;cd ../..

staticanalysis/inferencers/KindInferencing.hs : \
		staticanalysis/inferencers/KindInferencing.ag \
                syntax/UHA_Syntax.ag \
                
	# AG TypeInferencing
	cd staticanalysis/inferencers;$(AG) $(AG_OPTS) --self KindInferencing.ag;cd ../..

codegeneration/CodeGeneration.hs : \
		codegeneration/CodeGeneration.ag \
		syntax/UHA_Syntax.ag codegeneration/ToCoreModule.ag codegeneration/ToCoreDecl.ag \
		codegeneration/ToCoreExpr.ag codegeneration/ToCorePat.ag codegeneration/ToCoreName.ag
	# AG CodeGeneration
	cd codegeneration;$(AG) $(AG_OPTS) --self CodeGeneration.ag;cd ..

syntax/UHA_Syntax.hs : syntax/UHA_Syntax.ag
	# AG UHA_Syntax
	cd syntax;$(AG) -dmr UHA_Syntax.ag;cd ..

modulesystem/ExtractImportDecls.hs : \
		modulesystem/ExtractImportDecls.ag codegeneration/ToCoreName.ag syntax/UHA_Syntax.ag
	# AG ExtractImportDecls
	cd modulesystem;$(AG) $(AG_OPTS) --self ExtractImportDecls.ag;cd ..
        
staticanalysis/directives/TS_Syntax.hs : \
	staticanalysis/directives/TS_Syntax.ag
	# AG TS_Syntax
	cd staticanalysis/directives;$(AG) -dmr TS_Syntax.ag;cd ../..

staticanalysis/directives/TS_Analyse.hs : \
        staticanalysis/directives/TS_Syntax.ag \
        staticanalysis/directives/TS_Collect.ag \
        staticanalysis/directives/TS_Analyse.ag \
        syntax/UHA_Syntax.ag 
	# AG TS_Analyse
	cd staticanalysis/directives;$(AG) $(AG_OPTS) --self TS_Analyse.ag;cd ../..

staticanalysis/directives/TS_Apply.hs : \
        staticanalysis/directives/TS_Syntax.ag \
        staticanalysis/directives/TS_Collect.ag \
        staticanalysis/directives/TS_Apply.ag \
        staticanalysis/directives/TS_CoreSyntax.ag \
        syntax/UHA_Syntax.ag \
	# AG TS_Syntax
	cd staticanalysis/directives;$(AG) -mscf TS_Apply.ag;cd ../..

staticanalysis/directives/TS_CoreSyntax.hs : \
	staticanalysis/directives/TS_CoreSyntax.ag \
	# AG TS_CoreSyntax
	cd staticanalysis/directives;$(AG) -md TS_CoreSyntax.ag;cd ../..

staticanalysis/directives/TS_ToCore.hs : \
        staticanalysis/directives/TS_Syntax.ag \
        staticanalysis/directives/TS_Collect.ag \
        staticanalysis/directives/TS_ToCore.ag \
        syntax/UHA_Syntax.ag \
        syntax/UHA_OneLine.ag 
	# AG TS_Syntax
	cd staticanalysis/directives;$(AG) -mscrf --self TS_ToCore.ag;cd ../..
                        
endif

# Standard suffix rules
.o.hi:
	@:

.lhs.o:
	$(HC) -c $< $(HC_OPTS)

.hs.o:
	$(HC) -c $< $(HC_OPTS)

.hs.hi:
	$(HC) -c $< $(HC_OPTS) 

.lhs.hi:
	$(HC) -c $< $(HC_OPTS)

.ag.hs:
	$(AG) -a $<


# Documentation target (with Haddock) Ê
doc:
	haddock +RTS -K8M -RTS \
	    --title="The Helium Compiler" \
		--prologue=prologue.txt \
		-h -o ../docs/haddock \
		$(PARSER) $(STATICANALYSIS) $(UHA) $(CODEGENERATION) $(UTILS) \
		$(MAINFILES) $(MODULESYSTEM)

# Ignoring files for SVN repository

ignore :
	svn propset -R svn:ignore -F ../svn-ignore ..


# Clean	up
clean:
	$(RM) `find . -name "*.o" -print`
	$(RM) `find . -name "*.hi" -print`
	$(RM) `find . -name "*.class" -print`
	$(RM) ../lib/*.lvm
	$(RM) ../lib/simple/*.lvm
	$(RM) $(HELIUMBINDIR)/$(MAIN)$(EXE)
	$(RM) $(HELIUMBINDIR)/texthint$(EXE)	
	cd $(LVMLIBDIR); $(MAKE) clean
	cd $(LVMRUNTIMEDIR); $(MAKE) clean
	cd $(TOPDIR)/..; $(MAKE) clean 

# Inter-module dependencies
depend :
	# Checking dependencies
	$(HC) -M $(HC_OPTS) $(SRCS)

# UTRECHT ONLY

newVersion: 
	echo "module Version where version=\"1.6 (`date`)\"" >main/Version.hs

smaller:
	# *** UPX helium, texthint & lvmrun
ifdef UPX
	$(UPX) -q -9 $(HELIUMBINDIR)/$(MAIN)$(EXE) || echo "helium is al gecomprimeerd"
	cd $(LVMRUNTIMEDIR); $(UPX) -q -9 lvmrun$(EXE)  || echo "lvmrun is al gecomprimeerd"
	$(UPX) -q -9 $(HELIUMBINDIR)/texthint$(EXE) || echo "texthint is al gecomprimeerd"
endif

install : smaller
	# *** Copy sources to library directory
	$(MKDIR) $(bindir) $(libdir) $(demodir)
	$(INSTALL) -m 644 ../lib/simple/Prelude.hs $(libdir)
	$(INSTALL) -m 644 ../lib/simple/List.hs $(libdir)
	$(INSTALL) -m 644 ../lib/simple/Maybe.hs $(libdir)
	$(INSTALL) -m 755 $(HELIUMBINDIR)/$(MAIN)$(EXE) $(bindir)
	$(INSTALL) -m 755 $(LVMRUNTIMEDIR)/lvmrun$(EXE) $(bindir)
	$(INSTALL) -m 755 $(HELIUMBINDIR)/texthint$(EXE) $(bindir)
	# *** Copying demos to demo directory
	$(INSTALL) -m 644 ../demo/Calendar.hs $(demodir)
	$(INSTALL) -m 644 ../demo/ParserLibrary.hs $(demodir)
	$(INSTALL) -m 644 ../demo/ParserDemo.hs $(demodir)
	$(INSTALL) -m 644 ../demo/TicTacToe.hs $(demodir)
	# *** Copy generated lvms and touch them
	$(INSTALL) -m 644 ../lib/simple/HeliumLang.lvm $(libdir)
	$(INSTALL) -m 644 ../lib/simple/List.lvm $(libdir)
	$(INSTALL) -m 644 ../lib/simple/LvmException.lvm $(libdir)
	$(INSTALL) -m 644 ../lib/simple/LvmIO.lvm $(libdir)
	$(INSTALL) -m 644 ../lib/simple/LvmLang.lvm $(libdir)
	$(INSTALL) -m 644 ../lib/simple/Maybe.lvm $(libdir)
	$(INSTALL) -m 644 ../lib/simple/Prelude.lvm $(libdir)
	$(INSTALL) -m 644 ../lib/simple/PreludePrim.lvm $(libdir)
	$(INSTALL) -m 644 ../lib/simple/Prelude.type $(libdir)
	touch $(libdir)/*.lvm

movetohome: smaller
	# *** Copying simple library sources to distribution directory
	cp ../lib/simple/Prelude.hs ../lib/simple/List.hs ../lib/simple/Maybe.hs ../distribution/helium/lib/simple
	# *** Copying overloaded library sources to distribution directory
	cp ../lib/simple/Prelude.hs ../lib/simple/List.hs ../lib/simple/Maybe.hs ../lib/Char.hs ../distribution/helium/lib
	# *** Copying executables to projects directory
	cp $(HELIUMBINDIR)/$(MAIN)$(EXE) ../distribution/helium/bin
	cp $(LVMRUNTIMEDIR)/lvmrun$(EXE) ../distribution/helium/bin
	cp $(HELIUMBINDIR)/texthint$(EXE) ../distribution/helium/bin
	# *** Copying demos to projects directory
	cp ../demo/Calendar.hs ../demo/TicTacToe.hs ../distribution/helium/demo
	# *** Copy simple and overloaded generated lvms and touch them
	cp ../lib/simple/*.lvm ../distribution/helium/lib/simple
	cp ../lib/*.lvm ../distribution/helium/lib
	touch ../distribution/helium/lib/*.lvm # so that they are seen as up to date
	touch ../distribution/helium/lib/simple/*.lvm # so that they are seen as up to date

movetobbl: smaller
	# *** Copying library sources to projects directory
	cp ../lib/simple/Prelude.hs ../lib/simple/List.hs ../lib/simple/Maybe.hs /cygdrive/r/helium/lib/simple
	# *** Copying overloaded library sources to projects directory
	cp ../lib/simple/Prelude.hs ../lib/simple/List.hs ../lib/simple/Maybe.hs ../lib/Char.hs /cygdrive/r/helium/lib	
	# *** Copying executables to projects directory
	cp $(HELIUMBINDIR)/$(MAIN)$(EXE) /cygdrive/r/helium/bin
	cp $(LVMRUNTIMEDIR)/lvmrun$(EXE) /cygdrive/r/helium/bin
	cp $(HELIUMBINDIR)/texthint$(EXE) /cygdrive/r/helium/bin
	# *** Copying demos to projects directory
	cp ../demo/Calendar.hs ../demo/TicTacToe.hs /cygdrive/r/helium/demo
	# *** Copy generated simple and overloaded lvms and touch them
	cp ../lib/simple/*.lvm /cygdrive/r/helium/lib/simple
	cp ../lib/*.lvm /cygdrive/r/helium/lib
	touch /cygdrive/r/helium/lib/simple/*.lvm # so that they are seen as up to date	
	touch /cygdrive/r/helium/lib/*.lvm # so that they are seen as up to date
	# DON'T FORGET TO CHECK PERMISSIONS
	cp ../../hint/release/Hint.jar /cygdrive/r/helium/bin

# DO NOT DELETE: Beginning of Haskell dependencies
# DO NOT DELETE: End of Haskell dependencies
