1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.19 2002/02/11 13:59:01 simonmar Exp $
6 include $(TOP)/mk/boilerplate.mk
11 H_FILES = $(filter-out gmp.h,$(wildcard *.h)) gmp.h
14 # Header file built from the configure script's findings
20 all :: $(H_CONFIG) NativeDefs.h
22 # gmp.h is copied from the GMP directory
23 gmp.h : $(FPTOOLS_TOP)/ghc/rts/gmp/gmp.h
26 # The fptools configure script creates the configuration header file
27 # and puts it in fptools/mk/config.h. We copy it down to here, prepending
28 # some make variables specifying cpp platform variables.
30 $(H_CONFIG) : $(FPTOOLS_TOP)/mk/config.h $(FPTOOLS_TOP)/mk/config.mk
33 @echo "Creating $@..."
35 @echo "#ifndef __FPTOOLS_CONFIG_H__" >$@
36 @echo "#define __FPTOOLS_CONFIG_H__" >>$@
38 @echo "#define HostPlatform_TYPE $(HostPlatform_CPP)" >> $@
39 @echo "#define TargetPlatform_TYPE $(HostPlatform_CPP)" >> $@
40 @echo "#define BuildPlatform_TYPE $(HostPlatform_CPP)" >> $@
42 @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
43 @echo "#define $(HostPlatform_CPP)_TARGET 1" >> $@
44 @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
46 @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
47 @echo "#define $(HostArch_CPP)_TARGET_ARCH 1" >> $@
48 @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
49 @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
51 @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
52 @echo "#define $(HostOS_CPP)_TARGET_OS 1" >> $@
53 @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
54 @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
55 ifeq "$(HostOS_CPP)" "irix"
56 @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
57 @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
61 @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
62 @echo "#define $(HostVendor_CPP)_TARGET_VENDOR 1" >> $@
63 @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
64 @cat $(FPTOOLS_TOP)/mk/$@ >> $@
65 @echo "#endif /* __FPTOOLS_CONFIG_H__ */" >> $@
68 # ---------------------------------------------------------------------------
69 # Make DerivedConstants.h for the compiler
71 all :: DerivedConstants.h
73 mkDerivedConstants.c : $(H_CONFIG)
75 mkDerivedConstantsHdr : mkDerivedConstants.o
76 $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkDerivedConstants.o
78 DerivedConstants.h : mkDerivedConstantsHdr
79 ./mkDerivedConstantsHdr >DerivedConstants.h
81 CLEAN_FILES += mkDerivedConstantsHdr DerivedConstants.h
83 # ---------------------------------------------------------------------------
84 # Make NativeDefs.h for the NCG
88 mkNativeHdr.o : DerivedConstants.h
90 mkNativeHdr : mkNativeHdr.o
91 $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkNativeHdr.o
93 NativeDefs.h : mkNativeHdr
94 ./mkNativeHdr >NativeDefs.h
96 CLEAN_FILES += mkNativeHdr NativeDefs.h
98 # ---------------------------------------------------------------------------
101 # Need config.h to make dependencies in the runtime system source.
106 # Install all header files
108 # Hackily set the install destination here:
110 # Note: we keep per-platform copies of all the include files
111 # (ditto for interface files). This is not *really* needed, but
112 # it gives (perhaps) a cleaner binary dist structure..might change.
114 override datadir:=$(libdir)/include
115 INSTALL_DATAS += $(H_FILES) $(H_CONFIG)
118 # `make clean' settings:
120 CLEAN_FILES += $(H_CONFIG)
123 # Finally, slurp in the standard targets.
125 include $(TOP)/mk/target.mk