X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Futils%2Fhsc2hs%2FMakefile;h=2ea57863487470b38a13776bd6f28414ab2b6544;hb=703279c8b897153618e49bd960e2ca37de1fe7b7;hp=9c2adf1a2b4a23669faddbabe714c010ef0cbd53;hpb=c732b368a1799e8dce0ad88c22a39202b3f35662;p=ghc-hetmet.git diff --git a/ghc/utils/hsc2hs/Makefile b/ghc/utils/hsc2hs/Makefile index 9c2adf1..2ea5786 100644 --- a/ghc/utils/hsc2hs/Makefile +++ b/ghc/utils/hsc2hs/Makefile @@ -1,5 +1,6 @@ # ----------------------------------------------------------------------------- -# $Id: Makefile,v 1.30 2002/01/29 18:28:49 sof Exp $ +# To compile with nhc98 on unix: +# nhc98 -cpp -package base -o hsc2hs-bin Main.hs TOP=../.. include $(TOP)/mk/boilerplate.mk @@ -9,17 +10,29 @@ 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" -SRC_HC_OPTS += -package win32 '-\#include ' -endif -ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32" +ghc_ge_504 = $(shell if (test $(GhcCanonVersion) -ge 504); then echo YES; else echo NO; fi) + +ifeq "$(ghc_ge_504)" "NO" +SRC_HC_OPTS += -package util +endif + +# Note: Somehow we should pass $(exeext) here, but the history of changes used +# for calling the C preprocessor via GHC has changed a few times, making a +# clean solution impossible. So we revert to a hack in Main.hs... +SRC_HC_OPTS += -Wall +ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32" +SRC_HC_OPTS += -Dmingw32_HOST_OS=1 +endif + +ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32" INSTALLED_SCRIPT_PROG = hsc2hs endif INPLACE_SCRIPT_PROG = hsc2hs-inplace @@ -44,13 +57,13 @@ HSC2HS_EXTRA=--cc=$(bindir)/ghc-$(ProjectVersion) 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 +HSC2HS_DIR=$(FPTOOLS_TOP_ABS_PLATFORM)/$(CURRENT_DIR) + +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) --ld=$(CC) $(extra_flags) --cflag=-D__GLASGOW_HASKELL__=$(ProjectVersionInt) -I$(FPTOOLS_TOP_ABS_PLATFORM)/$(INCLUDE_DIR)" endif $(SCRIPT_PROG) : Makefile @@ -72,42 +85,14 @@ override datadir=$(libdir) INSTALL_DATAS += template-hsc.h # ----------------------------------------------------------------------------- -# Create driver configuration - -CONFIG_HS = Config.hs - -boot :: $(CONFIG_HS) - -all :: $(CONFIG_HS) - -$(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk Makefile - @$(RM) -f $(CONFIG_HS) - @echo -n "Creating $(CONFIG_HS) ... " - @echo "module Config where" >>$(CONFIG_HS) - @echo "cDEFAULT_TMPDIR = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS) - @echo "cGCC = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS) - @echo "progNameSuffix = \"$(exeext)\"" >> $(CONFIG_HS) -ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32" - @echo "pathSep = '/'" >> $(CONFIG_HS) -else - @echo "pathSep = (toEnum 92 :: Char)" >> $(CONFIG_HS) -endif - @echo done. - -CLEAN_FILES += $(CONFIG_HS) - # don't recurse on 'make install' # ifeq "$(INSTALLING)" "1" -all clean distclean maintainer-clean :: +all :: $(HS_PROG) $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@ -endif -MKDEPENDHS_SRCS += $(CONFIG_HS) +clean distclean maintainer-clean :: + $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@ +endif include $(TOP)/mk/target.mk - -# hsc2hs-inplace is needed to boot in ghc/lib/std... -ifneq "$(BootingFromHc)" "YES" -boot :: all -endif