1# Copyright (C) 2016 and later: Unicode, Inc. and others. 2# License & terms of use: http://www.unicode.org/copyright.html 3#********************************************************************** 4#* Copyright (C) 1999-2008, International Business Machines Corporation 5#* and others. All Rights Reserved. 6#********************************************************************** 7# nmake file for creating data files on win32 8# invoke with 9# nmake /f makedata.mak icup=<path_to_icu_instalation> [Debug|Release] 10# 11# 12/10/1999 weiv Created 12 13#If no config, we default to debug 14!IF "$(CFG)" == "" 15CFG=Debug 16!MESSAGE No configuration specified. Defaulting to common - Win32 Debug. 17!ENDIF 18 19#Here we test if a valid configuration is given 20!IF "$(CFG)" != "Release" && "$(CFG)" != "release" && "$(CFG)" != "Debug" && "$(CFG)" != "debug" && "$(CFG)" != "x86\Release" && "$(CFG)" != "x86\Debug" && "$(CFG)" != "x64\Release" && "$(CFG)" != "x64\Debug" && "$(CFG)" != "ARM\Release" && "$(CFG)" != "ARM\Debug" && "$(CFG)" != "ARM64\Release" && "$(CFG)" != "ARM64\Debug" 21!MESSAGE Invalid configuration "$(CFG)" specified. 22!MESSAGE You can specify a configuration when running NMAKE 23!MESSAGE by defining the macro CFG on the command line. For example: 24!MESSAGE 25!MESSAGE NMAKE /f "makedata.mak" CFG="Debug" 26!MESSAGE 27!MESSAGE Possible choices for configuration are: 28!MESSAGE 29!MESSAGE "Release" 30!MESSAGE "Debug" 31!MESSAGE 32!ERROR An invalid configuration is specified. 33!ENDIF 34 35#Let's see if user has given us a path to ICU 36#This could be found according to the path to makefile, but for now it is this way 37!IF "$(ICUP)"=="" 38!ERROR Can't find path! 39!ENDIF 40!MESSAGE ICU path is $(ICUP) 41 42RESNAME=uconvmsg 43RESDIR=resources 44RESFILES=resfiles.mk 45ICUDATA=$(ICUP)\data 46 47DLL_OUTPUT=.\$(CFG) 48# set the following to 'static' or 'dll' depending 49PKGMODE=static 50 51ICD=$(ICUDATA)^\ 52DATA_PATH=$(ICUP)\data^\ 53 54NATIVE_ARM= 55!IF "$(PROCESSOR_ARCHITECTURE)" == "ARM64" || "$(PROCESSOR_ARCHITEW6432)" == "ARM64" 56NATIVE_ARM=ARM64 57!ELSE IF "$(PROCESSOR_ARCHITECTURE)" == "ARM" || "$(PROCESSOR_ARCHITEW6432)" == "ARM" 58NATIVE_ARM=ARM 59!ENDIF 60 61# Use the x64 tools for building ARM and ARM64. 62# Note: This is similar to the TOOLS CFG PATH in source\data\makedata.mak 63!IF "$(NATIVE_ARM)" == "" 64!IF "$(CFG)" == "x64\Release" || "$(CFG)" == "x64\Debug" || "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug" || "$(CFG)" == "ARM64\Release" || "$(CFG)" == "ARM64\Debug" 65ICUTOOLS=$(ICUP)\bin64 66PATH = $(ICUP)\bin64;$(PATH) 67!ELSE 68ICUTOOLS=$(ICUP)\bin 69PATH = $(ICUP)\bin;$(PATH) 70!ENDIF 71!ELSE 72!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug" 73ICUTOOLS=$(ICUP)\binARM 74PATH = $(ICUP)\binARM;$(PATH) 75!ELSE 76ICUTOOLS=$(ICUP)\binARM64 77PATH = $(ICUP)\binARM64;$(PATH) 78!ENDIF 79!ENDIF 80 81# If building ARM/ARM, then we need to pass the arch as an argument. 82EXTRA_PKGDATA_ARGUMENTS= 83!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug" 84EXTRA_PKGDATA_ARGUMENTS=-a ARM 85!ENDIF 86!IF "$(CFG)" == "ARM64\Release" || "$(CFG)" == "ARM64\Debug" 87EXTRA_PKGDATA_ARGUMENTS=-a ARM64 88!ENDIF 89 90# Make sure the necessary tools exist before continuing. (This is to prevent cryptic errors from NMAKE). 91!IF !EXISTS($(ICUTOOLS)\pkgdata.exe) 92!MESSAGE Unable to find "$(ICUTOOLS)\pkgdata.exe" 93!ERROR The tool 'pkgdata.exe' does not exist! (Have you built all of ICU yet?). 94!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug" || "$(CFG)" == "ARM64\Release" || "$(CFG)" == "ARM64\Debug" 95!ERROR Note that the ARM and ARM64 builds require building x64 first. 96!ENDIF 97!ENDIF 98!IF !EXISTS($(ICUTOOLS)\genrb.exe) 99!MESSAGE Unable to find "$(ICUTOOLS)\genrb.exe" 100!ERROR The tool 'genrb.exe' does not exist! (Have you built all of ICU yet?). 101!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug" || "$(CFG)" == "ARM64\Release" || "$(CFG)" == "ARM64\Debug" 102!ERROR Note that the ARM and ARM64 builds require building x64 first. 103!ENDIF 104!ENDIF 105 106# Suffixes for data files 107.SUFFIXES : .ucm .cnv .dll .dat .res .txt .c 108 109# We're including a list of resource files. 110FILESEPCHAR= 111 112!IF EXISTS("$(RESFILES)") 113!INCLUDE "$(RESFILES)" 114!ELSE 115!ERROR ERROR: cannot find "$(RESFILES)" 116!ENDIF 117RES_FILES = $(RESSRC:.txt=.res) 118RB_FILES = resources\$(RES_FILES:.res =.res resources\) 119RESOURCESDIR= 120 121# This target should build all the data files 122!IF "$(PKGMODE)" == "dll" 123OUTPUT = "$(DLL_OUTPUT)\$(RESNAME).dll" 124!ELSE 125OUTPUT = "$(DLL_OUTPUT)\$(RESNAME).lib" 126!ENDIF 127 128ALL : $(OUTPUT) 129 @echo All targets are up to date (mode $(PKGMODE)) 130 131 132# invoke pkgdata - static 133"$(DLL_OUTPUT)\$(RESNAME).lib" : $(RB_FILES) $(RESFILES) 134 @echo Building $(RESNAME).lib 135 @"$(ICUTOOLS)\pkgdata" -f -v -m static -c -p $(RESNAME) -d "$(DLL_OUTPUT)" $(EXTRA_PKGDATA_ARGUMENTS) -s "$(RESDIR)" <<pkgdatain.txt 136$(RES_FILES:.res =.res 137) 138<<KEEP 139 140# This is to remove all the data files 141CLEAN : 142 -@erase "$(RB_FILES)" 143 -@erase "$(CFG)\*uconvmsg*.*" 144 -@"$(ICUTOOLS)\pkgdata" -f --clean -v -m static -c -p $(RESNAME) -d "$(DLL_OUTPUT)" $(EXTRA_PKGDATA_ARGUMENTS) -s "$(RESDIR)" pkgdatain.txt 145 146# Inference rule for creating resource bundles 147{$(RESDIR)}.txt{$(RESDIR)}.res: 148 @echo Making Resource Bundle files 149 "$(ICUTOOLS)\genrb" -s $(@D) -d $(@D) $(?F) 150 151$(RESSRC) : {"$(ICUTOOLS)"}genrb.exe 152