1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.20 2002/03/02 17:49:42 sof Exp $
6 include $(TOP)/mk/boilerplate.mk
11 H_FILES = $(filter-out gmp.h,$(wildcard *.h)) gmp.h
14 # Options -- if we're building unregisterised, add a couple of -D's
16 ifeq "$(GhcUnregisterised)" "YES"
17 SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
21 # Header file built from the configure script's findings
27 all :: $(H_CONFIG) NativeDefs.h
29 # gmp.h is copied from the GMP directory
30 gmp.h : $(FPTOOLS_TOP)/ghc/rts/gmp/gmp.h
33 # The fptools configure script creates the configuration header file
34 # and puts it in fptools/mk/config.h. We copy it down to here, prepending
35 # some make variables specifying cpp platform variables.
37 $(H_CONFIG) : $(FPTOOLS_TOP)/mk/config.h $(FPTOOLS_TOP)/mk/config.mk
40 @echo "Creating $@..."
42 @echo "#ifndef __FPTOOLS_CONFIG_H__" >$@
43 @echo "#define __FPTOOLS_CONFIG_H__" >>$@
45 @echo "#define HostPlatform_TYPE $(HostPlatform_CPP)" >> $@
46 @echo "#define TargetPlatform_TYPE $(HostPlatform_CPP)" >> $@
47 @echo "#define BuildPlatform_TYPE $(HostPlatform_CPP)" >> $@
49 @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
50 @echo "#define $(HostPlatform_CPP)_TARGET 1" >> $@
51 @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
53 @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
54 @echo "#define $(HostArch_CPP)_TARGET_ARCH 1" >> $@
55 @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
56 @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
58 @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
59 @echo "#define $(HostOS_CPP)_TARGET_OS 1" >> $@
60 @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
61 @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
62 ifeq "$(HostOS_CPP)" "irix"
63 @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
64 @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
68 @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
69 @echo "#define $(HostVendor_CPP)_TARGET_VENDOR 1" >> $@
70 @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
71 @cat $(FPTOOLS_TOP)/mk/$@ >> $@
72 @echo "#endif /* __FPTOOLS_CONFIG_H__ */" >> $@
75 # ---------------------------------------------------------------------------
76 # Make DerivedConstants.h for the compiler
78 all :: DerivedConstants.h
80 mkDerivedConstants.c : $(H_CONFIG)
82 mkDerivedConstantsHdr : mkDerivedConstants.o
83 $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkDerivedConstants.o
85 DerivedConstants.h : mkDerivedConstantsHdr
86 ./mkDerivedConstantsHdr >DerivedConstants.h
88 CLEAN_FILES += mkDerivedConstantsHdr DerivedConstants.h
90 # ---------------------------------------------------------------------------
91 # Make NativeDefs.h for the NCG
95 mkNativeHdr.o : DerivedConstants.h
97 mkNativeHdr : mkNativeHdr.o
98 $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkNativeHdr.o
100 NativeDefs.h : mkNativeHdr
101 ./mkNativeHdr >NativeDefs.h
103 CLEAN_FILES += mkNativeHdr NativeDefs.h
105 # ---------------------------------------------------------------------------
108 # Need config.h to make dependencies in the runtime system source.
113 # Install all header files
115 # Hackily set the install destination here:
117 # Note: we keep per-platform copies of all the include files
118 # (ditto for interface files). This is not *really* needed, but
119 # it gives (perhaps) a cleaner binary dist structure..might change.
121 override datadir:=$(libdir)/include
122 INSTALL_DATAS += $(H_FILES) $(H_CONFIG)
125 # `make clean' settings:
127 CLEAN_FILES += $(H_CONFIG)
130 # Finally, slurp in the standard targets.
132 include $(TOP)/mk/target.mk