summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2019-05-08 02:52:35 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-10-04 21:44:29 -0400
commit05419e55cab272ed39790695f448b311f22669f7 (patch)
treeb3f652d4eb27c0ad6108edd6bca5fc73e165981a /utils
parentec93d2a90a2d4f189feafd21575b9e9ba5ba9a5d (diff)
downloadhaskell-05419e55cab272ed39790695f448b311f22669f7.tar.gz
Per stage headers, ghc_boot_platform.h -> stage 0 ghcplatform.h
The generated headers are now generated per stage, which means we can skip hacks like `ghc_boot_platform.h` and just have that be the stage 0 header as proper. In general, stages are to be embraced: freely generate everything in each stage but then just build what you depend on, and everything is symmetrical and efficient. Trying to avoid stages because bootstrapping is a mind bender just creates tons of bespoke mini-mind-benders that add up to something far crazier. Hadrian was pretty close to this "stage-major" approach already, and so was fairly easy to fix. Make needed more work, however: it did know about stages so at least there was a scaffold, but few packages except for the compiler cared, and the compiler used its own counting system. That said, make and Hadrian now work more similarly, which is good for the transition to Hadrian. The merits of embracing stage aside, the change may be worthy for easing that transition alone.
Diffstat (limited to 'utils')
-rw-r--r--utils/genapply/Main.hs5
-rw-r--r--utils/genapply/ghc.mk7
-rw-r--r--utils/hp2ps/Main.h1
-rw-r--r--utils/hp2ps/ghc.mk4
-rw-r--r--utils/runghc/Main.hs2
5 files changed, 14 insertions, 5 deletions
diff --git a/utils/genapply/Main.hs b/utils/genapply/Main.hs
index 4d25054a1c..8c194f1ca0 100644
--- a/utils/genapply/Main.hs
+++ b/utils/genapply/Main.hs
@@ -12,10 +12,13 @@
-- for details
module Main(main) where
+-- Note [Genapply target as host for RTS macros]
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- We improperly include *HOST* macros for our target...
#include "../../includes/ghcconfig.h"
--- .. so that this header defines the right stuff.
+-- ...so that this header defines the right stuff. It is the RTS's host, but
+-- our target, as we are generating code that uses that RTS.
#include "../../includes/stg/MachRegsForHost.h"
#include "../../includes/rts/Constants.h"
diff --git a/utils/genapply/ghc.mk b/utils/genapply/ghc.mk
index 88b3444275..8da1f7aaf6 100644
--- a/utils/genapply/ghc.mk
+++ b/utils/genapply/ghc.mk
@@ -16,8 +16,15 @@ utils/genapply_dist_PROGNAME = genapply
utils/genapply_dist_INSTALL = NO
utils/genapply_dist_INSTALL_INPLACE = YES
+utils/dist/package-data.mk : $(includes_1_H_PLATFORM)
+utils/dist/package-data.mk : $(includes_1_H_CONFIG)
+
ifeq "$(GhcUnregisterised)" "YES"
utils/genapply_CONFIGURE_OPTS = --flag unregisterised
endif
$(eval $(call build-prog,utils/genapply,dist,0))
+
+# Purposely do the wrong stage for HOST := TARGET hack.
+# See Note [Genapply target as host for RTS macros].
+utils/genapply_dist_CC_OPTS += -I,$(BUILD_1_INCLUDE_DIR)
diff --git a/utils/hp2ps/Main.h b/utils/hp2ps/Main.h
index 1eea93f0a2..9849e49327 100644
--- a/utils/hp2ps/Main.h
+++ b/utils/hp2ps/Main.h
@@ -1,6 +1,5 @@
#pragma once
-#include "ghcconfig.h"
#include <stdio.h>
#if defined(__STDC__)
diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk
index bd62fbedef..75baa9ac4d 100644
--- a/utils/hp2ps/ghc.mk
+++ b/utils/hp2ps/ghc.mk
@@ -10,6 +10,8 @@
#
# -----------------------------------------------------------------------------
+utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
+
# stage0
utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \
Reorder.c TopTwenty.c AuxFile.c Deviation.c \
@@ -22,8 +24,6 @@ utils/hp2ps_dist_INSTALL_INPLACE = YES
utils/hp2ps_dist_SHELL_WRAPPER = YES
utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME = hp2ps
-utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
-
# stage 1
utils/hp2ps_dist-install_C_SRCS = $(utils/hp2ps_dist_C_SRCS)
utils/hp2ps_dist-install_EXTRA_LIBRARIES = $(utils/hp2ps_dist_EXTRA_LIBRARIES)
diff --git a/utils/runghc/Main.hs b/utils/runghc/Main.hs
index fd59475916..9ed650410d 100644
--- a/utils/runghc/Main.hs
+++ b/utils/runghc/Main.hs
@@ -1,5 +1,5 @@
{-# LANGUAGE CPP #-}
-#include "ghcconfig.h"
+#include <ghcplatform.h>
-----------------------------------------------------------------------------
--
-- (c) The University of Glasgow, 2004