Makefile revision 725a68ec81cba9b8aa8647bebfb5baa449803e7e
6N/A
6N/A# hetcats/Makefile
6N/A# $Id$
6N/A# Author: Klaus L�ttich
6N/A# Year: 2003
6N/A
6N/A# This Makefile will compile the new hetcats system and provides also
6N/A# targets for test programs during implementation phases.
6N/A
6N/A# !!! Note: This makefile is written for GNU make !!!
6N/A# (gmake on solaris ; make on linux)
6N/A
6N/A####################################################################
6N/A## Some varibles, which control the compilation
6N/A
6N/AINCLUDE_PATH = ghc:hetcats
6N/ACOMMONLIB_PATH = Common/Lib:Common/Lib/Parsec:Common/ATerm
6N/ACLEAN_PATH = Common:Logic:CASL:Syntax:Static:GUI:HasCASL:Haskell:Haskell/Language:Modal:CspCASL:$(INCLUDE_PATH)
6N/A
6N/AHC = ghc
6N/APERL = perl
6N/AHAPPY = happy
6N/ADRIFT = $(PERL) utils/DrIFT
6N/AAG = $(PERL) utils/ag
6N/AHADDOCK = $(PERL) utils/haddock
16N/A
16N/AHC_FLAGS = -fglasgow-exts -fallow-overlapping-instances -Wall
16N/AHC_INCLUDE = -i$(INCLUDE_PATH)
6N/AHC_PACKAGE =
6N/A
6N/AAG_FLAGS = -mdcfs
6N/A
6N/A### Profiling and Warnings (only for debugging)
6N/A### Attention every module must be compiled with profiling or the linker
6N/A### cannot link the various .o files properly. So after switching on
16N/A### Profiling, do an 'gmake clean; gmake'
6N/A### If you need Profiling comment out the following line
6N/A#HC_PROF = -prof -auto-all -Wall
1132N/A
1132N/AHCI_OPTS = $(HC_FLAGS) $(HC_PACKAGE) $(HC_INCLUDE)
1132N/AHC_OPTS = $(HCI_OPTS) $(HC_PROF)
1132N/A
1132N/A### list of directories to run checks in
6N/ATESTDIRS = CASL HasCASL test
6N/A
6N/A####################################################################
6N/A## sources for hetcats (semi - manually produced with a perl script)
6N/A
6N/Aifneq ($(MAKECMDGOALS),clean)
6N/Aifneq ($(MAKECMDGOALS),bin_clean)
6N/Aifneq ($(MAKECMDGOALS),d_clean)
16N/Aifneq ($(MAKECMDGOALS),real_clean)
16N/Aifneq ($(MAKECMDGOALS),distclean)
6N/Ainclude sources_hetcats.mk
6N/Aendif
6N/Aendif
6N/Aendif
6N/Aendif
6N/Aendif
6N/A
6N/Aobjects = $(patsubst %.lhs,%.o,$(sources:%.hs=%.o))
6N/A
6N/Adrifted_files = Syntax/AS_Architecture.hs Syntax/AS_Library.hs\
6N/A Common/AS_Annotation.hs CASL/AS_Basic_CASL.hs Syntax/AS_Structured.hs
6N/A
6N/A# this variable holds the modules that should be documented
6N/A# the imported parsec library is not included!
6N/Adoc_sources = $(filter-out Nothing/Nothing% ,$(sources))
6N/A
6N/A####################################################################
6N/A### targets
6N/A
6N/A.PHONY : clean d_clean real_clean bin_clean check
6N/A.SECONDARY : %.hs %.d
6N/A#.PRECIOUS: sources_hetcats.mk
6N/A
6N/Ahets: $(objects)
6N/A $(RM) $@
6N/A $(HC) -o $@ $(HC_OPTS) $(objects)
6N/A
6N/Ahetcats-make: hets.hs utils/create_sources.pl $(drifted_files)
16N/A $(RM) hetcats-make sources_hetcats.mk
6N/A $(HC) --make -o hets $< $(HC_OPTS) 2>&1 | tee hetcats-make && \
6N/A $(PERL) utils/create_sources.pl hetcats-make sources_hetcats.mk
6N/A
6N/A###############################
6N/A### TAGS files for (x)emacs
6N/A# load them with "M-x" "visit-tags-table" from
6N/A# "HetCATS/hetcats/hetcats.TAGS"
6N/A# use "M-." to search for a tag
6N/A# !!Beware this is somewhat instable, because it uses an absolute path!!
16N/Ahetcats.TAGS: $(sources)
6N/A /home/ger/linux/ghc-5.04.2/bin/i386-unknown-linux/hasktags \
16N/A $(sources); mv TAGS $@; mv tags hetcats.tags
16N/A
6N/A###############################
16N/A### Documentation via haddock
16N/Adoc: docs/index.html utils/hd-lib
6N/A
6N/Adocs/index.html: $(doc_sources)
6N/A $(HADDOCK) $(doc_sources) -o docs -h \
6N/A -t 'hets -- a heterogenous Specification (CASL) tool set'
6N/A
6N/Aapache_doc:
6N/A cvs up -d
6N/A $(RM) docs/*.html
6N/A $(MAKE) doc
6N/A $(PERL) utils/post_process_docs.pl docs \
6N/A 'Common.Lib.Map.html:Common.Lib._Map.html'
16N/A
6N/A###############
6N/A### clean up
6N/A
6N/A### removes *.hi and *.o in all include directories
6N/Aclean: bin_clean
6N/A for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
6N/A (cd $$p ; $(RM) *.hi *.o) ; done
6N/A
6N/A### remove binaries
6N/Abin_clean:
6N/A $(RM) hets
6N/A $(RM) test_parser
6N/A $(RM) CASL/capa
16N/A $(RM) HasCASL/hacapa
16N/A $(RM) Haskell/hapa
16N/A $(RM) Haskell/wrap
16N/A $(RM) Syntax/hetpa
16N/A $(RM) Static/hetana
16N/A $(RM) Static/hetana
16N/A $(RM) GUI/hetdg
16N/A $(RM) hetpa
16N/A $(RM) hetana
16N/A $(RM) hetdg
16N/A
16N/A### additonally removes *.d (dependency files) in every include directory
16N/A### also delete *.d.bak (dependency file backups)
16N/Ad_clean: clean
16N/A for p in $(subst :, ,$(CLEAN_PATH)) . ; do \
16N/A (cd $$p ; $(RM) *.d *.d.bak) ; done
16N/A
16N/A### remove files also in own libraries
16N/Alib_clean:
16N/A for p in $(subst :, ,$(COMMONLIB_PATH):$(CLEANPATH)) . ; do \
16N/A (cd $$p ; $(RM) *.hi *.d *.o) ; done
16N/A
16N/A### additionally removes the files that define the sources-variable
16N/Areal_clean: bin_clean lib_clean
16N/A $(RM) hetcats-make sources_hetcats.mk
16N/A $(RM) AS_*.hs
16N/A
16N/A### additionally removes files not in CVS tree
16N/Adistclean: real_clean
16N/A $(RM) hetcats/Version.hs
16N/A $(RM) $(drifted_files)
16N/A $(RM) Haskell/Language/Parser.hs
16N/A
16N/A####################################################################
16N/A### test targets
16N/A####################################################################
16N/A
16N/A### a parser to test annotation parser and Id parsers
16N/Atest_parser: Common/test_parser
16N/A
Common/test_parser: Common/test_parser.hs Common/AS_Annotation.der.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### interactive
ghci:
$(HC)i $(HCI_OPTS)
### christian's target
### CASL parser
capa: CASL/capa
CASL/capa: CASL/capa.lhs Common/*.hs CASL/*.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### HasCASL parser
hacapa: HasCASL/hacapa
HasCASL/hacapa: HasCASL/hacapa.lhs CASL/capa HasCASL/*.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### Haskell parser
hapa: Haskell/hapa
Haskell/hapa: Haskell/hapa.lhs Haskell/*.hs $(drifted_files) Haskell/Language/Parser.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
Haskell/Language/Parser.hs: Haskell/Language/Parser.ly
$(HAPPY) $<
### Haskell wrap parser
wrap: Haskell/wrap
Haskell/wrap: Haskell/wrap.lhs Haskell/*.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### HetCASL parser
hetpa: Syntax/hetpa.hs $(drifted_files) Haskell/Language/Parser.hs *.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### HetCASL parser
hetana: Static/hetana.hs $(drifted_files) *.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS)
### HetCASL with dev graph
hetdg: GUI/hetdg.hs $(drifted_files) *.hs
$(RM) $@
$(HC) --make -o $@ $< $(HC_OPTS) -package-conf ../uni/uni-package.conf -package uni-davinci -package uni-server
### run tests in other directories
check: hetcats
for i in $(TESTDIRS); do $(MAKE) -C $$i check; done
####################################################################
## 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
hetcats/Options.hs: hetcats/Version.hs
hets.hs: hetcats/Version.hs
####################################################################
## rules for DrIFT
%.ly: %.hs
$(HAPPY) $<
%.hs: %.ag.hs
$(AG) $<
%.hs: %.der.hs
$(DRIFT) $< > $@
%.hs: %.ag
$(AG) $< -o $@
%.lhs: %.der.lhs
$(DRIFT) $< > $@
## compiling rules for object and interface files
%.o %.hi: %.hs
$(HC) -c $< $(HC_OPTS)
%.o %.hi: %.lhs
$(HC) -c $< $(HC_OPTS)
## compiling rules for dependencies
%.d : %.hs
$(HC) -M $< $(HC_OPTS) -optdep-f -optdep$@
%.d : %.lhs
$(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)
## include every .d file in INCLUDE_PATH
-include $(objects:.o=.d)
sources_hetcats.mk: hetcats-make hetcats/Version.hs
endif
endif
endif
endif
endif