tock-mirror/Makefile.am

119 lines
5.3 KiB
Makefile

GHC_OPTS = \
-fglasgow-exts \
-fallow-undecidable-instances \
-fwarn-unused-binds \
-fwarn-unused-imports \
-fwarn-type-defaults \
-icommon -itransformations -ifrontends -ibackends
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
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'
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
frontends/LexOccam.hs: frontends/LexOccam.x
alex frontends/LexOccam.x
frontends/LexRain.hs: frontends/LexRain.x
alex frontends/LexRain.x
common/TagAST.hs: GenTagAST$(EXEEXT)
./GenTagAST$(EXEEXT) > common/TagAST.hs
BUILT_SOURCES = frontends/LexOccam.hs frontends/LexRain.hs CompilerCommands.hs common/TagAST.hs
CLEANFILES = $(BUILT_SOURCES)
tock_SOURCES_hs = transformations/SimplifyExprs.hs transformations/SimplifyTypes.hs
tock_SOURCES_hs += transformations/Unnest.hs transformations/RainUsageCheck.hs transformations/SimplifyProcs.hs
tock_SOURCES_hs += transformations/SimplifyComms.hs transformations/ArrayUsageCheck.hs
tock_SOURCES_hs += frontends/PreprocessOccam.hs frontends/ParseRain.hs frontends/StructureOccam.hs
tock_SOURCES_hs += frontends/ParseOccam.hs frontends/RainTypes.hs frontends/RainPasses.hs frontends/ParseUtils.hs
tock_SOURCES_hs += common/Pass.hs common/TreeUtil.hs common/Intrinsics.hs common/EvalLiterals.hs
tock_SOURCES_hs += common/Pattern.hs common/Errors.hs common/ShowCode.hs common/PrettyShow.hs
tock_SOURCES_hs += common/EvalConstants.hs common/Utils.hs common/CompState.hs common/Types.hs
tock_SOURCES_hs += common/Metadata.hs common/AST.hs common/FlowGraph.hs common/FlowAlgorithms.hs
tock_SOURCES_hs += common/TagAST.hs
tock_SOURCES_hs += backends/TLP.hs backends/BackendPasses.hs backends/AnalyseAsm.hs
tock_SOURCES_hs += backends/GenerateC.hs backends/GenerateCPPCSP.hs
tock_SOURCES_hs += Main.hs
tock_SOURCES = $(tock_SOURCES_hs) frontends/LexOccam.x frontends/LexRain.x
tocktest_SOURCES = $(tock_SOURCES)
tocktest_SOURCES += transformations/PassTest.hs transformations/RainUsageCheckTest.hs
tocktest_SOURCES += backends/GenerateCTest.hs backends/BackendPassesTest.hs
tocktest_SOURCES += common/TestUtil.hs common/CommonTest.hs common/FlowGraphTest.hs
tocktest_SOURCES += frontends/ParseRainTest.hs frontends/RainPassesTest.hs frontends/RainTypesTest.hs
tocktest_SOURCES += TestMain.hs
GenTagAST_SOURCES = GenTagAST.hs
#The programs to actually build:
bin_PROGRAMS = tock
noinst_PROGRAMS = tocktest GenTagAST
clean-local:
rm -f obj/*.o obj/*.hi
rmdir obj
cgtests/cgtest00.occ:
svn co https://subversion.frmb.org/pubsvn/cgtests/branches/tock 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
./compile-cgtests --backend=c
make-cgtests-cpp: tock cgtests/cgtest00.occ clean-cgtests
./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