help-gnu-utils
[Top][All Lists]
Advanced

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

Re: Make rule not taken although it matches


From: Sebastian Schuberth
Subject: Re: Make rule not taken although it matches
Date: Mon, 15 Aug 2005 12:21:50 +0200
User-agent: Mozilla Thunderbird 1.0+ (Windows/20050712)

Here's the solution to the problem: make has a built-in implicit rule to make .o files from .c files. I was pretty sure my rule to create .o files from .s files would override this implicit rule, but it does so ONLY IF THE .s FILE ALREADY EXISTS! So the implicit rule has to be explicitly canceled <grin> by adding

%.o: %.c

(with no commands) to the top of the file. For more information read:

http://www.gnu.org/software/make/manual/html_chapter/make_10.html#SEC105
http://www.gnu.org/software/make/manual/html_chapter/make_10.html#SEC114

--
Sebastian Schuberth

Hi,

in my makefile I have two simple rules:

prefix_%.s: prefix_%.c
    # Do something

prefix_%.o: prefix_%.s
        # Do something

The file prefix_test.c exists. When I type "make prefix_test.o", instead of my rule some default rule (which is not present in the file) launching "cc" is run. However, running "make prefix_test.s" works, and running "make prefix_test.o" afterwards (so prefix_test.s exists) works then, too. Why is that? Why can't I create both "prefix_test.s" and "prefix_test.o" in a single step by launching "make prefix_test.o"?

Thanks for any insights.


reply via email to

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