[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
make question (dependency)
From: |
James |
Subject: |
make question (dependency) |
Date: |
10 Feb 2006 11:49:41 -0800 |
User-agent: |
G2/0.2 |
How NOT to generate an empty dependency file if fails? For example,
TOP = $(HOME)
%.d: %.c
$(CC) -M $< | sed "s/$(TOP)/$$(TOP)/" > $@
if $(CC) -M fails, it generates an empty .d file.
.DELETE_ON_ERROR:
does not seem to help.
I could try
%.d: %.c
if [ "`$(CC) -M $<`" ]; then \
$(CC) -M $< | sed "s/$(TOP)/$$(TOP)/" > $@; \
else \
echo "Error"; \
fi
but it excutes $(CC) -M twice and not efficient.
Thanks for help.
James
- make question (dependency),
James <=