[project @ 2001-10-03 13:57:42 by simonmar]
[ghc-hetmet.git] / ghc / includes / Makefile
1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.16 2001/10/03 13:57:42 simonmar 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 "#define HostPlatform_TYPE   $(HostPlatform_CPP)"  > $@
36         @echo "#define TargetPlatform_TYPE $(HostPlatform_CPP)" >> $@
37         @echo "#define BuildPlatform_TYPE  $(HostPlatform_CPP)" >> $@
38         @echo >> $@
39         @echo "#define $(HostPlatform_CPP)_HOST         1" >> $@
40         @echo "#define $(HostPlatform_CPP)_TARGET       1" >> $@
41         @echo "#define $(HostPlatform_CPP)_BUILD        1" >> $@
42         @echo >> $@
43         @echo "#define $(HostArch_CPP)_HOST_ARCH        1" >> $@
44         @echo "#define $(HostArch_CPP)_TARGET_ARCH      1" >> $@
45         @echo "#define $(HostArch_CPP)_BUILD_ARCH       1" >> $@
46         @echo "#define HOST_ARCH                        \"$(HostArch_CPP)\"" >> $@
47         @echo >> $@
48         @echo "#define $(HostOS_CPP)_HOST_OS            1" >> $@
49         @echo "#define $(HostOS_CPP)_TARGET_OS          1" >> $@  
50         @echo "#define $(HostOS_CPP)_BUILD_OS           1" >> $@
51         @echo "#define HOST_OS                          \"$(HostOS_CPP)\"" >> $@
52 ifeq "$(HostOS_CPP)" "irix"
53         @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS           " >> $@  
54         @echo "#define $(IRIX_MAJOR)_TARGET_OS          1" >> $@  
55         @echo "#endif                                    " >> $@  
56 endif
57         @echo >> $@
58         @echo "#define $(HostVendor_CPP)_HOST_VENDOR    1" >> $@
59         @echo "#define $(HostVendor_CPP)_TARGET_VENDOR  1" >> $@
60         @echo "#define $(HostVendor_CPP)_BUILD_VENDOR   1" >> $@
61         @cat $(FPTOOLS_TOP)/mk/$@ >> $@
62         @echo "Done."
63
64 # ---------------------------------------------------------------------------
65 # Make NativeDefs.h for the NCG
66
67 all :: DerivedConstants.h
68
69 mkDerivedConstantsHdr : mkDerivedConstants.o
70         $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkDerivedConstants.o
71
72 DerivedConstants.h : mkDerivedConstantsHdr
73         ./mkDerivedConstantsHdr >DerivedConstants.h
74
75 CLEAN_FILES += DerivedConstants.h
76
77 # ---------------------------------------------------------------------------
78 # Make NativeDefs.h for the NCG
79
80 all :: NativeDefs.h
81
82 mkNativeHdr.o : DerivedConstants.h
83
84 mkNativeHdr : mkNativeHdr.o
85         $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkNativeHdr.o
86
87 NativeDefs.h : mkNativeHdr
88         ./mkNativeHdr >NativeDefs.h
89
90 CLEAN_FILES += NativeDefs.h
91
92 # ---------------------------------------------------------------------------
93 # boot setup:
94 #
95 # Need config.h to make dependencies in the runtime system source.
96 #
97 boot :: all
98
99 #
100 # Install all header files
101 #
102 # Hackily set the install destination here:
103 #
104 # Note: we keep per-platform copies of all the include files
105 # (ditto for interface files). This is not *really* needed, but
106 # it gives (perhaps) a cleaner binary dist structure..might change.
107 #
108 override datadir:=$(libdir)/include
109 INSTALL_DATAS += $(H_FILES) $(H_CONFIG)
110
111 #
112 # `make clean' settings:
113 #
114 CLEAN_FILES += $(H_CONFIG)
115
116 #
117 # Finally, slurp in the standard targets.
118 #
119 include $(TOP)/mk/target.mk