0N/A# Author: Klaus L�ttich
2362N/A# This Makefile will compile the new hetcats system and provides also
0N/A# targets for test programs during implementation phases.
0N/A# !!! Note: This makefile is written for GNU make !!!
0N/A# (gmake on solaris ; make on linux)
0N/A####################################################################
0N/A## Some varibles, which control the compilation
0N/AINCLUDE_PATH = ghc:hetcats
0N/ACLEAN_PATH = Common:Logic:CASL:Syntax:Static:GUI:HasCASL:Haskell:
Haskell/Language:Modal:CspCASL:$(INCLUDE_PATH)
0N/AHC_FLAGS = -fglasgow-exts -fallow-overlapping-instances -Wall
0N/AHC_INCLUDE = -i$(INCLUDE_PATH)
0N/A### Profiling and Warnings (only for debugging)
0N/A### Attention every module must be compiled with profiling or the linker
0N/A### cannot link the various .o files properly. So after switching on
0N/A### Profiling, do an 'gmake clean; gmake'
0N/A### If you need Profiling comment out the following line
0N/A#HC_PROF = -prof -auto-all -Wall
0N/AHCI_OPTS = $(HC_FLAGS) $(HC_PACKAGE) $(HC_INCLUDE)
0N/AHC_OPTS = $(HCI_OPTS) $(HC_PROF)
0N/ADRIFT_OPTS = +RTS -K10 -RTS
0N/A### list of directories to run checks in
0N/ATESTDIRS = CASL HasCASL test
0N/A####################################################################
0N/A## sources for hetcats (semi - manually produced with a perl script)
0N/Aifneq ($(MAKECMDGOALS),clean)
0N/Aifneq ($(MAKECMDGOALS),bin_clean)
0N/Aifneq ($(MAKECMDGOALS),d_clean)
0N/Aifneq ($(MAKECMDGOALS),real_clean)
0N/Aifneq ($(MAKECMDGOALS),distclean)
0N/Aifneq ($(MAKECMDGOALS),genRules)
0N/Aifneq ($(MAKECMDGOALS),apache_doc)
0N/Aifneq ($(MAKECMDGOALS),clean_genRules)
0N/Aobjects = $(patsubst %.lhs,%.o,$(sources:%.hs=%.o))
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 clean_genRules genRules
.SECONDARY : %.hs %.d $(generated_rule_files)
$(HC) --make -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'
##########################
### DrIFT-rule generation
genRules: $(generated_rule_files)
$(generated_rule_files): $(genrule_files)
$(foreach file,$(atc_files),$(gen_atc_files))
rule = ShATermConvertible
gen_atc_files = if [ -e 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)
### 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),clean_genRules)
ifeq ($(MAKECMDGOALS),hets-old)
## include every .d file in INCLUDE_PATH
-include $(objects:.o=.d)