Makefile revision 5d4038657f6a63e131f5804af2f7957b69e15a43
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# Author: Klaus L�ttich
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# This Makefile will compile the new hetcats system and provides also
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# targets for test programs during implementation phases.
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# !!! Note: This makefile is written for GNU make !!!
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# (gmake on solaris ; make on linux)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## Some varibles, which control the compilation
b9625461755578f3eed04676d42a63fd2caebd0cChristian MaederCOMMONLIB_PATH = Common/Lib:Common/Lib/Parsec:Common/ATerm
96ef2e46d048c357927f2795a40e9e66f21b85fbSonja GröningCLEAN_PATH = Common:Logic:CASL:Syntax:Static:GUI:HasCASL:Haskell:Haskell/Language:Modal:CspCASL:ATC:ToHaskell:Proofs:Comorphisms:$(INCLUDE_PATH):Haskell/Hatchet
e1905890322767ae24c4594d80e31877037f4055Klaus LuettichDRIFT_ENV = DERIVEPATH='.:ghc:hetcats:/home/linux-bkb/ghc/ghc-latest/lib/ghc-6.0.1/imports'
5d4038657f6a63e131f5804af2f7957b69e15a43Klaus LuettichHC_FLAGS = -fglasgow-exts -fallow-overlapping-instances -Wall -O2
5d4038657f6a63e131f5804af2f7957b69e15a43Klaus Luettich# please remove '-O2' if compilation lasts to long on your system
5d4038657f6a63e131f5804af2f7957b69e15a43Klaus Luettich# but please don't commit to cvs server
caf544dc9b8f02e05e37786681153f5660e67f64Martin KühlHC_PACKAGE = -package-conf ../uni/uni-package.conf -package uni-davinci -package uni-server
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### Profiling and Warnings (only for debugging)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### Attention every module must be compiled with profiling or the linker
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### cannot link the various .o files properly. So after switching on
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### Profiling, do an 'gmake clean; gmake'
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### If you need Profiling comment out the following line
5d4038657f6a63e131f5804af2f7957b69e15a43Klaus Luettich#HC_PROF = -prof -auto-all
b0294d73dcefc502ddaa13e18b46103a5916971fTill MossakowskiHCI_OPTS = $(HC_FLAGS) $(HC_PACKAGE) $(HC_INCLUDE)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### list of directories to run checks in
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## sources for hetcats (semi - manually produced with a perl script)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maederobjects = $(patsubst %.lhs,%.o,$(sources:%.hs=%.o))
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maederdrifted_files = Syntax/AS_Architecture.hs Syntax/AS_Library.hs\
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers Common/AS_Annotation.hs CASL/AS_Basic_CASL.hs Syntax/AS_Structured.hs \
5d4038657f6a63e131f5804af2f7957b69e15a43Klaus Luettichgenrule_header_files = $(wildcard ATC/*.header.hs)
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckersgenrule_files = Common/Lib/Graph.hs Common/Id.hs Common/Result.hs Common/AS_Annotation.der.hs Common/Named.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers Syntax/AS_Structured.der.hs Syntax/AS_Architecture.der.hs Common/GlobalAnnotations.hs Syntax/AS_Library.der.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers CASL/Morphism.hs CASL/StaticAna.hs CASL/AS_Basic_CASL.der.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers HasCASL/Le.hs HasCASL/As.hs HasCASL/Symbol.hs HasCASL/Morphism.hs \
96ef2e46d048c357927f2795a40e9e66f21b85fbSonja Gröning Haskell/Hatchet/AnnotatedHsSyn.hs Haskell/Hatchet/MultiModuleBasics.hs \
96ef2e46d048c357927f2795a40e9e66f21b85fbSonja Gröning Haskell/Hatchet/Class.hs Haskell/Hatchet/KindInference.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckersgendrifted_files = ATC/Graph.hs ATC/Id.hs ATC/Result.hs ATC/AS_Annotation.hs ATC/Named.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers ATC/AS_Structured.hs ATC/AS_Architecture.hs ATC/DevGraph.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers CASL/ATC_CASL.hs Haskell/ATC_Haskell.hs HasCASL/ATC_HasCASL.hs CspCASL/ATC_CspCASL.hs
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckersgenerated_rule_files = $(patsubst %.hs,%.der.hs,$(gendrifted_files))
96ef2e46d048c357927f2795a40e9e66f21b85fbSonja Gröninghappy_files = Haskell/Language/Parser.hs Haskell/Hatchet/HsParser.hs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# this variable holds the modules that should be documented
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# the imported parsec library is not included!
0e012772df2ce0dc7e8f0fe3acf458c2871dcfbcChristian Maederdoc_sources = $(filter-out Nothing/Nothing% ,$(sources))
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
ba0ec5e897ef99d420c8c14c2374e0f32b7043dbKlaus Luettich.PHONY : clean d_clean real_clean bin_clean check hetana hetpa hetdg clean_genRules genRules
b49276c9f50038e0bd499ad49f7bd6444566a834Christian Maederhetcats-make: hets.hs utils/create_sources.pl $(drifted_files) $(happy_files)
f29371d8bd5a232c974e736b06d0d8a655d320fbKlaus Luettich $(HC) --make -o hets $< $(HC_OPTS) 2>&1 | tee hetcats-make
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder###############################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### TAGS files for (x)emacs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# load them with "M-x" "visit-tags-table" from
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# use "M-." to search for a tag
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# !!Beware this is somewhat instable, because it uses an absolute path!!
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder /home/ger/linux/ghc-5.04.2/bin/i386-unknown-linux/hasktags \
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder $(sources); mv TAGS $@; mv tags hetcats.tags
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder###############################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### Documentation via haddock
670691f757fefac75f63a15f6aa14706e05fe155Klaus Luettich --read-interface=http://www.haskell.org/ghc/docs/latest/html/base,/home/linux-bkb/ghc/ghc-6.0.1/share/ghc-6.0.1/html/base/base.haddock \
ef67402074be14deb95e4ff564737d5593144130Klaus Luettich -t 'hets -- a heterogenous Specification (CASL) tool set'
ac43fa22d2d3f91a17674ac164cba3cf39a17795Klaus Luettich#############################
ac43fa22d2d3f91a17674ac164cba3cf39a17795Klaus Luettich### ATC DrIFT-rule generation
5d4038657f6a63e131f5804af2f7957b69e15a43Klaus Luettich$(generated_rule_files): $(genrule_files) $(genrule_header_files)
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers utils/genRules -r $(rule) -o CASL -h ATC/CASL.header.hs $(casl_files)
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers utils/genRules -r $(rule) -o HasCASL -h ATC/HasCASL.header.hs $(hascasl_files)
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers utils/genRules -r $(rule) -o CspCASL -h ATC/CspCASL.header.hs $(cspcasl_files)
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers utils/genRules -r $(rule) -o Haskell -h ATC/Haskell.header.hs $(haskell_files)
ac43fa22d2d3f91a17674ac164cba3cf39a17795Klaus Luettichgen_atc_files = if [ -f ATC/$(basename $(basename $(notdir $(file)))).header.hs ]; then \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers utils/genRules -r $(rule) -o ATC -h ATC/$(basename $(basename $(notdir $(file)))).header.hs $(file); \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckersatc_files := $(filter-out CASL/% HasCASL/% CspCASL/% Haskell/% ,$(genrule_files))
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckerscasl_files := $(filter CASL/% ,$(genrule_files))
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckershascasl_files := $(filter HasCASL/% ,$(genrule_files))
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckerscspcasl_files := $(filter CspCASL/% ,$(genrule_files))
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckershaskell_files := $(filter Haskell/%,$(genrule_files))
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder###############
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### removes *.hi and *.o in all include directories
26f228bf3a3fea810223396e5794c217a79a8d5bChristian Maeder for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
b9625461755578f3eed04676d42a63fd2caebd0cChristian Maeder### remove binaries
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### additonally removes *.d (dependency files) in every include directory
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### also delete *.d.bak (dependency file backups)
26f228bf3a3fea810223396e5794c217a79a8d5bChristian Maeder for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
b9625461755578f3eed04676d42a63fd2caebd0cChristian Maeder### remove files also in own libraries
75cda7e5b890d050d560d970af244a183f28328fKlaus Luettich for p in $(subst :, ,$(COMMONLIB_PATH)) . ; do \
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### additionally removes the files that define the sources-variable
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### additionally removes files not in CVS tree
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### test targets
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### a parser to test annotation parser and Id parsers
470ca7a2797069ae4b27c34c1b71419f67be1f84Christian MaederCommon/test_parser: Common/test_parser.hs Common/AS_Annotation.der.hs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### interactive
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### christian's target
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### CASL parser
470ca7a2797069ae4b27c34c1b71419f67be1f84Christian MaederCASL/capa: CASL/capa.lhs Common/*.hs CASL/*.hs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### HasCASL parser
d67a33b40578beef2e255a274f89bb9c34aaf056Christian MaederHasCASL/hacapa: HasCASL/hacapa.lhs CASL/capa HasCASL/*.hs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### Haskell parser
b49276c9f50038e0bd499ad49f7bd6444566a834Christian MaederHaskell/hapa: Haskell/hapa.lhs Haskell/*.hs Haskell/Language/*.hs $(happy_files)
d67a33b40578beef2e255a274f89bb9c34aaf056Christian Maeder### Haskell wrap parser
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### HetCASL parser
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### HetCASL parser
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers### ATC test system
5d4038657f6a63e131f5804af2f7957b69e15a43Klaus Luettich### ATerm.Lib test system
5d4038657f6a63e131f5804af2f7957b69e15a43Klaus Luettichatermlibtest: Common/ATerm/ATermLibTest.hs Common/ATerm/*.hs Common/SimpPretty.hs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### HetCASL with dev graph
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder $(HC) --make -o $@ $< $(HC_OPTS) -package-conf ../uni/uni-package.conf -package uni-davinci -package uni-server
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### run tests in other directories
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder for i in $(TESTDIRS); do $(MAKE) -C $$i check; done
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## Preparing the version of HetCATS
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maederhetcats/Version.hs: hetcats/Version.in version_nr
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder $(PERL) utils/build_version.pl version_nr < hetcats/Version.in > $@
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## two hardcoded dependencies for a correct generation of Version.hs
ba0ec5e897ef99d420c8c14c2374e0f32b7043dbKlaus Luettichhetcats/Options.hs hetcats/WriteFn.hs hetcats/ReadFn.hs: hetcats/Version.hs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## rules for DrIFT
ba0ec5e897ef99d420c8c14c2374e0f32b7043dbKlaus Luettich# $(AG) $< -o $@
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## compiling rules for object and interface files
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## compiling rules for dependencies
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## Setting a global search path (for dependency files)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## include every .d file in INCLUDE_PATH
f29371d8bd5a232c974e736b06d0d8a655d320fbKlaus Luettichsources_hetcats.mk: hetcats-make hetcats/Version.hs hets.hs utils/create_sources.pl $(drifted_files) $(happy_files)