bug-make
[Top][All Lists]
Advanced

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

make error but no message


From: Jeremiah Perry
Subject: make error but no message
Date: Thu, 12 Mar 2009 14:07:56 -0700

Hi,

I don't know if the following is a bug or not, but it came to my
attention recently. I ran make on a project only to have make stop
abruptly with no error messages. After some digging, I found one of my
dependencies referred to a non-existent file. My dependency rules are
in .d files that I then -include into the makefile. See the code
example below. It seems this -include throws make off somehow so it
doesn't issue any error messages. However, when I put the dependencies
explicitly into the makefile, make tells me "*** No rule to make
target `doesnt_exist.h', needed by `test.o'. Stop.", so that seems to
be fine.

Thanks,

Jeremiah

--------------------------------------------------------------------------------------
Makefile:
SRC = $(wildcard *.c)
OBJ = $(SRC:.c=.o)

CC = gcc

all: test

.PHONY = test
test: $(OBJ)
        $(CC) -o test $(OBJ)

%.d : %.c
        @echo Making $@ from $<
        @bash -ec '$(CC) -MM $< | sed "s/$*.o/& $@/g" > $@'

-include $(SRC:.c=.d)

--------------------------------------------------------------------------------------
test.c:
#include <stdio.h>

int main(int argc, char** argv)
{
  puts("just a test\n");
}

--------------------------------------------------------------------------------------
test.d:
test.o test.d: test.c doesnt_exist.h
--------------------------------------------------------------------------------------




reply via email to

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