[project @ 2000-08-02 14:13:26 by rrt]
[ghc-hetmet.git] / ghc / includes / Makefile
1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.12 2000/08/02 14:13:27 rrt 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 all :: $(H_CONFIG) NativeDefs.h
19
20 # gmp.h is copied from the GMP directory
21 gmp.h : $(FPTOOLS_TOP)/ghc/rts/gmp/gmp.h
22         $(CP) $< $@
23
24 # The fptools configure script creates the configuration header file 
25 # and puts it in fptools/mk/config.h. We copy it down to here, prepending
26 # some make variables specifying cpp platform variables.
27 #
28 $(H_CONFIG) : $(FPTOOLS_TOP)/mk/config.h
29
30 $(H_CONFIG) :
31         @echo "Creating $@..."
32         @$(RM) $@
33         @echo "#define HostPlatform_TYPE   $(HostPlatform_CPP)"  > $@
34         @echo "#define TargetPlatform_TYPE $(HostPlatform_CPP)" >> $@
35         @echo "#define BuildPlatform_TYPE  $(HostPlatform_CPP)" >> $@
36         @echo >> $@
37         @echo "#define $(HostPlatform_CPP)_HOST         1" >> $@
38         @echo "#define $(HostPlatform_CPP)_TARGET       1" >> $@
39         @echo "#define $(HostPlatform_CPP)_BUILD        1" >> $@
40         @echo >> $@
41         @echo "#define $(HostArch_CPP)_HOST_ARCH        1" >> $@
42         @echo "#define $(HostArch_CPP)_TARGET_ARCH      1" >> $@
43         @echo "#define $(HostArch_CPP)_BUILD_ARCH       1" >> $@
44         @echo "#define HOST_ARCH                        \"$(HostArch_CPP)\"" >> $@
45         @echo >> $@
46         @echo "#define $(HostOS_CPP)_HOST_OS            1" >> $@
47         @echo "#define $(HostOS_CPP)_TARGET_OS          1" >> $@  
48         @echo "#define $(HostOS_CPP)_BUILD_OS           1" >> $@
49         @echo "#define HOST_OS                          \"$(HostOS_CPP)\"" >> $@
50 ifeq "$(HostOS_CPP)" "irix"
51         @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS           " >> $@  
52         @echo "#define $(IRIX_MAJOR)_TARGET_OS          1" >> $@  
53         @echo "#endif                                    " >> $@  
54 endif
55         @echo >> $@
56         @echo "#define $(HostVendor_CPP)_HOST_VENDOR    1" >> $@
57         @echo "#define $(HostVendor_CPP)_TARGET_VENDOR  1" >> $@
58         @echo "#define $(HostVendor_CPP)_BUILD_VENDOR   1" >> $@
59         @cat $(FPTOOLS_TOP)/mk/$@ >> $@
60         @echo "Done."
61
62 # ---------------------------------------------------------------------------
63 # Make NativeDefs.h for the NCG
64
65 C_PROG = mkNativeHdr
66 C_SRCS = mkNativeHdr.c
67
68 NativeDefs.h : mkNativeHdr
69         ./mkNativeHdr >NativeDefs.h
70
71 CLEAN_FILES += NativeDefs.h
72
73 # ---------------------------------------------------------------------------
74 # boot setup:
75 #
76 # Need config.h to make dependencies in the runtime system source.
77 #
78 boot :: all
79
80 #
81 # Install all header files
82 #
83 # Hackily set the install destination here:
84 #
85 # Note: we keep per-platform copies of all the include files
86 # (ditto for interface files). This is not *really* needed, but
87 # it gives (perhaps) a cleaner binary dist structure..might change.
88 #
89 override datadir:=$(libdir)/includes
90 INSTALL_DATAS += $(H_FILES) $(H_CONFIG)
91
92 #
93 # `make clean' settings:
94 #
95 CLEAN_FILES += $(H_CONFIG)
96
97 #
98 # Finally, slurp in the standard targets.
99 #
100 include $(TOP)/mk/target.mk