tree.mk 2.62 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12

################################################################################
#
#	Layout of the source tree
#
################################################################################

# Here we provide defines for the various directories in the source tree,
# so we can move things around more easily.  A define $(GHC_FOO_DIR)
# indicates a directory relative to the top of the source tree.

GHC_UTILS_DIR           = utils
Ian Lynagh's avatar
Ian Lynagh committed
13
GHC_INCLUDE_DIRS        = includes includes/dist includes/dist-derivedconstants/header includes/dist-ghcconstants/header
14 15 16
GHC_RTS_DIR             = rts
GHC_DRIVER_DIR          = driver

17 18 19 20 21
INPLACE                 = inplace
INPLACE_BIN             = $(INPLACE)/bin
INPLACE_LIB             = $(INPLACE)/lib
INPLACE_TOPDIR          = $(INPLACE)/lib
INPLACE_MINGW           = $(INPLACE)/mingw
22

23 24 25 26 27 28
################################################################################
#
#    Bindist testing directory
#
################################################################################

thomie's avatar
thomie committed
29 30 31
# See Note [Spaces in TEST_HC].
# Directory contains multiple spaces, to test that multiple spaces aren't
# getting collapsed into a single space.
32
BIN_DIST_INST_SUBDIR = "install   dir"
33 34 35 36 37 38 39 40
BIN_DIST_INST_DIR = bindisttest/$(BIN_DIST_INST_SUBDIR)

################################################################################
#
#    rm
#
################################################################################

41 42 43
# These are here, rather than in config.mk, as they need to exist in an
# unconfigured tree so that the various clean targets can be used
# without configuring:
44
ifeq "$(ONLY_SHOW_CLEANS)" "YES"
45
RM = utils/testremove/wouldrm
46 47 48
RM_OPTS = CLEAN_FILES
RM_OPTS_REC = CLEAN_REC
else
49 50
RM = rm
RM_OPTS = -f
51
RM_OPTS_REC = -rf
52
endif
53

54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
# If $1 is empty then we don't do anything (as "rm -rf" fails on
# Solaris; trac #4916).
# If $1 contains a * then we fail; globbing needs to be done at the call
# site using $(wildcard ...). This makes it a little safer, as it's
# harder to accidentally delete something you didn't mean to.
# Similarly, we fail if any argument contains ".." or starts with a "/".

removeFiles = $(call removeHelper,removeFiles,"$(RM)",$(RM_OPTS),$1)
removeTrees = $(call removeHelper,removeTrees,"$(RM)",$(RM_OPTS_REC),$1)

removeHelper = $(if $(strip $4),\
                   $(if $(findstring *,$4),\
                       $(error $1: Got a star: $4),\
                   $(if $(findstring ..,$4),\
                       $(error $1: Got dot-dot: $4),\
                   $(if $(filter /%,$4),\
                       $(error $1: Got leading slash: $4),\
                       $2 $3 $4\
                    )))\
                )