delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/09/17:08:30

Message-Id: <3.0.16.19971009230603.385f3c22@hem1.passagen.se>
Date: Thu, 09 Oct 1997 23:06:06 -0400
To: djgpp AT delorie DOT com
From: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>
Subject: Re: How to create Makefiles ????
Mime-Version: 1.0

At 17.06 1997-10-08 +1000, you wrote:
>Hi ,
>
>I'm new to DJGPP and I can't seem to find information on how to
>write a Makefile. I'm currently using RHIDE 1.4 (I love this fantastic
>IDE !) but I also would like to learn using makefiles.
>
>Can anyone give me some basic info on that ? A skeletal frame of a
>Makefile contents and some explanation would be very much appreciated.

Well, you could try "info make" if you have downloaded and installed the
info thingy. And also remember not to use the DOS Edit program, because
make needs real tabs (atleast it doesn't work for me otherwise) and Dos
Edit doesn't support that. 

The very basic structure would be something like:

all: <target>
        <commands to make target>

<file1>: <file1dependencies>
        <commands to make file1>

<file2>: <file2dependencies>
        <commands to make file2>

Say I have a file named runme.exe that would be created from two object
files called main.o and extra.o which would be made of main.c and extra.c,
where main.c locally includes main.h and extra.c includes both main.h and
extra.h, the makefile would look something like this:

all: runme.exe
        gcc -o runme.exe main.o extra.o

extra.o: main.h extra.h
        gcc -c -o extra.o extra.c

main.o: extra.h
        gcc -c -o main.o main.c

And remember to use REAL tabs. 

(I haven't tested the makefile example above, but I think it would work)


-- Peter Palotas alias Blizzar -- blizzar AT hem1 DOT passagen DOT se --

*****************************************************
* A brief description of DJGPP:                     *
* NEVER BEFORE HAS SO FEW DONE SO MUCH FOR SO MANY! *
*****************************************************

- Raw text -


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