boilerplate.mk 3.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
#################################################################################
#
#			    nofib/mk/boilerplate.mk
#
#		Boilerplate Makefile for an fptools project
#
#################################################################################

# Begin by slurping in the boilerplate from one level up, 
# with standard TOP-mangling
# Remember, TOP is the top level of the innermost level

13 14
default : all

Simon Marlow's avatar
Simon Marlow committed
15 16 17
show:
	@echo '$(VALUE)="$($(VALUE))"'

18
NOFIB_TOP := $(TOP)
19
include $(NOFIB_TOP)/../mk/tree.mk
20 21 22
include $(NOFIB_TOP)/../mk/config.mk
GHC_TOP := $(TOP)
TOP := $(NOFIB_TOP)
23

24
RM = rm -f
25 26
SIZE = size
STRIP = strip
27

Ian Lynagh's avatar
Ian Lynagh committed
28 29 30 31
# Turn off -Werror for nofib. This allows you to use nofib in a tree
# built with validate.
WERROR=

Simon Marlow's avatar
Simon Marlow committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
# NoFibSubDirs controls which set of tests should be run
# You can run one or more of
#	imaginary 
#	spectral
#	real
#	parallel
#	PRIVATE
#	PENDING
#	UNUSED
NoFibSubDirs = imaginary spectral real

# The different ways to build nofib. Default is just to mirror
# what is done for the ghc prelude libraries.
#
NoFibWays = $(filter-out v,$(GhcLibWays))

# Haskell compiler options for nofib
NoFibHcOpts = -O

# Number of times to run each program
NoFibRuns = 5

54 55 56 57 58 59 60 61 62
# -----------------------------------------------------------------
# Everything after this point
# augments or overrides previously set variables.
# (these files are optional, so `make' won't fret if it
#  cannot get to them).
# -----------------------------------------------------------------

WAYS=$(NoFibWays)

Simon Marlow's avatar
Simon Marlow committed
63
TOP := $(GHC_TOP)
Simon Marlow's avatar
Simon Marlow committed
64
-include $(GHC_TOP)/mk/build.mk
Simon Marlow's avatar
Simon Marlow committed
65 66
TOP := $(NOFIB_TOP)

67 68
SRC_HC_OPTS += $(NoFibHcOpts) -Rghc-timing

69 70 71 72 73 74 75
# -package array is needed for GHC 7.0.1 and later, as the haskell98 package
# is no longer linked by default.  We would like to use
#    -hide-all-packages -package haskell2010
# instead, but there is at least one program that uses a non-haskell2010
# library module (fibheaps uses Control.Monad.ST)
SRC_HC_OPTS += -package array

Simon Marlow's avatar
Simon Marlow committed
76
ifeq "$(WithNofibHc)" ""
77 78
HC	   = $(GHC_TOP)/$(GHC_STAGE2)
MKDEPENDHS := $(GHC_TOP)/$(GHC_STAGE2)  # ToDo: wrong, if $(WithNofibHc) isn't GHC.
Simon Marlow's avatar
Simon Marlow committed
79 80 81 82 83
else
HC	   = $(WithNofibHc)
MKDEPENDHS := $(WithNofibHc)
endif

84 85 86 87 88 89 90 91 92 93 94 95
define get-ghc-rts-field # $1 = result variable, $2 = field name
$1 := $$(shell '$$(HC)' +RTS --info | grep '^ .("$2",' | tr -d '\r' | sed -e 's/.*", *"//' -e 's/")$$$$//')
endef

$(eval $(call get-ghc-rts-field,HC_VERSION,GHC version))

define ghc-ge # $1 = major version, $2 = minor version
HC_VERSION_GE_$1_$2 := $$(shell if [ `echo $$(HC_VERSION) | sed 's/\..*//'` -gt $1 ]; then echo YES; else if [ `echo $$(HC_VERSION) | sed 's/\..*//'` -ge $1 ] && [ `echo $$(HC_VERSION) | sed -e 's/[^.]*\.//' -e 's/\..*//'` -ge $2 ]; then echo YES; else echo NO; fi; fi)
endef

$(eval $(call ghc-ge,6,13))

96 97 98 99 100
MKDEPENDC := $(GHC_TOP)/$(MKDEPENDC)
RUNTEST   = $(NOFIB_TOP)/runstdtest/runstdtest

USE_NEW_MKDEPEND_FLAGS = YES
# USE_NEW_MKDEPEND_FLAGS := $(shell if test `$(MKDEPENDHS) --numeric-version | sed -e "s/\./0/" -e "s/\..*//"` -ge 609; then echo YES; else echo NO; fi)
101

102 103
include $(NOFIB_TOP)/mk/ghc-paths.mk
include $(NOFIB_TOP)/mk/ghc-opts.mk
104 105
include $(NOFIB_TOP)/mk/paths.mk
include $(NOFIB_TOP)/mk/opts.mk
106 107

-include .depend