Commit 81e5f8ff authored by Ian Lynagh's avatar Ian Lynagh

Bootstrapping fixes

parent fc15f6e8
......@@ -48,7 +48,7 @@ $(PACKAGE_MK):
sh boot-pkgs
# No need to update makefiles for these targets:
REALGOALS=$(filter-out framework-pkg clean clean_% distclean maintainer-clean show,$(MAKECMDGOALS))
REALGOALS=$(filter-out bootstrapping-files framework-pkg clean clean_% distclean maintainer-clean show,$(MAKECMDGOALS))
# NB. not the same as saying '%: ...', which doesn't do the right thing:
# it does nothing if we specify a target that already exists.
......@@ -77,7 +77,7 @@ clean distclean maintainer-clean:
$(filter clean_%, $(MAKECMDGOALS)) : clean_% :
$(MAKE) -r --no-print-directory -f ghc.mk $@
show: $(PACKAGE_MK)
bootstrapping-files show: $(PACKAGE_MK)
$(MAKE) -r --no-print-directory -f ghc.mk $@
ifeq "$(darwin_TARGET_OS)" "1"
......
......@@ -172,6 +172,10 @@ ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
NO_INCLUDE_DEPS = YES
NO_INCLUDE_PKGDATA = YES
endif
ifneq "$(findstring bootstrapping-files,$(MAKECMDGOALS))" ""
NO_INCLUDE_DEPS = YES
NO_INCLUDE_PKGDATA = YES
endif
ifeq "$(findstring show,$(MAKECMDGOALS))" "show"
NO_INCLUDE_DEPS = YES
# We want package-data.mk for show
......@@ -347,7 +351,8 @@ ifeq "$(BuildSharedLibs)" "YES"
OTHER_LIBS += libffi/libHSffi$(dyn_libsuf)
endif
ifeq "$(HaveLibGmp)" "NO"
OTHER_LIBS += gmp/libgmp.a
GMP_LIB = gmp/libgmp.a
OTHER_LIBS += $(GMP_LIB)
endif
# We cannot run ghc-cabal to configure a package until we have
......@@ -554,7 +559,7 @@ $(foreach pkg,$(PACKAGES) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-instal
# XXX Hack; remove this
$(foreach pkg,$(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_HC_OPTS += -Wwarn))
# XXX we configure packages with the bootsrapping compiler (for
# XXX we configure packages with the bootstrapping compiler (for
# dependency reasons, see the phase ordering), which doesn't
# necessarily support all the extensions we need, and Cabal filters
# out the ones it thinks aren't supported.
......@@ -865,7 +870,7 @@ publish-sdist :
endif
ifeq "$(GhcUnregisterised)" "YES"
SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
endif
# -----------------------------------------------------------------------------
......@@ -918,3 +923,9 @@ maintainer-clean : distclean
.PHONY: all_libraries
.PHONY: bootstrapping-files
bootstrapping-files: $(GMP_LIB)
bootstrapping-files: includes/ghcautoconf.h
bootstrapping-files: includes/DerivedConstants.h
bootstrapping-files: includes/GHCConstants.h
......@@ -120,9 +120,15 @@ $(INPLACE_LIB)/extra-gcc-opts : extra-gcc-opts
$(CP) $< $@
# The GHC programs need to depend on all the helper programs they might call
$(GHC_STAGE1) : $(INPLACE_LIB)/extra-gcc-opts $(MANGLER) $(SPLIT)
$(GHC_STAGE2) : $(INPLACE_LIB)/extra-gcc-opts $(MANGLER) $(SPLIT)
$(GHC_STAGE3) : $(INPLACE_LIB)/extra-gcc-opts $(MANGLER) $(SPLIT)
ifeq "$(GhcUnregisterised)" "NO"
$(GHC_STAGE1) : $(MANGLER) $(SPLIT)
$(GHC_STAGE2) : $(MANGLER) $(SPLIT)
$(GHC_STAGE3) : $(MANGLER) $(SPLIT)
endif
$(GHC_STAGE1) : $(INPLACE_LIB)/extra-gcc-opts
$(GHC_STAGE2) : $(INPLACE_LIB)/extra-gcc-opts
$(GHC_STAGE3) : $(INPLACE_LIB)/extra-gcc-opts
ifeq "$(Windows)" "YES"
$(GHC_STAGE1) : $(TOUCHY) $(INPLACE)/stamp-mingw $(INPLACE_LIB)/perl.exe
......@@ -130,6 +136,10 @@ $(GHC_STAGE2) : $(TOUCHY) $(INPLACE)/stamp-mingw $(INPLACE_LIB)/perl.exe
$(GHC_STAGE3) : $(TOUCHY) $(INPLACE)/stamp-mingw $(INPLACE_LIB)/perl.exe
endif
ifeq "$(BootingFromHc)" "YES"
ghc_stage2_OTHER_OBJS += $(compiler_stage2_v_LIB) $(ALL_LIBS) $(ALL_LIBS) $(ALL_LIBS) $(ALL_RTS_LIBS) -lgmp $(libffi_STATIC_LIB) -lm -lutil -lrt
endif
endif
INSTALL_LIBS += extra-gcc-opts
......
......@@ -43,6 +43,8 @@ EXCLUDED_SRCS += $(wildcard rts/Vis*.c)
rts_C_SRCS = $(filter-out $(EXCLUDED_SRCS),$(wildcard rts/*.c $(foreach dir,$(ALL_DIRS),rts/$(dir)/*.c)))
rts_CMM_SRCS = $(wildcard rts/*.cmm)
# Don't compile .S files when bootstrapping a new arch
ifeq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
ifneq "$(findstring $(TargetArch_CPP), powerpc powerpc64)" ""
rts_S_SRCS += rts/AdjustorAsm.S
else
......@@ -50,6 +52,7 @@ ifneq "$(findstring $(TargetOS_CPP), darwin)" ""
rts_S_SRCS += rts/AdjustorAsm.S
endif
endif
endif
ifeq "$(GhcUnregisterised)" "YES"
GENAPPLY_OPTS = -u
......
......@@ -97,9 +97,15 @@ $$(foreach dir,$$($1_$2_HS_SRC_DIRS),\
$(call c-objs,$1,$2,v)
$(call hs-objs,$1,$2,v)
ifeq "$$(BootingFromHc)" "NO"
$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS)
$$(MKDIRHIER) $$(dir $$@)
$$($1_$2_HC) -o $$@ $$($1_$2_v_ALL_HC_OPTS) $$(LD_OPTS) $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS)
else
$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS)
$$(MKDIRHIER) $$(dir $$@)
$$(CC) -o $$@ $$($1_$2_v_ALL_CC_OPTS) $$(LD_OPTS) $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS)
endif
# Note [lib-depends] if this program is built with stage1 or greater, we
# need to depend on the libraries too. NB. since $(ALL_STAGE1_LIBS) and
......
......@@ -54,7 +54,7 @@ endif
# XXX: for some reason these get used in preference to the direct
# .hs->.o rule, I don't know why --SDM
$1/$2/build/%.$$($3_osuf) : $1/$4/%.hc includes/ghcautoconf.h includes/ghcplatform.h
$1/$2/build/%.$$($3_osuf) : $1/$4/%.hc includes/ghcautoconf.h includes/ghcplatform.h $$(MKDIRHIER)
$$(MKDIRHIER) $$(dir $$@)
$$(CC) $$($1_$2_$3_ALL_CC_OPTS) -Iincludes -x c -c $$< -o $$@
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment