[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Should build dependents when headers change
From: |
Henrik Carlqvist |
Subject: |
Re: Should build dependents when headers change |
Date: |
Sat, 24 Jun 2006 19:55:19 +0200 |
User-agent: |
Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) |
"Eric Lilja" <mindcooler@gmail.com> wrote:
> My problem is that when I do a change in either header and then perform
> a make, make doesn't think anything needs to be recompiled. So I end up
> doing $ make clean ; make which, of course, rebuilds everything. How
> should I teach make to recompile files dependent on the headers I
> mentioned above whenever they have been changed?
I don't know if this group has a FAQ, but I did answer this only two days
ago and it seems that only 5 more messages has been written in this group
since then.
Method 1)
Manually add lines like:
crc32.o: crc32.h globals.h
Method 2)
Let gcc do the job for you, modify the following lines in your Makefile:
%.o: %.cpp %.d
$(CXX) $(CXXFLAGS) $<
%.d: %.cpp
$(CXX) -MM $(CXXFLAGS) -MT $@ $< > $@
ifneq ($(wildcard *.d),)
include $(wildcard *.d)
endif
clean:
rm -f $(OBJECTS) $(EXEC) *~ *.stackdump *.d
regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc8(at)uthyres.com Examples of addresses which go to spammers:
root@variousus.net root@localhost