[project @ 2001-11-25 03:56:39 by sof]
[ghc-hetmet.git] / ghc / includes / Makefile
index 19471af..a6374e2 100644 (file)
@@ -1,5 +1,5 @@
 # -----------------------------------------------------------------------------
-# $Id: Makefile,v 1.13 2000/08/07 16:07:53 rrt Exp $
+# $Id: Makefile,v 1.18 2001/11/21 16:56:19 sof Exp $
 #
 
 TOP = ..
@@ -27,12 +27,15 @@ gmp.h : $(FPTOOLS_TOP)/ghc/rts/gmp/gmp.h
 # and puts it in fptools/mk/config.h. We copy it down to here, prepending
 # some make variables specifying cpp platform variables.
 #
-$(H_CONFIG) : $(FPTOOLS_TOP)/mk/config.h
+$(H_CONFIG) : $(FPTOOLS_TOP)/mk/config.h $(FPTOOLS_TOP)/mk/config.mk
 
 $(H_CONFIG) :
        @echo "Creating $@..."
        @$(RM) $@
-       @echo "#define HostPlatform_TYPE   $(HostPlatform_CPP)"  > $@
+       @echo "#ifndef __FPTOOLS_CONFIG_H__"  >$@
+       @echo "#define __FPTOOLS_CONFIG_H__" >>$@
+       @echo >> $@
+       @echo "#define HostPlatform_TYPE   $(HostPlatform_CPP)" >> $@
        @echo "#define TargetPlatform_TYPE $(HostPlatform_CPP)" >> $@
        @echo "#define BuildPlatform_TYPE  $(HostPlatform_CPP)" >> $@
        @echo >> $@
@@ -59,18 +62,36 @@ endif
        @echo "#define $(HostVendor_CPP)_TARGET_VENDOR  1" >> $@
        @echo "#define $(HostVendor_CPP)_BUILD_VENDOR   1" >> $@
        @cat $(FPTOOLS_TOP)/mk/$@ >> $@
+       @echo "#endif /* __FPTOOLS_CONFIG_H__ */"          >> $@
        @echo "Done."
 
 # ---------------------------------------------------------------------------
 # Make NativeDefs.h for the NCG
 
-C_PROG = mkNativeHdr
-C_SRCS = mkNativeHdr.c
+all :: DerivedConstants.h
+
+mkDerivedConstantsHdr : mkDerivedConstants.o
+       $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkDerivedConstants.o
+
+DerivedConstants.h : mkDerivedConstantsHdr
+       ./mkDerivedConstantsHdr >DerivedConstants.h
+
+CLEAN_FILES += mkDerivedConstantsHdr DerivedConstants.h
+
+# ---------------------------------------------------------------------------
+# Make NativeDefs.h for the NCG
+
+all :: NativeDefs.h
+
+mkNativeHdr.o : DerivedConstants.h
+
+mkNativeHdr : mkNativeHdr.o
+       $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkNativeHdr.o
 
 NativeDefs.h : mkNativeHdr
        ./mkNativeHdr >NativeDefs.h
 
-CLEAN_FILES += NativeDefs.h
+CLEAN_FILES += mkNativeHdr NativeDefs.h
 
 # ---------------------------------------------------------------------------
 # boot setup:
@@ -88,7 +109,7 @@ boot :: all
 # (ditto for interface files). This is not *really* needed, but
 # it gives (perhaps) a cleaner binary dist structure..might change.
 #
-override datadir:=$(libdir)/includes
+override datadir:=$(libdir)/include
 INSTALL_DATAS += $(H_FILES) $(H_CONFIG)
 
 #