[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Reg Make build on LINUX

From: A, Sravanthi
Subject: RE: Reg Make build on LINUX
Date: Mon, 16 Jun 2008 18:00:55 +0530

Smith /Team,

Can you help on one issue in compiling. Issue: When any changes to
dependant files are changed, make is not rebuilding the binaries. Can
you please help on this. I tried to use -MM, -MP options, but still it
says binary is up to date after I made changes.

For example my c file is dependant on d3.h and d4.h.
gfilnx1d/sa20358(153)$ touch d4.h
gfilnx1d/sa20358(154)$ make -f make1.mk
make: `a' is up to date.

gfilnx1d/sa20358(157)$ cat make1.mk
CC = gcc 
CFLAGS = -I/home/sa20358/wip 
a: a.o 
        $(CC) $(CFLAGS) $? -o $@ 
%.o: %.c 
        #generate the *.d file with the dependency targets. 
        $(CC) $(CFLAGS) -MM -MP $< > $(subst .o,.d,$@) 
        $(CC) $(CFLAGS) -c $*.c 
        -include a.d
C file
gfilnx1d/sa20358(158)$ cat a.c
int main()
{int i=10;
printf("Number: %d", i);
printf("Hello World\n");

a.d file:
gfilnx1d/sa20358(160)$ cat a.d
a.o: a.c /home/sa20358/wip/d3.h /home/sa20358/wip/d4.h


-----Original Message-----
From: A, Sravanthi [CCC-OT_IT] 
Sent: Saturday, May 24, 2008 11:33 AM
To: 'address@hidden'
Cc: address@hidden; Dave Korn
Subject: RE: Reg Make build on LINUX


Thanks a lot for your reply. That answers my problem. Let me try this
and get back. I have one more issues if you can help?

My make doesn't build with latest files if any changes done. Let me know
any alternative without makedepends. 
Also can you send me link for [ You should rewrite your recursion as
discussed in the GNU make manual, with a separate rule for each

-----Original Message-----
From: Paul Smith [mailto:address@hidden
Sent: Friday, May 23, 2008 11:52 PM
To: Dave Korn
Cc: A, Sravanthi [CCC-OT_IT]; address@hidden
Subject: RE: Reg Make build on LINUX

On Fri, 2008-05-23 at 19:14 +0100, Dave Korn wrote:
> A, Sravanthi wrote on 23 May 2008 12:14:
> > Hi team,
> > 
> > Iam trying to build my application using make on Linux server. But 
> > my build doesn't stop after first error. I tried -S options  but 
> > doesn't seems to help.
>   The top-level makefile might be invoking the sub-makes using "-" at 
> the start of the commandline to suppress errors?  See the "Errors in
> section of the man/info page.

It's almost certainly the classic case of using a for-loop to do
recursion, like this:

                for dir in $(SUBDIRS); do cd $$dir && $(MAKE) all; done

or similar.  If one of the sub-makes other than the last one fails, the
loop doesn't fail it just keeps going.

Solaris make invokes all shells with the "-e" flag, which causes the
command to exit immediately on any error, so the above "works".
However, it is not conformant to the POSIX spec for make, and GNU make
has never worked like that.

You should rewrite your recursion as discussed in the GNU make manual,
with a separate rule for each subdirectory.  That way when one fails,
the make will fail (and flags like -k and -j will work properly as

 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.us
 "Please remain calm...I may be mad, but I am a professional." --Mad

reply via email to

[Prev in Thread] Current Thread [Next in Thread]