Makefile 4.22 KB
Newer Older
1
# -----------------------------------------------------------------------------
2
# $Id: Makefile,v 1.24 2004/09/19 09:15:03 panne Exp $
sof's avatar
sof committed
3
#
4

sof's avatar
sof committed
5
6
7
8
TOP = ..
include $(TOP)/mk/boilerplate.mk

#
9
# All header files
sof's avatar
sof committed
10
#
rrt's avatar
rrt committed
11
H_FILES = $(filter-out gmp.h,$(wildcard *.h)) gmp.h
sof's avatar
sof committed
12

sof's avatar
sof committed
13
14
15
16
17
18
19
#
# Options -- if we're building unregisterised, add a couple of -D's
#
ifeq "$(GhcUnregisterised)" "YES"
SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
endif

sof's avatar
sof committed
20
21
22
#
# Header file built from the configure script's findings
#
23
H_CONFIG = ghcconfig.h
24

rrt's avatar
rrt committed
25
26
boot :: gmp.h

27
all :: $(H_CONFIG)
28

rrt's avatar
rrt committed
29
30
31
32
# gmp.h is copied from the GMP directory
gmp.h : $(FPTOOLS_TOP)/ghc/rts/gmp/gmp.h
	$(CP) $< $@

33
34
35
36
37
# The fptools configure script creates the configuration header file and puts it
# in fptools/mk/config.h. We copy it down to here (without any PACKAGE_FOO
# definitions to avoid clashes), prepending some make variables specifying cpp
# platform variables.

rrt's avatar
rrt committed
38
$(H_CONFIG) : $(FPTOOLS_TOP)/mk/config.h $(FPTOOLS_TOP)/mk/config.mk
sof's avatar
sof committed
39
40
41
42

$(H_CONFIG) :
	@echo "Creating $@..."
	@$(RM) $@
43
44
	@echo "#ifndef __GHCCONFIG_H__"  >$@
	@echo "#define __GHCCONFIG_H__" >>$@
sof's avatar
sof committed
45
46
	@echo >> $@
	@echo "#define HostPlatform_TYPE   $(HostPlatform_CPP)" >> $@
47
48
	@echo "#define TargetPlatform_TYPE $(TargetPlatform_CPP)" >> $@
	@echo "#define BuildPlatform_TYPE  $(BuildPlatform_CPP)" >> $@
sof's avatar
sof committed
49
50
	@echo >> $@
	@echo "#define $(HostPlatform_CPP)_HOST		1" >> $@
51
52
	@echo "#define $(TargetPlatform_CPP)_TARGET	1" >> $@
	@echo "#define $(BuildPlatform_CPP)_BUILD  	1" >> $@
sof's avatar
sof committed
53
54
	@echo >> $@
	@echo "#define $(HostArch_CPP)_HOST_ARCH	1" >> $@
55
56
	@echo "#define $(TargetArch_CPP)_TARGET_ARCH	1" >> $@
	@echo "#define $(BuildArch_CPP)_BUILD_ARCH  	1" >> $@
sof's avatar
sof committed
57
	@echo "#define HOST_ARCH			\"$(HostArch_CPP)\"" >> $@
58
59
	@echo "#define TARGET_ARCH			\"$(TargetArch_CPP)\"" >> $@
	@echo "#define BUILD_ARCH			\"$(BuildArch_CPP)\"" >> $@
sof's avatar
sof committed
60
61
	@echo >> $@
	@echo "#define $(HostOS_CPP)_HOST_OS		1" >> $@
62
63
	@echo "#define $(TargetOS_CPP)_TARGET_OS	1" >> $@  
	@echo "#define $(BuildOS_CPP)_BUILD_OS 		1" >> $@
sof's avatar
sof committed
64
	@echo "#define HOST_OS 				\"$(HostOS_CPP)\"" >> $@
65
66
	@echo "#define TARGET_OS			\"$(TargetOS_CPP)\"" >> $@
	@echo "#define BUILD_OS				\"$(BuildOS_CPP)\"" >> $@
sof's avatar
sof committed
67
68
69
70
71
ifeq "$(HostOS_CPP)" "irix"
	@echo "#ifndef $(IRIX_MAJOR)_TARGET_OS		 " >> $@  
	@echo "#define $(IRIX_MAJOR)_TARGET_OS		1" >> $@  
	@echo "#endif					 " >> $@  
endif
sof's avatar
sof committed
72
73
	@echo >> $@
	@echo "#define $(HostVendor_CPP)_HOST_VENDOR	1" >> $@
74
75
	@echo "#define $(TargetVendor_CPP)_TARGET_VENDOR  1" >> $@
	@echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 	1" >> $@
76
77
#	Turn '#define PACKAGE_FOO "blah"' into '/* #undef PACKAGE_FOO */'.
	@sed 's,^\([	 ]*\)#[	 ]*define[	 ][	 ]*\(PACKAGE_BUGREPORT\|PACKAGE_NAME\|PACKAGE_STRING\|PACKAGE_TARNAME\|PACKAGE_VERSION\)[	 ].*$$,\1/* #undef \2 */,' $(FPTOOLS_TOP)/mk/config.h >> $@
78
	@echo "#endif /* __GHCCONFIG_H__ */"          >> $@
sof's avatar
sof committed
79
80
	@echo "Done."

81
# ---------------------------------------------------------------------------
82
# Make DerivedConstants.h for the compiler
83

84
85
all :: DerivedConstants.h

86
87
mkDerivedConstants.c : $(H_CONFIG)

88
89
90
91
mkDerivedConstantsHdr : mkDerivedConstants.o
	$(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkDerivedConstants.o

DerivedConstants.h : mkDerivedConstantsHdr
92
	./mkDerivedConstantsHdr >$@
93

sof's avatar
sof committed
94
CLEAN_FILES += mkDerivedConstantsHdr$(exeext) DerivedConstants.h
95

96
97
# -----------------------------------------------------------------------------
#
98

99
all :: GHCConstants.h
100

101
mkGHCConstants.c : $(H_CONFIG)
102

103
104
mkGHCConstants : mkGHCConstants.o
	$(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkGHCConstants.o
105

106
107
mkGHCConstants.o : mkDerivedConstants.c
	$(CC) -o $@ -c $<  -DGEN_HASKELL
sof's avatar
sof committed
108

109
110
111
112
GHCConstants.h : mkGHCConstants
	./mkGHCConstants >$@

CLEAN_FILES += mkDerivedConstantsHdr$(exeext) DerivedConstants.h
113
114

# ---------------------------------------------------------------------------
sof's avatar
sof committed
115
116
# boot setup:
#
117
# Need config.h to make dependencies in the runtime system source.
sof's avatar
sof committed
118
119
120
121
122
123
124
125
#
boot :: all

#
# Install all header files
#
# Hackily set the install destination here:
#
sof's avatar
sof committed
126
127
128
# Note: we keep per-platform copies of all the include files
# (ditto for interface files). This is not *really* needed, but
# it gives (perhaps) a cleaner binary dist structure..might change.
sof's avatar
sof committed
129
#
130
override datadir:=$(libdir)/include
131
INSTALL_DATAS += $(H_FILES) $(H_CONFIG)
sof's avatar
sof committed
132
133
134
135

#
# `make clean' settings:
#
136
CLEAN_FILES += $(H_CONFIG)
sof's avatar
sof committed
137
138
139
140
141

#
# Finally, slurp in the standard targets.
#
include $(TOP)/mk/target.mk