+# -----------------------------------------------------------------------------
+#
+# (c) 2009 The University of Glasgow
+#
+# This file is part of the GHC build system.
+#
+# To understand how the build system works and how to modify it, see
+# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
+# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
+#
+# -----------------------------------------------------------------------------
+
define hs-sources # args: $1 = dir, $2 = distdir
# NB. use :=, we only want this thing evaluated once.
#
$1_$2_HS_SRCS := $$(foreach file,$$($1_$2_SLASH_MODS),\
- $$(firstword \
- $$(wildcard \
- $$(foreach dir,$$($1_$2_HS_SRC_DIRS),\
- $1/$$(dir)/$$(file).hs $1/$$(dir)/$$(file).lhs)) \
- $1/$2/build/$$(file).hs))
+ $$(firstword \
+ $$(wildcard \
+ $$(foreach dir,$$($1_$2_HS_SRC_DIRS) $2/build/autogen,\
+ $1/$$(dir)/$$(file).hs $1/$$(dir)/$$(file).lhs)) \
+ $1/$2/build/$$(file).hs))
# .hs-boot files must be in the same place as the .hs file they go
# with (GHC assumes this). When we preprocess a source file, and
# NB. use :=, we only want this thing evaluated once.
#
$1_$2_HS_BOOT_SRCS := $$(foreach dir,$$($1_$2_HS_SRC_DIRS),\
- $$(subst $1/$$(dir),$1/$2/build,\
- $$(wildcard \
- $$(subst $1/$2/build,$1/$$(dir),\
- $$(foreach file,\
- $$(filter $1/$2/build%,$$($1_$2_HS_SRCS)),\
- $$(patsubst %.hs,%.hs-boot,$$(file)) \
- $$(patsubst %.hs,%.lhs-boot,$$(file)))))))
+ $$(subst $1/$$(dir),$1/$2/build,\
+ $$(wildcard \
+ $$(subst $1/$2/build,$1/$$(dir),\
+ $$(foreach file,\
+ $$(filter $1/$2/build%,$$($1_$2_HS_SRCS)),\
+ $$(patsubst %.hs,%.hs-boot,$$(file)) \
+ $$(patsubst %.hs,%.lhs-boot,$$(file)))))))
endef