2 # Header files built from the configure script's findings
4 # XXX: these should go in includes/dist/build?
5 includes_H_CONFIG = includes/ghcautoconf.h
6 includes_H_PLATFORM = includes/ghcplatform.h
11 includes_H_FILES = $(filter-out $(includes_H_CONFIG) $(includes_H_PLATFORM),$(wildcard includes/*.h))
16 ifeq "$(GhcUnregisterised)" "YES"
17 includes_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
20 ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
21 includes_CC_OPTS += -DTABLES_NEXT_TO_CODE
24 includes_CC_OPTS += -Iincludes -Irts -Irts/parallel
25 ifeq "$(HaveLibGmp)" "YES"
26 ifneq "$(GMP_INCLUDE_DIRS)" ""
27 includes_CC_OPTS += -I$(GMP_INCLUDE_DIRS)
30 includes_CC_OPTS += -Igmp/gmpbuild
33 ifneq "$(GhcWithSMP)" "YES"
34 includes_CC_OPTS += -DNOSMP
37 # The fptools configure script creates the configuration header file and puts it
38 # in fptools/mk/config.h. We copy it down to here (without any PACKAGE_FOO
39 # definitions to avoid clashes), prepending some make variables specifying cpp
42 ifneq "$(BINDIST)" "YES"
44 ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
46 $(includes_H_CONFIG) :
47 @echo "*** Cross-compiling: please copy $(includes_H_CONFIG) from the target system"
52 $(includes_H_CONFIG) : mk/config.h mk/config.mk includes/ghc.mk
53 @echo "Creating $@..."
54 @echo "#ifndef __GHCAUTOCONF_H__" >$@
55 @echo "#define __GHCAUTOCONF_H__" >>$@
56 # Turn '#define PACKAGE_FOO "blah"' into '/* #undef PACKAGE_FOO */'.
57 @sed 's,^\([ ]*\)#[ ]*define[ ][ ]*\(PACKAGE_[A-Z]*\)[ ][ ]*".*".*$$,\1/* #undef \2 */,' mk/config.h >> $@
58 @echo "#endif /* __GHCAUTOCONF_H__ */" >> $@
63 $(includes_H_PLATFORM) : Makefile
65 @echo "Creating $@..."
66 @echo "#ifndef __GHCPLATFORM_H__" >$@
67 @echo "#define __GHCPLATFORM_H__" >>$@
69 @echo "#define BuildPlatform_TYPE $(HostPlatform_CPP)" >> $@
70 @echo "#define HostPlatform_TYPE $(TargetPlatform_CPP)" >> $@
72 @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
73 @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
75 @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
76 @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
77 @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
78 @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
80 @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
81 @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
82 @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
83 @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
84 ifeq "$(HostOS_CPP)" "irix"
85 @echo "#ifndef $(IRIX_MAJOR)_HOST_OS" >> $@
86 @echo "#define $(IRIX_MAJOR)_HOST_OS 1" >> $@
90 @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
91 @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
92 @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
93 @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
95 @echo "/* These TARGET macros are for backwards compatibily... DO NOT USE! */" >> $@
96 @echo "#define TargetPlatform_TYPE $(TargetPlatform_CPP)" >> $@
97 @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
98 @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
99 @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
100 @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
101 @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
102 @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
104 @echo "#endif /* __GHCPLATFORM_H__ */" >> $@
109 # ---------------------------------------------------------------------------
110 # Make DerivedConstants.h for the compiler
112 includes_DERIVEDCONSTANTS = includes/DerivedConstants.h
114 ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
117 @echo "*** Cross-compiling: please copy DerivedConstants.h from the target system"
122 includes_dist-derivedconstants_C_SRCS = mkDerivedConstants.c
123 includes_dist-derivedconstants_PROG = mkDerivedConstants$(exeext)
125 $(eval $(call build-prog,includes,dist-derivedconstants,0))
127 $(includes_dist-derivedconstants_depfile) : $(includes_H_CONFIG) $(includes_H_PLATFORM)
128 includes/dist-derivedconstants/build/mkDerivedConstants.o : $(includes_H_CONFIG) $(includes_H_PLATFORM)
130 ifneq "$(BINDIST)" "YES"
131 $(includes_DERIVEDCONSTANTS) : $(INPLACE_BIN)/mkDerivedConstants$(exeext)
137 # -----------------------------------------------------------------------------
140 includes_GHCCONSTANTS = includes/GHCConstants.h
142 ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
144 $(includes_GHCCONSTANTS) :
145 @echo "*** Cross-compiling: please copy DerivedConstants.h from the target system"
150 includes_dist-ghcconstants_C_SRCS = mkDerivedConstants.c
151 includes_dist-ghcconstants_PROG = mkGHCConstants$(exeext)
152 includes_dist-ghcconstants_CC_OPTS = -DGEN_HASKELL
154 $(eval $(call build-prog,includes,dist-ghcconstants,0))
156 ifneq "$(BINDIST)" "YES"
157 $(includes_dist-ghcconstants_depfile) : $(includes_H_CONFIG) $(includes_H_PLATFORM)
159 includes/dist-ghcconstants/build/mkDerivedConstants.o : $(includes_H_CONFIG) $(includes_H_PLATFORM)
161 $(includes_GHCCONSTANTS) : $(INPLACE_BIN)/mkGHCConstants$(exeext)
167 # ---------------------------------------------------------------------------
168 # Install all header files
170 INSTALL_HEADERS += $(includes_H_FILES) $(includes_H_CONFIG) $(includes_H_PLATFORM)
172 $(eval $(call clean-target,includes,,\
173 $(includes_H_CONFIG) $(includes_H_PLATFORM) \
174 $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS)))
176 $(eval $(call all-target,includes,,\
177 $(includes_H_CONFIG) $(includes_H_PLATFORM) \
178 $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS)))