Fixed uninitialised FunBind fun_tick field
[ghc-hetmet.git] / includes / Makefile
1 # -----------------------------------------------------------------------------
2
3 TOP = ..
4 include $(TOP)/mk/boilerplate.mk
5
6 #
7 # All header files
8 #
9 H_FILES = $(filter-out gmp.h,$(wildcard *.h)) gmp.h
10
11 #
12 # Options
13 #
14 ifeq "$(GhcUnregisterised)" "YES"
15 SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
16 endif
17
18 ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
19 SRC_CC_OPTS += -DTABLES_NEXT_TO_CODE
20 endif
21
22 SRC_CC_OPTS += -I. -I../rts
23
24 ifneq "$(GhcWithSMP)" "YES"
25 SRC_CC_OPTS += -DNOSMP
26 endif
27
28 #
29 # Header file built from the configure script's findings
30 #
31 H_CONFIG   = ghcautoconf.h
32 H_PLATFORM = ghcplatform.h
33
34 boot :: gmp.h
35
36 all :: $(H_CONFIG) $(H_PLATFORM)
37
38 # gmp.h is copied from the GMP directory
39 gmp.h : $(FPTOOLS_TOP)/rts/gmp/gmp.h
40         $(CP) $< $@
41
42 # The fptools configure script creates the configuration header file and puts it
43 # in fptools/mk/config.h. We copy it down to here (without any PACKAGE_FOO
44 # definitions to avoid clashes), prepending some make variables specifying cpp
45 # platform variables.
46
47 ifneq "$(TARGETPLATFORM)"  "$(HOSTPLATFORM)"
48
49 $(H_CONFIG) :
50         @echo "*** Cross-compiling: please copy $(H_CONFIG) from the target system"
51         @exit 1
52
53 else
54
55 $(H_CONFIG) : $(FPTOOLS_TOP)/mk/config.h $(FPTOOLS_TOP)/mk/config.mk
56
57 $(H_CONFIG) : Makefile
58         @echo "#ifndef __GHCAUTOCONF_H__"  >$@
59         @echo "#define __GHCAUTOCONF_H__" >>$@
60 #       Turn '#define PACKAGE_FOO "blah"' into '/* #undef PACKAGE_FOO */'.
61         @sed 's,^\([     ]*\)#[  ]*define[       ][      ]*\(PACKAGE_[A-Z]*\)[   ][     ]*".*".*$$,\1/* #undef \2 */,' $(FPTOOLS_TOP)/mk/config.h >> $@
62         @echo "#endif /* __GHCAUTOCONF_H__ */"          >> $@
63         @echo "Done."
64
65 endif
66
67 $(H_PLATFORM) : Makefile
68         @echo "Creating $@..."
69         @$(RM) $@
70         @echo "#ifndef __GHCPLATFORM_H__"  >$@
71         @echo "#define __GHCPLATFORM_H__" >>$@
72         @echo >> $@
73         @echo "#define BuildPlatform_TYPE  $(HostPlatform_CPP)" >> $@
74         @echo "#define HostPlatform_TYPE   $(TargetPlatform_CPP)" >> $@
75         @echo >> $@
76         @echo "#define $(HostPlatform_CPP)_BUILD  1" >> $@
77         @echo "#define $(TargetPlatform_CPP)_HOST  1" >> $@
78         @echo >> $@
79         @echo "#define $(HostArch_CPP)_BUILD_ARCH  1" >> $@
80         @echo "#define $(TargetArch_CPP)_HOST_ARCH  1" >> $@
81         @echo "#define BUILD_ARCH  \"$(HostArch_CPP)\"" >> $@
82         @echo "#define HOST_ARCH  \"$(TargetArch_CPP)\"" >> $@
83         @echo >> $@
84         @echo "#define $(HostOS_CPP)_BUILD_OS  1" >> $@
85         @echo "#define $(TargetOS_CPP)_HOST_OS  1" >> $@
86         @echo "#define BUILD_OS  \"$(HostOS_CPP)\"" >> $@
87         @echo "#define HOST_OS  \"$(TargetOS_CPP)\"" >> $@
88 ifeq "$(HostOS_CPP)" "irix"
89         @echo "#ifndef $(IRIX_MAJOR)_HOST_OS" >> $@  
90         @echo "#define $(IRIX_MAJOR)_HOST_OS  1" >> $@  
91         @echo "#endif" >> $@  
92 endif
93         @echo >> $@
94         @echo "#define $(HostVendor_CPP)_BUILD_VENDOR  1" >> $@
95         @echo "#define $(TargetVendor_CPP)_HOST_VENDOR  1" >> $@
96         @echo "#define BUILD_VENDOR  \"$(HostVendor_CPP)\"" >> $@
97         @echo "#define HOST_VENDOR  \"$(TargetVendor_CPP)\"" >> $@
98         @echo >> $@
99         @echo "/* These TARGET macros are for backwards compatibily... DO NOT USE! */" >> $@
100         @echo "#define TargetPlatform_TYPE $(TargetPlatform_CPP)" >> $@
101         @echo "#define $(TargetPlatform_CPP)_TARGET  1" >> $@
102         @echo "#define $(TargetArch_CPP)_TARGET_ARCH  1" >> $@
103         @echo "#define TARGET_ARCH  \"$(TargetArch_CPP)\"" >> $@
104         @echo "#define $(TargetOS_CPP)_TARGET_OS  1" >> $@  
105         @echo "#define TARGET_OS  \"$(TargetOS_CPP)\"" >> $@
106         @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR  1" >> $@
107         @echo >> $@
108         @echo "#endif /* __GHCPLATFORM_H__ */"          >> $@
109         @echo "Done."
110
111 # ---------------------------------------------------------------------------
112 # Make DerivedConstants.h for the compiler
113
114 all :: DerivedConstants.h
115
116 ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
117
118 DerivedConstants.h :
119         @echo "*** Cross-compiling: please copy DerivedConstants.h from the target system"
120         @exit 1
121
122 else
123
124 mkDerivedConstants.c : $(H_CONFIG) $(H_PLATFORM)
125
126 mkDerivedConstantsHdr : mkDerivedConstants.o
127         $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkDerivedConstants.o
128
129 DerivedConstants.h : mkDerivedConstantsHdr
130         ./mkDerivedConstantsHdr >$@
131
132 endif
133
134 CLEAN_FILES += mkDerivedConstantsHdr$(exeext) DerivedConstants.h
135
136 # -----------------------------------------------------------------------------
137 #
138
139 all :: GHCConstants.h
140
141 ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
142
143 GHCConstants.h :
144         @echo "*** Cross-compiling: please copy DerivedConstants.h from the target system"
145         @exit 1
146
147 else
148
149 mkGHCConstants : mkGHCConstants.o
150         $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkGHCConstants.o
151
152 mkGHCConstants.o : mkDerivedConstants.c
153         $(CC) -o $@ $(CC_OPTS) -c $<  -DGEN_HASKELL
154
155 GHCConstants.h : mkGHCConstants
156         ./mkGHCConstants >$@
157
158 endif
159
160 CLEAN_FILES += mkGHCConstants$(exeext) GHCConstants.h
161
162 # ---------------------------------------------------------------------------
163 # boot setup:
164 #
165 # Need config.h to make dependencies in the runtime system source.
166 #
167 boot :: all
168
169 #
170 # Install all header files
171 #
172 # Hackily set the install destination here:
173 #
174 # Note: we keep per-platform copies of all the include files
175 # (ditto for interface files). This is not *really* needed, but
176 # it gives (perhaps) a cleaner binary dist structure..might change.
177 #
178 override datadir:=$(libdir)/include
179 INSTALL_DATAS += $(H_FILES) $(H_CONFIG) $(H_PLATFORM)
180
181 #
182 # `make clean' settings:
183 #
184 CLEAN_FILES += $(H_CONFIG) $(H_PLATFORM)
185
186 #
187 # Finally, slurp in the standard targets.
188 #
189 include $(TOP)/mk/target.mk