boilerplate.mk 2.75 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 25
RM = rm -f

Ian Lynagh's avatar
Ian Lynagh committed
26 27 28 29
# 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
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
# 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

52 53 54 55 56 57 58 59 60
# -----------------------------------------------------------------
# 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
61
TOP := $(GHC_TOP)
Simon Marlow's avatar
Simon Marlow committed
62
-include $(GHC_TOP)/mk/build.mk
Simon Marlow's avatar
Simon Marlow committed
63 64
TOP := $(NOFIB_TOP)

65 66
SRC_HC_OPTS += $(NoFibHcOpts) -Rghc-timing

Simon Marlow's avatar
Simon Marlow committed
67
ifeq "$(WithNofibHc)" ""
68 69
HC	   = $(GHC_TOP)/$(GHC_STAGE2)
MKDEPENDHS := $(GHC_TOP)/$(GHC_STAGE2)  # ToDo: wrong, if $(WithNofibHc) isn't GHC.
Simon Marlow's avatar
Simon Marlow committed
70 71 72 73 74
else
HC	   = $(WithNofibHc)
MKDEPENDHS := $(WithNofibHc)
endif

75 76 77 78 79 80 81 82 83 84 85 86
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))

87 88 89 90 91
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)
92

93 94
include $(NOFIB_TOP)/mk/ghc-paths.mk
include $(NOFIB_TOP)/mk/ghc-opts.mk
95 96
include $(NOFIB_TOP)/mk/paths.mk
include $(NOFIB_TOP)/mk/opts.mk
97 98

-include .depend