[project @ 2001-08-06 20:39:32 by sof]
[ghc-hetmet.git] / mk / target.mk
index 8b09305..7522603 100644 (file)
@@ -301,19 +301,8 @@ else
 $(HS_PROG) :: $(HS_OBJS)
        $(CC) -o $@ $(HC_BOOT_CC_OPTS) $(HC_BOOT_LD_OPTS) $(HS_OBJS) $(HC_BOOT_LIBS)
 endif
-endif
-
-# Object and interface files have suffixes tagged with their ways
-ifneq "$(way)" ""
-SRC_HC_OPTS += -hisuf $(way_)hi -hcsuf $(way_)hc -osuf $(way_)o
-endif
 
-# add syslib dependencies and current package name
-SRC_HC_OPTS += $(patsubst %, -package %, $(PACKAGE_DEPS))
-ifneq "$(PACKAGE)" ""
-SRC_HC_OPTS += -package-name $(PACKAGE)
-else
-# No library, we are actually building the tools
+# for building a Haskell program, we add FptoolsHcOpts
 SRC_HC_OPTS += $(FptoolsHcOpts)
 endif
 
@@ -347,13 +336,18 @@ endif
 
 ifneq "$(PACKAGE)" ""
 
+# add syslib dependencies and current package name
+SRC_HC_OPTS += -package-name $(PACKAGE)
+SRC_HC_OPTS += $(patsubst %, -package %, $(PACKAGE_DEPS))
+
 ifeq "$(IS_CBITS_LIB)" "YES"
 _cbits := _cbits
 STUBOBJS += $(HSC_C_OBJS)
 # Add _hsc.c files to the cbits library
-SRCS       += $(wildcard ../*_hsc.c)
+C_SRCS += $(wildcard ../*_hsc.c)
 # Make .hsc.h include files from the directory above visible
-SRC_CC_OPTS += -I..
+# (and the cbits/ library too).
+SRC_CC_OPTS += -I.. -I.
 endif
 
 LIBRARY      = libHS$(PACKAGE)$(_cbits)$(_way).a
@@ -385,7 +379,7 @@ endif # PACKAGE
 #----------------------------------------
 #      Libraries/archives
 #
-# Build $(LIBRARY) from $(LIBOJBS)+$(STUBOBJS)
+# Build $(LIBRARY) from $(LIBOBJS)+$(STUBOBJS)
 #
 # Inputs:
 #   $(LIBOBJS)
@@ -987,11 +981,11 @@ install-strip::
        @$(MAKE) EXTRA_INSTALL_OPTS='-s' install                                        
 endif
 
-###########################################
+##############################################################################
 #
 #      Targets: check tags show
 #
-###########################################
+##############################################################################
 
 #------------------------------------------------------------
 #                      Check
@@ -1029,11 +1023,14 @@ endif
 #
 
 show:
-       @echo '$(VALUE)=$($(VALUE))'
+       @echo '$(VALUE)="$($(VALUE))"'
 
-#--------------------------------------------------------------------------
-# SGML Documentation
+################################################################################
 #
+#                      SGML Documentation
+#
+################################################################################
+
 .PHONY: dvi ps html pdf rtf
 
 ifneq "$(SGML_DOC)" ""
@@ -1072,11 +1069,11 @@ extraclean ::
        $(RM) -rf $(SGML_DOC)
 endif
 
-###########################################
+##############################################################################
 #
 #      Targets: clean
 #
-###########################################
+##############################################################################
 
 # we have to be careful about recursion here; since all the clean
 # targets are recursive, we don't want to make eg. distclean depend on
@@ -1101,11 +1098,11 @@ maintainer-clean:: extraclean
        @echo 'deletes files that may need special tools to rebuild.'
        rm -f $(MOSTLY_CLEAN_FILES) $(CLEAN_FILES) $(DIST_CLEAN_FILES) $(MAINTAINER_CLEAN_FILES)
 
-#################################################################################
+################################################################################
 #
 #                      Way management
 #
-#################################################################################
+################################################################################
 
 # Here is the ingenious jiggery pokery that allows you to build multiple versions
 # of a program in a single build tree.
@@ -1160,6 +1157,16 @@ $(LIB_WAY_TARGETS) :
 
 endif  # if way
 
+# -------------------------------------------------------------------------
+# Object and interface files have suffixes tagged with their ways
+
+ifneq "$(way)" ""
+SRC_HC_OPTS += -hisuf $(way_)hi -hcsuf $(way_)hc -osuf $(way_)o
+endif
+
+# -------------------------------------------------------------------------
+# Rules to invoke the current target recursively for each way
+
 ifneq "$(WAYS)" ""
 ifeq "$(way)" ""