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 09:52:08 +0530


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]