Makefile revision 69555d5968539c209b9b414c6ca8339e8e4765e0
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Author: (c) Klaus L�ttich, Christian Maeder, Uni Bremen 2002-2004
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# This Makefile will compile the new hetcats system and provides also
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# targets for test programs during implementation phases.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# !!! Note: This makefile is written for GNU make !!!
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# (gmake on solaris ; make on linux)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe####################################################################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## Some varibles, which control the compilation
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweCOMMONLIB_PATH = Common/Lib:Common/Lib/Parsec:Common/ATerm
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweCLEAN_PATH = utils/DrIFT-src:utils/GenerateRules:utils/inlineAxioms:Common:Logic:CASL:CASL/CCC:Syntax:Static:GUI:HasCASL:Haskell:Modal:CoCASL:COL:CspCASL:ATC:ToHaskell:Proofs:Comorphisms:Isabelle:$(INCLUDE_PATH):Haskell/Hatchet
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## set ghc imports properly for your system
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweLINUX_IMPORTS = $(wildcard /home/linux-bkb/ghc/ghc-latest/lib/ghc-*/imports)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDRIFT_ENV = DERIVEPATH='.:ghc:hetcats:${LINUX_IMPORTS}:${GHC_IMPORTS}'
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# override on commandline for other architectures
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweINSTALLDIR = /home/www/agbkb/forschung/formal_methods/CoFI/hets/`utils/sysname.sh`
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweGENERATERULES_deps = utils/GenerateRules/*hs $(DRIFT_deps)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# -fglasgow-exts comes in via ../uni/uni-package.conf
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# but added it here in case of compilation without uni
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweHC_PACKAGE = -package-conf ../uni/uni-package.conf -package uni-davinci \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### Profiling (only for debugging)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### Attention every module must be compiled with profiling or the linker
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### cannot link the various .o files properly. So after switching on
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### Profiling, do an 'gmake real_clean; gmake'
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### and comment out HC_PACKAGE variable definition above.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### Comment in the following line for switching on profiling.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#HC_PROF = -prof -auto-all
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweHCI_OPTS = $(HC_FLAGS) $(HC_PACKAGE) $(HC_INCLUDE)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### list of directories to run checks in
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweTESTDIRS = Common CASL HasCASL Haskell/Hatchet/examples ToHaskell/test
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe####################################################################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## sources for hetcats (semi - manually produced with a perl script)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweobjects = $(patsubst %.lhs,%.o,$(sources:%.hs=%.o))
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowedrifted_files = Syntax/AS_Architecture.hs Syntax/AS_Library.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Common/AS_Annotation.hs CASL/AS_Basic_CASL.hs Syntax/AS_Structured.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Modal/AS_Modal.hs CoCASL/AS_CoCASL.hs COL/AS_COL.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowegenrule_header_files = $(wildcard ATC/*.header.hs)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowegenrule_files = Common/Lib/Graph.hs Common/Id.hs Common/Result.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Syntax/AS_Structured.der.hs Syntax/AS_Architecture.der.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Common/GlobalAnnotations.hs Syntax/AS_Library.der.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe CASL/Morphism.hs CASL/Sign.hs CASL/AS_Basic_CASL.der.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe HasCASL/As.hs HasCASL/Le.hs HasCASL/Morphism.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Haskell/Hatchet/Class.hs Haskell/Hatchet/KindInference.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowegendrifted_files = ATC/Graph.hs ATC/Id.hs ATC/Result.hs ATC/AS_Annotation.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe HasCASL/ATC_HasCASL.hs CspCASL/ATC_CspCASL.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Modal/ATC_Modal.hs CoCASL/ATC_CoCASL.hs COL/ATC_COL.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowegenerated_rule_files = $(patsubst %.hs,%.der.hs,$(gendrifted_files))
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweinline_axiom_files = Comorphisms/CASL2PCFOL.hs Comorphisms/PCFOL2FOL.hs Comorphisms/Modal2CASL.hs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowegen_inline_axiom_files = $(patsubst %.hs,%.inline.hs,$(inline_axiom_files))
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# this variable holds the modules that should be documented
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# the imported parsec library is not included!
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowecpp_sources = ./Isabelle/IsaProve.hs ./Isabelle/Logic_Isabelle.hs ./Proofs/Proofs.hs hets.hs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowedoc_sources = $(filter-out ./Isabelle/IsaSign.hs $(cpp_sources) ,$(sources)) \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe####################################################################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe.PHONY : clean d_clean real_clean bin_clean check hetana hetpa hetdg \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe.SECONDARY : %.hs %.d $(generated_rule_files) $(gen_inline_axiom_files)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(HC) --make -o $@ hets.hs $(HC_OPTS) 2>&1 | tee hetcats-make
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(HC) --make -O -o hets hets.hs $(HC_OPTS) -w 2>&1 | tee hetcats-make
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe ghc --make -package-conf /home/luettich/ghc-pkg/package.conf -package WASH-CGI GUI/hets_cgi.hs -o hets.cgi $(HC_OPTS) -O
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowehetcats-make: hets.hs utils/create_sources.pl $(drifted_files) $(happy_files) $(inline_axiom_files) Modal/ModalSystems.hs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(HC) --make -o hets $< $(HC_OPTS) 2>&1 | tee hetcats-make
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe###############################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### TAGS files for (x)emacs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# load them with "M-x" "visit-tags-table" from
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# use "M-." to search for a tag
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# !!Beware this is somewhat instable, because it uses an absolute path!!
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe /home/ger/linux/ghc-5.04.2/bin/i386-unknown-linux/hasktags \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe###############################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### count lines of code
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe###############################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### Documentation via haddock
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# index for prelude is missing
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe -t 'hets -- a heterogenous Specification (CASL) tool set'
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe###############################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### release management
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LowederivedSources: $(drifted_files) $(happy_files) hetcats/Version.hs $(inline_axiom_files) Modal/ModalSystems.hs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe (cd utils/DrIFT-src; $(HC) --make DrIFT.hs -o ../DrIFT && \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(HC) --make '-i../..:../DrIFT-src' -package text GenerateRules.hs -o ../genRules && \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(HC) --make utils/InlineAxioms/InlineAxioms.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe cvs -d :pserver:cvsread@cvs-agbkb.informatik.uni-bremen.de:/repository co HetCATS
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe (cd HetCATS; $(MAKE) derivedSources; ./clean.sh; \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe find . -name CVS -o -name \*.o -o -name \*.hi | xargs $(RM) -r; \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe cp -p hets $(INSTALLDIR)/versions/hets-`cat version_nr`
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe ln -s versions/hets-`cat version_nr` hets; $(RM) version_nr)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#############################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### ATC DrIFT-rule generation
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LowegenRules: $(generated_rule_files) utils/genRules
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(generated_rule_files): $(genrule_files) utils/genRules #$(genrule_header_files)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe utils/genRules -r $(rule) -o CASL $(casl_files)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe utils/genRules -r $(rule) -o HasCASL $(hascasl_files)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe utils/genRules -r $(rule) -o Modal $(modal_files)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe utils/genRules -r $(rule) -o CoCASL $(cocasl_files)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe utils/genRules -r $(rule) -o CspCASL $(cspcasl_files)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe utils/genRules -r $(rule) -o Haskell -h ATC/Haskell.header.hs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowegen_atc_files = if [ -f ATC/$(basename $(basename $(notdir $(file)))).header.hs ]; then \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe utils/genRules -r $(rule) -o ATC -h ATC/$(basename $(basename $(notdir $(file)))).header.hs $(file); \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweatc_files := $(filter-out CASL/% HasCASL/% Modal/% CoCASL/% COL/% CspCASL/% Haskell/% ,$(genrule_files))
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowecasl_files := $(filter CASL/% ,$(genrule_files))
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowehascasl_files := $(filter HasCASL/% ,$(genrule_files))
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowemodal_files := $(filter Modal/% ,$(genrule_files))
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowecocasl_files := $(filter CoCASL/% ,$(genrule_files))
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowecspcasl_files := $(filter CspCASL/% ,$(genrule_files))
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowehaskell_files := $(filter Haskell/%,$(genrule_files))
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe###############
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### removes *.hi and *.o in all include directories
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### remove binaries
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### additonally removes *.d (dependency files) in every include directory
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### also delete *.d.bak (dependency file backups)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### remove files also in own libraries
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe for p in $(subst :, ,$(COMMONLIB_PATH)) . ; do \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### additionally removes the files that define the sources-variable
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### additionally removes files not in CVS tree
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(RM) utils/DrIFT utils/genRules $(INLINEAXIOMS)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# $(RM) $(happy_files)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe####################################################################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### test targets
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe####################################################################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### a parser to test annotation parser and Id parsers
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweCommon/test_parser: Common/test_parser.hs Common/AS_Annotation.der.hs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### interactive
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### christian's target
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### CASL parser
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### HasCASL parser
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweHasCASL/hacapa: HasCASL/hacapa.hs Common/*.hs HasCASL/*.hs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### Haskell parser
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweHaskell/hapa: Haskell/hapa.hs Haskell/Hatchet/*.hs $(happy_files)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### Haskell analysis
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweHaskell/hana: Haskell/hana.hs Haskell/HatAna.hs Haskell/Hatchet/*.hs $(happy_files)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### HetCASL parser
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### HetCASL parser
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### ATC test system
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweatctest2: Common/ATerm/ATermLibTest.hs Common/SimpPretty.hs Common/ATerm/*.hs Common/Lib/*.hs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### ATerm.Lib test system
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweatermlibtest: Common/ATerm/ATermLibTest.hs Common/ATerm/*.hs Common/SimpPretty.hs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### HetCASL with dev graph
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(HC) --make -o $@ $< $(HC_OPTS) -package-conf ../uni/uni-package.conf -package uni-davinci -package uni-server
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe### run tests in other directories
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe for i in $(TESTDIRS); do $(MAKE) -C $$i check; done
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe####################################################################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## Preparing the version of HetCATS
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowehetcats/Version.hs: hetcats/Version.in version_nr
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(PERL) utils/build_version.pl version_nr < hetcats/Version.in > $@
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## two hardcoded dependencies for a correct generation of Version.hs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowehetcats/Options.hs hetcats/WriteFn.hs hetcats/ReadFn.hs: hetcats/Version.hs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe####################################################################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## rules for DrIFT
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## rules for inlineAxioms
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## rule for cpp and haddock
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## compiling rules for object and interface files
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## compiling rules for dependencies
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## rule for Modal/ModalSystems.hs needed for ModalLogic Translation
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweModal/ModalSystems.hs: Modal/GeneratePatterns.inline.hs.in utils/genTransMFormFunc.pl $(INLINEAXIOMS)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe####################################################################
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## Setting a global search path (for dependency files)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe## include every .d file in INCLUDE_PATH
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowesources_hetcats.mk: hetcats-make hetcats/Version.hs hets.hs utils/create_sources.pl $(drifted_files) $(happy_files)