Home | History | Annotate | Download | only in config
      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/MinGW specific setup
      5 ## Copyright (c) 2001-2014, International Business Machines Corporation and
      6 ## others. All Rights Reserved.
      7 
      8 # TODO: Finish the rest of this port. This platform port is incomplete.
      9 
     10 # This file is similar to mh-mingw64
     11 # Any changes made here may also need to be made in mh-mingw64
     12 
     13 # We install sbin tools into the same bin directory because
     14 # pkgdata needs some of the tools in sbin, and we can't always depend on
     15 # icu-config working on Windows.
     16 sbindir=$(bindir)
     17 
     18 ## Commands to generate dependency files
     19 GEN_DEPS.c=	$(CC) -E -MM $(DEFS) $(CPPFLAGS)
     20 GEN_DEPS.cc=	$(CXX) -E -MM $(DEFS) $(CPPFLAGS)
     21 
     22 ## Flags to create/use a static library
     23 ifneq ($(ENABLE_SHARED),YES)
     24 ## Make sure that the static libraries can be built and used
     25 CPPFLAGS += -DU_STATIC_IMPLEMENTATION
     26 else
     27 ## Make sure that the static libraries can be built
     28 STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION
     29 endif
     30 
     31 ## ICU requires a minimum target of Windows 7, and MinGW does not set this by default.
     32 ## https://msdn.microsoft.com/en-us/library/aa383745.aspx
     33 CPPFLAGS += -DWINVER=0x0601 -D_WIN32_WINNT=0x0601
     34 
     35 ## Flags for position independent code
     36 SHAREDLIBCFLAGS = 
     37 SHAREDLIBCXXFLAGS = 
     38 SHAREDLIBCPPFLAGS = -DPIC
     39 
     40 ## Additional flags when building libraries and with threads
     41 THREADSCFLAGS = -mthreads
     42 THREADSCXXFLAGS = -mthreads
     43 LIBCPPFLAGS =
     44 
     45 ## Add 'd' suffix to the names of binary files with Debug configuration
     46 ifeq ($(ENABLE_DEBUG),1)
     47 ICULIBSUFFIX:=$(ICULIBSUFFIX)d#M#
     48 endif
     49 
     50 # Commands to link. Link with C++ in case static libraries are used.
     51 LINK.c=       $(CXX) $(CXXFLAGS) $(LDFLAGS)
     52 #LINK.cc=      $(CXX) $(CXXFLAGS) $(LDFLAGS)
     53 
     54 ## Shared library options
     55 LD_SOOPTIONS= -Wl,-Bsymbolic
     56 
     57 ## Commands to make a shared library
     58 SHLIB.c=	$(CC) $(CFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(dir $@)lib$(notdir $(@:$(SO_TARGET_VERSION_MAJOR).$(SO)=))$(IMPORT_LIB_EXT)#M#
     59 SHLIB.cc=	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(dir $@)lib$(notdir $(@:$(SO_TARGET_VERSION_MAJOR).$(SO)=))$(IMPORT_LIB_EXT)#M#
     60 
     61 ## Compiler switch to embed a runtime search path
     62 LD_RPATH=	
     63 LD_RPATH_PRE=	-Wl,-rpath,
     64 
     65 ## Compiler switch to embed a library name
     66 LD_SONAME = 
     67 
     68 ## Shared object suffix
     69 SO = dll
     70 ## Non-shared intermediate object suffix
     71 STATIC_O = ao
     72 
     73 ifeq ($(ENABLE_SHARED),YES)
     74 SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR)
     75 else
     76 SO_TARGET_VERSION_SUFFIX = 
     77 endif
     78 
     79 # Static library prefix and file extension
     80 LIBSICU = $(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
     81 A = a
     82 
     83 ## An import library is needed for z/OS and MSVC
     84 IMPORT_LIB_EXT = .dll.a
     85 
     86 LIBPREFIX=lib
     87 
     88 # Change the stubnames so that poorly working FAT disks and installation programs can work.
     89 # This is also for backwards compatibility.
     90 DATA_STUBNAME = dt
     91 I18N_STUBNAME = in
     92 LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)
     93 
     94 #SH### copied from Makefile.inc
     95 #SH## for icu-config to test with
     96 #SH#ICULIBS_COMMON_LIB_NAME="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}.${SO}"
     97 #SH#ICULIBS_COMMON_LIB_NAME_A="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}.${A}"
     98 
     99 #SH#ICULIBS_DATA="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)"
    100 #SH#ICULIBS_I18N="-l$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)"
    101 #SH#
    102 #SH## ICULIBS is the set of libraries your application should link
    103 #SH## with usually. Many applications will want to add ${ICULIBS_I18N} as well. 
    104 #SH#ICULIBS="${ICULIBS_BASE} ${ICULIBS_I18N} ${ICULIBS_COMMON} ${ICULIBS_DATA} "
    105 
    106 # The #M# is used to delete lines for icu-config
    107 # Current full path directory.
    108 #CURR_FULL_DIR=$(shell pwd -W)#M# for MSYS
    109 CURR_FULL_DIR?=$(subst \,/,$(shell cmd /c cd))#M# for Cygwin shell
    110 # Current full path directory for use in source code in a -D compiler option.
    111 #CURR_SRCCODE_FULL_DIR=$(subst /,\\\\,$(shell pwd -W))#M# for MSYS
    112 CURR_SRCCODE_FULL_DIR=$(subst \,/,$(shell cmd /c cd))#M# for Cygwin shell
    113 
    114 ## Compilation rules
    115 %.$(STATIC_O): $(srcdir)/%.c
    116 	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
    117 %.o: $(srcdir)/%.c
    118 	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
    119 
    120 %.$(STATIC_O): $(srcdir)/%.cpp
    121 	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
    122 %.o: $(srcdir)/%.cpp
    123 	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
    124 
    125 
    126 ## Dependency rules
    127 %.d: $(srcdir)/%.c
    128 	@echo "generating dependency information for $<"
    129 	@echo -n "$@ " > $@
    130 	@$(GEN_DEPS.c) $< >> $@ || (rm -f $@ && FALSE)
    131 
    132 %.d: $(srcdir)/%.cpp
    133 	@echo "generating dependency information for $<"
    134 	@echo -n "$@ " > $@
    135 	@$(GEN_DEPS.cc) $< >> $@ || (rm -f $@ && FALSE)
    136 
    137 ## Versioned target for a shared library.
    138 ## Since symbolic links don't work the same way on Windows,
    139 ## we only use the version major number.
    140 #FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
    141 FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
    142 MIDDLE_SO_TARGET=$(FINAL_SO_TARGET)
    143 
    144 FINAL_IMPORT_LIB = $(dir $(SO_TARGET))lib$(notdir $(basename $(SO_TARGET)))$(IMPORT_LIB_EXT)#M#
    145 IMPORT_LIB = $(FINAL_IMPORT_LIB)#M#
    146 MIDDLE_IMPORT_LIB = $(FINAL_IMPORT_LIB)#M#
    147 
    148 ## Special pkgdata information that is needed
    149 PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR)
    150 #ICUPKGDATA_INSTALL_DIR = $(shell cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M#
    151 #ICUPKGDATA_INSTALL_LIBDIR = $(shell cygpath -dma $(DESTDIR)$(libdir))#M#
    152 
    153 ## Versioned libraries rules
    154 #%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
    155 #	$(RM) $@ && cp ${<F} $@
    156 %.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
    157 	@echo -n
    158 
    159 # Environment variable to set a runtime search path
    160 LDLIBRARYPATH_ENVVAR = PATH
    161 
    162 # The type of assembly to write for generating an object file
    163 GENCCODE_ASSEMBLY=-a gcc-cygwin
    164 
    165 # These are needed to allow the pkgdata GNU make files to work
    166 PKGDATA_DEFS = -DU_MAKE=\"$(MAKE)\"
    167 
    168 ## End Cygwin/MinGW specific setup
    169 
    170