[project @ 2002-02-04 20:10:47 by sof]
[ghc-hetmet.git] / ghc / includes / Makefile
1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.18 2001/11/21 16:56:19 sof Exp $
3 #
4
5 TOP = ..
6 include $(TOP)/mk/boilerplate.mk
7
8 #
9 # All header files
10 #
11 H_FILES = $(filter-out gmp.h,$(wildcard *.h)) gmp.h
12
13 #
14 # Header file built from the configure script's findings
15 #
16 H_CONFIG = config.h
17
18 boot :: gmp.h
19
20 all :: $(H_CONFIG) NativeDefs.h
21
22 # gmp.h is copied from the GMP directory
23 gmp.h : $(FPTOOLS_TOP)/ghc/rts/gmp/gmp.h
24         $(CP) $< $@
25
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.
29 #
30 $(H_CONFIG) : $(FPTOOLS_TOP)/mk/config.h $(FPTOOLS_TOP)/mk/config.mk
31
32 $(H_CONFIG) :
33         @echo "Creating $@..."
34         @$(RM) $@
35         @echo "#ifndef __FPTOOLS_CONFIG_H__"  >$@
36         @echo "#define __FPTOOLS_CONFIG_H__" >>$@
37         @echo >> $@
38         @echo "#define HostPlatform_TYPE   $(HostPlatform_CPP)" >> $@
39         @echo "#define TargetPlatform_TYPE $(HostPlatform_CPP)" >> $@
40         @echo "#define BuildPlatform_TYPE  $(HostPlatform_CPP)" >> $@
41         @echo >> $@
42         @echo "#define $(HostPlatform_CPP)_HOST         1" >> $@
43         @echo "#define $(HostPlatform_CPP)_TARGET       1" >> $@
44         @echo "#define $(HostPlatform_CPP)_BUILD        1" >> $@
45         @echo >> $@
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)\"" >> $@
50         @echo >> $@
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" >> $@  
58         @echo "#endif                                    " >> $@  
59 endif
60         @echo >> $@
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__ */"          >> $@
66         @echo "Done."
67
68 # ---------------------------------------------------------------------------
69 # Make NativeDefs.h for the NCG
70
71 all :: DerivedConstants.h
72
73 mkDerivedConstantsHdr : mkDerivedConstants.o
74         $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkDerivedConstants.o
75
76 DerivedConstants.h : mkDerivedConstantsHdr
77         ./mkDerivedConstantsHdr >DerivedConstants.h
78
79 CLEAN_FILES += mkDerivedConstantsHdr DerivedConstants.h
80
81 # ---------------------------------------------------------------------------
82 # Make NativeDefs.h for the NCG
83
84 all :: NativeDefs.h
85
86 mkNativeHdr.o : DerivedConstants.h
87
88 mkNativeHdr : mkNativeHdr.o
89         $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkNativeHdr.o
90
91 NativeDefs.h : mkNativeHdr
92         ./mkNativeHdr >NativeDefs.h
93
94 CLEAN_FILES += mkNativeHdr NativeDefs.h
95
96 # ---------------------------------------------------------------------------
97 # boot setup:
98 #
99 # Need config.h to make dependencies in the runtime system source.
100 #
101 boot :: all
102
103 #
104 # Install all header files
105 #
106 # Hackily set the install destination here:
107 #
108 # Note: we keep per-platform copies of all the include files
109 # (ditto for interface files). This is not *really* needed, but
110 # it gives (perhaps) a cleaner binary dist structure..might change.
111 #
112 override datadir:=$(libdir)/include
113 INSTALL_DATAS += $(H_FILES) $(H_CONFIG)
114
115 #
116 # `make clean' settings:
117 #
118 CLEAN_FILES += $(H_CONFIG)
119
120 #
121 # Finally, slurp in the standard targets.
122 #
123 include $(TOP)/mk/target.mk