1N/A# Author: (c) Klaus L�ttich, Christian Maeder, Uni Bremen 2002-2004
1N/A# This Makefile will compile the new hetcats system and provides also
1N/A# targets for test programs during implementation phases.
1N/A# !!! Note: This makefile is written for GNU make !!!
1N/A# (gmake on solaris ; make on linux)
1N/A####################################################################
1N/A## Some varibles, which control the compilation
INCLUDE_PATH = ghc:hetcats
CLEAN_PATH = Common:Logic:CASL:Syntax:Static:GUI:HasCASL:Haskell:Modal:CspCASL:ATC:ToHaskell:Proofs:Comorphisms:Isabelle:$(INCLUDE_PATH):
Haskell/Hatchet## set ghc imports properly for your system
HC_FLAGS = -fglasgow-exts -Wall
HC_INCLUDE = -i$(INCLUDE_PATH)
### Profiling and Warnings (only for debugging)
### Attention every module must be compiled with profiling or the linker
### cannot link the various .o files properly. So after switching on
### Profiling, do an 'gmake clean; gmake'
### If you need Profiling comment out the following line
#HC_PROF = -prof -auto-all
HCI_OPTS = $(HC_FLAGS) $(HC_PACKAGE) $(HC_INCLUDE)
HC_OPTS = $(HCI_OPTS) $(HC_PROF)
DRIFT_OPTS = +RTS -K10m -RTS
### list of directories to run checks in
TESTDIRS = Common CASL HasCASL
####################################################################
## sources for hetcats (semi - manually produced with a perl script)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),bin_clean)
ifneq ($(MAKECMDGOALS),d_clean)
ifneq ($(MAKECMDGOALS),real_clean)
ifneq ($(MAKECMDGOALS),distclean)
ifneq ($(MAKECMDGOALS),genRules)
ifneq ($(MAKECMDGOALS),hets-opt)
ifneq ($(MAKECMDGOALS),hets-optimized)
ifneq ($(MAKECMDGOALS),derivedSources)
ifneq ($(MAKECMDGOALS),release)
ifneq ($(MAKECMDGOALS),check)
ifneq ($(MAKECMDGOALS),apache_doc)
ifneq ($(MAKECMDGOALS),clean_genRules)
ifneq ($(MAKECMDGOALS),atctest2)
objects = $(patsubst %.lhs,%.o,$(sources:%.hs=%.o))
genrule_header_files = $(wildcard ATC/*
.header.hs)
generated_rule_files = $(patsubst %.hs,%
.der.hs,$(gendrifted_files))
# this variable holds the modules that should be documented
# the imported parsec library is not included!
####################################################################
.PHONY : clean d_clean real_clean bin_clean check hetana hetpa hetdg \
.SECONDARY : %.hs %.d $(generated_rule_files)
$(HC) --make -o $@
hets.hs $(HC_OPTS) 2>&1 | tee hetcats-make
$(HC) --make -O -o hets
hets.hs $(HC_OPTS) 2>&1 | tee hetcats-make
$(HC) -o hets $(HC_OPTS) $(objects)
$(HC) --make -o hets $< $(HC_OPTS) 2>&1 | tee hetcats-make
###############################
### TAGS files for (x)emacs
# load them with "M-x" "visit-tags-table" from
# use "M-." to search for a tag
# !!Beware this is somewhat instable, because it uses an absolute path!!
###############################
### Documentation via haddock
# index for prelude is missing
$(HADDOCK) $(doc_sources) -o docs -h \
-t 'hets -- a heterogenous Specification (CASL) tool set'
###############################
$(HC) --make '-i../..:../DrIFT-src' -package text
GenerateRules.hs -o ../genRules && \
cvs -d :pserver:cvsread@cvs-agbkb.informatik.uni-bremen.de:/repository co HetCATS
(cd HetCATS; $(MAKE) derivedSources; ./
clean.sh; \
find . -name CVS -o -name \*.o -o -name \*.hi | xargs -r $(RM) -r; \
$(RM) clean.*; $(RM) Makefile; mv ReleaseMakefile Makefile)
#############################
### ATC DrIFT-rule generation
$(generated_rule_files): $(genrule_files)
utils/genRules #$(genrule_header_files)
$(foreach file,$(atc_files),$(gen_atc_files))
rule = ShATermConvertible
gen_atc_files = if [ -f ATC/$(basename $(basename $(notdir $(file))))
.header.hs ]; then \
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))
$(RM) $(generated_rule_files)
### removes *.hi and *.o in all include directories
for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
(cd $$p ; $(RM) *.hi *.o) ; done
### additonally removes *.d (dependency files) in every include directory
### also delete *
.d.bak (dependency file backups)
for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
(cd $$p ; $(RM) *.d *
.d.bak) ; done
### remove files also in own libraries
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
### additionally removes files not in CVS tree
distclean: real_clean clean_genRules d_clean
####################################################################
####################################################################
### a parser to test annotation parser and Id parsers
$(HC) --make -o $@ $< $(HC_OPTS)
$(HC) --make -o $@ $< $(HC_OPTS)
$(HC) --make -o $@ $< $(HC_OPTS)
$(HC) --make -o $@ $< $(HC_OPTS)
$(HC) --make -o $@ $< $(HC_OPTS)
$(HC) --make -o $@ $< $(HC_OPTS)
$(HC) --make -o $@ $< $(HC_OPTS)
$(HC) --make -o $@ $< $(HC_OPTS)
$(HC) --make -o $@ $< $(HC_OPTS)
### HetCASL with dev graph
$(HC) --make -o $@ $< $(HC_OPTS) -package-conf ..
/uni/uni-package.conf -package uni-davinci -package uni-server
### run tests in other directories
for i in $(TESTDIRS); do $(MAKE) -C $$i check; done
####################################################################
## Preparing the version of HetCATS
## two hardcoded dependencies for a correct generation of
Version.hs####################################################################
$(DRIFT) $(DRIFT_OPTS) $< > $@
## compiling rules for object and interface files
## compiling rules for dependencies
$(HC) -M $< $(HC_OPTS) -optdep-f -optdep$@
$(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),derivedSources)
ifneq ($(MAKECMDGOALS),release)
ifneq ($(MAKECMDGOALS),clean_genRules)
ifeq ($(MAKECMDGOALS),hets-old)
## include every .d file in INCLUDE_PATH
-include $(objects:.o=.d)