?prevdifflink? - Blame
###########################################################################
#
# Variables
#
top = .
hsmodules = $(shell find $(top) -name "*.hs")
lhsmodules = $(shell find $(top) -name "*.lhs")
modules = $(shell find $(top) -name "*.hs" -or -name "*.lhs")
humodules = $(shell find $(top) -name "*HUnit.hs" -or \
-name "*HUnit.lhs")
root = $(PWD)
contrib = $(root)/contrib
###########################################################################
#
# Instructions
#
all:
@cat instructions
###########################################################################
#
# GHC
#
sfLib = $(contrib)/StrategyLib-5.0
sfModel = drift-default
sfPath = $(sfLib)/library:$(sfLib)/models/$(sfModel)
atPath = $(atLib)/library
uminho = $(contrib)/uminho
hsqlPath = $(contrib)/HSQL-1.7/HSQL
postgreshsqlPath= $(contrib)/HSQL-1.7/PostgreSQL
haxmlPath = $(contrib)/HaXml-1.17/src
washPath = $(contrib)/WashNGo-2.0.5/cgi:$(contrib)/WashNGo-2.0.5/Utility:$(contrib)/WashNGo-2.0.5/WASH
hsPluginsPath = $(contrib)/hs-plugins-0.9.8/src/altdata
ghcPath = :$(contrib)/HList/src:$(contrib)/HUnit-1.0:$(sfPath):$(shPath):$(atPath):$(haxmlPath):$(hsPluginsPath):$(hlistPath):$(oohaskellPath):$(hsqlPath):$(postgreshsqlPath):$(uminho):$(root)/1lt:$(root)/2lt:$(root)/sql:$(root)/vdm:$(root)/type:$(root)/xml:$(root)/xpath:$(contrib)/vdm-front/haskell:$(contrib)/Sdf2Haskell/library:$(contrib)/ATermLib/library:$(root)/2lt-gui
ghcOpts = -w -fwarn-overlapping-patterns -fwarn-deprecations -fwarn-duplicate-exports \
-fwarn-missing-fields -fglasgow-exts -fallow-overlapping-instances \
-fallow-undecidable-instances -fwarn-unused-imports \
-i$(ghcPath)
washModules = $(shell egrep -l "</[a-z]+>" `find $(top) -iname "*hs"`)
ghciModules = $(filter-out $(washModules), $(modules))
sql-happy:
ifeq ($(SQL),max)
happy -i -g -a -c Language/SQL/PostgreSQLmax.y
else
happy -i -g -a -c Language/SQL/PostgreSQLmin.y
endif
ghci:
mkdir -p ${docDir}
mkdir -p hidir
mkdir -p odir
ifeq ($(hsql),postgres)
hsc2hs $(hsqlPath)/Database/HSQL.hsc
hsc2hs $(postgreshsqlPath)/Database/HSQL/PostgreSQL.hsc -I/usr/local/pgsql/include -I/usr/local/pgsql/include/server
ghc --make -hidir hidir -odir odir -fglasgow-exts -i$(hsqlPath) -i$(postgreshsqlPath) $(postgreshsqlPath)/Database/HSQL/PostgreSQL.hs
ghci -hidir hidir -odir odir ${ghcOpts} ${extraOpts} $(ghciModules) -L/usr/local/pgsql/lib -lpq
else
ghci -hidir hidir -odir odir ${ghcOpts} ${extraOpts} $(ghciModules)
endif
ghc:
mkdir -p hidir
mkdir -p odir
ifeq ($(hsql),postgres)
hsc2hs $(hsqlPath)/Database/HSQL.hsc
hsc2hs $(postgreshsqlPath)/Database/HSQL/PostgreSQL.hsc -I/usr/local/pgsql/include -I/usr/local/pgsql/include/server
ghc --make -hidir hidir -odir odir ${ghcOpts} ${extraOpts} $(ghciModules) -L/usr/local/pgsql/lib -lpq
else
ghc --make -hidir hidir -odir odir ${ghcOpts} ${extraOpts} $(ghciModules)
endif
# Don't rely on this rule. It's a temporary patch
hsql:
mkdir -p hidir
mkdir -p odir
ghc --make -hidir hidir -odir odir ${ghcOpts} -cpp $(ghciModules)
###########################################################################
#
# Documentation
#
docDir = ./documentation
infixModules = $(shell egrep -l ":.:" `find $(top) -name "*hs"`)
skipModules = $(infixModules) $(washModules)
skipModulesCodd= $(washModules) $(qcmodules) $(humodules)
lhs2hsModules = $(patsubst %.lhs, %.lhs2hs, $(filter-out $(skipModules), $(lhsmodules)))
hddkModules = $(filter-out $(skipModules), $(hsmodules)) $(lhs2hsModules)
haddock: lhs2hs
@$(RM) -r ${docDir}
@mkdir -p ${docDir}
@echo "Running Haddock, redirecting warnings to haddock.log"
@haddock -o ${docDir} -h \
--title="UMinho Haskell Libraries ($(distVersion))" \
-p Prologue \
$(filter-out $(skipModules), $(hsmodules)) \
$(lhs2hsModules) 2> haddock.log
@echo "Generated documentation in $(docDir)"
@echo "Skipped modules: $(skipModules)"
@echo "because Haddock can't handle them"
lhs2hs: $(lhs2hsModules)
%.lhs2hs: %.lhs
@ghc -E $< -o /tmp/q
@egrep -v "^#" /tmp/q > $@
###########################################################################
#
# Distribution
#
distName = 2LT
distVersion = $(shell date "+%Y.%m.%d")
hiddenFiles = $(shell find $(top) -name ".*")
distFiles = $(filter-out $(hiddenFiles), ${wildcard *})
distFullName = $(distName)-$(distVersion)
lnDistFiles = $(subst /./,/, $(patsubst %, $(distFullName)/%, $(distFiles)))
dist:
@echo "Creating distribution $(distFullName)"
@rm -rf $(distFullName)
@ln -s . $(distFullName)
@rm -f $(distFullName).tgz
@tar zcf $(distFullName).tgz $(lnDistFiles)
@rm -f $(distFullName)
@echo " READY for distribution:"
@echo " $(distFullName).tgz"
###########################################################################
#
# HUnit
#
huSession = session.hunit
hunit:
@echo "Running HUnit on modules: $(humodules)"
@echo "" > $(huSession)
@$(MAKE) $(patsubst %, %.hunit, $(humodules))
@ghci -hidir hidir -odir odir -w $(ghcOpts) -v0 < $(huSession)
@rm $(huSession)
%.hunit:
@echo ":l $*" >> $(huSession)
@echo "main" >> $(huSession)
###########################################################################
#
# Cleaning
hiModules = hidir #$(shell find $(top) -name "*.hi")
oModules = odir #$(shell find $(top) -name "*.o")
clean:
$(RM) $(distName)-*.zip $(distName)-*.tgz
$(RM) -rf $(hiModules) $(oModules)
$(RM) $(shell find $(top) -name "*.lhs2hs")
$(RM) session.* *.log hugsin
###########################################################################
#
# Debugging this Makefile
echo-%:
@echo $($(*))
###########################################################################
|