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