If you need to pass a filename to a Windows program, such as the Visual C++ com-piler, you can usually just pass the relative path to the file using POSIX-style forward slashes. The Win32 API does not distinguish between forward and backward slashes. Unfortunately, some utilities that perform their own command-line argument pars-ing treat all forward slashes as command options. One such utility is the DOS print command; another is the net command.
If absolute paths are used, the drive letter syntax is always a problem. Although Win-dows programs are usually happy with forward slashes, they are completely unable to fathom the /c syntax. The drive letter must always be tranformed back into c:. To accomplish this and the forward/backslash conversion, Cygwin provides the cygpath utility to translate between POSIX paths and Windows paths.
cygpath-mixed = $(shell cygpath -m "$1")
cygpath-unix = $(shell cygpath -u "$1")
drive-letter-to-slash = /$(subst :,,$1)
cygpath-mixed = $1
cygpath-unix = $1
drive-letter-to-slash = $1
This is the Title of the Book, eMatter Edition
Copyright © 2005 O’Reilly & Associates, Inc. All rights reserved.
If your commitment to Cygwin is strong and you do not need to build using native Win-dows support tools, you can safely place the Cygwin /bin directory at the front of your Windows path. This will guarantee access to Cygwin tools over Windows versions.
If your makefile is working with Java tools, be aware that Cygwin includes the GNU jar program that is incompatible with the standard Sun jar file format. Therefore, the Java jdk bin directory should be placed before the Cygwin /bin directory in your Path variable to avoid using Cygwin’s jar program.
MV ?= move
RM ?= del
MV ?= mv -f
RM ?= rm -f
If a simple block is used, the values can be changed by resetting them on the com-mand line, by editing the makefile, or (in this case because we used conditional assignment, ?=) by setting an environment variable. As mentioned previously, one