www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/06/20:37:13

Xref: news2.mv.net comp.os.msdos.djgpp:8368
From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Makefiles on DOS
Date: Fri, 06 Sep 1996 18:11:32 -0700
Organization: Three pounds of chaos and a pinch of salt
Lines: 53
Message-ID: <3230CBC4.4A67@cs.com>
References: <50nndq$kv9 AT newsgate DOT sps DOT mot DOT com>
NNTP-Posting-Host: ppp203.cs.com
Mime-Version: 1.0
To: rmemory AT phxtc DOT sps DOT mot DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Richard Memory wrote:
> 
> I'm a newcomer to the world of development with DJGPP and DOS. I have
> been trying in vain the past few days to get a "simple" makefile
> running. I originally wrote it for unix, but am now porting the
> application to dos. All of the documentation that I have read with
> the INFO utility seems to be general purpose and more intended for
> a unix environment.
> 
> My problem in general is this:
> 
> If I don't use macros in the command (ie. hardcode everything), and
> have everything all in one directory it works fine. If I try to
> start using mutiple directorys for everything, for example, a source
> directory, an object file directory, an executable directory, etc.
> the make utility will stop. I have tried a variety of different
> things with no success. My guess is that make doesn't like the
> backslash that dos uses, but I don't know how to get around it.

GNU Make works perfectly well with either forward or backslashes.  For
just about any DJGPP or Unix-derived program, forward slashes should
work just as well as backslashes, but for DOS programs which *require*
backslashes, simply use another backslash to 'escape' them.  See, under
Unix, the backslash is an escape character, and thus if you just do
something like this:

foo.exe : foo.o
	...
	gcc -I..\..\include\sys ...

Then what gcc will actually _get_ is "-I....includesys", which is
meaningless.  The fix is to use '\\' each time you want '\' to appear
in your command lines.  I was going to post an example of this with
recursive Make's, but for the life of me I can't think of anything,
so I will have to leave that up to you.

Unfortunately, this particular feature of Unixy programs is not obvious
and intuitive to native DOS users who've never experienced Unix before.
But C and Unix are highly intertwined, and the backslash system _is_ a
major feature of C programming.  If you've ever looked at C programs
which interface with files, you'll probably have seen the double-backslash
convention before.  You just have to get used to it.  :)

John <fighteer AT cs DOT com>

-- 
                      Anything that happens, happens.
    Anything that, in happening, causes something else to happen, causes
                         something else to happen.
 Anything that, in happening, causes itself to happen again, happens again.
        It doesn't necessarily do it in chronological order, though.
 
                                       --- Douglas Adams

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019