Running a NT program from cygwin

Jorg Schaible jorg.schaible@db.com
Thu Jun 29 13:16:00 GMT 2000


Hi Tom (and Jason),

use the following definitions as substitute for the "normal" make variables and constructs wherever you have to use a DOS/Win utility instead of a unix utility.
Syntax requires make 3.79. You can write with this definitions rules completely independent like:

%.$(OEXT): %.cxx
     $(CC) -o$(RT) $(RF)

%$(APPEXT): $(OBJECTS)
     $(LD) $(RT) $(call cygwlist,$(OBJECTS))


... you got the idea ...



================= cygwin.cfg ==============

ifndef INC_COM_GFT_CONFIG_CYGWIN_CFG
INC_COM_GFT_CONFIG_CYGWIN_CFG := 1

# Special variables to deal with cygwin

ifeq ($(OSTYPE),cygwin32)
# Cygwin versions B20.x and below
CYGWIN := 1
include --please-upgrade-your-Cygwin-Version--
endif
ifeq ($(OSTYPE),cygwin)
# Cygwin versions V1.1 and above
CYGWIN := 2
endif

ifneq ($(words $(CYGWIN)),0)

# Functions to convert file names
cygnus = $(strip $(shell cygpath -$(1) $(2)" "))
cygwfile = $(subst \,\\,$(call cygnus,w,$(1)))
cygwpath = $(subst \,\\,$(call cygnus,wp,$(1)))
cygwlist = $(subst \,\\,$(subst ;,$(space),$(call cygnus,wp,$(subst $(space),:,$(strip $(1))))))
cygufile = $(call cygnus,u,$(1))
cygupath = $(call cygnus,up,$(1))
cygulist = $(subst $(space),:,$(call cygnus,up,$(subst $(space),\;,$(1))))

# Rule target
RT = $(call cygwfile,$@)
# First dependend
RF = $(call cygwfile,$<)
# Newer dependend
RN = $(call cygwlist,$?)
# All dependend
RA = $(call cygwlist,$^)
# Stem of rule target
RS = $(call cygwfile,$*)

# Rule target without extension
RTB = $(call cygwfile,$(basename $@))
# First dependend without extension
RFB = $(call cygwfile,$(basename $<))

# Rule target directory
RTD = $(call cygwfile,$(@D))
# First dependend directory
RFD = $(call cygwfile,$(<D))

else

# Functions to convert file names
cygwfile = $(1)
cygwpath = $(1)
cygwlist = $(1)
cygufile = $(1)
cygupath = $(1)
cygulist = $(1)

# Rule target
RT = $@
# First dependend
RF = $<
# Newer dependend
RN = $?
# All dependend
RA = $^
# Stem of rule target
RS = $*

# Rule target without extension
RTB = $(basename $@)
# First dependend without extension
RFB = $(basename $<)

# Rule target directory
RTD = $(@D)
# First dependend directory
RFD = $(<D)

endif

endif

========================== cygwin.cfg ==============


---------------------------------------- Message History ----------------------------------------


From: Jason.Tishler@dothill.com on 29/06/2000 14:13

To:   tomyeh@infoshock.com
cc:   cygwin@sourceware.cygnus.com
Subject:  Re: Running a NT program from cygwin



Tom,

"Tom M. Yeh" wrote:

> It works if I
> place $(cygpath -w $(shell pwd)), but I don't like the platform dependency.
> I can add if/else/endif, but...

This is exactly what we do -- I don't see anyway around this.  It is
certainly much better than trying to maintain two makefiles -- one for
UNIX (ie, GNU make) and one for Windows (ie, Microsoft nmake).

> Any hint, why does the problem, I mentioned, happen?

Your "problem" is due to non-Cygwin apps (eg, cl) do not understand
Cygwin constructs such as mount points, symlinks, etc.  The way to
map back and forth is cygpath.

> Invoke: e /usr/include/stdio.h -> FAIL, c:\cygwin\usr\usr\include\stdio.h is

My guess would be that e is actually trying to open

    c:\usr\include\stdio.h

and not

    c:\cygwin\usr\usr\include\stdio.h

This is because the Win32 CreateFile and open *can* deal with forward
slashes but will use the current drive letter for absolute paths if
none is supplied.

I refer you to the "Mapping path names" section of the Cygwin User's
Guide:

    http://sourceware.cygnus.com/cygwin/cygwin-ug-net/using.html#MOUNT-TABLE

for more information.

Jason

--
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corporation         Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com





--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list