#
# Automatic dependencies code from:
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#tldr
-BINARY_NAME=exo2
+BINARY_NAME:=exo2
SRC_PATH:=src
-LIBRARY_NAME=libexo2
+LIBRARY_NAME:=libexo2
LIBRARY_PATH:=lib
-LDLIBS=-lncurses -ltinfo
-BUILD_TYPE=debug
+LDLIBS:=-lncurses -ltinfo
+BUILD_TYPE:=debug
#BUILD_TYPE=release
# ====================================
POSTCOMPILE = mv -f $(DEPDIR)/$(notdir $*).Td $(DEPDIR)/$(notdir $*).d
ifeq ($(UNAME),Cygwin)
+CYGWIN_DLIBRARY_NAME := $(subst lib,cyg,$(LIBRARY_NAME))
GOLD_SUPPORT = no
# Cygwin ncurses do not contain tinfo
LDLIBS := $(filter-out -ltinfo,$(LDLIBS))
BINARY_SUFFIX := .exe
DLIB_SUFFIX := .dll
-CYGWIN_LDLIBS_NOARCHIVE = -lncurses
+CYGWIN_LDLIBS_NOARCHIVE := $(LDLIBS)
CYGWIN_LIBLDFLAGS := -Wl,--out-implib=$(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX).a \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import
@$(AR) rcs $@ $^
ifeq ($(UNAME),Cygwin)
-$(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX).a: $(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX)
-$(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX): $(LIBOBJS)
+$(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX).a: $(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 $@
else
-@rm $(BINARY_NAME).static$(BINARY_SUFFIX)
-@rm $(BINARY_NAME).dynamic$(BINARY_SUFFIX)
-@rm $(LIBRARY_PATH)/$(SLIB_PREFIX)$(LIBRARY_NAME)$(SLIB_SUFFIX)
- -@rm $(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX)
ifeq ($(UNAME),Cygwin)
+ -@rm $(LIBRARY_PATH)/$(DLIB_PREFIX)$(CYGWIN_DLIBRARY_NAME)$(DLIB_SUFFIX)
-@rm $(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX).a
+else
+ -@rm $(LIBRARY_PATH)/$(DLIB_PREFIX)$(LIBRARY_NAME)$(DLIB_SUFFIX)
endif
disassemble: $(BINARY_NAME)$(BINARY_SUFFIX)