-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_RTS_DIR)
-ifneq "$(PACKAGE)" "std"
- ifeq "$(IS_CBITS_LIB)" ""
- SRC_BLD_DLL_OPTS += -lHSstd_$(way_)imp -L$(GHC_LIB_DIR)/std
- endif
-endif
-endif
-endif
-
-SRC_BLD_DLL_OPTS += -lgmp -L. -L$(GHC_RTS_DIR)/gmp
-ifeq "$(IS_CBITS_LIB)" ""
-SRC_BLD_DLL_OPTS += $(patsubst %,-lHS%_$(way_)imp, $(PACKAGE_DEPS))
-SRC_BLD_DLL_OPTS += $(patsubst %,-L../%, $(PACKAGE_DEPS))
-endif
-ifneq "$(HAS_CBITS)" ""
-SRC_BLD_DLL_OPTS += -lHS$(PACKAGE)_cbits_imp -Lcbits
-endif
-SRC_BLD_DLL_OPTS += -lwsock32 -lwinmm
-
-endif # PACKAGE != ""
-
-SplitObjs = NO
-
-ifneq "$(LIBRARY)" ""
-
-all :: DllVersionInfo.$(way_)o
-
-ifeq "$(DLL_NAME)" ""
-DLL_NAME = $(patsubst %.a,%.dll,$(subst lib,,$(LIBRARY)))
-endif
-
-ifneq "$(DLL_NAME)" ""
-DLL_NAME := $(DLL_PEN)/$(DLL_NAME)
-endif
-
-all :: $(DLL_NAME)
-
-ifeq "$(DLL_IMPLIB_NAME)" ""
-DLL_IMPLIB_NAME = $(patsubst %.a,%_imp.a,$(LIBRARY))
-endif
-
-$(DLL_NAME) :: $(LIBRARY)
- $(BLD_DLL) --output-lib $(DLL_IMPLIB_NAME) -o $(DLL_NAME) $(LIBRARY) $(BLD_DLL_OPTS)
-endif # LIBRARY != ""
-
-endif # DLLized
+# Generates library.dll.a; by MinGW conventions, this is the dll's import library
+$(LIBRARY).a: $(LIBOBJS) $(LIBRARY).def
+ $(DLLTOOL) -D $(LIBRARY) --def $(LIBRARY).def --output-lib $@