This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: cp.exe bug


> > > Problem:
> > > fileutils version 4.1-2, specifically: cp.exe does not 
> work properly.
> > >

[ ... Snip ... ]

> 
> I've narrowed it down to running `make' on my linux Makefiles, simple
> example follows:
> 
> ####### Simple Makefile Example
> 
> CC= gcc
> 
> OBJ= foo.o
> FILE= foo.c
> BIN= foo
> 
> all: $(BIN) install
> 
> $(BIN): $(OBJ)
>  $(CC) -o $(BIN) $(OBJ)
> 
> $(OBJ):
>  $(CC) -c $(FILE) -o $(OBJ)
> 
> install:
>  mkdir -p ./bin/;
>  cp $(BIN) ./bin/;
> 
> ####### End Makefile> 
> 
> >From prompt:
> 
> $ make
> mkdir -p ./bin/;
> cp foo ./bin/;
> cp: `foo' and `./bin/foo' are the same file
> make: *** [install] Error 1
> 
> 
> The problem I believe is that `Make' outputs the binary `foo' 
> as `foo.exe'
> which causes `cp.exe' to fail. This had previously worked 
> fine with the
> version of `cp.exe' included with `fileutils 4.1-1'
> 
> Workaround:
> Modify all existing Makefiles by adding the proper file 
> extension to the
> binary.
> 
> Example:
> BIN= foo
> 
> Should be changed to:
> BIN= foo.exe
> 
> 
> 

I cut more from my makefile and just use one symbolic in place of your BIN,
OBJ, and FILE as follows:

####### Even More Simple Makefile Example

CC= gcc

FILE= foo

all: $(FILE).exe install

$(FILE).exe: $(FILE).o
 $(CC) -o $(FILE).exe $(FILE).o

$(FILE).o:
 $(CC) -c $(FILE).c -o $(FILE).o

install:
 mkdir -p ./bin/;
 cp $(FILE).exe ./bin/;

####### End Makefile



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]