Makefile revision 0898ff703a21cf78e18cc03e8fe5a3c6d1fc25c3
2N/A# hetcats/Makefile
2N/A# $Header$
2N/A# Author: (c) Klaus L�ttich, Christian Maeder, Uni Bremen 2002-2004
2N/A# Year: 2004
2N/A
2N/A# This Makefile will compile the new hetcats system and provides also
2N/A# targets for test programs during implementation phases.
2N/A
2N/A# !!! Note: This makefile is written for GNU make !!!
2N/A# (gmake on solaris ; make on linux)
2N/A
2N/A####################################################################
2N/A## Some varibles, which control the compilation
2N/A
2N/AINCLUDE_PATH = ghc:hetcats:fgl
2N/ACOMMONLIB_PATH = Common/Lib:Common/Lib/Parsec:Common/ATerm:fgl/Data/Graph:fgl/Data/Graph/Inductive:fgl/Data/Graph/Inductive/Aux:fgl/Data/Graph/Inductive/Monad:fgl/Data/Graph/Inductive/Query
2N/ACLEAN_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:$(PFE_PATHS)
2N/A
2N/A## set ghc imports properly for your system
2N/ALINUX_IMPORTS = $(wildcard /home/linux-bkb/ghc/ghc-latest/lib/ghc-*/imports)
2N/ADRIFT_ENV = DERIVEPATH='.:ghc:hetcats:${LINUX_IMPORTS}:${GHC_IMPORTS}'
2N/A
2N/A# the 'replacing spaces' example was taken from the (GNU) Make info manual
2N/Aempty:=
2N/Aspace:= $(empty) $(empty)
2N/A
2N/A# override on commandline for other architectures
2N/AINSTALLDIR = /home/www/agbkb/forschung/formal_methods/CoFI/hets/`utils/sysname.sh`
2N/A
2N/ADRIFT_deps = utils/DrIFT-src/*hs
2N/AGENERATERULES_deps = utils/GenerateRules/*hs $(DRIFT_deps)
2N/AINLINEAXIOMS_deps = utils/InlineAxioms/*hs
2N/A
2N/AHC = ghc
2N/APERL = perl
2N/AHAPPY = happy
2N/ADRIFT = $(DRIFT_ENV) utils/DrIFT
2N/AINLINEAXIOMS = utils/outlineAxioms
2N/AHADDOCK = haddock
2N/ACPPP = cpp
2N/A
2N/AHC_FLAGS = -Wall -fglasgow-exts -fallow-overlapping-instances -fallow-incoherent-instances
2N/A# -ddump-minimal-imports
2N/A# flags also come in via ../uni/uni-package.conf
2N/A# but added it here in case of compilation without uni
2N/A
2N/AHC_INCLUDE = -i$(INCLUDE_PATH)
2N/A
2N/AUNI_PACKAGE_CONF := $(wildcard ../uni/uni-package.conf)
2N/Aifneq ($(strip $(UNI_PACKAGE_CONF)),)
2N/AHC_PACKAGE = -package-conf $(UNI_PACKAGE_CONF) -package uni-davinci \
2N/A -package uni-server -DUNI_PACKAGE
2N/A
2N/A# some modules from uni for haddock
2N/A# if uni/server is included also HaXml sources are needed
2N/Auni_sources = $(wildcard ../uni/davinci/haddock/*.hs) \
2N/A $(wildcard ../uni/graphs/haddock/*.hs) \
2N/A ../uni/htk/toplevel/HTk.hs \
2N/A $(wildcard ../uni/htk/haddock/*/*.hs) \
2N/A $(wildcard ../uni/events/haddock/*.hs) \
2N/A $(wildcard ../uni/reactor/haddock/*.hs) \
2N/A $(wildcard ../uni/util/haddock/*.hs) \
2N/A $(wildcard ../uni/posixutil/haddock/*.hs)
2N/Aendif
2N/A
2N/APFE_TOOLDIR := $(wildcard ../programatica/tools)
2N/Aifneq ($(strip $(PFE_TOOLDIR)),)
2N/APFE_DIRS = base/AST base/TI base/parse2 base/parse2/Lexer base/parse2/Parser \
2N/A base/pretty base/syntax base/lib base/lib/Monads base/Modules base/defs \
2N/A base/transforms base/transforms/Deriving hs2html \
2N/A property/pfe property/syntax property/AST property/transforms \
2N/A property/TI property/defs property/parse2 property/parse2/Parser \
2N/A hs2stratego hs2stratego/AST
2N/APFE_PATH = $(addprefix -i$(PFE_TOOLDIR)/, $(PFE_DIRS))
2N/A
2N/A# add PFE_PATHS to DERIVEPATH if needed
2N/A# but name clashes currently prevent ATC generation in a single file
2N/APFE_PATHS = $(subst $(space),:,$(addprefix $(PFE_TOOLDIR)/, $(PFE_DIRS)))
2N/Apfe_sources = $(wildcard $(subst :,/*hs , $(PFE_PATHS)))
2N/APFE_FLAGS = -package data -package text $(PFE_PATH) -DPROGRAMATICA
2N/A#-fallow-undecidable-instances -fno-monomorphism-restriction
2N/Aendif
2N/A
2N/A
2N/A### Profiling (only for debugging)
2N/A### Attention every module must be compiled with profiling or the linker
2N/A### cannot link the various .o files properly. So after switching on
2N/A### Profiling, do an 'gmake real_clean; gmake'
2N/A### and comment out HC_PACKAGE variable definition above.
2N/A### Comment in the following line for switching on profiling.
2N/A#HC_PROF = -prof -auto-all
2N/A
2N/AHCI_OPTS = $(HC_FLAGS) $(HC_INCLUDE) $(HC_PACKAGE) $(PFE_FLAGS)
2N/AHC_OPTS = $(HCI_OPTS) $(HC_PROF)
2N/ADRIFT_OPTS = +RTS -K10m -RTS
2N/A
2N/A### list of directories to run checks in
2N/ATESTDIRS = Common CASL HasCASL
2N/A
2N/A
2N/A####################################################################
2N/A## sources for hetcats (semi - manually produced with a perl script)
2N/A
2N/AGHCMAKE_OUTPUT = $(wildcard hetcats-make)
2N/A
2N/Aifneq ($(strip $(GHCMAKE_OUTPUT)),)
2N/Ainclude sources_hetcats.mk
2N/Aelse
2N/ASOURCE_PATHS = $(COMMON_LIB_PATH):$(CLEAN_PATH)
2N/Asources = $(wildcard $(subst :,/*hs , $(SOURCE_PATHS))/*hs)
2N/Aendif
2N/A
2N/Aobjects = $(patsubst %.lhs,%.o,$(sources:%.hs=%.o))
2N/A
2N/Adrifted_files = Syntax/AS_Architecture.hs Syntax/AS_Library.hs \
2N/A Common/AS_Annotation.hs CASL/AS_Basic_CASL.hs Syntax/AS_Structured.hs \
2N/A Modal/AS_Modal.hs CoCASL/AS_CoCASL.hs COL/AS_COL.hs \
2N/A $(gendrifted_files)
2N/A
2N/Agenrule_header_files = $(wildcard ATC/*.header.hs)
2N/A
2N/Aatc_files := Common/Lib/Graph.hs Common/Id.hs Common/Result.hs \
2N/A Common/AS_Annotation.der.hs \
2N/A Syntax/AS_Structured.der.hs Syntax/AS_Architecture.der.hs \
2N/A Common/GlobalAnnotations.hs Syntax/AS_Library.der.hs \
2N/A Static/DevGraph.hs \
2N/A Proofs/Proofs.hs \
2N/A Isabelle/IsaSign.hs
2N/A
2N/Aatc_der_files = $(foreach file, $(atc_files), \
2N/A ATC/$(basename $(basename $(notdir $(file)))).der.hs)
2N/A
2N/ACASL_files := CASL/Sublogic.hs CASL/Morphism.hs CASL/Sign.hs \
2N/A CASL/AS_Basic_CASL.der.hs
2N/A
2N/AHasCASL_files := HasCASL/As.hs HasCASL/Le.hs HasCASL/Morphism.hs \
2N/A HasCASL/Sublogic.hs \
2N/A
2N/AModal_files := Modal/AS_Modal.hs Modal/ModalSign.hs
2N/ACoCASL_files := CoCASL/AS_CoCASL.hs CoCASL/CoCASLSign.hs
2N/ACOL_files := COL/AS_COL.hs COL/COLSign.hs
2N/ACspCASL_files := CspCASL/AS_CSP_CASL.hs CspCASL/SignCSP.hs
2N/A
2N/Alogics := CASL HasCASL Modal CoCASL COL CspCASL
2N/A
2N/Aatc_logic_files = $(foreach logic, $(logics), $(logic)/ATC_$(logic).der.hs)
2N/A
2N/Agenerated_rule_files = $(atc_der_files) $(atc_logic_files)
2N/A
2N/Agendrifted_files = $(patsubst %.der.hs, %.hs, $(generated_rule_files))
2N/A
2N/Ainline_axiom_files = Comorphisms/CASL2PCFOL.hs Comorphisms/PCFOL2FOL.hs \
2N/A Comorphisms/Modal2CASL.hs
2N/A
2N/Agen_inline_axiom_files = $(patsubst %.hs,%.inline.hs,$(inline_axiom_files))
2N/A
2N/Ahappy_files =
2N/A
2N/Aderived_sources = $(drifted_files) $(happy_files) hetcats/Version.hs \
2N/A $(inline_axiom_files) Modal/ModalSystems.hs
2N/A
2N/A# sources that have {-# OPTIONS -cpp #-}
2N/Acpp_sources = ./Isabelle/Logic_Isabelle.hs \
2N/A ./Proofs/Proofs.hs hets.hs ./CASL/CCC/FreeTypes.hs \
2N/A ./Comorphisms/LogicList.hs ./Comorphisms/LogicGraph.hs
2N/A
2N/A# this variable holds the modules that should be documented
2N/Adoc_sources = $(filter-out $(cpp_sources), $(filter-out $(pfe_sources), \
2N/A $(sources))) $(patsubst %.hs, %.hspp, $(cpp_sources))
2N/A
2N/Atax_sources = Taxonomy/AbstractGraphView.hs Taxonomy/MMiSSOntology.hs \
2N/A Taxonomy/MMiSSOntologyGraph.hs Taxonomy/OntoParser.hs
2N/Atax_objects = $(patsubst %.hs,%.o,$(tax_sources))
2N/A
2N/A
2N/A####################################################################
2N/A### targets
2N/A
2N/A.PHONY : all hets-opt hets-optimized clean d_clean real_clean bin_clean \
2N/A lib_clean distclean check capa hacapa clean_genRules genRules \
2N/A taxonomy hets.cgi count doc apache_doc post_doc4apache \
2N/A derivedSources install_hets install release
2N/A
2N/A.SECONDARY : %.hs %.d $(generated_rule_files) $(gen_inline_axiom_files)
2N/A#.PRECIOUS: sources_hetcats.mk
2N/A
2N/Aall: hets
2N/A
2N/Ahets: $(sources) $(derived_sources)
2N/A $(HC) --make -o $@ hets.hs $(HC_OPTS) 2>&1 | tee hetcats-make
2N/A
2N/Ahets-opt:
2N/A $(MAKE) distclean
2N/A $(MAKE) derivedSources
2N/A $(MAKE) real_clean
2N/A $(MAKE) hets-optimized
2N/A
2N/Ahets-optimized: $(derived_sources)
2N/A $(HC) --make -O -o hets hets.hs $(HC_OPTS) -w 2>&1 | tee hetcats-make
2N/A strip hets
2N/A
2N/Ahets-old: $(objects)
2N/A $(RM) $@
2N/A $(HC) -o hets $(HC_OPTS) $(objects)
2N/A
2N/Ahets.cgi: $(sources) GUI/hets_cgi.hs
2N/A ghc --make -package-conf /home/luettich/ghc-pkg/package.conf \
2N/A -package WASH-CGI GUI/hets_cgi.hs -o hets.cgi $(HC_INCLUDE) \
2N/A $(HC_FLAGS) -O
2N/A
2N/Ataxonomy: Taxonomy/taxonomyTool.hs $(tax_sources)
2N/A $(HC) --make -o Taxonomy/taxonomyTool $< -ifgl $(HC_OPTS)
2N/A
2N/A###############################
2N/A### TAGS files for (x)emacs
2N/A# load them with "M-x" "visit-tags-table" from
2N/A# "HetCATS/hetcats/hetcats.TAGS"
2N/A# use "M-." to search for a tag
2N/A# !!Beware this is somewhat instable, because it uses an absolute path!!
2N/Ahetcats.TAGS: $(sources)
2N/A /home/ger/linux/ghc-5.04.2/bin/i386-unknown-linux/hasktags \
2N/A $(sources); mv TAGS $@; mv tags hetcats.tags
2N/A
2N/A###############################
2N/A### count lines of code
2N/Acount: $(sources)
2N/A wc -l $(sources)
2N/A###############################
2N/A### Documentation via haddock
2N/Adoc: docs/index.html
2N/A
2N/A# generate haddock documentation with links to sources
2N/Adocs/index.html: $(doc_sources)
2N/A $(HADDOCK) $(doc_sources) $(uni_sources) -o docs -h -v \
2N/A -i docs/base.haddock -i docs/parsec.haddock -s ../ \
2N/A -t 'hets -- a heterogenous Specification (CASL) tool set'
2N/A
2N/A# sources are not copied here
2N/Aapache_doc:
2N/A $(RM) docs/*.*
2N/A cvs up -d
2N/A $(MAKE) hets-opt
2N/A $(MAKE) doc
2N/A $(MAKE) post_doc4apache
2N/A $(MAKE) hets.cgi
2N/A
2N/Apost_doc4apache:
2N/A $(PERL) utils/post_process_docs.pl docs \
2N/A 'Common.Lib.Map.html:Common.Lib._Map.html'
2N/A cp docs/*.* a-docs/
2N/A
2N/A###############################
2N/A### release management
2N/A
2N/AderivedSources: $(derived_sources)
2N/A
2N/Autils/DrIFT: $(DRIFT_deps)
2N/A (cd utils/DrIFT-src; $(HC) --make DrIFT.hs -o ../DrIFT && \
2N/A strip ../DrIFT)
2N/A
2N/Autils/genRules: $(GENERATERULES_deps)
2N/A (cd utils/GenerateRules; \
2N/A $(HC) --make '-i../..:../DrIFT-src' -package text \
2N/A GenerateRules.hs -o ../genRules && strip ../genRules)
2N/A
2N/A$(INLINEAXIOMS): $(INLINEAXIOMS_deps)
2N/A $(HC) --make utils/InlineAxioms/InlineAxioms.hs \
2N/A $(HC_OPTS) -o $(INLINEAXIOMS)
2N/A strip $(INLINEAXIOMS)
2N/A
2N/Arelease:
2N/A $(RM) -r HetCATS
2N/A cvs -d :pserver:cvsread@cvs-agbkb.informatik.uni-bremen.de:/repository\
2N/A co HetCATS
2N/A $(RM) -r uni
2N/A ln -s ../uni uni
2N/A (cd HetCATS; $(MAKE) derivedSources; ./clean.sh; \
2N/A find . -name CVS -o -name \*.o -o -name \*.hi | xargs $(RM) -r; \
2N/A $(RM) clean.*; mv Makefile Makefile.orig; \
2N/A mv ReleaseMakefile Makefile)
2N/A tar cvf HetCATS.tar HetCATS
2N/A
2N/Ainstall-hets:
2N/A chmod g+w hets
2N/A cp -p hets $(INSTALLDIR)/versions/hets-`cat version_nr`
2N/A cp -p version_nr $(INSTALLDIR)
2N/A (cd $(INSTALLDIR); $(RM) hets; \
2N/A ln -s versions/hets-`cat version_nr` hets; $(RM) version_nr)
2N/A
2N/Ainstall: hets-opt install-hets
2N/A
2N/A#############################
2N/A### ATC DrIFT-rule generation
2N/A
2N/AgenRules: $(generated_rule_files)
2N/A
2N/A$(atc_der_files): $(atc_files) $(genrule_header_files) utils/genRules
2N/A $(foreach file,$(atc_files),$(gen_atc_files))
2N/A
CASL/ATC_CASL.der.hs: $(CASL_files) utils/genRules
utils/genRules -r $(rule) -o CASL $(CASL_files)
HasCASL/ATC_HasCASL.der.hs: $(HasCASL_files) utils/genRules
utils/genRules -r $(rule) -o HasCASL $(HasCASL_files)
Modal/ATC_Modal.der.hs: $(Modal_files) utils/genRules
utils/genRules -r $(rule) -o Modal $(Modal_files)
CoCASL/ATC_CoCASL.der.hs: $(CoCASL_files) utils/genRules
utils/genRules -r $(rule) -o CoCASL $(CoCASL_files)
COL/ATC_COL.der.hs: $(COL_files) utils/genRules
utils/genRules -r $(rule) -o COL $(COL_files)
CspCASL/ATC_CspCASL.der.hs: $(CspCASL_files) utils/genRules
utils/genRules -r $(rule) -o CspCASL $(CspCASL_files)
rule:= ShATermConvertible
gen_atc_files = \
if [ -f ATC/$(basename $(basename $(notdir $(file)))).header.hs ]; \
then utils/genRules -r $(rule) -o ATC -h \
ATC/$(basename $(basename $(notdir $(file)))).header.hs $(file); \
else utils/genRules -r $(rule) -o ATC $(file); fi ;
clean_genRules:
$(RM) $(generated_rule_files) $(gendrifted_files)
###############
### clean up
### removes *.hi and *.o in all include directories
clean: bin_clean
for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
(cd $$p ; $(RM) *.hi *.o *.hspp) ; done
### remove binaries
bin_clean:
$(RM) hets
$(RM) test_parser
$(RM) CASL/capa
$(RM) HasCASL/hacapa
$(RM) Haskell/hapa
$(RM) Haskell/hana
$(RM) Haskell/wrap
$(RM) Syntax/hetpa
$(RM) Static/hetana
$(RM) GUI/hetdg
$(RM) hetpa
$(RM) hetana
$(RM) hetdg
$(RM) atctest2
$(RM) atctest
$(RM) Common/annos
$(RM) Haskell/Hatchet/hatch
$(RM) ToHaskell/translateAna
$(RM) Taxonomy/taxonomyTool
### additonally removes *.d (dependency files) in every include directory
### also delete *.d.bak (dependency file backups)
d_clean: clean
for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
(cd $$p ; $(RM) *.d *.d.bak) ; done
### remove files also in own libraries
lib_clean:
for p in $(subst :, ,$(COMMONLIB_PATH)) . ; do \
(cd $$p ; $(RM) *.hi *.d *.o) ; done
### additionally removes the files that define the sources-variable
real_clean: bin_clean lib_clean clean
$(RM) hetcats-make sources_hetcats.mk
### additionally removes files not in CVS tree
distclean: real_clean clean_genRules d_clean
$(RM) hetcats/Version.hs
$(RM) $(drifted_file) $(inline_axiom_files)
$(RM) utils/DrIFT utils/genRules $(INLINEAXIOMS)
# $(RM) $(happy_files)
####################################################################
### test targets
####################################################################
### a parser to test annotation parser and Id parsers
test_parser: Common/test_parser
Common/test_parser: Common/test_parser.hs Common/AS_Annotation.der.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### interactive
ghci:
$(HC)i $(HCI_OPTS)
### christian's target
### CASL parser
capa: CASL/capa
CASL/capa: CASL/capa.hs Common/*.hs CASL/*.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### HasCASL parser
hacapa: HasCASL/hacapa
HasCASL/hacapa: HasCASL/hacapa.hs Common/*.hs HasCASL/*.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### Haskell parser
hapa: Haskell/hapa
Haskell/hapa: Haskell/hapa.hs Haskell/Hatchet/*.hs $(happy_files)
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### Haskell analysis
hana: Haskell/hana
Haskell/hana: Haskell/hana.hs Haskell/HatAna.hs Haskell/Hatchet/*.hs \
$(happy_files)
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### HetCASL parser
hetpa: Syntax/hetpa.hs Syntax/*.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### HetCASL parser
hetana: Static/hetana.hs Static/*.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### ATC test system
atctest: ATC/ATCTest.hs ATC/*.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
atctest2: Common/ATerm/ATermLibTest.hs Common/SimpPretty.hs \
Common/ATerm/*.hs Common/Lib/*.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### ATerm.Lib test system
atermlibtest: Common/ATerm/ATermLibTest.hs Common/ATerm/*.hs \
Common/SimpPretty.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### HetCASL with dev graph
hetdg: GUI/hetdg.hs $(drifted_files) *.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### run tests in other directories
check: hetcats
for i in $(TESTDIRS); do $(MAKE) -C $$i check; done
####################################################################
## Preparing the version of HetCATS
hetcats/Version.hs: hetcats/Version.in version_nr
$(PERL) utils/build_version.pl version_nr < hetcats/Version.in > $@
## two hardcoded dependencies for a correct generation of Version.hs
hetcats/Options.hs hetcats/WriteFn.hs hetcats/ReadFn.hs: hetcats/Version.hs
hets.hs: hetcats/Version.hs
####################################################################
## rules for DrIFT
.SUFFIXES:
%.hs: %.ly
$(HAPPY) $<
%.hs: %.der.hs utils/DrIFT
$(DRIFT) $(DRIFT_OPTS) $< > $@
## rules for inlineAxioms
%.hs: %.inline.hs $(INLINEAXIOMS)
$(INLINEAXIOMS) $< > $@
## rule for cpp and haddock
%.hspp: %.hs
$(HC) -E -cpp -DUNI_PACKAGE -optP -P $<
## compiling rules for object and interface files
%.o %.hi: %.hs
$(HC) -c $< $(HC_OPTS)
%.o %.hi: %.lhs
$(HC) -c $< $(HC_OPTS)
## compiling rules for dependencies
%.d : %.hs
$(HC) -M $< $(HC_OPTS) -optdep-f -optdep$@
%.d : %.lhs
$(HC) -M $< $(HC_OPTS) -optdep-f -optdep$@
## rule for Modal/ModalSystems.hs needed for ModalLogic Translation
Modal/ModalSystems.hs: Modal/GeneratePatterns.inline.hs.in \
utils/genTransMFormFunc.pl $(INLINEAXIOMS)
$(PERL) utils/genTransMFormFunc.pl $< $@
# hetcats-make is created as side-effect of hets or hets-optimized
sources_hetcats.mk: hetcats-make utils/create_sources.pl
$(PERL) utils/create_sources.pl hetcats-make sources_hetcats.mk
%::
$(RM) hetcats-make