1## -*-makefile-*- 2## Copyright (C) 2016 and later: Unicode, Inc. and others. 3## License & terms of use: http://www.unicode.org/copyright.html 4## Cygwin-specific setup 5## Copyright (c) 2001-2010, International Business Machines Corporation and 6## others. All Rights Reserved. 7 8## Commands to generate dependency files 9GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS) 10GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS) $(CXXFLAGS) 11 12## Flags to create/use a static library 13ifneq ($(ENABLE_SHARED),YES) 14## Make sure that the static libraries can be built and used 15CPPFLAGS += -DU_STATIC_IMPLEMENTATION 16else 17## Make sure that the static libraries can be built 18STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION 19endif 20 21## ICU requires a minimum target of Windows 7, and WINVER is not set to this by default. 22## https://msdn.microsoft.com/en-us/library/aa383745.aspx 23CPPFLAGS += -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 24 25## Flags for position independent code 26SHAREDLIBCFLAGS = 27SHAREDLIBCXXFLAGS = 28SHAREDLIBCPPFLAGS = -DPIC 29 30## Additional flags when building libraries and with threads 31THREADSCPPFLAGS = -D_REENTRANT 32LIBCPPFLAGS = 33 34# Commands to link. Link with C++ in case static libraries are used. 35LINK.c= $(CXX) $(CXXFLAGS) $(LDFLAGS) 36#LINK.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) 37 38## Shared library options 39LD_SOOPTIONS= -Wl,-Bsymbolic 40 41## Commands to make a shared library 42# $(subst) won't work in shell script. #M# at the end omits these 43# lines from the shell script (Make only) 44SHLIB.c= $(CC) $(CFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst cyg,lib,$@).$(A)#M# 45SHLIB.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst cyg,lib,$@).$(A)#M# 46# the #SH# lines don't go through further postprocessing. 47# so, they must be valid shell script starting from column 4 48#SH#SHLIB_c="$(CC) $(CFLAGS) $(LDFLAGS) -shared " 49#SH#SHLIB_cc="$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared " 50 51 52## Compiler switch to embed a runtime search path 53LD_RPATH= 54LD_RPATH_PRE= -Wl,-rpath, 55 56## Compiler switch to embed a library name 57LD_SONAME = 58 59## Shared object suffix 60SO = dll 61## Non-shared intermediate object suffix 62STATIC_O = ao 63LIBICU = cyg$(ICUPREFIX) 64## To have an import library is better on Cygwin 65IMPORT_LIB_EXT = .dll.a 66 67## Compilation rules 68%.$(STATIC_O): $(srcdir)/%.c 69 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $< 70%.o: $(srcdir)/%.c 71 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $< 72 73%.$(STATIC_O): $(srcdir)/%.cpp 74 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $< 75%.o: $(srcdir)/%.cpp 76 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $< 77 78 79## Dependency rules 80%.d: $(srcdir)/%.c 81 @echo "generating dependency information for $<" 82 @echo -n "$@ " > $@ 83 @$(GEN_DEPS.c) $< >> $@ || (rm -f $@ && FALSE) 84 85%.d: $(srcdir)/%.cpp 86 @echo "generating dependency information for $<" 87 @echo -n "$@ " > $@ 88 @$(GEN_DEPS.cc) $< >> $@ || (rm -f $@ && FALSE) 89 90## Versioned target for a shared library. 91## Since symbolic links don't work the same way on Windows, 92## we only use the version major number. 93#FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO) 94FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO) 95MIDDLE_SO_TARGET=$(FINAL_SO_TARGET) 96 97IMPORT_LIB = $(subst cyg,lib,$(FINAL_SO_TARGET)).$(A)#M# 98MIDDLE_IMPORT_LIB = $(subst cyg,lib,$(basename $(SO_TARGET)))$(SO_TARGET_VERSION_MAJOR).$(SO).$(A)#M# 99FINAL_IMPORT_LIB = $(IMPORT_LIB)#M# 100 101# The following is for Makefile.inc's use. 102ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR) 103 104## Versioned libraries rules 105#%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO) 106# $(RM) $@ && cp ${<F} $@ 107%.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO) 108 ln -fs $(subst cyg,lib,${<F}).$(A) $(subst cyg,lib,$@).$(A) 109 110## Install libraries as executable 111INSTALL-L=$(INSTALL_PROGRAM) 112 113## Bind internal references 114 115# LDflags that pkgdata will use 116BIR_LDFLAGS= -Wl,-Bsymbolic 117 118# Dependencies [i.e. map files] for the final library 119BIR_DEPS= 120 121# Environment variable to set a runtime search path 122LDLIBRARYPATH_ENVVAR = PATH 123 124# The type of assembly to write for generating an object file 125GENCCODE_ASSEMBLY=-a gcc-cygwin 126 127# put this here again so it gets cyguc... 128 129#SH#ICULIBS_COMMON_LIB_NAME="${LIBICU}uc${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}.${SO}" 130 131# for icu-config 132 133#SH### copied from Makefile.inc 134#SH#ICULIBS_COMMON="-l${LIBICU}uc${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}" 135#SH#ICULIBS_DATA="-l${LIBICU}${DATA_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}" 136#SH#ICULIBS_I18N="-l${LIBICU}${I18N_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}" 137#SH#ICULIBS_TOOLUTIL="-l${LIBICU}tu${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}" 138#SH#ICULIBS_CTESTFW="-l${LIBICU}ctestfw${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}" 139#SH#ICULIBS_ICUIO="-l${LIBICU}io${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}" 140#SH#ICULIBS_OBSOLETE="-l${LIBICU}obsolete${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}" 141#SH#ICULIBS_LAYOUT="-l${LIBICU}le${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}" 142#SH#ICULIBS_LAYOUTEX="-l${LIBICU}lx${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}" 143#SH#ICULIBS_BASE="${LIBS} -L${libdir}" 144#SH#ICULIBS="${ICULIBS_BASE} ${ICULIBS_I18N} ${ICULIBS_COMMON} ${ICULIBS_DATA}" 145 146## End Cygwin-specific setup 147 148