200 lines
7.8 KiB
Makefile
200 lines
7.8 KiB
Makefile
GHC_OPTS = \
|
|
-fglasgow-exts \
|
|
-fwarn-deprecations \
|
|
-fwarn-duplicate-exports \
|
|
-fwarn-incomplete-record-updates \
|
|
-fwarn-missing-fields \
|
|
-fwarn-missing-methods \
|
|
-fwarn-missing-signatures \
|
|
-fwarn-overlapping-patterns \
|
|
-fwarn-simple-patterns \
|
|
-fwarn-type-defaults \
|
|
-fwarn-unused-binds \
|
|
-fwarn-unused-imports \
|
|
-ibackends -ichecks -icommon -ifrontends -itransformations
|
|
|
|
if GHC68
|
|
GHC_OPTS += -XUndecidableInstances -fwarn-tabs -fwarn-monomorphism-restriction
|
|
else
|
|
GHC_OPTS += -fallow-undecidable-instances
|
|
endif
|
|
|
|
tock$(EXEEXT): $(BUILT_SOURCES) $(tock_SOURCES)
|
|
@MKDIR_P@ obj
|
|
ghc $(GHC_OPTS) -o tock$(EXEEXT) --make Main -odir obj -hidir obj
|
|
|
|
#The order of the -main-is and --make flags is important here:
|
|
tocktest$(EXEEXT): $(BUILT_SOURCES) $(tocktest_SOURCES)
|
|
@MKDIR_P@ obj
|
|
ghc $(GHC_OPTS) -o tocktest$(EXEEXT) -main-is TestMain --make TestMain -odir obj -hidir obj
|
|
|
|
GenTagAST$(EXEEXT): $(GenTagAST_SOURCES)
|
|
@MKDIR_P@ obj
|
|
ghc $(GHC_OPTS) -o GenTagAST$(EXEEXT) -main-is GenTagAST --make GenTagAST -odir obj -hidir obj
|
|
|
|
GenOrdAST$(EXEEXT): $(GenOrdAST_SOURCES)
|
|
@MKDIR_P@ obj
|
|
ghc $(GHC_OPTS) -o GenOrdAST$(EXEEXT) -main-is GenOrdAST --make GenOrdAST -odir obj -hidir obj
|
|
|
|
TOCK_CFLAGS = @gnu89_inline@ -O2 -g -Wall `kroc --cflags` `kroc --ccincpath`
|
|
|
|
TOCK_CXXFLAGS = -O2 -g -Wall -ggdb3 -I.
|
|
TOCK_CXXLDFLAGS = -lcppcsp2 -pthread
|
|
|
|
|
|
CompilerCommands.hs: Makefile
|
|
echo -e 'module CompilerCommands where\n' > CompilerCommands.hs
|
|
echo -e '--This file is auto-generated by Makefile.am\n' >> CompilerCommands.hs
|
|
echo -e 'import Data.List\n' >> CompilerCommands.hs
|
|
echo -e 'cCommand :: String -> String -> String\n' >> CompilerCommands.hs
|
|
echo -e 'cCommand inp out = "$(CC) $(TOCK_CFLAGS) -x c -c -o " ++ out ++ " " ++ inp\n' >> CompilerCommands.hs
|
|
echo -e 'cAsmCommand :: String -> String -> String\n' >> CompilerCommands.hs
|
|
echo -e 'cAsmCommand inp out = "$(CC) $(TOCK_CFLAGS) -x c -S -o " ++ out ++ " " ++ inp\n' >> CompilerCommands.hs
|
|
echo -e 'krocLinkCommand :: String -> [String] -> String -> String\n' >> CompilerCommands.hs
|
|
echo -e 'krocLinkCommand wrapper files out = "kroc -o " ++ out ++ " " ++ wrapper ++ " " ++ (concat (intersperse " " files)) ++ " -lcif"\n' >> CompilerCommands.hs
|
|
echo -e 'cxxCommand :: String -> String -> String\n' >> CompilerCommands.hs
|
|
echo -e 'cxxCommand inp out = "$(CXX) $(TOCK_CXXFLAGS) -x c++ -o " ++ out ++ " " ++ inp ++ " $(TOCK_CXXLDFLAGS)"\n' >> CompilerCommands.hs
|
|
|
|
# Both these results are near-identical. The -g flag to alex tells it to generate
|
|
# a lexer optimised for GHC. The other part of the rule inserts the
|
|
# -fno-warn-tabs flag under GHC >= 6.8, but doesn't add anything under previous
|
|
# versions of GHC
|
|
|
|
frontends/LexOccam.hs: frontends/LexOccam.x
|
|
alex -g frontends/LexOccam.x -o frontends/LexOccam.temphs
|
|
if GHC68
|
|
echo "{-# OPTIONS_GHC -fno-warn-tabs -fno-warn-monomorphism-restriction #-}" > frontends/LexOccam.hs
|
|
cat frontends/LexOccam.temphs >> frontends/LexOccam.hs
|
|
rm frontends/LexOccam.temphs
|
|
else
|
|
mv frontends/LexOccam.temphs frontends/LexOccam.hs
|
|
endif
|
|
|
|
frontends/LexRain.hs: frontends/LexRain.x
|
|
alex -g frontends/LexRain.x -o frontends/LexRain.temphs
|
|
if GHC68
|
|
echo "{-# OPTIONS_GHC -fno-warn-tabs -fno-warn-monomorphism-restriction #-}" > frontends/LexRain.hs
|
|
cat frontends/LexRain.temphs >> frontends/LexRain.hs
|
|
rm frontends/LexRain.temphs
|
|
else
|
|
mv frontends/LexRain.temphs frontends/LexRain.hs
|
|
endif
|
|
|
|
common/TagAST.hs: GenTagAST$(EXEEXT)
|
|
./GenTagAST$(EXEEXT) > common/TagAST.hs
|
|
|
|
common/OrdAST.hs: GenOrdAST$(EXEEXT)
|
|
./GenOrdAST$(EXEEXT) > common/OrdAST.hs
|
|
|
|
BUILT_SOURCES = frontends/LexOccam.hs frontends/LexRain.hs CompilerCommands.hs common/TagAST.hs common/OrdAST.hs
|
|
CLEANFILES = $(BUILT_SOURCES)
|
|
|
|
EXTRA_DIST = docextra testcases/automatic
|
|
|
|
#One entry per line makes it easier to read and easier to modify, even if it is longer
|
|
|
|
tock_SOURCES_hs = Main.hs
|
|
tock_SOURCES_hs += backends/AnalyseAsm.hs
|
|
tock_SOURCES_hs += backends/BackendPasses.hs
|
|
tock_SOURCES_hs += backends/GenerateC.hs
|
|
tock_SOURCES_hs += backends/GenerateCBased.hs
|
|
tock_SOURCES_hs += backends/GenerateCPPCSP.hs
|
|
tock_SOURCES_hs += backends/TLP.hs
|
|
tock_SOURCES_hs += checks/ArrayUsageCheck.hs
|
|
tock_SOURCES_hs += checks/Check.hs
|
|
tock_SOURCES_hs += checks/Omega.hs
|
|
tock_SOURCES_hs += checks/UsageCheckAlgorithms.hs
|
|
tock_SOURCES_hs += checks/UsageCheckUtils.hs
|
|
tock_SOURCES_hs += common/AST.hs
|
|
tock_SOURCES_hs += common/CompState.hs
|
|
tock_SOURCES_hs += common/Errors.hs
|
|
tock_SOURCES_hs += common/EvalConstants.hs
|
|
tock_SOURCES_hs += common/EvalLiterals.hs
|
|
tock_SOURCES_hs += common/FlowGraph.hs
|
|
tock_SOURCES_hs += common/FlowAlgorithms.hs
|
|
tock_SOURCES_hs += common/Intrinsics.hs
|
|
tock_SOURCES_hs += common/Metadata.hs
|
|
tock_SOURCES_hs += common/OrdAST.hs
|
|
tock_SOURCES_hs += common/Pass.hs
|
|
tock_SOURCES_hs += common/PassList.hs
|
|
tock_SOURCES_hs += common/Pattern.hs
|
|
tock_SOURCES_hs += common/PrettyShow.hs
|
|
tock_SOURCES_hs += common/ShowCode.hs
|
|
tock_SOURCES_hs += common/TagAST.hs
|
|
tock_SOURCES_hs += common/TreeUtils.hs
|
|
tock_SOURCES_hs += common/Types.hs
|
|
tock_SOURCES_hs += common/Utils.hs
|
|
tock_SOURCES_hs += frontends/ParseOccam.hs
|
|
tock_SOURCES_hs += frontends/ParseRain.hs
|
|
tock_SOURCES_hs += frontends/ParseUtils.hs
|
|
tock_SOURCES_hs += frontends/PreprocessOccam.hs
|
|
tock_SOURCES_hs += frontends/RainPasses.hs
|
|
tock_SOURCES_hs += frontends/RainTypes.hs
|
|
tock_SOURCES_hs += frontends/StructureOccam.hs
|
|
tock_SOURCES_hs += transformations/SimplifyComms.hs
|
|
tock_SOURCES_hs += transformations/SimplifyExprs.hs
|
|
tock_SOURCES_hs += transformations/SimplifyProcs.hs
|
|
tock_SOURCES_hs += transformations/SimplifyTypes.hs
|
|
tock_SOURCES_hs += transformations/Unnest.hs
|
|
|
|
tock_SOURCES = $(tock_SOURCES_hs) frontends/LexOccam.x frontends/LexRain.x
|
|
|
|
tocktest_SOURCES = $(tock_SOURCES)
|
|
tocktest_SOURCES += TestMain.hs
|
|
tocktest_SOURCES += backends/BackendPassesTest.hs
|
|
tocktest_SOURCES += backends/GenerateCTest.hs
|
|
tocktest_SOURCES += checks/ArrayUsageCheckTest.hs
|
|
tocktest_SOURCES += checks/RainUsageCheckTest.hs
|
|
tocktest_SOURCES += common/CommonTest.hs
|
|
tocktest_SOURCES += common/FlowGraphTest.hs
|
|
tocktest_SOURCES += common/TestFramework.hs
|
|
tocktest_SOURCES += common/TestHarness.hs
|
|
tocktest_SOURCES += common/TestUtils.hs
|
|
tocktest_SOURCES += frontends/ParseRainTest.hs
|
|
tocktest_SOURCES += frontends/RainPassesTest.hs
|
|
tocktest_SOURCES += frontends/RainTypesTest.hs
|
|
tocktest_SOURCES += transformations/PassTest.hs
|
|
|
|
GenTagAST_SOURCES = GenTagAST.hs
|
|
GenOrdAST_SOURCES = GenOrdAST.hs
|
|
|
|
#The programs to actually build:
|
|
bin_PROGRAMS = tock
|
|
noinst_PROGRAMS = tocktest GenTagAST GenOrdAST
|
|
|
|
|
|
clean-local:
|
|
rm -f obj/*.o obj/*.hi
|
|
rmdir obj
|
|
|
|
cgtests/cgtest00.occ:
|
|
svn co http://projects.cs.kent.ac.uk/projects/kroc/svn/cgtests/branches/tock@4200 cgtests
|
|
|
|
# We must clean the cgtests every time at the moment, because if someone makes make-cgtests-c then make-cgtests-cpp, they'll need a clean inbetween:
|
|
# In future we should give the version compiled using the C++ backend a different extension:
|
|
|
|
make-cgtests-c: tock cgtests/cgtest00.occ clean-cgtests
|
|
sh ./compile-cgtests --backend=c
|
|
|
|
make-cgtests-cpp: tock cgtests/cgtest00.occ clean-cgtests
|
|
sh ./compile-cgtests --backend=cppcsp
|
|
|
|
clean-cgtests:
|
|
rm -f cgtests/cgtest??
|
|
|
|
#Haddock does allow you to customise the description section of a file, but only with more Haskell comments
|
|
#Since I want to use an HTML description (with links to SVG using object tags) I have to perform the following hack
|
|
#to use my own custom HTML description. Fixes to make the hack nicer are welcome :-)
|
|
|
|
haddock:
|
|
@mkdir -p doc
|
|
@echo "putmycustomdocumentationhere" > .temp-haddock-file
|
|
haddock -o doc --html -p .temp-haddock-file -t Tock $(tock_SOURCES_hs)
|
|
cp docextra/*.svg doc/
|
|
@rm .temp-haddock-file
|
|
@grep -B 10000 putmycustomdocumentationhere doc/index.html | sed "s/putmycustomdocumentationhere//" > doc/index.html-2
|
|
@cat docextra/description.html >> doc/index.html-2
|
|
@grep -A 10000 putmycustomdocumentationhere doc/index.html | tail -n +2 >> doc/index.html-2
|
|
@rm doc/index.html
|
|
@mv doc/index.html-2 doc/index.html
|