www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/06/25/11:11:15

Date: Thu, 25 Jun 92 10:53:10 -0400
From: unifi!yigal AT uunet DOT UU DOT NET (Yigal Hochberg)
To: uunet!tts.lth.se!exjtmm AT uunet DOT UU DOT NET
Cc: djgpp AT uunet DOT UU DOT NET
Subject: How to make up a makefile?

> Return-Path: <exjtmm AT tts DOT lth DOT se>
> From: Thommy "M." Malmstroem <uunet!tts.lth.se!exjtmm>
> Date: Thu, 25 Jun 92 14:23:58 +0200
> To: djgpp AT sun DOT soe DOT clarkson DOT edu
> Subject: How to make up a makefile?
> 
> Hi all!
> 
> What's wrong with this makefile? 
> 
> Gives error:
> C:\TGT>gmake
> make: makefile:5: missing separator. Stop.

(1) Gmake wants a real <TAB> in front of a command-line, for example:

target : dep1 dep1
<TAB>echo dep1 dep2

In your specific case for example you need:

tgt.exe : timer.o setup.o trafsig.o signals.o tgt.o
<TAB>gcc -o tgt timer.o setup.o trafsig.o signals.o tgt.o
<TAB>strip tgt
<TAB>aout2exe tgt


(2) Other comments:

(a) Why don't you use generic rule for compilation:

%.o : %.c
	$(CC) -c $(CFLAGS) $<

And then you will not need a line per individual "c" file.

(b) You can also use some builtin macros like $^ $@ $? etc. for example:

tgt.exe : timer.o setup.o trafsig.o signals.o tgt.o
         gcc -o $(basename $@) $^
         strip $(basename $@)
         aout2exe $(basename $@)

I hope it helps.

- Yigal
 
Yigal Hochberg                                 yigal AT unifi DOT com
Unifi Communications Corp.                     Tel: 508-663-7570
4 Federal St.                                  Fax: 508-663-7543
Bellerica, MA 01821                            

- Raw text -


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