-# Here we generate a little header file containing CPP symbols that GHC
-# uses to determine which platform it is building on/for. The platforms
-# can differ between stage1 and stage2 if we're cross-compiling, so we
-# need one of these header files per stage.
-
-PLATFORM_H = ghc_boot_platform.h
-
-stage1/$(PLATFORM_H) : $(FPTOOLS_TOP)/mk/config.mk
- $(MKDIRHIER) stage1
- @echo "Creating $@..."
- @$(RM) $@
- @echo "#ifndef __PLATFORM_H__" >$@
- @echo "#define __PLATFORM_H__" >>$@
- @echo >> $@
- @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@
- @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
- @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
- @echo >> $@
- @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@
- @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
- @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
- @echo >> $@
- @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@
- @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
- @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
- @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
- @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
- @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo >> $@
- @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
- @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
- @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
- @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
- @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
- @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
-ifeq "$(HostOS_CPP)" "irix"
- @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
- @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
- @echo "#endif " >> $@
-endif
- @echo >> $@
- @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@
- @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
- @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
- @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
- @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
- @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
- @echo >> $@
- @echo "#endif /* __PLATFORM_H__ */" >> $@
- @echo "Done."
-
-# For stage2 and above, the BUILD platform is the HOST of stage1, and
-# the HOST platform is the TARGET of stage1. The TARGET remains the same
-# (stage1 is the cross-compiler, not stage2).
-stage2plus/$(PLATFORM_H) : $(FPTOOLS_TOP)/mk/config.mk
- $(MKDIRHIER) stage2plus
- @echo "Creating $@..."
- @$(RM) $@
- @echo "#ifndef __PLATFORM_H__" >$@
- @echo "#define __PLATFORM_H__" >>$@
- @echo >> $@
- @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
- @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
- @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
- @echo >> $@
- @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
- @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
- @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
- @echo >> $@
- @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
- @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
- @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
- @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
- @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo >> $@
- @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
- @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
- @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
- @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
- @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
- @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
-ifeq "$(HostOS_CPP)" "irix"
- @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
- @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
- @echo "#endif " >> $@
-endif
- @echo >> $@
- @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
- @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
- @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
- @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
- @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
- @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
- @echo >> $@
- @echo "#endif /* __PLATFORM_H__ */" >> $@
- @echo "Done."
-
-ifeq "$(stage)" "1"
-STAGE_PLATFORM_H = stage1/$(PLATFORM_H)
-else
-STAGE_PLATFORM_H = stage2plus/$(PLATFORM_H)
-endif
-
-boot :: $(STAGE_PLATFORM_H)
-
-# ----------------------------------------------------------------------------
-# Generate supporting stuff for prelude/PrimOp.lhs
-# from prelude/primops.txt
-
-SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
-SRC_CPP_OPTS += ${GhcCppOpts}
-
-prelude/primops.txt parser/Parser.y: %: %.pp stage1/$(PLATFORM_H)
- $(CPP) $(RAWCPP_FLAGS) -P $(CPP_OPTS) -x c $< | grep -v '^#pragma GCC' > $@
-
-primop-data-decl.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --data-decl < $< > $@
-primop-tag.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --primop-tag < $< > $@
-primop-list.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --primop-list < $< > $@
-primop-has-side-effects.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --has-side-effects < $< > $@
-primop-out-of-line.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --out-of-line < $< > $@
-primop-commutable.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --commutable < $< > $@
-primop-needs-wrapper.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --needs-wrapper < $< > $@
-primop-can-fail.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --can-fail < $< > $@
-primop-strictness.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --strictness < $< > $@
-primop-primop-info.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --primop-primop-info < $< > $@
-
-# Usages aren't used any more; but the generator
-# can still generate them if we want them back
-primop-usage.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --usage < $< > $@
-
-#-----------------------------------------------------------------------------
-# binary-dist
-#