root/ghc/ghc.mk

Revision ad752fd3453569af129d8ff270f7707bf6535f11, 5.5 KB (checked in by Ian Lynagh <igloo@…>, 2 months ago)

Fix building with devel snapshots

  • Property mode set to 100644
Line 
1# -----------------------------------------------------------------------------
2#
3# (c) 2009 The University of Glasgow
4#
5# This file is part of the GHC build system.
6#
7# To understand how the build system works and how to modify it, see
8#      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9#      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
10#
11# -----------------------------------------------------------------------------
12
13ghc_USES_CABAL = YES
14ghc_PACKAGE = ghc-bin
15
16ghc_stage1_CONFIGURE_OPTS += --flags=stage1
17ghc_stage2_CONFIGURE_OPTS += --flags=stage2
18ghc_stage3_CONFIGURE_OPTS += --flags=stage3
19
20ifeq "$(GhcWithInterpreter)" "YES"
21ghc_stage2_CONFIGURE_OPTS += --flags=ghci
22ghc_stage3_CONFIGURE_OPTS += --flags=ghci
23endif
24
25ifeq "$(compiler_stage1_VERSION_MUNGED)" "YES"
26# If we munge the stage1 version, and we're using a devel snapshot for
27# stage0, then stage1 may actually have an earlier version than stage0
28# (e.g. boot with ghc-7.5.20120316, building ghc-7.5). We therefore
29# need to tell Cabal to use version 7.5 of the ghc package when building
30# in ghc/stage1
31ghc_stage1_CONFIGURE_OPTS += --constraint "ghc == $(compiler_stage1_MUNGED_VERSION)"
32endif
33
34ghc_stage1_MORE_HC_OPTS = $(GhcStage1HcOpts)
35ghc_stage2_MORE_HC_OPTS = $(GhcStage2HcOpts)
36ghc_stage3_MORE_HC_OPTS = $(GhcStage3HcOpts)
37
38# We need __GLASGOW_HASKELL__ in hschooks.c, so we have to build C
39# sources with GHC:
40ghc_stage1_UseGhcForCC = YES
41ghc_stage2_UseGhcForCC = YES
42ghc_stage3_UseGhcForCC = YES
43
44ghc_stage1_C_FILES_NODEPS = ghc/hschooks.c
45
46ghc_stage2_MKDEPENDC_OPTS = -DMAKING_GHC_BUILD_SYSTEM_DEPENDENCIES
47ghc_stage3_MKDEPENDC_OPTS = -DMAKING_GHC_BUILD_SYSTEM_DEPENDENCIES
48
49ifeq "$(GhcDebugged)" "YES"
50ghc_stage1_MORE_HC_OPTS += -debug
51ghc_stage2_MORE_HC_OPTS += -debug
52ghc_stage3_MORE_HC_OPTS += -debug
53endif
54
55ifeq "$(GhcDynamic)" "YES"
56ghc_stage2_MORE_HC_OPTS += -dynamic
57ghc_stage3_MORE_HC_OPTS += -dynamic
58endif
59
60ifeq "$(GhcThreaded)" "YES"
61# Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
62ghc_stage2_MORE_HC_OPTS += -threaded
63ghc_stage3_MORE_HC_OPTS += -threaded
64endif
65
66ifeq "$(GhcProfiled)" "YES"
67ghc_stage2_MORE_HC_OPTS += -prof
68endif
69
70ghc_stage1_PROG = ghc-stage1$(exeext)
71ghc_stage2_PROG = ghc-stage2$(exeext)
72ghc_stage3_PROG = ghc-stage3$(exeext)
73
74ghc_stage1_SHELL_WRAPPER = YES
75ghc_stage2_SHELL_WRAPPER = YES
76ghc_stage3_SHELL_WRAPPER = YES
77ghc_stage1_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
78ghc_stage2_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
79ghc_stage3_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
80
81ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER = YES
82ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_NAME = ghc-$(ProjectVersion)
83
84# We override the program name to be ghc, rather than ghc-stage2.
85# This means the right program name is used in error messages etc.
86define ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_EXTRA
87echo 'executablename="$$exedir/ghc"' >> "$(WRAPPER)"
88endef
89
90# if stage is set to something other than "1" or "", disable stage 1
91ifneq "$(filter-out 1,$(stage))" ""
92ghc_stage1_NOT_NEEDED = YES
93endif
94# if stage is set to something other than "2" or "", disable stage 2
95ifneq "$(filter-out 2,$(stage))" ""
96ghc_stage2_NOT_NEEDED = YES
97endif
98# When cross-compiling, the stage 1 compiler is our release compiler, so omit stage 2
99ifeq "$(BuildingCrossCompiler)" "YES"
100ghc_stage2_NOT_NEEDED = YES
101endif
102# stage 3 has to be requested explicitly with stage=3
103ifneq "$(stage)" "3"
104ghc_stage3_NOT_NEEDED = YES
105endif
106$(eval $(call build-prog,ghc,stage1,0))
107$(eval $(call build-prog,ghc,stage2,1))
108$(eval $(call build-prog,ghc,stage3,2))
109
110ifneq "$(BINDIST)" "YES"
111
112ghc/stage1/build/tmp/$(ghc_stage1_PROG) : $(BOOT_LIBS)
113ifeq "$(GhcProfiled)" "YES"
114ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(compiler_stage2_p_LIB)
115ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_p_LIB))
116endif
117
118# Modules here import HsVersions.h, so we need ghc_boot_platform.h
119$(ghc_stage1_depfile_haskell) : compiler/stage1/$(PLATFORM_H)
120$(ghc_stage2_depfile_haskell) : compiler/stage2/$(PLATFORM_H)
121$(ghc_stage3_depfile_haskell) : compiler/stage3/$(PLATFORM_H)
122
123all_ghc_stage1 : $(GHC_STAGE1)
124all_ghc_stage2 : $(GHC_STAGE2)
125all_ghc_stage3 : $(GHC_STAGE3)
126
127$(INPLACE_LIB)/settings : settings
128        "$(CP)" $< $@
129
130# The GHC programs need to depend on all the helper programs they might call,
131# and the settings files they use
132
133$(GHC_STAGE1) : | $(UNLIT) $(INPLACE_LIB)/settings
134$(GHC_STAGE2) : | $(UNLIT) $(INPLACE_LIB)/settings
135$(GHC_STAGE3) : | $(UNLIT) $(INPLACE_LIB)/settings
136
137ifeq "$(GhcUnregisterised)" "NO"
138$(GHC_STAGE1) : | $(SPLIT)
139$(GHC_STAGE2) : | $(SPLIT)
140$(GHC_STAGE3) : | $(SPLIT)
141endif
142
143ifeq "$(Windows)" "YES"
144$(GHC_STAGE1) : | $(TOUCHY)
145$(GHC_STAGE2) : | $(TOUCHY)
146$(GHC_STAGE3) : | $(TOUCHY)
147endif
148
149ifeq "$(BootingFromHc)" "YES"
150$(GHC_STAGE2) : $(ALL_STAGE1_LIBS)
151ghc_stage2_OTHER_OBJS += $(compiler_stage2_v_LIB) $(ALL_STAGE1_LIBS) $(ALL_STAGE1_LIBS) $(ALL_STAGE1_LIBS) $(ALL_RTS_LIBS) $(libffi_STATIC_LIB)
152endif
153
154endif
155
156INSTALL_LIBS += settings
157
158ifeq "$(Windows)" "NO"
159install: install_ghc_link
160.PHONY: install_ghc_link
161install_ghc_link:
162        $(call removeFiles,"$(DESTDIR)$(bindir)/ghc")
163        $(LN_S) $(CrossCompilePrefix)ghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc"
164else
165# On Windows we install the main binary as $(bindir)/ghc.exe
166# To get ghc-<version>.exe we have a little C program in driver/ghc
167install: install_ghc_post
168.PHONY: install_ghc_post
169install_ghc_post: install_bins
170        $(call removeFiles,$(DESTDIR)$(bindir)/ghc.exe)
171        "$(MV)" -f $(DESTDIR)$(bindir)/ghc-stage$(INSTALL_GHC_STAGE).exe $(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc.exe
172endif
Note: See TracBrowser for help on using the browser.