Makefile revision 327a9b9bf44b6e33f71fee7526dc1c0035251591
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder# Author: (c) Klaus L�ttich, Christian Maeder, Uni Bremen 2002-2004
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# This Makefile will compile the new hetcats system and provides also
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# targets for test programs during implementation phases.
43b4c41fbb07705c9df321221ab9cb9832460407Christian Maeder# !!! Note: This makefile is written for GNU make !!!
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# (gmake on solaris ; make on linux)
f2f9df2e17e70674f0bf426ed1763c973ee4cde0Christian Maeder####################################################################
c9a7e6af169a2adfb92f42331cd578065ed83a2bChristian Maeder## Some varibles, which control the compilation
e7757995211bd395dc79d26fe017d99375f7d2a6Christian MaederCOMMONLIB_PATH = Common/Lib:Common/Lib/Parsec:Common/ATerm
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian MaederCLEAN_PATH = Common:Logic:CASL:Syntax:Static:GUI:HasCASL:Haskell:Modal:CspCASL:ATC:ToHaskell:Proofs:Comorphisms:$(INCLUDE_PATH):Haskell/Hatchet
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder## set ghc imports properly for your system
a1ed34933c266ce85066acb0d7b20c90cb8eb213Christian MaederDRIFT_ENV = DERIVEPATH='.:ghc:hetcats:/home/linux-bkb/ghc/ghc-latest/lib/ghc-6.0.1/imports:${GHC_IMPORTS}'
d23b0cc79c0d204e6ec758dff8d0ba71c9f693f7Christian MaederHC_PACKAGE = -package-conf ../uni/uni-package.conf -package uni-davinci \
3e8b136f23ed57d40ee617f49bcac37830b58cabChristian Maeder### Profiling and Warnings (only for debugging)
ef9e8535c168d3f774d9e74368a2317a9eda5826Christian Maeder### Attention every module must be compiled with profiling or the linker
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder### cannot link the various .o files properly. So after switching on
e593b89bfd4952698dc37feced21cefe869d87a2Christian Maeder### Profiling, do an 'gmake clean; gmake'
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder### If you need Profiling comment out the following line
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder#HC_PROF = -prof -auto-all
1aee4aaddde105264c1faf394d88e302c05094ffChristian MaederHCI_OPTS = $(HC_FLAGS) $(HC_PACKAGE) $(HC_INCLUDE)
51d769d55d88dfa88bdf54bee78d8fa85a2deba8Christian Maeder#DRIFT_OPTS = +RTS -K10 -RTS
7cc09dd93962a2155c34d209d1d4cd7d7b838264Christian Maeder### list of directories to run checks in
1aee4aaddde105264c1faf394d88e302c05094ffChristian Maeder####################################################################
c3053d57f642ca507cdf79512e604437c4546cb9Christian Maeder## sources for hetcats (semi - manually produced with a perl script)
6dc9bc98d0854fe2e3dd3bfc4275096a0c28ee1cChristian Maederobjects = $(patsubst %.lhs,%.o,$(sources:%.hs=%.o))
61fa0ac06ede811c7aad54ec4c4202346727368eChristian Maederdrifted_files = Syntax/AS_Architecture.hs Syntax/AS_Library.hs\
c0c2380bced8159ff0297ece14eba948bd236471Christian Maeder Common/AS_Annotation.hs CASL/AS_Basic_CASL.hs Syntax/AS_Structured.hs \
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maedergenrule_header_files = $(wildcard ATC/*.header.hs)
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maedergenrule_files = Common/Lib/Graph.hs Common/Id.hs Common/Result.hs \
6a79849bed67264c396dddb3e9c184bdfc1a1bc9Christian Maeder Syntax/AS_Structured.der.hs Syntax/AS_Architecture.der.hs \
6a79849bed67264c396dddb3e9c184bdfc1a1bc9Christian Maeder Common/GlobalAnnotations.hs Syntax/AS_Library.der.hs \
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder CASL/Morphism.hs CASL/Sign.hs CASL/AS_Basic_CASL.der.hs \
ca074a78b8dcccbb8c419586787882f98d0c6163Christian Maeder HasCASL/Le.hs HasCASL/As.hs HasCASL/Symbol.hs \
a5e5b8c3e5c11177e5034ef2423813a5d28979edChristian Maeder Haskell/Hatchet/Class.hs Haskell/Hatchet/KindInference.hs \
2d130d212db7208777ca896a7ecad619a8944971Christian Maedergendrifted_files = ATC/Graph.hs ATC/Id.hs ATC/Result.hs ATC/AS_Annotation.hs \
f4a2a20e49f41b2afa657e5e64d9e349c7faa091Christian Maeder ATC/AS_Library.hs ATC/GlobalAnnotations.hs \
2d130d212db7208777ca896a7ecad619a8944971Christian Maeder ATC/AS_Structured.hs ATC/AS_Architecture.hs \
6ff7a91875597d6e4dfaa68c79187d01473e8341Christian Maeder HasCASL/ATC_HasCASL.hs CspCASL/ATC_CspCASL.hs
6a79849bed67264c396dddb3e9c184bdfc1a1bc9Christian Maedergenerated_rule_files = $(patsubst %.hs,%.der.hs,$(gendrifted_files))
6a79849bed67264c396dddb3e9c184bdfc1a1bc9Christian Maeder# this variable holds the modules that should be documented
6a79849bed67264c396dddb3e9c184bdfc1a1bc9Christian Maeder# the imported parsec library is not included!
6a79849bed67264c396dddb3e9c184bdfc1a1bc9Christian Maederdoc_sources = $(filter-out Nothing/Nothing% ,$(sources))
6a79849bed67264c396dddb3e9c184bdfc1a1bc9Christian Maeder####################################################################
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder.PHONY : clean d_clean real_clean bin_clean check hetana hetpa hetdg \
ca074a78b8dcccbb8c419586787882f98d0c6163Christian Maeder.SECONDARY : %.hs %.d $(generated_rule_files)
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maederhetcats-make: hets.hs utils/create_sources.pl $(drifted_files) $(happy_files)
ca074a78b8dcccbb8c419586787882f98d0c6163Christian Maeder $(HC) --make -o hets $< $(HC_OPTS) 2>&1 | tee hetcats-make
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder###############################
ca074a78b8dcccbb8c419586787882f98d0c6163Christian Maeder### TAGS files for (x)emacs
ca074a78b8dcccbb8c419586787882f98d0c6163Christian Maeder# load them with "M-x" "visit-tags-table" from
3e8b136f23ed57d40ee617f49bcac37830b58cabChristian Maeder# use "M-." to search for a tag
f1541d4a151dbd08002dbd14e7eb1d5dde253689Christian Maeder# !!Beware this is somewhat instable, because it uses an absolute path!!
d946c1bfdd7d58aa7c023efe864d5999eb44a61bChristian Maeder /home/ger/linux/ghc-5.04.2/bin/i386-unknown-linux/hasktags \
e6d5dbbc3308f05197868806e0b860f4f53875f1Christian Maeder $(sources); mv TAGS $@; mv tags hetcats.tags
e4f4d096e5e6d60dd91c746d0e833d0ac7a29c50Christian Maeder###############################
eb74267cf39e4e95f9eeb5c765f4c8dac33971b4Christian Maeder### Documentation via haddock
61fa0ac06ede811c7aad54ec4c4202346727368eChristian Maeder# index for prelude is missing
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder -t 'hets -- a heterogenous Specification (CASL) tool set'
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder###############################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### release management
93f5b72fdb9ee734caa750b43dd79bbb590dcd73Christian MaederderivedSources: $(drifted_files) $(happy_files) hetcats/Version.hs
93f5b72fdb9ee734caa750b43dd79bbb590dcd73Christian Maeder (cd utils/DrIFT-src; $(HC) --make DrIFT.hs -o ../DrIFT)
254df6f22d01eacf7c57b85729e0445747b630d9Christian Maeder $(HC) --make -i../.. -package text GenerateRules.hs -o ../genRules)
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder cvs -d :pserver:cvsread@cvs-agbkb.informatik.uni-bremen.de:/repository co HetCATS
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder (cd HetCATS; $(MAKE) derivedSources; ./clean.sh; \
a14767aeac3e78ed100f5b75e210ba563ee10dbaChristian Maeder find . -name CVS -o -name \*.o -o -name \*.hi | xargs -r $(RM) -r; \
54ea981a0503c396c2923a1c06421c6235baf27fChristian Maeder $(RM) clean.*; $(RM) Makefile; mv ReleaseMakefile Makefile)
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers#############################
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder### ATC DrIFT-rule generation
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian MaedergenRules: $(generated_rule_files) utils/genRules
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder$(generated_rule_files): $(genrule_files) utils/genRules #$(genrule_header_files)
383aa66e5142365fe9b1f88b18c1da5b27cc8c04Christian Maeder $(foreach file,$(atc_files),$(gen_atc_files))
383aa66e5142365fe9b1f88b18c1da5b27cc8c04Christian Maeder utils/genRules -r $(rule) -o CASL -h ATC/CASL.header.hs \
aded505f9b42cc38975559c2a5d175ae95de436bChristian Maeder utils/genRules -r $(rule) -o HasCASL -h ATC/HasCASL.header.hs \
aded505f9b42cc38975559c2a5d175ae95de436bChristian Maeder utils/genRules -r $(rule) -o CspCASL -h ATC/CspCASL.header.hs \
aded505f9b42cc38975559c2a5d175ae95de436bChristian Maeder utils/genRules -r $(rule) -o Haskell -h ATC/Haskell.header.hs \
a14767aeac3e78ed100f5b75e210ba563ee10dbaChristian Maedergen_atc_files = if [ -f ATC/$(basename $(basename $(notdir $(file)))).header.hs ]; then \
a14767aeac3e78ed100f5b75e210ba563ee10dbaChristian Maeder utils/genRules -r $(rule) -o ATC -h ATC/$(basename $(basename $(notdir $(file)))).header.hs $(file); \
aded505f9b42cc38975559c2a5d175ae95de436bChristian Maeder utils/genRules -r $(rule) -o ATC $(file); \
54ea981a0503c396c2923a1c06421c6235baf27fChristian Maederatc_files := $(filter-out CASL/% HasCASL/% CspCASL/% Haskell/% ,$(genrule_files))
54ea981a0503c396c2923a1c06421c6235baf27fChristian Maedercasl_files := $(filter CASL/% ,$(genrule_files))
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maederhascasl_files := $(filter HasCASL/% ,$(genrule_files))
aded505f9b42cc38975559c2a5d175ae95de436bChristian Maedercspcasl_files := $(filter CspCASL/% ,$(genrule_files))
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maederhaskell_files := $(filter Haskell/%,$(genrule_files))
819e29dba060687cf391e444e0f6ff88c1908cc3Christian Maeder###############
254df6f22d01eacf7c57b85729e0445747b630d9Christian Maeder### removes *.hi and *.o in all include directories
d23b0cc79c0d204e6ec758dff8d0ba71c9f693f7Christian Maeder for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
d23b0cc79c0d204e6ec758dff8d0ba71c9f693f7Christian Maeder### remove binaries
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder### additonally removes *.d (dependency files) in every include directory
986d3f255182539098a97ac86da9eeee5b7a72e3Christian Maeder### also delete *.d.bak (dependency file backups)
4561227a776bdf0ab679b19fb92f1eaaed8786f7Christian Maeder for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
5ad5dffe06818a13e1632b1119fbca7881085fc1Dominik Luecke### remove files also in own libraries
8c812cd83569e973f10cf69a342424ceabc07af9Christian Maeder for p in $(subst :, ,$(COMMONLIB_PATH)) . ; do \
7a3fe82695aa32657693e05712f84d7f81672f2eJonathan von Schroeder### additionally removes the files that define the sources-variable
7a3fe82695aa32657693e05712f84d7f81672f2eJonathan von Schroeder $(RM) hetcats-make sources_hetcats.mk
05a206508bc898f87fe6ab6e069814df3c29d303Dominik Luecke### additionally removes files not in CVS tree
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maederdistclean: real_clean clean_genRules d_clean
b1f59a4ea7c96f4c03a4d7cfcb9c5e66871cfbbbChristian Maeder####################################################################
63f0e65a37b95621334db9ee4ba0cd9d826f5c0fChristian Maeder### test targets
8c812cd83569e973f10cf69a342424ceabc07af9Christian Maeder####################################################################
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly### a parser to test annotation parser and Id parsers
f04e8f3ff56405901be968fd4c6e9769239f1a9bKlaus LuettichCommon/test_parser: Common/test_parser.hs Common/AS_Annotation.der.hs
ea3bff3e547a1ac714d4db39c5efef95e02b2e7dChristian Maeder### interactive
23b4e542dca35852f58d1fb3f7d9078c1de5ab06Christian Maeder### christian's target
23b4e542dca35852f58d1fb3f7d9078c1de5ab06Christian Maeder### CASL parser
8a78868bae2ec6838c87366c35c57e109154c51eChristian MaederCASL/capa: CASL/capa.hs Common/*.hs CASL/*.hs
48aa0645e25883048369afc02aac3f49b14a50daChristian Maeder### HasCASL parser
456238178f89e5a3de2988ee6c8af924297d52d9Christian MaederHasCASL/hacapa: HasCASL/hacapa.hs CASL/capa HasCASL/*.hs
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder### Haskell parser
456238178f89e5a3de2988ee6c8af924297d52d9Christian MaederHaskell/hapa: Haskell/hapa.hs Haskell/Hatchet/*.hs $(happy_files)
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder### HetCASL parser
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder### HetCASL parser
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder### ATC test system
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maederatctest2: ATC/ATCTest2.hs Common/SimpPretty.hs Common/ATerm/*.hs Common/Lib/*.hs
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maederatermlibtest: Common/ATerm/ATermLibTest.hs Common/ATerm/*.hs Common/SimpPretty.hs
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder### HetCASL with dev graph
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder $(HC) --make -o $@ $< $(HC_OPTS) -package-conf ../uni/uni-package.conf -package uni-davinci -package uni-server
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder### run tests in other directories
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder for i in $(TESTDIRS); do $(MAKE) -C $$i check; done
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder####################################################################
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder## Preparing the version of HetCATS
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maederhetcats/Version.hs: hetcats/Version.in version_nr
3e8b136f23ed57d40ee617f49bcac37830b58cabChristian Maeder $(PERL) utils/build_version.pl version_nr < hetcats/Version.in > $@
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder## two hardcoded dependencies for a correct generation of Version.hs
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maederhetcats/Options.hs hetcats/WriteFn.hs hetcats/ReadFn.hs: hetcats/Version.hs
9f85afecbd79b3df5a0bb17bd28cd0b288dc3213Kristina Sojakova####################################################################
48aa0645e25883048369afc02aac3f49b14a50daChristian Maeder## rules for DrIFT
c2e192ace9ef7cfb0e59563f1b24477b2b65cff3Dominik Dietrich## compiling rules for object and interface files
c70ef4c3b3a62764f715510c9fd67dde3acfe454Christian Maeder## compiling rules for dependencies
456238178f89e5a3de2988ee6c8af924297d52d9Christian Maeder####################################################################
61fa0ac06ede811c7aad54ec4c4202346727368eChristian Maeder## Setting a global search path (for dependency files)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## include every .d file in INCLUDE_PATH
10883d13973c46cac98964b66ace7a52b2d059abChristian Maedersources_hetcats.mk: hetcats-make hetcats/Version.hs hets.hs utils/create_sources.pl $(drifted_files) $(happy_files)