[project @ 2002-10-27 10:38:32 by mthomas]
[ghc-hetmet.git] / mk / paths.mk
index 49e34ff..b6c1007 100644 (file)
@@ -22,6 +22,7 @@
 #  INSTALL_LIBS     (installed in $(libdir))
 #  INSTALL_LIBEXECS (installed in $(libexecdir))
 #  INSTALL_DATAS    (installed in $(datadir))
+#  INSTALL_IFACES   (installed in $(ifacedir))
 #
 # see target.mk for more information.
 #
@@ -61,9 +62,6 @@ INSTALL_DIR     = $(FPTOOLS_TOP)/glafp-utils/mkdirhier/mkdirhier
 # The install variables does not have any defaults,
 # what files to install have to be specified in the Makefiles.
 #
-#INSTALL_PROGS += $(HS_PROG) $(C_PROG)
-#INSTALL_LIBS  += $(LIBRARY)
-#INSTALL_DATAS += $(HS_IFACES)
 
 #################################################################################
 #
@@ -166,7 +164,10 @@ EXCLUDED_DERIVED_SRCS = $(patsubst %.hsc, %.hs, $(EXCLUDED_HSC_SRCS)) \
                        $(patsubst %.y,   %.hs, $(EXCLUDED_HAPPY_Y_SRCS)) \
                        $(patsubst %.ly,  %.hs, $(EXCLUDED_HAPPY_LY_SRCS)) \
                        $(patsubst %.hs,  %.hc, $(EXCLUDED_HS_SRCS)) \
-                       $(patsubst %.lhs, %.hc, $(EXCLUDED_LHS_SRCS))
+                       $(patsubst %.lhs, %.hc, $(EXCLUDED_LHS_SRCS)) \
+                       $(patsubst %.hs,  %_stub.c, $(EXCLUDED_HS_SRCS)) \
+                       $(patsubst %.lhs, %_stub.c, $(EXCLUDED_LHS_SRCS))
+
 # Exclude _hsc.c files; they get built as part of the cbits library,
 # not part of the main library
 
@@ -181,7 +182,14 @@ HS_IFACES   = $(addsuffix .$(way_)hi,$(basename $(HS_SRCS)))
 
 HSC_C_OBJS  = $(addsuffix _hsc.$(way_)o,$(basename $(filter %.hsc,$(SRCS))))
 
-C_SRCS      = $(filter %.c,$(SRCS))
+EXTRA_OBJS  = $(addsuffix .$(way_)o,$(basename $(EXTRA_SRCS)))
+
+# Always remove $(EXCLUDED_C_SRCS) from C_SRCS
+EXCLUDED_C_SRCS = $(patsubst %.lhs, %_stub.c, $(HS_SRCS)) \
+                 $(patsubst %.hs,  %_stub.c, $(HS_SRCS))
+
+
+C_SRCS      = $(filter-out $(EXCLUDED_C_SRCS),$(filter %.c,$(SRCS)))
 C_OBJS      = $(addsuffix .$(way_)o,$(basename $(C_SRCS)))
 
 # SCRIPT_SRCS:  list of raw script files (in literate form)
@@ -221,7 +229,7 @@ MKDEPENDC_SRCS=$(C_SRCS)
 #
 # make TAGS defaults
 #
-# The default set of files for the dependency generators to work on
+# The default set of files for the TAGS file generators to work on
 # is just their source equivalents.
 #
 TAGS_HS_SRCS=$(HS_SRCS)
@@ -244,8 +252,13 @@ TAGS_C_SRCS=$(C_SRCS)
 #
 MOSTLY_CLEAN_FILES += $(HS_OBJS) $(C_OBJS) $(HSC_C_OBJS)
 CLEAN_FILES        += $(HS_PROG) $(C_PROG) $(SCRIPT_PROG) $(SCRIPT_LINK) \
-                     $(PROG) $(LIBRARY) $(HS_IFACES) a.out \
-                     $(DERIVED_HSC_SRCS)
+                     $(PROG) $(LIBRARY) a.out \
+                     $(DERIVED_HSC_SRCS) \
+                     $(patsubst %,%/*.$(way_)hi, . $(ALL_DIRS))
+
+# we delete *all* the .hi files we can find, rather than just
+# $(HS_IFACES), because stale interfaces left around by modules which
+# don't exist any more can screw up the build.
 
 # Don't clean the .hc files if we're bootstrapping
 ifneq "$(BootingFromHc)" "YES"