#-----------------------------------------------------------------------------
-# $Id: Makefile,v 1.42 2000/12/31 16:58:05 panne Exp $
+# $Id: Makefile,v 1.51 2001/07/03 16:57:03 sewardj Exp $
#
# This is the Makefile for the runtime-system stuff.
# This stuff is written in C (and cannot be written in Haskell).
SRCS_RTS_C := $(filter-out Main.c, $(SRCS_RTS_C))
endif
-#-----------------------------------------------------------------------------
-# creating and installing libHSrts.a (in its many flavors)
-#
LIBOBJS = $(patsubst %.c,%.$(way_)o,$(SRCS_RTS_C)) \
$(patsubst %.hc,%.$(way_)o,$(SRCS_RTS_HC)) \
$(patsubst %.S,%.$(way_)o,$(SRCS_RTS_S))
+#-----------------------------------------------------------------------------
+# Flags for compiling RTS .c and .hc files
+
# gcc provides lots of useful warnings if you ask it.
# This is a pretty good list to start with - use a # to comment out
# any you don't like.
-WARNING_OPTS += -optc-Wall
-WARNING_OPTS += -optc-W
-WARNING_OPTS += -optc-Wstrict-prototypes
-WARNING_OPTS += -optc-Wmissing-prototypes
-WARNING_OPTS += -optc-Wmissing-declarations
-WARNING_OPTS += -optc-Winline
-WARNING_OPTS += -optc-Waggregate-return
-#WARNING_OPTS += -optc-Wpointer-arith
-WARNING_OPTS += -optc-Wbad-function-cast
-#WARNING_OPTS += -optc-Wcast-align
-#WARNING_OPTS += -optc-Wnested-externs
-#WARNING_OPTS += -optc-Wshadow
-#WARNING_OPTS += -optc-Wcast-qual
-#WARNING_OPTS += -optc-Wno-unused
-#WARNING_OPTS += -optc-Wredundant-decls
-#WARNING_OPTS += -optc-Wconversion
-
-SRC_HC_OPTS += -I../includes -I. -Iparallel $(WARNING_OPTS) $(GhcRtsHcOpts) -optc-DCOMPILING_RTS
-SRC_CC_OPTS = $(GhcRtsCcOpts)
-
-ifeq "$(GhcWithInterpreter)" "YES"
-SRC_HC_OPTS += -optc-DGHCI
-SRC_CC_OPTS += -DGHCI
-endif
+WARNING_OPTS += -Wall
+WARNING_OPTS += -W
+WARNING_OPTS += -Wstrict-prototypes
+WARNING_OPTS += -Wmissing-prototypes
+WARNING_OPTS += -Wmissing-declarations
+WARNING_OPTS += -Winline
+WARNING_OPTS += -Waggregate-return
+#WARNING_OPTS += -Wpointer-arith
+WARNING_OPTS += -Wbad-function-cast
+#WARNING_OPTS += -Wcast-align
+#WARNING_OPTS += -Wnested-externs
+#WARNING_OPTS += -Wshadow
+#WARNING_OPTS += -Wcast-qual
+#WARNING_OPTS += -Wno-unused
+#WARNING_OPTS += -Wredundant-decls
+#WARNING_OPTS += -Wconversion
+
+SRC_CC_OPTS += $(GhcRtsCcOpts) $(WARNING_OPTS) -DCOMPILING_RTS
+
+SRC_HC_OPTS += -I../includes -I. -Iparallel $(GhcRtsHcOpts) -DCOMPILING_RTS
ifneq "$(DLLized)" "YES"
SRC_HC_OPTS += -static
endif
-# SRC_HC_OPTS += -optc-fPIC
+# SRC_HC_OPTS += -fPIC
ifeq "$(way)" "mp"
SRC_HC_OPTS += -I$$PVM_ROOT/include
ifeq "$(GhcRtsWithFrontPanel)" "YES"
SRC_HC_OPTS += `$(GTK_CONFIG) --cflags` -optc-DRTS_GTK_FRONTPANEL
SRCS_RTS_C := $(SRCS_RTS_C) $(wildcard Vis*.c)
-VisCallbacks_CC_OPTS += -optc-Wno-unused
+VisCallbacks_CC_OPTS += -Wno-unused
endif # GhcRtsWithFrontPanel
endif # GTK_CONFIG
# ../driver/ghc (a better C compiler :-) to compile the
# different RTS pieces
#
-CC=$(GHC_INPLACE) $(HC_OPTS) $($*_HC_OPTS)
+
+ifeq "$(BootingFromHc)" "YES"
+# use the normal $(CC) when booting from .hc files
+SRC_CC_OPTS += $(HC_OPTS)
+else
+# otherwise, use $(GHC_INPLACE) as the C compiler.
+CC=$(GHC_INPLACE)
+CC_OPTS := $(addprefix -optc, $(CC_OPTS)) $(HC_OPTS)
+endif
+
HC=$(GHC_INPLACE)
# prevent this value from leaking into the GMP makefile
# and not worth re-implementing in our Makefile framework.
ifneq "$(HaveLibGmp)" "YES"
+ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
boot ::
- cd gmp && ./configure --enable-shared=no --target=$(HOSTPLATFORM)
+ cd gmp && ./configure --enable-shared=no \
+ --host=`echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g'`
+else
+# Pass --target to configure of GMP, so that building for mingwin under
+# cygwin works properly (when the host is not the same as the target)
+boot ::
+ cd gmp && CC=$(WhatGccIsCalled) ./configure --enable-shared=no --target=$(HOSTPLATFORM)
+endif
-# Slight cheatage here to past host as target, but x-compilation isn't supported by ghc.
+# Slight cheatage here to pass host as target, but x-compilation isn't supported by ghc.
all :: gmp/libgmp.a
all :: $(DLL_PEN)/gmp.dll
$(DLL_PEN)/gmp.dll:
- make -C gmp gmp.dll
+ $(MAKE) -C gmp gmp.dll
$(MV) gmp/gmp.dll $(DLL_PEN)
endif
install :: gmp/libgmp.a
-clean ::
- $(MAKE) -C gmp MAKEFLAGS= clean
+clean distclean maintainer-clean ::
+ $(MAKE) -C gmp MAKEFLAGS= $@
ifeq "$(way)" ""
INSTALL_LIBS += gmp/libgmp.a