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