summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-11-05 01:30:11 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-11-05 02:38:39 +0000
commit07bd27e09e0a66b2570c87a1b8b9b384b6bd6767 (patch)
tree0044bdbc54f1a9026555a3a8c5b0f1d40b8319ad
parent086e288c6bb121581debd9308a8c2278f294e35a (diff)
downloadhaskell-wip/make-generated-headers-org.tar.gz
make: Futher systematize handling of generated headerswip/make-generated-headers-org
This will make it easier to add and remove generated headers, as we will do when we add a configure script for the RTS.
-rw-r--r--ghc.mk16
-rw-r--r--rts/ghc.mk6
-rw-r--r--rts/include/ghc.mk16
3 files changed, 12 insertions, 26 deletions
diff --git a/ghc.mk b/ghc.mk
index 437fbee612..bd0b4bbfdc 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -1046,11 +1046,7 @@ $(eval $(call bindist-list,.,\
$(BINDIST_HI) \
$(BINDIST_EXTRAS) \
rts/include/Makefile \
- $(includes_H_FILES) \
- $(includes_1_H_CONFIG) \
- $(includes_1_H_PLATFORM) \
- $(includes_1_H_VERSION) \
- $(includes_DERIVEDCONSTANTS) \
+ $(includes_dist-install_H_FILES) \
$(libffi_HEADERS) \
$(INSTALL_LIBEXECS) \
$(INSTALL_LIBEXEC_SCRIPTS) \
@@ -1090,7 +1086,7 @@ BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk
#
# See Note [No stage2 packages when CrossCompiling or Stage1Only].
-unix-binary-dist-prep: $(includes_1_H_CONFIG) $(includes_1_H_PLATFORM) $(includes_1_H_VERSION)
+unix-binary-dist-prep: $(includes_dist-install_H_FILES_GENERATED)
$(call removeTrees,bindistprep/)
"$(MKDIRHIER)" $(BIN_DIST_PREP_DIR)
set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile m4 aclocal.m4 config.sub config.guess install-sh llvm-targets llvm-passes ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
@@ -1330,12 +1326,8 @@ CLEAN_FILES += mk/config.mk.old
CLEAN_FILES += mk/project.mk.old
CLEAN_FILES += compiler/ghc.cabal.old
-# These are no longer generated, but we still clean them for a while
-# as they may still be in old GHC trees:
-CLEAN_FILES += rts/include/GHCConstants.h
-CLEAN_FILES += rts/include/DerivedConstants.h
-$(foreach n,0 1 2, \
- $(foreach h,$(includes_$n_H_CONFIG) $(includes_$n_H_PLATFORM) $(includes_$n_H_VERSION), \
+$(foreach d,dist dist-install, \
+ $(foreach h,$(includes_$d_H_FILES_GENERATED), \
$(eval CLEAN_FILES += $h)))
CLEAN_FILES += $(includes_SETTINGS)
CLEAN_FILES += utils/ghc-pkg/Version.hs
diff --git a/rts/ghc.mk b/rts/ghc.mk
index ba1e17ec2e..b4cef0956c 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -595,10 +595,6 @@ $(eval $(call dependencies,rts,dist-install,1))
$(rts_dist-install_depfile_c_asm) : $(includes_dist-install_H_FILES)
-$(rts_dist-install_depfile_c_asm) : $(includes_1_H_CONFIG)
-$(rts_dist-install_depfile_c_asm) : $(includes_1_H_PLATFORM)
-$(rts_dist-install_depfile_c_asm) : $(includes_1_H_VERSION)
-
$(rts_dist-install_depfile_c_asm) : $(DTRACEPROBES_H)
ifneq "$(UseSystemLibFFI)" "YES"
$(rts_dist-install_depfile_c_asm) : $(libffi_HEADERS)
@@ -625,7 +621,7 @@ DTRACE_FLAGS = -x cpppath=$(CC)
endif
DTRACEPROBES_SRC = rts/RtsProbes.d
-$(DTRACEPROBES_H): $(DTRACEPROBES_SRC) $(includes_1_H_PLATFORM) | $$(dir $$@)/.
+$(DTRACEPROBES_H): $(DTRACEPROBES_SRC) $(includes_1_H_CONFIG) $(includes_1_H_PLATFORM) | $$(dir $$@)/.
"$(DTRACE)" $(filter -I%,$(rts_CC_OPTS)) -C $(DTRACE_FLAGS) -h -o $@ -s $<
endif
diff --git a/rts/include/ghc.mk b/rts/include/ghc.mk
index 9e863f6305..7c26499ce4 100644
--- a/rts/include/ghc.mk
+++ b/rts/include/ghc.mk
@@ -55,6 +55,8 @@ define includesFilesWithGenerated
# $1 = distdir
includes_$1_H_FILES = \
$$(includes_H_FILES) \
+ $$(includes_$1_H_FILES_GENERATED)
+includes_$1_H_FILES_GENERATED = \
$$(patsubst %,rts/$1/build/include/%,$$(includes_H_FILES_GENERATED))
endef
$(eval $(call includesFilesWithGenerated,dist))
@@ -303,31 +305,27 @@ $(includes_DERIVEDCONSTANTS): $(deriveConstants_INPLACE) $(includes_1_H_CONFIG)
$< --gen-header -o $@ --tmpdir $(dir $@) $(DERIVE_CONSTANTS_FLAGS_FOR_HEADER)
endif
-includes_dist-install_H_FILES += $(includes_DERIVEDCONSTANTS)
+includes_dist-install_H_FILES_GENERATED += $(includes_DERIVEDCONSTANTS)
# ---------------------------------------------------------------------------
# Install all header files
$(eval $(call clean-target,includes,,\
- $(includes_0_H_CONFIG) $(includes_0_H_PLATFORM) $(includes_0_H_VERSION) \
- $(includes_1_H_CONFIG) $(includes_1_H_PLATFORM) $(includes_1_H_VERSION)))
+ $(foreach distdir,dist dist-install,$(includes_$(distdir)_H_FILES_GENERATED))))
$(eval $(call all-target,includes,\
- $(includes_0_H_CONFIG) $(includes_0_H_PLATFORM) $(includes_0_H_VERSION) \
- $(includes_1_H_CONFIG) $(includes_1_H_PLATFORM) $(includes_1_H_VERSION) \
- $(includes_DERIVEDCONSTANTS)))
+ $(foreach distdir,dist dist-install,$(includes_$(distdir)_H_FILES_GENERATED))))
install: install_includes
.PHONY: install_includes
-install_includes : $(includes_1_H_CONFIG) $(includes_1_H_PLATFORM) $(includes_1_H_VERSION)
+install_includes : $(includes_dist-install_H_FILES_GENERATED)
$(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)"
$(foreach d,$(includes_H_SUBDIRS), \
$(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)/$d" && \
$(INSTALL_HEADER) $(INSTALL_OPTS) rts/include/$d/*.h "$(DESTDIR)$(ghcheaderdir)/$d/" && \
) true
$(INSTALL_HEADER) $(INSTALL_OPTS) \
- $(includes_1_H_CONFIG) $(includes_1_H_PLATFORM) $(includes_1_H_VERSION) \
- $(includes_DERIVEDCONSTANTS) \
+ $(includes_dist-install_H_FILES_GENERATED) \
"$(DESTDIR)$(ghcheaderdir)/"