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