delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/21/23:24:56

Date: Sun, 22 Nov 1998 04:21:59 +0000 (GMT)
From: George Foot <george DOT foot AT merton DOT oxford DOT ac DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Makefile Beginner
In-Reply-To: <737m7o$jp0$1@oak.prod.itd.earthlink.net>
Message-ID: <Pine.OSF.4.05.9811220415050.8417-100000@sable.ox.ac.uk>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Sat, 21 Nov 1998, Chris Dupuy wrote:

>     I have been playing with djgpp for about three days now, I usually use
> MSVC for my compiler, but lately decided to check out djgpp.  My problem is
> in the makefile, I can't seem to get any makefile to work properly, even
> when copying them directly out of the HTML help page.

Which help page?

>     Here is my make as it sits, and the message I am getting back is "unable
> to find rule to make target gcc needed by main.o".. What?  My make seems to
> work ok on the Linux box, am I missing something, or am i just stupid?

You copied them wrongly.  You ought to read the Info
documentation -- `info make' -- but briefly, the basic syntax
is:

    target: dependencies
    <tab>command

You can have more than one command -- put them on separate
lines, in the order they should be executed.  They must be
indented using real tab characters.  Your makefile ends up
looking like this (but watch out for the tabs):

    CC=gcc
    CFLAGS = -c
    
    MkTest.exe : main.o serversocket.o
    
    main.o : main.cc 
    <tab>$(CC) $(CFLAGS) main.cc -o main.o
    
    serversocket.o : serversocket.cc
    <tab>$(CC) $(CFLAGS) -c  serversocket.cc -o serversocket.o

There are still some problems with it though.  I don't think
Make knows how to make the .exe like that -- you must tell it.
Also you could just lean on the built-in rules here and write a
much shorter makefile, but at first it's probably best to learn
one thing at a time.

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

xu do tavla fo la lojban  --  http://xiron.pc.helsinki.fi/lojban/

- Raw text -


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