[project @ 2001-07-16 21:01:58 by qrczak]
[ghc-hetmet.git] / ghc / includes / Makefile
1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.15 2001/07/16 21:01:58 qrczak 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 C_PROG = mkNativeHdr
68 C_SRCS = mkNativeHdr.c
69
70 NativeDefs.h : mkNativeHdr
71         ./mkNativeHdr >NativeDefs.h
72
73 CLEAN_FILES += NativeDefs.h
74
75 # ---------------------------------------------------------------------------
76 # boot setup:
77 #
78 # Need config.h to make dependencies in the runtime system source.
79 #
80 boot :: all
81
82 #
83 # Install all header files
84 #
85 # Hackily set the install destination here:
86 #
87 # Note: we keep per-platform copies of all the include files
88 # (ditto for interface files). This is not *really* needed, but
89 # it gives (perhaps) a cleaner binary dist structure..might change.
90 #
91 override datadir:=$(libdir)/include
92 INSTALL_DATAS += $(H_FILES) $(H_CONFIG)
93
94 #
95 # `make clean' settings:
96 #
97 CLEAN_FILES += $(H_CONFIG)
98
99 #
100 # Finally, slurp in the standard targets.
101 #
102 include $(TOP)/mk/target.mk