From: sof Date: Wed, 29 May 2002 22:32:50 +0000 (+0000) Subject: [project @ 2002-05-29 22:32:49 by sof] X-Git-Tag: Approx_11550_changesets_converted~2003 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;ds=sidebyside;h=5062fac4ac5b87a495d4118e2a1357e9eddd0515;p=ghc-hetmet.git [project @ 2002-05-29 22:32:49 by sof] Use HOSTPLATFORM / *_HOST_OS to examine properties of the environment/compiler we're using. --- diff --git a/ghc/utils/hsc2hs/Main.hs b/ghc/utils/hsc2hs/Main.hs index 95aae88..ae71dc9 100644 --- a/ghc/utils/hsc2hs/Main.hs +++ b/ghc/utils/hsc2hs/Main.hs @@ -1,5 +1,5 @@ ------------------------------------------------------------------------ --- $Id: Main.hs,v 1.38 2002/04/18 12:15:56 simonmar Exp $ +-- $Id: Main.hs,v 1.39 2002/05/29 22:32:49 sof Exp $ -- -- Program for converting .hsc files to .hs files, by converting the -- file into a C program which is run to generate the Haskell source. @@ -19,7 +19,7 @@ import List (intersperse) #include "../../includes/config.h" -#ifdef mingw32_TARGET_OS +#ifdef mingw32_HOST_OS import Win32DLL #endif @@ -71,7 +71,7 @@ main = do let header = "Usage: "++prog++" [OPTIONS] INPUT.hsc [...]" args <- getArgs let opts@(flags, files, errs) = getOpt Permute options args -#ifdef mingw32_TARGET_OS +#ifdef mingw32_HOST_OS h <- getModuleHandle Nothing n <- getModuleFileName h let tempName = reverse (drop (length "\\bin\\hsc2hs.exe") (reverse n)) ++ "\\template-hsc.h" @@ -106,7 +106,7 @@ processFile flags name ------------------------------------------------------------------------ -- Convert paths foo/baz to foo\baz on Windows -#if defined(mingw32_TARGET_OS) +#if defined(mingw32_HOST_OS) subst a b ls = map (\ x -> if x == a then b else x) ls dosifyPath xs = subst '/' '\\' xs #else diff --git a/ghc/utils/hsc2hs/Makefile b/ghc/utils/hsc2hs/Makefile index c8fa96e..23a9b1f 100644 --- a/ghc/utils/hsc2hs/Makefile +++ b/ghc/utils/hsc2hs/Makefile @@ -1,5 +1,5 @@ # ----------------------------------------------------------------------------- -# $Id: Makefile,v 1.32 2002/04/30 14:40:33 simonmar Exp $ +# $Id: Makefile,v 1.33 2002/05/29 22:32:50 sof Exp $ TOP=../.. include $(TOP)/mk/boilerplate.mk @@ -9,17 +9,21 @@ INCLUDE_DIR=ghc/includes INSTALLING=1 -ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32" HS_PROG = hsc2hs-bin -else +ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32" +HS_PROG = hsc2hs$(exeext) +endif +ifeq "$(HOSTPLATFORM)" "i386-unknown-cygwinw32" HS_PROG = hsc2hs$(exeext) endif + SRC_HC_OPTS += -package util -cpp -ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32" + +ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32" SRC_HC_OPTS += -package win32 '-\#include ' endif -ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32" +ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32" INSTALLED_SCRIPT_PROG = hsc2hs endif INPLACE_SCRIPT_PROG = hsc2hs-inplace @@ -45,12 +49,12 @@ endif # BIN_DIST else HSC2HS_BINDIR=$(FPTOOLS_TOP_ABS)/$(CURRENT_DIR) HSC2HS_DIR=$(FPTOOLS_TOP_ABS)/$(CURRENT_DIR) -ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32" -HSC2HS_EXTRA="--cc=$(CC) --cflag=-D__GLASGOW_HASKELL__=$(ProjectVersionInt) -I$(FPTOOLS_TOP_ABS)/$(INCLUDE_DIR)" -else + +ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32" extra_flags=$(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS))) -HSC2HS_EXTRA="--cc=$(CC) $(extra_flags) --cflag=-D__GLASGOW_HASKELL__=$(ProjectVersionInt) -I$(FPTOOLS_TOP_ABS)/$(INCLUDE_DIR)" endif + +HSC2HS_EXTRA="--cc=$(CC) $(extra_flags) --cflag=-D__GLASGOW_HASKELL__=$(ProjectVersionInt) -I$(FPTOOLS_TOP_ABS)/$(INCLUDE_DIR)" endif $(SCRIPT_PROG) : Makefile @@ -87,7 +91,7 @@ $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk Makefile @echo "cDEFAULT_TMPDIR = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS) @echo "cGCC = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS) @echo "progNameSuffix = \"$(exeext)\"" >> $(CONFIG_HS) -ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32" +ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32" @echo "pathSep = '/'" >> $(CONFIG_HS) else @echo "pathSep = (toEnum 92 :: Char)" >> $(CONFIG_HS)