From: Jason Green Newsgroups: comp.os.msdos.djgpp Subject: Re: problem with cat redirection in a makefile Date: Fri, 20 Apr 2001 00:01:04 +0100 Lines: 77 Message-ID: <3erudtsj35122mstnv610spcci3lcrgenj@4ax.com> References: NNTP-Posting-Host: modem-81.uranium.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: newsg1.svr.pol.co.uk 987721236 30259 62.136.65.209 (19 Apr 2001 23:00:36 GMT) NNTP-Posting-Date: 19 Apr 2001 23:00:36 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Agent 1.7/32.534 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com drososa AT pat DOT forthnet DOT gr () wrote: > Problem: In a project makefile there is a need to concatenate two binary > files together, so the cat command is used. What is observed is that this > command sometimes works and most often not. When it doesn't, the binary > characters of the two files are dumped on screen. > > Environment: MS-DOS Prompt window in Windows 98 second edition. > > Here is a makefile sample that duplicates the problem. The files involved > can be any binary files. > ------------------------- > MAINEXE = image > COPY = cat > > > all: $(MAINEXE).elf > > $(MAINEXE).elf: > $(COPY) signram.atm $(MAINEXE).bin > $(MAINEXE)_ram.bin > ------------------------- The makefile you show should work fine. The target (image.elf) does not match the output of the concatenation (image_ram.bin), but I assume this is because you have simplified the makefile from something else. Firstly, check you are invoking the correct make with the command `make --version'. I suggest to simplify the makefile further, and add a target to check the correct `cat' is being called: all: cat signram.atm image.bin > image_ram.bin cat_version: cat --version > cat_vers.txt Try that and cut and paste here the output of `make cat_version' and the contents of cat_vers.txt. > Trying the "copy /b" dos equivalent with the appropriate syntax change (i.e. > copy /b file1+file2 file3), I get the error message > > make.exe: *** [image.elf] Error -1 This should work fine too, but you need to cut and paste the makefile (and full errors) here, to say for sure. > Trying to find the dos or windows executable copy.exe it appears that it > does not exist. Perhaps it is included in some command.com file somewhere. Yes, it is built in to command.com. There is an xcopy.exe though, with its own options of course. > If it matters, my path is > PATH= > C:\DJGPP\BIN;C:\DJGPP\JED\BIN;C:\BIN;C:\PYTHON20;C:\WINDOWS;C:\WINDOWS\COMMAND What would also matter is if you have set the SHELL environment variable, this is the only thing I can think is causing the misbehaviour you report. Please post here the output of `make show_shell' if you add the following lines to the makefile: show_shell: echo "$(SHELL)" > I have also tried putting the C:\WINDOWS\COMMAND entry at the PATH beginning but No. Don't do that. :) > the behaviour is still the same. Have also tried playing with the window > settings such as memory and environment with no success. Are you running make from an MS-DOS prompt, or some other shell? > Can anyone shed some light on this?