Makefile revision ba0ec5e897ef99d420c8c14c2374e0f32b7043db
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# Author: Klaus L�ttich
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# This Makefile will compile the new hetcats system and provides also
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# targets for test programs during implementation phases.
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# !!! Note: This makefile is written for GNU make !!!
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# (gmake on solaris ; make on linux)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## Some varibles, which control the compilation
b9625461755578f3eed04676d42a63fd2caebd0cChristian MaederCOMMONLIB_PATH = Common/Lib:Common/Lib/Parsec:Common/ATerm
09a67ca9b5cdf09e06470d4c965484783e2963f4Christian MaederCLEAN_PATH = Common:Logic:CASL:Syntax:Static:GUI:HasCASL:Haskell:Haskell/Language:Modal:CspCASL:$(INCLUDE_PATH)
88c800932dd7053322501ea2039d9f234be6866cKlaus LuettichDRIFT_ENV = DERIVEPATH='.:ghc:hetcats:/home/linux-bkb/ghc/ghc-latest/lib/ghc-6.0/imports'
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian MaederHC_FLAGS = -fglasgow-exts -fallow-overlapping-instances -Wall
caf544dc9b8f02e05e37786681153f5660e67f64Martin KühlHC_PACKAGE = -package-conf ../uni/uni-package.conf -package uni-davinci -package uni-server
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### Profiling and Warnings (only for debugging)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### Attention every module must be compiled with profiling or the linker
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### cannot link the various .o files properly. So after switching on
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### Profiling, do an 'gmake clean; gmake'
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### If you need Profiling comment out the following line
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder#HC_PROF = -prof -auto-all -Wall
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian MaederHCI_OPTS = $(HC_FLAGS) $(HC_PACKAGE) $(HC_INCLUDE)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### list of directories to run checks in
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## sources for hetcats (semi - manually produced with a perl script)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maederobjects = $(patsubst %.lhs,%.o,$(sources:%.hs=%.o))
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maederdrifted_files = Syntax/AS_Architecture.hs Syntax/AS_Library.hs\
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers Common/AS_Annotation.hs CASL/AS_Basic_CASL.hs Syntax/AS_Structured.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckersgenrule_files = Common/Lib/Graph.hs Common/Id.hs Common/Result.hs Common/AS_Annotation.der.hs Common/Named.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers Syntax/AS_Structured.der.hs Syntax/AS_Architecture.der.hs Common/GlobalAnnotations.hs Syntax/AS_Library.der.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers CASL/Morphism.hs CASL/StaticAna.hs CASL/AS_Basic_CASL.der.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers HasCASL/Le.hs HasCASL/As.hs HasCASL/Symbol.hs HasCASL/Morphism.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckersgendrifted_files = ATC/Graph.hs ATC/Id.hs ATC/Result.hs ATC/AS_Annotation.hs ATC/Named.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers ATC/AS_Structured.hs ATC/AS_Architecture.hs ATC/DevGraph.hs \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers CASL/ATC_CASL.hs Haskell/ATC_Haskell.hs HasCASL/ATC_HasCASL.hs CspCASL/ATC_CspCASL.hs
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckersgenerated_rule_files = $(patsubst %.hs,%.der.hs,$(gendrifted_files))
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# this variable holds the modules that should be documented
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# the imported parsec library is not included!
0e012772df2ce0dc7e8f0fe3acf458c2871dcfbcChristian Maederdoc_sources = $(filter-out Nothing/Nothing% ,$(sources))
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
ba0ec5e897ef99d420c8c14c2374e0f32b7043dbKlaus Luettich.PHONY : clean d_clean real_clean bin_clean check hetana hetpa hetdg clean_genRules genRules
b49276c9f50038e0bd499ad49f7bd6444566a834Christian Maederhetcats-make: hets.hs utils/create_sources.pl $(drifted_files) $(happy_files)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder $(HC) --make -o hets $< $(HC_OPTS) 2>&1 | tee hetcats-make && \
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder $(PERL) utils/create_sources.pl hetcats-make sources_hetcats.mk
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder###############################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### TAGS files for (x)emacs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# load them with "M-x" "visit-tags-table" from
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# use "M-." to search for a tag
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder# !!Beware this is somewhat instable, because it uses an absolute path!!
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder /home/ger/linux/ghc-5.04.2/bin/i386-unknown-linux/hasktags \
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder $(sources); mv TAGS $@; mv tags hetcats.tags
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder###############################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### Documentation via haddock
b391fd2c38849689e02c23dee372739eca29b7b6Christian Maeder -i/home/linux-bkb/ghc/ghc-6.0/share/ghc-6.0/html/base,/home/linux-bkb/ghc/ghc-6.0/share/ghc-6.0/html/base/base.haddock \
ef67402074be14deb95e4ff564737d5593144130Klaus Luettich -t 'hets -- a heterogenous Specification (CASL) tool set'
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers##########################
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers### DrIFT-rule generation
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers utils/genRules -r $(rule) -o CASL -h ATC/CASL.header.hs $(casl_files)
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers utils/genRules -r $(rule) -o HasCASL -h ATC/HasCASL.header.hs $(hascasl_files)
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers utils/genRules -r $(rule) -o CspCASL -h ATC/CspCASL.header.hs $(cspcasl_files)
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers utils/genRules -r $(rule) -o Haskell -h ATC/Haskell.header.hs $(haskell_files)
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckersgen_atc_files = if [ -e ATC/$(basename $(basename $(notdir $(file)))).header.hs ]; then \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers utils/genRules -r $(rule) -o ATC -h ATC/$(basename $(basename $(notdir $(file)))).header.hs $(file); \
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckersatc_files := $(filter-out CASL/% HasCASL/% CspCASL/% Haskell/% ,$(genrule_files))
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckerscasl_files := $(filter CASL/% ,$(genrule_files))
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckershascasl_files := $(filter HasCASL/% ,$(genrule_files))
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckerscspcasl_files := $(filter CspCASL/% ,$(genrule_files))
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckershaskell_files := $(filter Haskell/%,$(genrule_files))
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder###############
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### removes *.hi and *.o in all include directories
26f228bf3a3fea810223396e5794c217a79a8d5bChristian Maeder for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
b9625461755578f3eed04676d42a63fd2caebd0cChristian Maeder### remove binaries
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### additonally removes *.d (dependency files) in every include directory
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### also delete *.d.bak (dependency file backups)
26f228bf3a3fea810223396e5794c217a79a8d5bChristian Maeder for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
b9625461755578f3eed04676d42a63fd2caebd0cChristian Maeder### remove files also in own libraries
75cda7e5b890d050d560d970af244a183f28328fKlaus Luettich for p in $(subst :, ,$(COMMONLIB_PATH)) . ; do \
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### additionally removes the files that define the sources-variable
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### additionally removes files not in CVS tree
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### test targets
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### a parser to test annotation parser and Id parsers
470ca7a2797069ae4b27c34c1b71419f67be1f84Christian MaederCommon/test_parser: Common/test_parser.hs Common/AS_Annotation.der.hs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### interactive
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### christian's target
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### CASL parser
470ca7a2797069ae4b27c34c1b71419f67be1f84Christian MaederCASL/capa: CASL/capa.lhs Common/*.hs CASL/*.hs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### HasCASL parser
d67a33b40578beef2e255a274f89bb9c34aaf056Christian MaederHasCASL/hacapa: HasCASL/hacapa.lhs CASL/capa HasCASL/*.hs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### Haskell parser
b49276c9f50038e0bd499ad49f7bd6444566a834Christian MaederHaskell/hapa: Haskell/hapa.lhs Haskell/*.hs Haskell/Language/*.hs $(happy_files)
d67a33b40578beef2e255a274f89bb9c34aaf056Christian Maeder### Haskell wrap parser
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### HetCASL parser
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### HetCASL parser
8b0f493ae42bad8b94918cc0957f1af57096cda4Felix Reckers### ATC test system
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### HetCASL with dev graph
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder $(HC) --make -o $@ $< $(HC_OPTS) -package-conf ../uni/uni-package.conf -package uni-davinci -package uni-server
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder### run tests in other directories
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder for i in $(TESTDIRS); do $(MAKE) -C $$i check; done
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## Preparing the version of HetCATS
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maederhetcats/Version.hs: hetcats/Version.in version_nr
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder $(PERL) utils/build_version.pl version_nr < hetcats/Version.in > $@
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## two hardcoded dependencies for a correct generation of Version.hs
ba0ec5e897ef99d420c8c14c2374e0f32b7043dbKlaus Luettichhetcats/Options.hs hetcats/WriteFn.hs hetcats/ReadFn.hs: hetcats/Version.hs
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## rules for DrIFT
ba0ec5e897ef99d420c8c14c2374e0f32b7043dbKlaus Luettich# $(AG) $< -o $@
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## compiling rules for object and interface files
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## compiling rules for dependencies
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder####################################################################
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## Setting a global search path (for dependency files)
5191fa24c532d1f67e7a642e9aece65efb8a0975Christian Maeder## include every .d file in INCLUDE_PATH