Makefile revision 9db48b4604636bfdf03e60890fc094b7bec775dc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
e83ed59502a681713982f25c559aae77a4145734Christian Maeder# hetcats/Makefile
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder# $Id$
e6d40133bc9f858308654afb1262b8b483ec5922Till Mossakowski# Author: Klaus L�ttich
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder# Year: 2002
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian Maeder
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder# This Makefile will compile the new hetcats system and provides also
3f69b6948966979163bdfe8331c38833d5d90ecdChristian Maeder# targets for test programs during implementation phases.
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder# !!! Note: This makefile is written for GNU make !!!
f3a94a197960e548ecd6520bb768cb0d547457bbChristian Maeder# (gmake on solaris ; make on linux)
e6d40133bc9f858308654afb1262b8b483ec5922Till Mossakowski
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder####################################################################
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder## Some varibles, which control the compilation
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederINCLUDE_PATH = ../parsec:../haterm-1.0/src:../fgl:../pretty:..:../CASL:../HasCASL:../aterm_conv:../ghc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederHC = ghc
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederPERL = perl
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederDRIFT = $(PERL) ../utils/DrIFT
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederAG = $(PERL) ../utils/ag
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederHC_FLAGS = -fglasgow-exts -fallow-overlapping-instances -Wall
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederHC_INCLUDE = -i$(INCLUDE_PATH)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederHC_PACKAGE = -package data
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederAG_FLAGS = -mdcfs
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
e83ed59502a681713982f25c559aae77a4145734Christian Maeder### Profiling and Warnings (only for debugging)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### Attention every module must be compiled with profiling or the linker
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### cannot link the various .o files properly. So after switching on
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### Profiling, do an 'gmake clean; gmake'
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### If you need Profiling comment out the following line
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder# HC_PROF = -prof -auto-all -Wall
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
e83ed59502a681713982f25c559aae77a4145734Christian MaederHCI_OPTS = $(HC_FLAGS) $(HC_PACKAGE) $(HC_INCLUDE)
e83ed59502a681713982f25c559aae77a4145734Christian MaederHC_OPTS = $(HCI_OPTS) $(HC_PROF)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
e83ed59502a681713982f25c559aae77a4145734Christian Maeder### list of directories to run checks in
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederTESTDIRS = ../CASL ../test
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
e83ed59502a681713982f25c559aae77a4145734Christian Maeder####################################################################
e83ed59502a681713982f25c559aae77a4145734Christian Maeder## sources for hetcats (semi - manually produced with a perl script)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederifneq ($(MAKECMDGOALS),clean)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederifneq ($(MAKECMDGOALS),bin_clean)
e83ed59502a681713982f25c559aae77a4145734Christian Maederifneq ($(MAKECMDGOALS),d_clean)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederifneq ($(MAKECMDGOALS),real_clean)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederifneq ($(MAKECMDGOALS),distclean)
e83ed59502a681713982f25c559aae77a4145734Christian Maederinclude sources_hetcats.mk
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederendif
e83ed59502a681713982f25c559aae77a4145734Christian Maederendif
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederendif
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederendif
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederendif
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederobjects = $(patsubst %.lhs,%.o,$(sources:%.hs=%.o))
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederdrifted_files = ../AS_Architecture.hs ../AS_Library.hs ../AS_Annotation.hs\
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder../CASL/AS_Basic_CASL.hs ../AS_Structured.hs
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder####################################################################
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### targets
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder.PHONY : clean d_clean real_clean bin_clean check
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder.SECONDARY : %.hs %.d
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder#.PRECIOUS: sources_hetcats.mk
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederhetcats: $(objects)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder $(RM) $@
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian Maeder $(HC) -o $@ $(HC_OPTS) $(objects)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian Maederhetcats-make: hetcats.lhs ../utils/create_sources.pl $(drifted_files)
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian Maeder $(RM) hetcats-make sources_hetcats.mk
749d29b3119ff42bf90ccf341892ef91df8269a2Christian Maeder $(HC) --make -o hetcats $< $(HC_OPTS) 2>&1 | tee hetcats-make && \
35db0960aa2e2a13652381c756fae5fb2b27213bChristian Maeder $(PERL) ../utils/create_sources.pl hetcats-make sources_hetcats.mk
1320edfb75af112d509a6ce0a4c02425da7fed4dChristian Maeder
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski###############
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### clean up
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### removes *.hi and *.o in all include directories
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederclean:
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder for p in $(subst :, ,$(INCLUDE_PATH)) . ; do \
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder (cd $$p ; $(RM) *.hi *.hi.bak *.o) ; done
07b1bf56f3a486f26d69514d05b73100abb25a0eChristian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### additionally removes binaries
eb483f2216949400bfef8f6deb5320f071445626Christian Maederbin_clean: clean
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder $(RM) hetcats
e83ed59502a681713982f25c559aae77a4145734Christian Maeder $(RM) capa
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder $(RM) hacapa
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder### additonally removes *.d (dependency files) in every include directory
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### also delete *.d.bak (dependency file backups)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederd_clean: clean
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski for p in $(subst :, ,$(INCLUDE_PATH)) . ; do \
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski (cd $$p ; $(RM) *.d *.d.bak) ; done
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski
e33e3b425e953236b4617870f995d263ac35b883Christian Maeder### additionally removes the files that define the sources-variable
58564afba8f0bb6b57783c4b440d0b666edf5f67Christian Maederreal_clean: d_clean bin_clean
e83ed59502a681713982f25c559aae77a4145734Christian Maeder $(RM) hetcats-make sources_hetcats.mk
e33e3b425e953236b4617870f995d263ac35b883Christian Maeder
3a3bbc51abf804d91bc9d8e0f2ce745cfae4c9c7Christian Maeder### additionally removes files not in CVS tree
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowskidistclean: real_clean
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski $(RM) Version.hs
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski $(RM) $(drifted_files)
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski
e83ed59502a681713982f25c559aae77a4145734Christian Maeder####################################################################
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski### test targets
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski####################################################################
f624c6980131e5b0598e00e7d8b4acb9720f8996Christian Maeder
e83ed59502a681713982f25c559aae77a4145734Christian Maeder### a parser to test annotation parser and Id parsers
3a3bbc51abf804d91bc9d8e0f2ce745cfae4c9c7Christian Maedertest_parser: ../test_parser.hs $(drifted_files)
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski $(RM) $@
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder $(HC) --make -o $@ $< $(HC_OPTS)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### interactive
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowskighci:
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder $(HC)i $(HCI_OPTS)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder### christian's target
1865083b72c1307e9040d78c2743abd5a54ee260Christian Maeder### CASL parser
eb483f2216949400bfef8f6deb5320f071445626Christian Maedercapa: ../CASL/capa.lhs $(drifted_files)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder $(RM) $@
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder $(HC) --make -o ../CASL/$@ $< $(HC_OPTS)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### HasCASL parser
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederhacapa: ../HasCASL/hacapa.lhs $(drifted_files)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder $(RM) $@
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder $(HC) --make -o ../HasCASL/$@ $< $(HC_OPTS)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder### run tests in other directories
eb483f2216949400bfef8f6deb5320f071445626Christian Maedercheck: hetcats
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder for i in $(TESTDIRS); do $(MAKE) -C $$i check; done
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
e83ed59502a681713982f25c559aae77a4145734Christian Maeder####################################################################
e83ed59502a681713982f25c559aae77a4145734Christian Maeder## Preparing the version of HetCATS
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian MaederVersion.hs: Version.in version_nr
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder $(PERL) ../utils/build_version.pl version_nr < Version.in > $@
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder## two hardcoded dependencies for a correct generation of Version.hs
eb483f2216949400bfef8f6deb5320f071445626Christian MaederOptions.hs: Version.hs
eb483f2216949400bfef8f6deb5320f071445626Christian Maederhetcats.lhs: Version.hs
1509ea46b471bef1c5e70864fb1cfc0a5280266bChristian Maeder####################################################################
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder## rules for DrIFT
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
afbd86903151121381e4e9d22862136817d7f0f0Christian Maeder%.hs: %.ag.hs
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder $(AG) $<
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
e83ed59502a681713982f25c559aae77a4145734Christian Maeder%.hs: %.der.hs
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder $(DRIFT) $< > $@
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder%.hs: %.ag
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder $(AG) $< -o $@
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
e83ed59502a681713982f25c559aae77a4145734Christian Maeder%.lhs: %.der.lhs
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder $(DRIFT) $< > $@
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder## compiling rules for object and interface files
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder%.o %.hi: %.hs
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder $(HC) -c $< $(HC_OPTS)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder%.o %.hi: %.lhs
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder $(HC) -c $< $(HC_OPTS)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder## compiling rules for dependencies
e83ed59502a681713982f25c559aae77a4145734Christian Maeder%.d : %.hs
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder $(HC) -M $< $(HC_OPTS) -optdep-f -optdep$@
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder%.d : %.lhs
afbd86903151121381e4e9d22862136817d7f0f0Christian Maeder $(HC) -M $< $(HC_OPTS) -optdep-f -optdep$@
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder####################################################################
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder## Setting a global search path (for dependency files)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder
e83ed59502a681713982f25c559aae77a4145734Christian Maederifneq ($(MAKECMDGOALS),clean)
e83ed59502a681713982f25c559aae77a4145734Christian Maederifneq ($(MAKECMDGOALS),real_clean)
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maederifneq ($(MAKECMDGOALS),d_clean)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederifneq ($(MAKECMDGOALS),real_clean)
e83ed59502a681713982f25c559aae77a4145734Christian Maederifneq ($(MAKECMDGOALS),distclean)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder## include every .d file in INCLUDE_PATH
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-include $(objects:.o=.d)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maedersources_hetcats.mk: hetcats-make Version.hs
25a0b76bc87e80c0f697951d9817862755a71d33Christian Maederendif
eb483f2216949400bfef8f6deb5320f071445626Christian Maederendif
e83ed59502a681713982f25c559aae77a4145734Christian Maederendif
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederendif
e83ed59502a681713982f25c559aae77a4145734Christian Maederendif
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder