DLIB_SUFFIX := .dll
# do not archive external libraries
CYGWIN_LDLIBS_NOARCHIVE := $(filter-out -l$(BINARY_NAME),$(LDLIBS))
-CYGWIN_LIBLDFLAGS := -Wl,--out-implib=$(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX).a \
+CYGWIN_LIBLDFLAGS := -Wl,--out-implib=$(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX)$(SLIB_SUFFIX) \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import
endif
@$(AR) rcs $@ $^
ifeq ($(findstring CYGWIN_NT,$(UNAME)),CYGWIN_NT)
-$(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX).a: $(LIBRARY_PATH)/$(DLIB_PREFIX)$(CYGWIN_DLIBRARY_NAME)$(DLIB_SUFFIX)
+$(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX)$(SLIB_SUFFIX): $(LIBRARY_PATH)/$(DLIB_PREFIX)$(CYGWIN_DLIBRARY_NAME)$(DLIB_SUFFIX)
$(LIBRARY_PATH)/$(DLIB_PREFIX)$(CYGWIN_DLIBRARY_NAME)$(DLIB_SUFFIX): $(LIBOBJS)
@echo "[LD DLL] $@"
@$(LD) $(LIBCFLAGS) $(LIBLDFLAGS) $(CYGWIN_LIBLDFLAGS) -Wl,--whole-archive $^ -Wl,--no-whole-archive $(CYGWIN_LDLIBS_NOARCHIVE) -o $@
@$(LD) $(CFLAGS) $(STATICLIBLDFLAGS) $^ $(LDLIBS) -o $@
ifeq ($(findstring CYGWIN_NT,$(UNAME)),CYGWIN_NT)
-$(BINARY_NAME).dynamic$(BINARY_SUFFIX): $(OBJS) $(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX).a
+$(BINARY_NAME).dynamic$(BINARY_SUFFIX): $(OBJS) $(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX)$(SLIB_SUFFIX)
else
$(BINARY_NAME).dynamic$(BINARY_SUFFIX): $(OBJS) $(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX)
endif
-@rm $(LIBRARY_PATH)/$(SLIB_PREFIX)$(LIBRARY_NAME)$(SLIB_SUFFIX)
ifeq ($(findstring CYGWIN_NT,$(UNAME)),CYGWIN_NT)
-@rm $(LIBRARY_PATH)/$(DLIB_PREFIX)$(CYGWIN_DLIBRARY_NAME)$(DLIB_SUFFIX)
- -@rm $(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX).a
+ -@rm $(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX)$(SLIB_SUFFIX)
else
-@rm $(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX)
endif