replace git subtree with submodule.
[ghc.git] / mk / tree.mk
1
2 ################################################################################
3 #
4 # Layout of the source tree
5 #
6 ################################################################################
7
8 # Here we provide defines for the various directories in the source tree,
9 # so we can move things around more easily. A define $(GHC_FOO_DIR)
10 # indicates a directory relative to the top of the source tree.
11
12 GHC_UTILS_DIR = utils
13 GHC_INCLUDE_DIRS = includes includes/dist includes/dist-derivedconstants/header includes/dist-ghcconstants/header
14 GHC_RTS_DIR = rts
15 GHC_DRIVER_DIR = driver
16
17 INPLACE = inplace
18 INPLACE_BIN = $(INPLACE)/bin
19 INPLACE_LIB = $(INPLACE)/lib
20 INPLACE_TOPDIR = $(INPLACE)/lib
21 INPLACE_MINGW = $(INPLACE)/mingw
22 INPLACE_PERL = $(INPLACE)/perl
23
24 ################################################################################
25 #
26 # Bindist testing directory
27 #
28 ################################################################################
29
30 # See Note [Spaces in TEST_HC].
31 # Directory contains multiple spaces, to test that multiple spaces aren't
32 # getting collapsed into a single space.
33 BIN_DIST_INST_SUBDIR = "install dir"
34 BIN_DIST_INST_DIR = bindisttest/$(BIN_DIST_INST_SUBDIR)
35
36 ################################################################################
37 #
38 # rm
39 #
40 ################################################################################
41
42 # These are here, rather than in config.mk, as they need to exist in an
43 # unconfigured tree so that the various clean targets can be used
44 # without configuring:
45 ifeq "$(ONLY_SHOW_CLEANS)" "YES"
46 RM = utils/testremove/wouldrm
47 RM_OPTS = CLEAN_FILES
48 RM_OPTS_REC = CLEAN_REC
49 else
50 RM = rm
51 RM_OPTS = -f
52 RM_OPTS_REC = -rf
53 endif
54
55 # If $1 is empty then we don't do anything (as "rm -rf" fails on
56 # Solaris; trac #4916).
57 # If $1 contains a * then we fail; globbing needs to be done at the call
58 # site using $(wildcard ...). This makes it a little safer, as it's
59 # harder to accidentally delete something you didn't mean to.
60 # Similarly, we fail if any argument contains ".." or starts with a "/".
61
62 removeFiles = $(call removeHelper,removeFiles,"$(RM)",$(RM_OPTS),$1)
63 removeTrees = $(call removeHelper,removeTrees,"$(RM)",$(RM_OPTS_REC),$1)
64
65 removeHelper = $(if $(strip $4),\
66 $(if $(findstring *,$4),\
67 $(error $1: Got a star: $4),\
68 $(if $(findstring ..,$4),\
69 $(error $1: Got dot-dot: $4),\
70 $(if $(filter /%,$4),\
71 $(error $1: Got leading slash: $4),\
72 $2 $3 $4\
73 )))\
74 )
75