On Fri, Oct 24, 2008 at 12:45 AM, Peng Yu <[EMAIL PROTECTED]> wrote:
> On Thu, Oct 23, 2008 at 8:59 PM, Greg Chicares <[EMAIL PROTECTED]> wrote:
>> On 2008-10-23 23:49Z, Peng Yu wrote:
>> [...issues with generating dependency files]
>>
>> http://make.paulandlesley.org/autodep.html
>
> Are you referring to this section?
> Avoiding ``No rule to make target ...'' Errors
>
> I'm not sure how to adapt it to my problem, as my problem arises when
> the dependence file is modified externally. Would you please let me
> know how to change my Makefile?
I guess. I figure out how to use it. See below for the source code and
the Makefile. After running make, I can change nothing3.hpp to
nothing2.hpp. The make still runs after the modification.
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' -e '/^$$/ d' -e
's/$$/ :/' < $*.d >> $*.P; \
But the above line is too hard to understand. Can somebody explain
what eche command after -e does?
The first one 's/#.*//' seems removes the comment, right? But would
g++ -MM generate comments?
Thanks,
Peng
=================================
$ for f in *.cpp *.hpp; do echo //$f; cat $f; done; echo \#Makefile;
cat Makefile
//main.cpp
#include "print.hpp"
int main() {
print();
}
//nothing1.hpp
#include "nothing3.hpp"
//nothing3.hpp
//print.hpp
#include "nothing1.hpp"
#include <iostream>
void print() {
std::cout << "Hello World" << std::endl;
}
#Makefile
.PHONY: all
all: main.exe
main.exe : main.o
$(CC) $< $(LOADLIBES) $(LDLIBS) -o $@
SRC = main.cpp
MAKEDEPEND = g++ -MM $(CPPFLAGS) -o $*.d $<
%.o: %.cpp
$(MAKEDEPEND); \
cp $*.d $*.P; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' -e
'/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
rm -f $*.d
$(COMPILE.c) -o $@ $<
-include $(SRC:.cpp=.P)
clean:
@$(RM) *.o *.exe *.d *.P
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make