Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: shivrajang@yahoo.com (Shiva Gowda)
Subject: Re: make command problem with dependencies..!
Date: 19 Oct 2001 01:55:32 -0700	[thread overview]
Message-ID: <c8246df4.0110190055.3a7367fc@posting.google.com> (raw)
In-Reply-To: c8246df4.0110180402.764c9a26@posting.google.com

shivrajang@yahoo.com (Shiva Gowda) wrote in message news:<c8246df4.0110180402.764c9a26@posting.google.com>...
> Hello Gurus...
> 
> Not sure this is the right place for make command problem! If not please
> redirect me to the right list!!!
> 
> I have a problem with one of my Makefile. here is the makefile
> 
> $ sizer -v
> Digital UNIX V4.0G (Rev. 1530); Thu Dec  7 13:46:52 MET 2000
> $ ls  
> Makefile      _defaultRule  header.h      hello.c
> $ cat _defaultRule
> .SUFFIXES : .c
> 
> local : $(DELIVER)
> 
> .c : $$@.c $(INCLUDE_FILES)
>         cc -o $@ $@.c
> 
> $ cat Makefile
> INCLUDE_FILES=\
>         header.h
> 
> DSOURCE=\
>         hello.c
> 
> DELIVER=$(DSOURCE:.c=)
> 
> include _defaultRule
> 
> clean :: 
>         rm -f hello
> 
> $ cat header.h
> #include <stdio.h>
> 
> #define MESSAGE "Hello, World!\n"
> 
> $ cat hello.c
> #include "header.h"
> 
> main() {
> 
>         printf("%s", MESSAGE);
> 
> }
> --------------------------------------------------------
> 
> the steps below shows the problem.
> 
> $ type make
> make is a tracked alias for /bin/make
> $ make local
> cc -o hello hello.c
> $ echo "#define DAY MONTAG" >> header.h
> $ make local
> $ make clean
> rm -f hello
> $ /usr/bin/posix/make local
> cc -o hello hello.c
> $ echo "#define DAY1 MONTAG" >> header.h
> $ /usr/bin/posix/make local
> cc -o hello hello.c
> $
> 
> I'm using echo just to update one of the dependency, here it is header.h.
> my question is: why hello.c file not gets compiled when there is a change 
> in the dependency with base make? 
> 
> Not sure the problem is with my Makefile or with the base make. It works 
> the way I wanted with posix make. I don't want to use posix make as the build
> environmet uses base make. So.....any workaround otherthan posix make???
> 
> thx a lot..
> 
> -shiva


Well, just an update. One of my friend suggested me a workaround which
works pretty well.

Here is my updated _defaultRule 

$ cat _defaultRule 

.SUFFIXES : .c

local : $(DELIVER)

$(DELIVER) : $$@.c $(INCLUDE_FILES)

.c : 
        cc -o $@ $@.c

The idea is to have dependency on the target!! 
so, base make works fine with this makefile.

-shiva


      reply	other threads:[~2001-10-19  8:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-18 12:02 make command problem with dependencies..! Shiva Gowda
2001-10-19  8:55 ` Shiva Gowda [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox