Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | ## MSYS with Microsoft Visual C++ compiler specific setup |
michael@0 | 2 | ## Copyright (c) 2001-2013, International Business Machines Corporation and |
michael@0 | 3 | ## others. All Rights Reserved. |
michael@0 | 4 | |
michael@0 | 5 | # We install sbin tools into the same bin directory because |
michael@0 | 6 | # pkgdata needs some of the tools in sbin, and we can't always depend on |
michael@0 | 7 | # icu-config working on Windows. |
michael@0 | 8 | sbindir=$(bindir) |
michael@0 | 9 | |
michael@0 | 10 | ## Commands to generate dependency files |
michael@0 | 11 | GEN_DEPS.c= : |
michael@0 | 12 | GEN_DEPS.cc= : |
michael@0 | 13 | #GEN_DEPS.c= $(COMPILE.c) -E |
michael@0 | 14 | #GEN_DEPS.cc= $(COMPILE.cc) -E |
michael@0 | 15 | |
michael@0 | 16 | ## Flags to create/use a static library |
michael@0 | 17 | ifneq ($(ENABLE_SHARED),YES) |
michael@0 | 18 | ## Make sure that the static libraries can be built and used |
michael@0 | 19 | CPPFLAGS += -DU_STATIC_IMPLEMENTATION#M# |
michael@0 | 20 | else |
michael@0 | 21 | ## Make sure that the static libraries can be built |
michael@0 | 22 | STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION |
michael@0 | 23 | endif |
michael@0 | 24 | |
michael@0 | 25 | ## Flags for position independent code |
michael@0 | 26 | SHAREDLIBCFLAGS = |
michael@0 | 27 | SHAREDLIBCXXFLAGS = |
michael@0 | 28 | SHAREDLIBCPPFLAGS = |
michael@0 | 29 | |
michael@0 | 30 | ## Additional flags when building libraries and with threads |
michael@0 | 31 | LIBCPPFLAGS = |
michael@0 | 32 | |
michael@0 | 33 | ifeq ($(ENABLE_RELEASE),1) |
michael@0 | 34 | # Make sure that assertions are disabled |
michael@0 | 35 | CPPFLAGS+=-DU_RELEASE=1#M# |
michael@0 | 36 | endif |
michael@0 | 37 | |
michael@0 | 38 | ifeq ($(ENABLE_DEBUG),1) |
michael@0 | 39 | # Pass debugging flag through |
michael@0 | 40 | CPPFLAGS+=-D_DEBUG=1#M# |
michael@0 | 41 | ICULIBSUFFIX:=$(ICULIBSUFFIX)d#M# |
michael@0 | 42 | endif |
michael@0 | 43 | |
michael@0 | 44 | # -GF pools strings and places them into read-only memory |
michael@0 | 45 | # -EHsc enables exception handling |
michael@0 | 46 | # -Zc:wchar_t makes wchar_t a native type. Required for C++ ABI compatibility. |
michael@0 | 47 | # -D_CRT_SECURE_NO_DEPRECATE is needed to quiet warnings about using standard C functions. |
michael@0 | 48 | CFLAGS+=-GF -nologo |
michael@0 | 49 | CXXFLAGS+=-GF -nologo -EHsc -Zc:wchar_t |
michael@0 | 50 | CPPFLAGS+=-D_CRT_SECURE_NO_DEPRECATE |
michael@0 | 51 | DEFS+=-DWIN32 -DCYGWINMSVC |
michael@0 | 52 | LDFLAGS+=-nologo |
michael@0 | 53 | |
michael@0 | 54 | # Commands to compile |
michael@0 | 55 | COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c |
michael@0 | 56 | COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c |
michael@0 | 57 | |
michael@0 | 58 | # Commands to link |
michael@0 | 59 | LINK.c= LINK.EXE -subsystem:console $(LDFLAGS) |
michael@0 | 60 | LINK.cc= LINK.EXE -subsystem:console $(LDFLAGS) |
michael@0 | 61 | |
michael@0 | 62 | ## Commands to make a shared library |
michael@0 | 63 | SHLIB.c= LINK.EXE -DLL $(LDFLAGS) |
michael@0 | 64 | SHLIB.cc= LINK.EXE -DLL $(LDFLAGS) |
michael@0 | 65 | |
michael@0 | 66 | ## Compiler switch to embed a runtime search path |
michael@0 | 67 | LD_RPATH= |
michael@0 | 68 | LD_RPATH_PRE= |
michael@0 | 69 | |
michael@0 | 70 | ## Compiler switch to embed a library name |
michael@0 | 71 | LD_SONAME = -IMPLIB:$(SO_TARGET:.dll=.lib) |
michael@0 | 72 | |
michael@0 | 73 | ## Shared object suffix |
michael@0 | 74 | SO = dll |
michael@0 | 75 | ## Non-shared intermediate object suffix |
michael@0 | 76 | STATIC_O = ao |
michael@0 | 77 | # OUTOPT is for creating a specific output name |
michael@0 | 78 | OUTOPT = -out: |
michael@0 | 79 | |
michael@0 | 80 | # Static library prefix and file extension |
michael@0 | 81 | LIBSICU = $(STATIC_PREFIX)$(ICUPREFIX) |
michael@0 | 82 | A = lib |
michael@0 | 83 | |
michael@0 | 84 | # Cygwin's ar can't handle Win64 right now. So we use Microsoft's tool instead. |
michael@0 | 85 | AR = LIB.EXE#M# |
michael@0 | 86 | ARFLAGS := -nologo $(ARFLAGS:r=)#M# |
michael@0 | 87 | RANLIB = ls -s#M# |
michael@0 | 88 | AR_OUTOPT = -OUT:#M# |
michael@0 | 89 | |
michael@0 | 90 | ## An import library is needed for z-OS, MSVC and Cygwin |
michael@0 | 91 | IMPORT_LIB_EXT = .lib |
michael@0 | 92 | |
michael@0 | 93 | LIBPREFIX= |
michael@0 | 94 | DEFAULT_LIBS = advapi32.lib |
michael@0 | 95 | |
michael@0 | 96 | # Change the stubnames so that poorly working FAT disks and installation programs can work. |
michael@0 | 97 | # This is also for backwards compatibility. |
michael@0 | 98 | DATA_STUBNAME = dt |
michael@0 | 99 | I18N_STUBNAME = in |
michael@0 | 100 | LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX) |
michael@0 | 101 | |
michael@0 | 102 | ## Link commands to link to ICU libs |
michael@0 | 103 | ifeq ($(wildcard $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib),) |
michael@0 | 104 | LIBICUDT= $(top_builddir)/stubdata/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib |
michael@0 | 105 | else |
michael@0 | 106 | LIBICUDT= $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib |
michael@0 | 107 | endif |
michael@0 | 108 | LIBICUUC= $(LIBDIR)/$(LIBICU)$(COMMON_STUBNAME)$(ICULIBSUFFIX).lib $(LIBICUDT) |
michael@0 | 109 | LIBICUI18N= $(LIBDIR)/$(LIBICU)$(I18N_STUBNAME)$(ICULIBSUFFIX).lib |
michael@0 | 110 | LIBICULE= $(LIBDIR)/$(LIBICU)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX).lib |
michael@0 | 111 | LIBICULX= $(LIBDIR)/$(LIBICU)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX).lib |
michael@0 | 112 | LIBICUIO= $(LIBDIR)/$(LIBICU)$(IO_STUBNAME)$(ICULIBSUFFIX).lib |
michael@0 | 113 | LIBCTESTFW= $(top_builddir)/tools/ctestfw/$(LIBICU)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX).lib |
michael@0 | 114 | LIBICUTOOLUTIL= $(LIBDIR)/$(LIBICU)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX).lib |
michael@0 | 115 | |
michael@0 | 116 | ## These are the library specific LDFLAGS |
michael@0 | 117 | LDFLAGSICUDT+= -base:"0x4ad00000" -NOENTRY# The NOENTRY option is required for creating a resource-only DLL. |
michael@0 | 118 | LDFLAGSICUUC= -base:"0x4a800000"# in-uc = 1MB |
michael@0 | 119 | LDFLAGSICUI18N= -base:"0x4a900000"# io-in = 2MB |
michael@0 | 120 | LDFLAGSICUIO= -base:"0x4ab00000"# le-io = 1MB |
michael@0 | 121 | LDFLAGSICULE= -base:"0x4ac00000"# lx-le = 512KB |
michael@0 | 122 | LDFLAGSICULX= -base:"0x4ac80000" |
michael@0 | 123 | LDFLAGSCTESTFW=# Unused for now. |
michael@0 | 124 | LDFLAGSICUTOOLUTIL= -base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix. |
michael@0 | 125 | |
michael@0 | 126 | ## Compilation rules |
michael@0 | 127 | %.$(STATIC_O): $(srcdir)/%.c |
michael@0 | 128 | $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -Fo$@ $< |
michael@0 | 129 | %.o: $(srcdir)/%.c |
michael@0 | 130 | $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -Fo$@ $< |
michael@0 | 131 | |
michael@0 | 132 | %.$(STATIC_O): $(srcdir)/%.cpp |
michael@0 | 133 | $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -Fo$@ $< |
michael@0 | 134 | %.o: $(srcdir)/%.cpp |
michael@0 | 135 | $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -Fo$@ $< |
michael@0 | 136 | |
michael@0 | 137 | |
michael@0 | 138 | ## Dependency rules |
michael@0 | 139 | ## This is a start to how depdendencies could work |
michael@0 | 140 | # The commented out rules may not properly delete the file when ^C is pressed |
michael@0 | 141 | # or the compiler fails. |
michael@0 | 142 | # make currently doesn't like rules with C:\\PROGRA~1\\.. in the depedency. |
michael@0 | 143 | # So system headers are ignored by ignoring \\ |
michael@0 | 144 | %.d : $(srcdir)/%.c |
michael@0 | 145 | @echo "generating dependency information for $<" |
michael@0 | 146 | @$(GEN_DEPS.c) $< > $@ |
michael@0 | 147 | # @echo -n "generating dependency information for " |
michael@0 | 148 | # @echo -n "$@ $(basename $<).o : " > $@ |
michael@0 | 149 | # @$(SHELL) -ec '$(GEN_DEPS.c) $< \ |
michael@0 | 150 | # | grep "#line 1 " | grep -v \\\\ | cut -d " " -f 3 \ |
michael@0 | 151 | # | /usr/bin/sort -u | sed s/\"$$/\\\\/ | sed s/^\"/\ / >> $@ \ |
michael@0 | 152 | # || (rm -f $@ && echo $@ && false)' |
michael@0 | 153 | |
michael@0 | 154 | %.d : $(srcdir)/%.cpp |
michael@0 | 155 | @echo "generating dependency information for $<" |
michael@0 | 156 | @$(GEN_DEPS.cc) $< > $@ |
michael@0 | 157 | # @echo -n "generating dependency information for " |
michael@0 | 158 | # @echo -n "$@ $(basename $<).o : " > $@ |
michael@0 | 159 | # @$(SHELL) -ec '$(GEN_DEPS.cc) $< \ |
michael@0 | 160 | # | grep "#line 1 " | grep -v \\\\ | cut -d " " -f 3 \ |
michael@0 | 161 | # | /usr/bin/sort -u | sed s/\"$$/\\\\/ | sed s/^\"/\ / >> $@ \ |
michael@0 | 162 | # || (rm -f $@ && echo $@ && false)' |
michael@0 | 163 | |
michael@0 | 164 | ## Compile a Windows resource file |
michael@0 | 165 | %.res : $(srcdir)/%.rc |
michael@0 | 166 | rc.exe -fo$@ $(CPPFLAGS) $< |
michael@0 | 167 | |
michael@0 | 168 | ## Versioned target for a shared library. |
michael@0 | 169 | FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO) |
michael@0 | 170 | MIDDLE_SO_TARGET=$(FINAL_SO_TARGET) |
michael@0 | 171 | |
michael@0 | 172 | ## Starting in MSVC 2005, manifest files are required. This reduces the obnoxiousness of this feature. |
michael@0 | 173 | POST_SO_BUILD_STEP = @([ -e $<.manifest ] && \ |
michael@0 | 174 | ( echo Embedding manifest into $< && mt.exe -nologo -manifest $<.manifest -outputresource:"$<;2" && rm -rf $<.manifest )) \ |
michael@0 | 175 | || true |
michael@0 | 176 | POST_BUILD_STEP = @([ -e $@.manifest ] && \ |
michael@0 | 177 | ( echo Embedding manifest into $@ && mt.exe -nologo -manifest $@.manifest -outputresource:"$@;1" && rm -rf $@.manifest )) \ |
michael@0 | 178 | || true |
michael@0 | 179 | |
michael@0 | 180 | ## Special pkgdata information that is needed |
michael@0 | 181 | PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR) |
michael@0 | 182 | ICUPKGDATA_INSTALL_DIR = $(shell mkdir -p $(DESTDIR)$(ICUPKGDATA_DIR) ; echo $(DESTDIR)$(ICUPKGDATA_DIR))#M# |
michael@0 | 183 | ICUPKGDATA_INSTALL_LIBDIR = $(shell mkdir -p $(DESTDIR)$(libdir) ; echo $(DESTDIR)$(libdir))#M# |
michael@0 | 184 | |
michael@0 | 185 | ## Versioned import library names. The library names are versioned, |
michael@0 | 186 | ## but the import libraries do not need versioning. |
michael@0 | 187 | IMPORT_LIB = $(basename $(SO_TARGET))$(IMPORT_LIB_EXT)#M# |
michael@0 | 188 | MIDDLE_IMPORT_LIB = $(IMPORT_LIB)#M# |
michael@0 | 189 | FINAL_IMPORT_LIB = $(MIDDLE_IMPORT_LIB)#M# |
michael@0 | 190 | |
michael@0 | 191 | # The following is for Makefile.inc's use. |
michael@0 | 192 | ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR) |
michael@0 | 193 | |
michael@0 | 194 | ## Versioned libraries rules |
michael@0 | 195 | #%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO) |
michael@0 | 196 | # $(RM) $@ && cp ${<F} $@ |
michael@0 | 197 | |
michael@0 | 198 | # The following rule is sometimes a no op. |
michael@0 | 199 | # We only want to do a post-build step when a manifest file doesn't exist. |
michael@0 | 200 | %.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO) |
michael@0 | 201 | @echo -n |
michael@0 | 202 | $(POST_SO_BUILD_STEP) |
michael@0 | 203 | |
michael@0 | 204 | ## Install libraries as executable |
michael@0 | 205 | INSTALL-L=$(INSTALL_PROGRAM) |
michael@0 | 206 | |
michael@0 | 207 | # Environment variable to set a runtime search path |
michael@0 | 208 | LDLIBRARYPATH_ENVVAR = PATH |
michael@0 | 209 | |
michael@0 | 210 | # These are needed to allow the pkgdata nmake files to work |
michael@0 | 211 | PKGDATA_INVOKE_OPTS = MAKEFLAGS= |
michael@0 | 212 | |
michael@0 | 213 | # Include the version information in the shared library |
michael@0 | 214 | ENABLE_SO_VERSION_DATA=1 |
michael@0 | 215 | |
michael@0 | 216 | ## End MSYS-specific setup |
michael@0 | 217 |