Makefile revision e1905890322767ae24c4594d80e31877037f4055
200N/A# hetcats/Makefile
200N/A# $Id$
200N/A# Author: Klaus L�ttich
200N/A# Year: 2003
200N/A
200N/A# This Makefile will compile the new hetcats system and provides also
200N/A# targets for test programs during implementation phases.
200N/A
200N/A# !!! Note: This makefile is written for GNU make !!!
200N/A# (gmake on solaris ; make on linux)
200N/A
200N/A####################################################################
200N/A## Some varibles, which control the compilation
200N/A
200N/AINCLUDE_PATH = ghc:hetcats
200N/ACOMMONLIB_PATH = Common/Lib:Common/Lib/Parsec:Common/ATerm
200N/ACLEAN_PATH = Common:Logic:CASL:Syntax:Static:GUI:HasCASL:Haskell:Haskell/Language:Modal:CspCASL:ATC:ToHaskell:Proofs:Comorphisms:$(INCLUDE_PATH)
200N/A
200N/ADRIFT_ENV = DERIVEPATH='.:ghc:hetcats:/home/linux-bkb/ghc/ghc-latest/lib/ghc-6.0.1/imports'
200N/A
200N/AHC = ghc
200N/APERL = perl
814N/AHAPPY = happy
200N/ADRIFT = $(DRIFT_ENV) $(PERL) utils/DrIFT
200N/AAG = $(PERL) utils/ag
200N/AHADDOCK = $(PERL) utils/haddock
200N/A
814N/AHC_FLAGS = -fglasgow-exts -fallow-overlapping-instances -Wall
206N/AHC_INCLUDE = -i$(INCLUDE_PATH)
200N/AHC_PACKAGE = -package-conf ../uni/uni-package.conf -package uni-davinci -package uni-server
200N/A
618N/AAG_FLAGS = -mdcfs
200N/A
200N/A### Profiling and Warnings (only for debugging)
200N/A### Attention every module must be compiled with profiling or the linker
206N/A### cannot link the various .o files properly. So after switching on
200N/A### Profiling, do an 'gmake clean; gmake'
200N/A### If you need Profiling comment out the following line
200N/A#HC_PROF = -prof -auto-all -Wall
200N/A
200N/AHCI_OPTS = $(HC_FLAGS) $(HC_PACKAGE) $(HC_INCLUDE)
200N/AHC_OPTS = $(HCI_OPTS) $(HC_PROF)
200N/ADRIFT_OPTS = +RTS -K10 -RTS
200N/A
200N/A### list of directories to run checks in
200N/ATESTDIRS = CASL HasCASL test
206N/A
200N/A####################################################################
200N/A## sources for hetcats (semi - manually produced with a perl script)
206N/A
206N/Aifneq ($(MAKECMDGOALS),clean)
206N/Aifneq ($(MAKECMDGOALS),bin_clean)
206N/Aifneq ($(MAKECMDGOALS),d_clean)
206N/Aifneq ($(MAKECMDGOALS),real_clean)
200N/Aifneq ($(MAKECMDGOALS),distclean)
206N/Aifneq ($(MAKECMDGOALS),genRules)
200N/Aifneq ($(MAKECMDGOALS),apache_doc)
200N/Aifneq ($(MAKECMDGOALS),clean_genRules)
200N/Ainclude sources_hetcats.mk
206N/Aendif
200N/Aendif
206N/Aendif
206N/Aendif
206N/Aendif
200N/Aendif
200N/Aendif
200N/Aendif
200N/A
200N/Aobjects = $(patsubst %.lhs,%.o,$(sources:%.hs=%.o))
200N/A
200N/Adrifted_files = Syntax/AS_Architecture.hs Syntax/AS_Library.hs\
200N/A Common/AS_Annotation.hs CASL/AS_Basic_CASL.hs Syntax/AS_Structured.hs \
206N/A $(gendrifted_files)
200N/A
200N/Agenrule_files = Common/Lib/Graph.hs Common/Id.hs Common/Result.hs Common/AS_Annotation.der.hs Common/Named.hs \
200N/A Syntax/AS_Structured.der.hs Syntax/AS_Architecture.der.hs Common/GlobalAnnotations.hs Syntax/AS_Library.der.hs \
200N/A CASL/Morphism.hs CASL/StaticAna.hs CASL/AS_Basic_CASL.der.hs \
200N/A Haskell/Language/Syntax.hs \
206N/A HasCASL/Le.hs HasCASL/As.hs HasCASL/Symbol.hs HasCASL/Morphism.hs \
200N/A CspCASL/AS_CSP_CASL.hs \
200N/A Static/DevGraph.hs
206N/A
200N/Agendrifted_files = ATC/Graph.hs ATC/Id.hs ATC/Result.hs ATC/AS_Annotation.hs ATC/Named.hs \
200N/A ATC/AS_Library.hs ATC/GlobalAnnotations.hs \
200N/A ATC/AS_Structured.hs ATC/AS_Architecture.hs ATC/DevGraph.hs \
200N/A CASL/ATC_CASL.hs Haskell/ATC_Haskell.hs HasCASL/ATC_HasCASL.hs CspCASL/ATC_CspCASL.hs
200N/A
200N/Agenerated_rule_files = $(patsubst %.hs,%.der.hs,$(gendrifted_files))
200N/A
200N/Ahappy_files = Haskell/Language/Parser.hs
200N/A
200N/A# this variable holds the modules that should be documented
200N/A# the imported parsec library is not included!
200N/Adoc_sources = $(filter-out Nothing/Nothing% ,$(sources))
200N/A
200N/A####################################################################
200N/A### targets
200N/A
200N/A.PHONY : clean d_clean real_clean bin_clean check hetana hetpa hetdg clean_genRules genRules
200N/A.SECONDARY : %.hs %.d $(generated_rule_files)
200N/A#.PRECIOUS: sources_hetcats.mk
206N/A
200N/Aall: hets
200N/A
200N/Ahets: $(sources)
206N/A $(HC) --make -o $@ hets.hs $(HC_OPTS)
206N/A
200N/Ahets-old: $(objects)
200N/A $(RM) $@
200N/A $(HC) -o hets $(HC_OPTS) $(objects)
200N/A
200N/Ahetcats-make: hets.hs utils/create_sources.pl $(drifted_files) $(happy_files)
200N/A $(RM) hetcats-make sources_hetcats.mk
200N/A $(HC) --make -o hets $< $(HC_OPTS) 2>&1 | tee hetcats-make
200N/A
200N/A###############################
206N/A### TAGS files for (x)emacs
200N/A# load them with "M-x" "visit-tags-table" from
200N/A# "HetCATS/hetcats/hetcats.TAGS"
200N/A# use "M-." to search for a tag
200N/A# !!Beware this is somewhat instable, because it uses an absolute path!!
200N/Ahetcats.TAGS: $(sources)
200N/A /home/ger/linux/ghc-5.04.2/bin/i386-unknown-linux/hasktags \
200N/A $(sources); mv TAGS $@; mv tags hetcats.tags
###############################
### Documentation via haddock
doc: docs/index.html utils/hd-lib
docs/index.html: $(doc_sources)
$(HADDOCK) $(doc_sources) -o docs -h \
-i/home/linux-bkb/ghc/ghc-6.0.1/share/ghc-6.0.1/html/base,/home/linux-bkb/ghc/ghc-6.0.1/share/ghc-6.0.1/html/base/base.haddock \
-t 'hets -- a heterogenous Specification (CASL) tool set'
apache_doc:
cvs up -d
$(MAKE) distclean
$(MAKE) hetcats-make
$(RM) docs/*.html
$(MAKE) doc
$(MAKE) post_doc4apache
a_docs_base:
$(RM) -r a-docs/base
cp -r /home/linux-bkb/ghc/ghc-6.0.1/share/ghc-6.0.1/html/base a-docs
post_doc4apache:
$(PERL) utils/post_process_docs.pl docs \
'Common.Lib.Map.html:Common.Lib._Map.html' \
'/home/linux-bkb/ghc/ghc-6.0.1/share/ghc-6.0.1/html/:'
mv docs/* a-docs/
#############################
### ATC DrIFT-rule generation
genRules: $(generated_rule_files)
$(generated_rule_files): $(genrule_files)
$(MAKE) clean_genRules
$(foreach file,$(atc_files),$(gen_atc_files))
utils/genRules -r $(rule) -o CASL -h ATC/CASL.header.hs $(casl_files)
utils/genRules -r $(rule) -o HasCASL -h ATC/HasCASL.header.hs $(hascasl_files)
utils/genRules -r $(rule) -o CspCASL -h ATC/CspCASL.header.hs $(cspcasl_files)
utils/genRules -r $(rule) -o Haskell -h ATC/Haskell.header.hs $(haskell_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 ;
atc_files := $(filter-out CASL/% HasCASL/% CspCASL/% Haskell/% ,$(genrule_files))
casl_files := $(filter CASL/% ,$(genrule_files))
hascasl_files := $(filter HasCASL/% ,$(genrule_files))
cspcasl_files := $(filter CspCASL/% ,$(genrule_files))
haskell_files := $(filter Haskell/%,$(genrule_files))
clean_genRules:
$(RM) $(generated_rule_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) ; done
### remove binaries
bin_clean:
$(RM) hets
$(RM) test_parser
$(RM) CASL/capa
$(RM) HasCASL/hacapa
$(RM) Haskell/hapa
$(RM) Haskell/wrap
$(RM) Syntax/hetpa
$(RM) Static/hetana
$(RM) Static/hetana
$(RM) GUI/hetdg
$(RM) hetpa
$(RM) hetana
$(RM) hetdg
### 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: 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
$(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_files)
$(RM) Haskell/Language/Parser.hs
####################################################################
### 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.lhs Common/*.hs CASL/*.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### HasCASL parser
hacapa: HasCASL/hacapa
HasCASL/hacapa: HasCASL/hacapa.lhs CASL/capa HasCASL/*.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### Haskell parser
hapa: Haskell/hapa
Haskell/hapa: Haskell/hapa.lhs Haskell/*.hs Haskell/Language/*.hs $(happy_files)
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### Haskell wrap parser
wrap: Haskell/wrap
Haskell/wrap: Haskell/wrap.lhs Haskell/*.hs
$(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)
### HetCASL with dev graph
hetdg: GUI/hetdg.hs $(drifted_files) *.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS) -package-conf ../uni/uni-package.conf -package uni-davinci -package uni-server
### 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
%.hs: %.ly
$(HAPPY) $<
#%.hs: %.ag.hs
# $(AG) $<
%.hs: %.der.hs
$(DRIFT) $(DRIFT_OPTS) $< > $@
#%.hs: %.ag
# $(AG) $< -o $@
%.lhs: %.der.lhs
$(DRIFT) $< > $@
## 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$@
####################################################################
## Setting a global search path (for dependency files)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),real_clean)
ifneq ($(MAKECMDGOALS),d_clean)
ifneq ($(MAKECMDGOALS),real_clean)
ifneq ($(MAKECMDGOALS),distclean)
ifneq ($(MAKECMDGOALS),genRules)
ifneq ($(MAKECMDGOALS),clean_genRules)
ifeq ($(MAKECMDGOALS),hets-old)
## include every .d file in INCLUDE_PATH
-include $(objects:.o=.d)
endif
sources_hetcats.mk: hetcats-make hetcats/Version.hs hets.hs utils/create_sources.pl $(drifted_files) $(happy_files)
$(PERL) utils/create_sources.pl hetcats-make sources_hetcats.mk
endif
endif
endif
endif
endif
endif
endif