the following Makefile (and make-3.79.1):

        DIRA=.
        DIRB=b
        CFLAGS_A=-O2
        CFLAGS_B=-g

        $(DIRA)/%.o: $(DIRA)/%.c
                gcc $(CFLAGS_A) -o $@ -c $<

        $(DIRB)/%.o: $(DIRB)/%.c
                gcc $(CFLAGS_B) -o $@ -c $<

and the command:

        make ./a.o b/b.o

executed the wrong commands:

        gcc -O2 -o a.o -c a.c
        gcc -O2 -o b/b.o -c b/b.c # "-O2" should be "-g"

whereas this Makefile:

        DIRA=.
        DIRB=b
        CFLAGS_A=-O2
        CFLAGS_B=-g

        $(DIRB)/%.o: $(DIRB)/%.c
                gcc $(CFLAGS_B) -o $@ -c $<

        $(DIRA)/%.o: $(DIRA)/%.c
                gcc $(CFLAGS_A) -o $@ -c $<

and the same command:

        make ./a.o b/b.o

executes the correct commands:

        gcc -O2 -o a.o -c a.c
        gcc -g -o b/b.o -c b/b.c

raf


_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to