#----------------------------------------------------------------------------- # PXSL Makefile # # CVS: $Id: Makefile,v 1.8 2003/06/05 20:05:56 thor Exp $ # # Copyright (C) 2003 Tom Moertel # Licensed under the terms of the GNU General Public License. # See the LICENSE file in the project distribution for details. #----------------------------------------------------------------------------- PROJECT = pxsl VERSION = 0.9.1 TARGETS = pxslcc DOCDIR = docs TESTDIR = tests MIRRORHOST = SPECFILE = pxsl-tools.spec DISTDIR = sources/$(PROJECT)-$(VERSION) TARBALL = $(DISTDIR).tar.gz GMAP_TGZ = gmap-5.0.tar.gz GMAP_DIR := $(GMAP_TGZ:.tar.gz=) BINDISTDIR = Linux-binaries/$(PROJECT)-$(VERSION)-$(shell uname -ms | tr 'A-Z ' 'a-z-') BINTARGETS := README $(TARGETS) examples TESTS_IN := $(wildcard $(TESTDIR)/*.xsl) TESTS_OUT_PXSL := $(TESTS_IN:.xsl=.pxsl) TESTS_OUT_XSL2 := $(TESTS_IN:.xsl=.xsl2) TESTS_OUT_DIFF := $(TESTS_IN:.xsl=.diff) TESTS_OUT_PXSL2 := $(TESTS_IN:.xsl=.pxsl2) DSFILES := $(wildcard *.ds) HASKELL := $(sort $(wildcard *.hs) $(DSFILES:.ds=.hs)) LIB_HASKELL := $(wildcard $(GMAP_DIR)/src/*.hs) ALL_HASKELL := $(sort $(HASKELL) $(LIB_HASKELL)) GHC_PACKAGE = -package lang GHC_OPT = # GHC_WARN = -Wall -fno-warn-name-shadowing GHC_OPTS = -i$(GMAP_DIR)/src -fglasgow-exts \ -fallow-overlapping-instances \ -fallow-undecidable-instances \ -fgenerics GHC := $(strip ghc $(GHC_WARN) $(GHC_OPT) $(GHC_OPTS) \ $(GHC_PACKAGE)) DRIFT = $(HOME)/dls/DrIFT-Strafunski-1.8/src/DrIFT STRIP = strip DIST_MANIFEST := README README.html LICENSE Makefile xsl2pxsl.xsl \ text-to-html.pl $(HASKELL) $(GMAP_TGZ) examples TODO \ $(SPECFILE) GENERATED := $(sort $(TARGETS) $(TESTS_OUT_PXSL) $(TESTS_OUT_XSL2) \ $(TESTS_OUT_PXSL2) $(TESTS_OUT_DIFF)) #----------------------------------------------------------------------------- # top level targets: all docs dist #----------------------------------------------------------------------------- .PHONY : all allfast allopt allstatic dist bindist all : $(TARGETS) README.html allfast : ; make GHC_OPT='' all allopt : ; make GHC_OPT='-O2' all allstatic : ; make GHC_OPT='-O2 -optl-static' all dist : $(DISTDIR) bindist : $(BINDISTDIR) $(DISTDIR) : $(DIST_MANIFEST) rm -rf $@ rsync -avC --delete-excluded $(DIST_MANIFEST) $@/ echo $(DIST_MANIFEST) | tr ' ' \\012 > $@/MANIFEST touch $@ rm -f $@.tar.gz && tar zcf $@.tar.gz $@ $(BINDISTDIR) : $(BINTARGETS) @[ -d $@ ] || mkdir -p $@ rsync -avC $(BINTARGETS) $@/ touch $@ rm -f $@.tar.gz && tar zcf $@.tar.gz $@ $(DOCDIR) : $(HASKELL) @[ -d $@ ] || mkdir -p $@ haddock --html -o $(DOCDIR) $(HASKELL) && touch $@ .PHONY : test test : $(TESTS_OUT_PXSL2) $(TESTS_OUT_DIFF) .PHONY : rpms rpms : dist rpmbuild -ta $(TARBALL) .PHONY : mirror mirror : README-online.html rsync -e ssh -avC README-online.html $(MIRRORHOST)/pxsl/README.html rsync -e ssh -avRC examples sources/*.gz Linux-binaries/*.gz \ $(MIRRORHOST)/pxsl/ rsync -e ssh -avC $(HOME)/rpm/RPMS/*/pxsl*rpm $(HOME)/rpm/SRPMS/pxsl*rpm \ $(MIRRORHOST)/pxsl/RPMS README-online.html : README.html perl -lpe'BEGIN{print "}i' $< > $@ #----------------------------------------------------------------------------- # helpers #----------------------------------------------------------------------------- # run tests .SECONDARY : $(TESTS_OUT_PXSL) $(TESTS_OUT_XSL2) %.pxsl : %.xsl xsl2pxsl.xsl ; xsltproc xsl2pxsl.xsl $< > $@ %.xsl2 : %.pxsl $(TARGETS) ; ./pxslcc -i --xslt $< > $@ %.pxsl2 : %.xsl2 xsl2pxsl.xsl ; xsltproc xsl2pxsl.xsl $< > $@ %.diff : %.xsl %.xsl2 ; diff -uw $^ > $@ || : # rules to build Typeable and Term instances for datatypes via DrIFT %.hs : %.ds $(DRIFT) $(DRIFT) -g Typeable $< > $@.drift-tmp $(DRIFT) -r -g Data $< >> $@.drift-tmp mv -f $@.drift-tmp $@ # build rules for Haskell % : %.hs $(ALL_HASKELL) $(GMAP_DIR) $(GHC) -o $@ --make $@.hs $(STRIP) $@ || echo "(Binary not stripped. No big deal.)" # build rules for unpacking sources from GMAP tarball $(GMAP_DIR) : $(GMAP_TGZ) cd $(dir $@) && tar zxf $^ $(GMAP_DIR)/src $(GMAP_DIR)/LICENSE # make README.html from README README.html : README text-to-html.pl perl text-to-html.pl $< > $@ # stamp RPM spec files %.spec : %.spec.in Makefile perl -pe's/\@\@VERSION\@\@/$(VERSION)/g;' $< > $@ # maintenance rules .PHONY : clean clean : rm -f *.o *.hi *.bak $(GENERATED) rm -rf $(DOCDIR) .PHONY : cleandeps cleandeps : rm -f *.d .PHONY : squeakyclean squeakyclean : clean cleandeps rm -rf $(GMAP_DIR) TAGS : $(HASKELL) hasktags $(HASKELL)