[project @ 2001-07-16 11:43:17 by simonpj]
[ghc-hetmet.git] / mk / target.mk
index 57b5628..9d1683a 100644 (file)
@@ -312,6 +312,9 @@ endif
 SRC_HC_OPTS += $(patsubst %, -package %, $(PACKAGE_DEPS))
 ifneq "$(PACKAGE)" ""
 SRC_HC_OPTS += -package-name $(PACKAGE)
+else
+# No library, we are actually building the tools
+SRC_HC_OPTS += $(FptoolsHcOpts)
 endif
 
 #----------------------------------------
@@ -334,7 +337,7 @@ endif
 #
 # Outputs:
 #   $(LIBRARY)         the name of the library.a
-#   $(GHIC_LIBRARY)    the name of the library.o (for GHCi0
+#   $(GHIC_LIBRARY)    the name of the library.o (for GHCi)
 #   $(LIBOBJS)         objects to put in library
 #   $(STUBOBJS)                more objects to put in library
 # 
@@ -346,6 +349,11 @@ ifneq "$(PACKAGE)" ""
 
 ifeq "$(IS_CBITS_LIB)" "YES"
 _cbits := _cbits
+STUBOBJS += $(HSC_C_OBJS)
+# Add _hsc.c files to the cbits library
+SRCS       += $(wildcard ../*_hsc.c)
+# Make .hsc.h include files from the directory above visible
+SRC_CC_OPTS += -I..
 endif
 
 LIBRARY      = libHS$(PACKAGE)$(_cbits)$(_way).a
@@ -363,7 +371,6 @@ ifeq "$(LIBOBJS)" ""
   endif
 endif
 
-STUBOBJS += $(HSC_C_OBJS)
 SRC_CC_OPTS += -I$(GHC_INCLUDE_DIR) -I$(GHC_RUNTIME_DIR)
 
 ifeq "$(IS_CBITS_LIB)" "YES"
@@ -516,10 +523,13 @@ endif # GHCI_LIBRARY
 #
 
 ifeq "$(DLLized)" "YES"
+SRC_CC_OPTS += -DDLLized
 
 ifneq "$(PACKAGE)" ""
 
 SRC_BLD_DLL_OPTS += --export-all --output-def=HS$(PACKAGE)$(_cbits)$(_way).def DllVersionInfo.$(way_)o
+
+ifneq "$(PACKAGE) $(IS_CBITS_LIB)" "std YES"
 ifneq "$(PACKAGE)" "rts"
 SRC_BLD_DLL_OPTS += -lHSstd_cbits_imp -L$(GHC_LIB_DIR)/std/cbits
 SRC_BLD_DLL_OPTS += -lHSrts_$(way_)imp -L$(GHC_RUNTIME_DIR)
@@ -529,6 +539,8 @@ ifneq "$(PACKAGE)" "std"
   endif
 endif
 endif
+endif
+
 SRC_BLD_DLL_OPTS += -lgmp -L. -L$(GHC_RUNTIME_DIR)/gmp
 ifeq "$(IS_CBITS_LIB)" ""
 SRC_BLD_DLL_OPTS += $(patsubst %,-lHS%_$(way_)imp, $(PACKAGE_DEPS))