summaryrefslogtreecommitdiff
path: root/mk/bootstrap.mk
diff options
context:
space:
mode:
authorsimonmar <unknown>2001-03-23 16:36:23 +0000
committersimonmar <unknown>2001-03-23 16:36:23 +0000
commit50027272414438955dbc41696541cbd25da55883 (patch)
treef624c5ebb5b1630ad644dc527bb859a6839cc445 /mk/bootstrap.mk
parent4f4e61a3e5c29075acc8d5128fd93e81b4116550 (diff)
downloadhaskell-50027272414438955dbc41696541cbd25da55883.tar.gz
[project @ 2001-03-23 16:36:20 by simonmar]
Changes to support bootstrapping the compiler from .hc files. It's not quite working yet, but it's not far off. - the biggest change is that any injected #includes are now placed in the .hc file at generation time, rather than compilation time. I can't see any reason not to do this - it makes it clear by looking at the .hc file which files are being #included, it means one less temporary file at compilation time, and it means the .hc file is more standalone. - all the gruesomeness is in mk/bootstrap.mk, which handles building .hc files without a ghc driver.
Diffstat (limited to 'mk/bootstrap.mk')
-rw-r--r--mk/bootstrap.mk64
1 files changed, 64 insertions, 0 deletions
diff --git a/mk/bootstrap.mk b/mk/bootstrap.mk
new file mode 100644
index 0000000000..7e7e44eb98
--- /dev/null
+++ b/mk/bootstrap.mk
@@ -0,0 +1,64 @@
+# -----------------------------------------------------------------------------
+# $Id: bootstrap.mk,v 1.1 2001/03/23 16:36:23 simonmar Exp $
+#
+# Makefile rules for booting from .hc files without a driver.
+#
+
+TOP_SAVED := $(TOP)
+TOP:=$(TOP)/ghc
+
+include $(FPTOOLS_TOP_ABS)/ghc/mk/version.mk
+include $(FPTOOLS_TOP_ABS)/ghc/mk/paths.mk
+
+# Reset TOP
+TOP:=$(TOP_SAVED)
+
+# -----------------------------------------------------------------------------
+# Set the platform-specific options to send to the C compiler. These should
+# match the list in machdepCCOpts in ghc/compiler/DriverFlags.hs.
+#
+
+PLATFORM_CC_OPTS =
+PLATFORM_HC_BOOT_CC_OPTS =
+
+ifeq "$(i386_TARGET_ARCH)" "1"
+PLATFORM_CC_OPTS += -DDONT_WANT_WIN32_DLL_SUPPORT
+PLATFORM_HC_BOOT_CC_OPTS += -fno-defer-pop -fomit-frame-pointer
+# ToDo:
+STOLEN_X86_REGS = 4
+endif
+
+ifeq "$(hppa_TARGET_ARCH)" "1"
+PLATFORM_CC_OPTS += -static -D_HPUX_SOURCE
+endif
+
+ifeq "$(powerpc_TARGET_ARCH)" "1"
+PLATFORM_CC_OPTS += -static
+PLATFORM_HC_BOOT_CC_OPTS += -finhibit-size-directive
+endif
+
+ifeq "$(rs6000_TARGET_ARCH)" "1"
+PLATFORM_CC_OPTS += -static
+PLATFORM_HC_BOOT_CC_OPTS += -static -finhibit-size-directive
+endif
+
+ifeq "$(mingw32_TARGET_OS)" "1"
+PLATFORM_CC_OPTS += -mno-cygwin
+endif
+
+PLATFORM_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
+
+HC_BOOT_CC_OPTS = $(PLATFORM_HC_BOOT_CC_OPTS)
+
+# -----------------------------------------------------------------------------
+# suffix rules for building a .o from a .hc file. The normal build system
+# should be able to take care of the rest.
+
+%.raw_s : %.hc
+ $(CC) -x c $< -o $@ -S -O $(HC_BOOT_CC_OPTS) -I. -I$(FPTOOLS_TOP_ABS)/ghc/includes -I$(FPTOOLS_TOP_ABS)/ghc/lib/std/cbits
+
+%.s : %.raw_s
+ $(GHC_MANGLER) $< $@ $(STOLEN_X86_REGS)
+
+%.o : %.s
+ $(CC) -c -o $@ $<