summaryrefslogtreecommitdiff
path: root/compiler/Makefile.ghcbin
blob: 25a8a583414985c56829307eb8ac761ed947c1d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# This Makefile builds the GHC binary for stage2.  In stage2, the GHC binary
# is built as a single Main module that links to the GHC package.  It
# is easier to do this with a separate Makefile, because we don't want most
# of the options normally dumped into SRC_HC_OPTS by the main GHC Makefile.
# In particular, we don't want the .hi files picked up along the home package
# search path when compiling Main, we need the compiler to find them in
# the GHC package.

TOP = ..
include $(TOP)/mk/boilerplate.mk

ifeq "$(stage)" "2"
HC=$(GHC_STAGE1)
endif

ifeq "$(stage)" "3"
HC=$(GHC_STAGE2)
endif

SRC_HC_OPTS += -package ghc
SRC_HC_OPTS += -Istage$(stage)
SRC_HC_OPTS += \
  -cpp -fglasgow-exts -fno-generics -Rghc-timing \
  -I. -IcodeGen -InativeGen -Iparser
SRC_HC_OPTS += $(GhcHcOpts) $(GhcStage$(stage)HcOpts)
ifeq "$(TargetOS_CPP)" "openbsd"
SRC_HC_OPTS += -optl-Xlinker -optl-E
endif

ifeq "$(GhcWithInterpreter)" "YES"
SRC_HC_OPTS += -DGHCI

# Should the debugger commands be enabled?
ifeq "$(GhciWithDebugger)" "YES"
SRC_HC_OPTS += -DDEBUGGER
endif

endif

ifneq "$(GhcNotThreaded)" "YES"
SRC_HC_OPTS += -threaded
endif

odir=stage$(stage)

HS_SRCS = main/Main.hs
HS_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(HS_SRCS))))
$(odir)/main/Main.o : libHSghc$(_way).a
SRC_HC_OPTS += -fforce-recomp
# can't rely on GHC's recompilation checking here, because it won't spot 
# changes in the ghc package.

include $(TOP)/mk/target.mk