help-make
[Top][All Lists]
Advanced

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

dependency problem


From: Bhaskar G
Subject: dependency problem
Date: Tue, 26 Jun 2007 11:08:52 +0530


Hi All,

Sorry for the incomplete question. I have src/bg.c and src/bg1.c.
src/bg2.c doenot exist. So when I run gmake I expect the error message "make: *** No rule to make target `src/bg2.o', needed by `bg.a'.  Stop."

not  "cc src/bg.o src/bg1.o src/bg2.o -o bg.a
cc: src/bg2.o: No such file or directory
make: *** [bg.a] Error 1"

Thanks & Regards,
Bhaskar


----- Forwarded by Bhaskar G/BTC/SC/PHILIPS on 2007-06-26 11:04 AM -----





Bhaskar G

2007-06-26 09:49 AM

To
address@hidden
cc
Subject
dependency problemLink
Classification
Unclassified




Hi All,

The following makefile results in the below said behaviour. This is true for both gmake 3.80 and gmake 3.81 on RHEL.

SRCS=src/bg.c src/bg1.c src/bg2.c
OBJS=$(SRCS:.c=.o)


bg.a: $(OBJS)
        $(CC) $(OBJS) -o bg.a

$(OBJS):makefile

/tmp/bg/objs/%.o:%.c
        mkdir -p $(dir $@)
        $(CC) -c -o $@ $<

:-)) gmake
cc src/bg.o src/bg1.o src/bg2.o -o bg.a
cc: src/bg2.o: No such file or directory
make: *** [bg.a] Error 1
address@hidden [ /tmp/bg ]

Where as commenting the line $(OBJS):makefile results in another behaviour.

:-)) cat makefile
SRCS=src/bg.c src/bg1.c src/bg2.c
OBJS=$(SRCS:.c=.o)


bg.a: $(OBJS)
        $(CC) $(OBJS) -o bg.a

#$(OBJS):makefile

/tmp/bg/objs/%.o:%.c
        mkdir -p $(dir $@)
        $(CC) -c -o $@ $<


:-)) gmake
make: *** No rule to make target `src/bg2.o', needed by `bg.a'.  Stop.

How do I get the second behaviour with the first implementation.


Thanks in advance for you help.

Thanks & Regards,
Bhaskar


reply via email to

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