www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/12/20/16:47:41

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Should I use bash as default shell in makefiles?
Date: Thu, 20 Dec 2001 21:41:55 +0000
Lines: 30
Message-ID: <pll42u4ptd5iv2bbo8790jcd5v1jni9ba5@4ax.com>
References: <809aeb88 DOT 0112171814 DOT 317a55ad AT posting DOT google DOT com> <200112200325 DOT fBK3P8528329 AT envy DOT delorie DOT com> <809aeb88 DOT 0112200908 DOT 59cd0b1f AT posting DOT google DOT com>
NNTP-Posting-Host: modem-172.change-management-shark.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: news7.svr.pol.co.uk 1008884549 2537 62.137.10.172 (20 Dec 2001 21:42:29 GMT)
NNTP-Posting-Date: 20 Dec 2001 21:42:29 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Agent 1.7/32.534
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

big10p AT hotmail DOT com (Chris Chadwick) wrote:

> DJ Delorie <dj AT delorie DOT com> wrote in message news:<200112200325 DOT fBK3P8528329 AT envy DOT delorie DOT com>...

> > http://www.delorie.com/gnu/docs/make/make_16.html talks about
> > automatic dependency generation, but that's more robust (and complex)
> > than most need.  For simple DJGPP Makefiles, just add -MMD to your gcc
> > options, and put this at the end of your Makefile:
> > 
> > DEPS=$(wildcard *.d)
> > ifneq ($(DEPS),)
> > include $(DEPS)
> > endif
> > 
> > And it's best to be simple anyway :-)

Even simpler then:

-include $(sources:.c=.d)

> The main reason I was thinking I'd have to use an alternative shell to
> command.com, was because of this example from the make docs:
> 
> %.d: %.c
>         $(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< \
>               | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
>               [ -s $@ ] || rm -f $@'

I've never understood why the docs say that.  Is there a good reason for
all that effort to create the .d files?

- Raw text -


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