ReleaseMakefile revision 149dd26a03ea86cfd27e9cdf1c4e5f731be98d72
# Makefile for a Release
# $Header$
# Author: (c) Klaus L�ttich, Christian Maeder, Uni Bremen 2002-2004
# Year: 2004
# This Makefile will compile the hets sources
# note that you'll need the "uni" library residing in ".."
# !!! Note: This makefile is written for GNU make !!!
# (gmake on solaris ; make on linux)
####################################################################
## Some varibles, which control the compilation
INCLUDE_PATH = ghc:hetcats
CLEAN_PATH = Common:Logic:CASL:Syntax:Static:GUI:HasCASL:Haskell:Haskell/Language:CspCASL:ATC:Proofs:Comorphisms:$(INCLUDE_PATH):Haskell/Hatchet
## set ghc imports properly for your system!
DRIFT_ENV = DERIVEPATH='.:ghc:hetcats:/home/linux-bkb/ghc/ghc-latest/lib/ghc-6.0.1/imports'
HC = ghc
PERL = perl
HAPPY = happy
DRIFT = $(DRIFT_ENV) utils/DrIFT
HADDOCK = haddock
HC_FLAGS = -fglasgow-exts
HC_INCLUDE = -i$(INCLUDE_PATH)
# you need the "uni" library!
HC_PACKAGE = -package-conf ../uni/uni-package.conf -package uni-davinci \
-package uni-server
### 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)
drifted_files = Syntax/AS_Architecture.hs Syntax/AS_Library.hs\
$(gendrifted_files)
genrule_header_files = $(wildcard ATC/*.header.hs)
generated_rule_files = $(patsubst %.hs,%.der.hs,$(gendrifted_files))
happy_files = Haskell/Language/Parser.hs Haskell/Hatchet/HsParser.hs
# this variable holds the modules that should be documented
doc_sources = $(filter-out Nothing/Nothing% ,$(sources))
####################################################################
### targets
.PHONY : clean d_clean real_clean bin_clean check hetana hetpa hetdg \
clean_genRules genRules
.SECONDARY : %.hs %.d $(generated_rule_files)
all: hets-optimized
hets-opt: hetcats/Version.hs
$(MAKE) distclean
$(MAKE) driftedSources
$(MAKE) hets-optimized
hets-optimized:
$(HC) --make -O -o $@ hets.hs $(HC_OPTS)
driftedSources: $(drifted_files) $(happy_files) hetcats/Version.hs
(cd utils/DrIFT-src; $(HC) --make DrIFT.hs -o ../DrIFT)
(cd utils/GenerateRules; \
$(HC) --make -i../.. -package text GenerateRules.hs -o ../genRules)
$(RM) uni
#############################
### ATC DrIFT-rule generation
genRules: $(generated_rule_files) utils/genRules
$(generated_rule_files): $(genrule_files) utils/genRules $(genrule_header_files)
$(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
### remove binary
bin_clean:
$(RM) hets
### 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 files also in own libraries
lib_clean: clean
for p in $(subst :, ,$(COMMONLIB_PATH)) . ; do \
(cd $$p ; $(RM) *.hi *.o) ; done
### additionally removes the files that define the sources-variable
real_clean: lib_clean
### additionally generated files not in CVS tree
distclean: real_clean clean_genRules d_clean
$(RM) hetcats/Version.hs
$(RM) $(drifted_files)
$(RM) $(happy_files)
####################################################################
## 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
####################################################################
## rules for DrIFT
%.hs: %.ly
$(HAPPY) $<
%.hs: %.der.hs utils/DrIFT
$(DRIFT) $(DRIFT_OPTS) $< > $@