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