www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/18/17:20:24

From: George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Can't MAKE
Date: 18 Nov 1997 21:09:54 GMT
Organization: Oxford University, England
Lines: 66
Message-ID: <64t072$64u$1@news.ox.ac.uk>
References: <ABcb0PqSO6 AT rsuzi DOT pgu DOT karelia DOT ru> <Pine DOT OSF DOT 3 DOT 96 DOT 971118152537 DOT 22706C-100000 AT barra DOT jcu DOT edu DOT au>
NNTP-Posting-Host: sable.ox.ac.uk
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Tue, 18 Nov 1997 15:36:45 +1000 in comp.os.msdos.djgpp Oon Lin <sci-okl AT jcu DOT edu DOT au> wrote:

: makefile:2: *** missing separator.  Stop.

: What does that mean ?? It drives me crazy.. I know that make needs real
: tabs in MAKEFILE . Since DOS EDIT doesn't support real tab , I had got VIM
: , which is similiar to VI in UNIX , to write a makefile but the same error
: still appears.

Perhaps vim is also not using real tabs... I haven't used it for a
while.  If you know how to use debug, you could debug the makefile and
find out whether it really does have real tabs, or spaces.  IIRC in
the Win95 DOS Edit you can insert real tabs by typing Ctrl-P Ctrl-I.
It's flaky, though; if you do too much editing it can change them all
back into spaces again. :(

Note that you can get around this problem to some extent by leaving
out the commands in your makefile ;).  Make already knows how to do
most of what you want it to do... you can rewrite your makefile like
this:

--- begin makefile ---
# Tell Make what compiler to use
CC = gcc

# Tell Make what flags to pass for C compilation (you didn't use any
# but this is how you pass them)
CFLAGS = -O2 -Wall -g

# The following rule runs the value of `CC'. $@ expands to the target
# name (program.exe in this case), and $^ expands to the complete
# dependency list (mainsrc.o printer.o header.o in this case)

program.exe: mainsrc.o printer.o header.o
	$(CC) -o $@ $^

# The following rules don't have commands given.  Make will look
# through its internal database to decide what to do to them.

mainsrc.o: mainsrc.c printer.h header.h

printer.o: printer.c printer.h

header.o: header.c header.h

--- end makefile ---

Now it only has one tab in it -- less opportunity for Edit to corrupt
it ;).

Also a brief comment on your C code... In mainsrc.c you have:

: void main(void) {

This is bad.  The `main' function must return an integer -- you should
declare it like this:

int main (void) {

and you should put in a `return' statement before the closing brace.

And finally, your `header.c' and `printer.c' files should have
`#include <stdio.h>', since they use printf.

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

- Raw text -


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