[Top][All Lists]

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

Strange behaviour

From: qun-ying
Subject: Strange behaviour
Date: Tue, 21 Nov 2000 19:36:55 +0800
User-agent: Mozilla/5.0 (X11; U; Linux 2.2.17 i686; en-US; m18) Gecko/20001119


I have encounter this stragne behaviour. It is properly due to my writing of the Makefile. But how do I solve this kind of problem?

I want the object files to be placed in the object directory and latter link against them.

I am running make 2.79.1 under Linux 2.2.17 (slackware 7.1) with gcc 2.95.2.

I have attached a minimum test case. you first may need to create a ./obj directory before making the file.

The problem I encounter is that I always fail on the first attemt to make the file. but second time it is alright.

first time run:
gcc -c -o ./obj/hello.o hello.c
gcc -o hello hello.o
gcc: hello.o: No such file or directory
gcc: No input files
make: *** [hello] Error 1

second time:
gcc -o hello ./obj/hello.o

#include <stdio.h>

int main(void)
    printf("hello world\n");

    return 0;
vpath %.o ./obj
hello: hello.o
        gcc -o $@ $<

%.o: %.c
        gcc -c -o ./obj/$@ $<

reply via email to

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