# it does nothing if we specify a target that already exists.
.PHONY: $(REALGOALS)
$(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
+ifneq "$(OMIT_PHASE_0)" "YES"
@echo "===--- building phase 0"
$(MAKE) -r --no-print-directory -f ghc.mk phase=0 phase_0_builds
+endif
ifneq "$(OMIT_PHASE_1)" "YES"
@echo "===--- building phase 1"
$(MAKE) -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
default_to_ghc : all_ghc
dir = compiler
-TOP = ..
-SPEC_TARGETS = 1 2 3
-include $(TOP)/mk/sub-makefile.mk
+
+include ../mk/compiler-ghc.mk
all_ghc :
+$(TOPMAKE) all_ghc $(EXTRA_MAKE_OPTS)
-FAST_MAKE_OPTS += compiler_stage1_NO_BUILD_DEPS=YES compiler_stage2_NO_BUILD_DEPS=YES compiler_stage3_NO_BUILD_DEPS=YES
-
-.PHONY: 1 2 3
-
-1:
- +$(TOPMAKE) stage=1 all_ghc_stage1 $(FAST_MAKE_OPTS) NO_STAGE1_DEPS=YES NO_STAGE2_DEPS=YES
-
-2:
- +$(TOPMAKE) stage=2 all_ghc_stage2 $(FAST_MAKE_OPTS) NO_STAGE2_DEPS=YES
-
-3:
- +$(TOPMAKE) stage=3 all_ghc_stage3 $(FAST_MAKE_OPTS) NO_STAGE3_DEPS=YES
-
-.PHONY: extra-help
-help : extra-help
-extra-help :
- @echo " make 1"
- @echo " make 2"
- @echo " make 3"
- @echo
- @echo " Build the stage 1, 2 or 3 GHC respectively, omitting dependencies"
- @echo " and initial phases for speed."
# -----------------------------------------------------------------------------
dir = ghc
-TOP = ..
-SPEC_TARGETS = 1 2 3
-include $(TOP)/mk/sub-makefile.mk
-FAST_MAKE_OPTS += compiler_stage1_NO_BUILD_DEPS=YES \
- compiler_stage2_NO_BUILD_DEPS=YES \
- compiler_stage3_NO_BUILD_DEPS=YES \
- ghc_stage1_NO_BUILD_DEPS=YES \
- ghc_stage2_NO_BUILD_DEPS=YES \
- ghc_stage3_NO_BUILD_DEPS=YES
+include ../mk/compiler-ghc.mk
-.PHONY: 1 2 3
-
-1:
- +$(TOPMAKE) stage=1 all_ghc_stage1 $(FAST_MAKE_OPTS) NO_STAGE1_DEPS=YES NO_STAGE2_DEPS=YES
-
-2:
- +$(TOPMAKE) stage=2 all_ghc_stage2 $(FAST_MAKE_OPTS) NO_STAGE2_DEPS=YES
-
-3:
- +$(TOPMAKE) stage=3 all_ghc_stage3 $(FAST_MAKE_OPTS) NO_STAGE3_DEPS=YES
-
-
-# 'make re2' rebuilds stage2, removing the old executable first. Useful for
-# something like 'make re2 GhcDebugged=YES'.
-
-.PHONY: re1 re2 re3
-re1:
- $(RM) stage1/build/tmp/ghc-stage1
- $(MAKE) 1
-re2:
- $(RM) stage2/build/tmp/ghc-stage2
- $(MAKE) 2
-re3:
- $(RM) stage3/build/tmp/ghc-stage3
- $(MAKE) 3
-
-.PHONY: extra-help
-help : extra-help
-extra-help :
- @echo " make 1"
- @echo " make 2"
- @echo " make 3"
- @echo
- @echo " Build the stage 1, 2 or 3 GHC respectively, omitting dependencies"
- @echo " and initial phases for speed."
--- /dev/null
+# -----------------------------------------------------------------------------
+#
+# (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
+#
+# -----------------------------------------------------------------------------
+
+dir = ghc
+TOP = ..
+SPEC_TARGETS = 1 2 3
+include $(TOP)/mk/sub-makefile.mk
+
+FAST_MAKE_OPTS += compiler_stage1_NO_BUILD_DEPS=YES \
+ compiler_stage2_NO_BUILD_DEPS=YES \
+ compiler_stage3_NO_BUILD_DEPS=YES \
+ ghc_stage1_NO_BUILD_DEPS=YES \
+ ghc_stage2_NO_BUILD_DEPS=YES \
+ ghc_stage3_NO_BUILD_DEPS=YES
+
+.PHONY: 1 2 3
+
+1:
+ +$(TOPMAKE) stage=1 all_ghc_stage1 $(FAST_MAKE_OPTS) ONLY_DEPS_FOR="compiler_stage1 ghc_stage1"
+
+2:
+ +$(TOPMAKE) stage=2 all_ghc_stage2 $(FAST_MAKE_OPTS) ONLY_DEPS_FOR="compiler_stage2 ghc_stage2" NO_STAGE2_DEPS=YES
+
+3:
+ +$(TOPMAKE) stage=3 all_ghc_stage3 $(FAST_MAKE_OPTS) ONLY_DEPS_FOR="compiler_stage3 ghc_stage3" NO_STAGE3_DEPS=YES
+
+
+# 'make re2' rebuilds stage2, removing the old executable first. Useful for
+# something like 'make re2 GhcDebugged=YES'.
+
+.PHONY: re1 re2 re3
+re1:
+ $(RM) $(TOP)/ghc/stage1/build/tmp/ghc-stage1
+ $(MAKE) 1
+re2:
+ $(RM) $(TOP)/ghc/stage2/build/tmp/ghc-stage2
+ $(MAKE) 2
+re3:
+ $(RM) $(TOP)/ghc/stage3/build/tmp/ghc-stage3
+ $(MAKE) 3
+
+.PHONY: extra-help
+help : extra-help
+extra-help :
+ @echo " make 1"
+ @echo " make 2"
+ @echo " make 3"
+ @echo
+ @echo " Build the stage 1, 2 or 3 GHC respectively, omitting dependencies"
+ @echo " and initial phases for speed."
$(dir)_dist_NO_BUILD_DEPS=YES \
$(dir)_dist-boot_NO_BUILD_DEPS=YES \
$(dir)_dist-install_NO_BUILD_DEPS=YES \
- OMIT_PHASE_1=YES OMIT_PHASE_2=YES OMIT_PHASE_3=YES
+ NO_GENERATED_MAKEFILE_RULES=YES \
+ OMIT_PHASE_0=YES OMIT_PHASE_1=YES
ifneq "$(filter fast,$(MAKECMDGOALS))" ""
EXTRA_MAKE_OPTS += $(FAST_MAKE_OPTS)
$1_$2_MKDEPENDHS_FLAGS = -dep-makefile $$($1_$2_depfile_haskell).tmp $$(foreach way,$$(filter-out v,$$($1_$2_WAYS)),-dep-suffix $$(way))
$1_$2_MKDEPENDHS_FLAGS += -include-pkg-deps
-ifneq "$$($1_$2_NO_BUILD_DEPS)" "YES"
+ifneq "$$(NO_GENERATED_MAKEFILE_RULES)" "YES"
# Some of the Haskell files (e.g. utils/hsc2hs/Main.hs) (directly or
# indirectly) include the generated includes files.
echo "$1_$2_depfile_c_asm_EXISTS = YES" >> $$@.tmp
mv $$@.tmp $$@
-endif # $1_$2_NO_BUILD_DEPS
+endif # NO_GENERATED_MAKEFILE_RULES
# Note sed magic above: mkdependC can't do -odir stuff, so we have to
# munge the dependencies it generates to refer to the correct targets.
endif
ifneq "$$(BINDIST)" "YES"
+ifneq "$$(NO_GENERATED_MAKEFILE_RULES)" "YES"
$1/$2/inplace-pkg-config : $1/$2/package-data.mk
$1/$2/build/autogen/cabal_macros.h : $1/$2/package-data.mk
endif
endif
endif
+endif
PACKAGE_DATA_MKS += $1/$2/package-data.mk
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
-ifneq "$$(NO_INCLUDE_DEPS)" "YES"
+$1_$2_INCLUDE_DEPFILES = YES
+ifeq "$$(NO_INCLUDE_DEPS)" "YES"
+$1_$2_INCLUDE_DEPFILES = NO
+endif
+ifneq "$$(ONLY_DEPS_FOR)" ""
+ifeq "$$(filter $1_$2,$$(ONLY_DEPS_FOR))" ""
+$1_$2_INCLUDE_DEPFILES = NO
+endif
+endif
+
+ifeq "$$($1_$2_INCLUDE_DEPFILES)" "YES"
ifneq "$$(strip $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS))" ""
ifneq "$$(NO_STAGE$3_DEPS)" "YES"
include $$($1_$2_depfile_haskell)