From: Jerome Benoit Date: Tue, 21 Mar 2017 17:57:35 +0000 (+0100) Subject: BuildSystem: Permit to differentiate between native DLL and CYGWIN DLL. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=54f5188b02b60f36891ac998c3fbd5bd1db84258;p=TD_C.git BuildSystem: Permit to differentiate between native DLL and CYGWIN DLL. Signed-off-by: Jerome Benoit --- diff --git a/TP_13/exo2/Makefile b/TP_13/exo2/Makefile index ef4bea8..88bc97f 100644 --- a/TP_13/exo2/Makefile +++ b/TP_13/exo2/Makefile @@ -17,12 +17,12 @@ # # 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 # ==================================== @@ -73,12 +73,13 @@ DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$(notdir $*).Td 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 @@ -109,8 +110,8 @@ $(LIBRARY_PATH)/$(SLIB_PREFIX)$(LIBRARY_NAME)$(SLIB_SUFFIX): $(LIBOBJS) @$(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 @@ -166,9 +167,11 @@ clean: -@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)