2ronwalf# Author: (c) Klaus L�ttich, Christian Maeder, Uni Bremen 2002-2004
2ronwalf# This Makefile will compile the new hetcats system and provides also
2ronwalf# targets for test programs during implementation phases.
2ronwalf# !!! Note: This makefile is written for GNU make !!!
2ronwalf# (gmake on solaris ; make on linux)
2ronwalf####################################################################
2ronwalf## Some varibles, which control the compilation
2ronwalf## set ghc imports properly for your system
2ronwalf### Profiling and Warnings (only for debugging)
2ronwalf### Attention every module must be compiled with profiling or the linker
2ronwalf### cannot link the various .o files properly. So after switching on
2ronwalf### Profiling, do an 'gmake clean; gmake'
2ronwalf### 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 -K10 -RTS
### list of directories to run checks in
TESTDIRS = CASL HasCASL test
####################################################################
## 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),driftedSources)
ifneq ($(MAKECMDGOALS),release)
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)
$(HC) --make -O -o $@
hets.hs $(HC_OPTS)
$(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
$(HADDOCK) $(doc_sources) -o docs -h \
-t 'hets -- a heterogenous Specification (CASL) tool set'
###############################
cvs -d :pserver:cvsread@cvs-agbkb.informatik.uni-bremen.de:/repository co HetCATS
(cd HetCATS; $(MAKE) driftedSources; ./
clean.sh; \
find . -name CVS | xargs -r $(RM) -r; \
$(RM)
clean.lst; $(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)
$(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),driftedSources)
ifneq ($(MAKECMDGOALS),release)
ifneq ($(MAKECMDGOALS),clean_genRules)
ifeq ($(MAKECMDGOALS),hets-old)
## include every .d file in INCLUDE_PATH
-include $(objects:.o=.d)