[project @ 2001-03-23 16:36:20 by simonmar]
[ghc-hetmet.git] / mk / bootstrap.mk
1 # -----------------------------------------------------------------------------
2 # $Id: bootstrap.mk,v 1.1 2001/03/23 16:36:23 simonmar Exp $
3 #
4 # Makefile rules for booting from .hc files without a driver.
5 #
6
7 TOP_SAVED := $(TOP)
8 TOP:=$(TOP)/ghc
9
10 include $(FPTOOLS_TOP_ABS)/ghc/mk/version.mk
11 include $(FPTOOLS_TOP_ABS)/ghc/mk/paths.mk
12
13 # Reset TOP
14 TOP:=$(TOP_SAVED)
15
16 # -----------------------------------------------------------------------------
17 # Set the platform-specific options to send to the C compiler.  These should
18 # match the list in machdepCCOpts in ghc/compiler/DriverFlags.hs.
19 #
20
21 PLATFORM_CC_OPTS =
22 PLATFORM_HC_BOOT_CC_OPTS =
23
24 ifeq "$(i386_TARGET_ARCH)" "1"
25 PLATFORM_CC_OPTS += -DDONT_WANT_WIN32_DLL_SUPPORT
26 PLATFORM_HC_BOOT_CC_OPTS += -fno-defer-pop -fomit-frame-pointer 
27 # ToDo:
28 STOLEN_X86_REGS = 4
29 endif
30
31 ifeq "$(hppa_TARGET_ARCH)" "1"
32 PLATFORM_CC_OPTS += -static -D_HPUX_SOURCE
33 endif
34
35 ifeq "$(powerpc_TARGET_ARCH)" "1"
36 PLATFORM_CC_OPTS += -static
37 PLATFORM_HC_BOOT_CC_OPTS += -finhibit-size-directive
38 endif
39
40 ifeq "$(rs6000_TARGET_ARCH)" "1"
41 PLATFORM_CC_OPTS += -static
42 PLATFORM_HC_BOOT_CC_OPTS += -static -finhibit-size-directive
43 endif
44
45 ifeq "$(mingw32_TARGET_OS)" "1"
46 PLATFORM_CC_OPTS += -mno-cygwin
47 endif
48
49 PLATFORM_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt) 
50
51 HC_BOOT_CC_OPTS = $(PLATFORM_HC_BOOT_CC_OPTS)
52
53 # -----------------------------------------------------------------------------
54 # suffix rules for building a .o from a .hc file.  The normal build system
55 # should be able to take care of the rest.
56
57 %.raw_s : %.hc
58         $(CC) -x c $< -o $@ -S -O $(HC_BOOT_CC_OPTS) -I. -I$(FPTOOLS_TOP_ABS)/ghc/includes -I$(FPTOOLS_TOP_ABS)/ghc/lib/std/cbits
59
60 %.s : %.raw_s
61         $(GHC_MANGLER) $< $@ $(STOLEN_X86_REGS)
62
63 %.o : %.s
64         $(CC) -c -o $@ $<