bug-make
[Top][All Lists]
Advanced

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

./ in implicit rule patterns is order dependent


From: raf
Subject: ./ in implicit rule patterns is order dependent
Date: Tue, 21 Nov 2000 21:20:25 +1100

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




reply via email to

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