1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-22 23:16:27 +02:00

poly2h/: auto-generate dependencies also for C++ code

This commit is contained in:
Werner Almesberger 2012-05-07 22:53:45 -03:00
parent a950c5b13c
commit 7f813b5254
2 changed files with 12 additions and 1 deletions

View File

@ -34,22 +34,26 @@ CC_normal := $(CC)
CXX_normal := $(CXX)
AR_normal := $(AR)
DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG
DEPENDXX_normal := $(CPP) $(CXXFLAGS) -MM -MG
CC_quiet = @echo " CC " $@ && $(CC_normal)
CXX_quiet = @echo " CXX " $@ && $(CXX_normal)
AR_quiet = @echo " AR " $@ && $(AR_normal)
DEPEND_quiet = @$(DEPEND_normal)
DEPENDXX_quiet = @$(DEPENDXX_normal)
ifeq ($(V),1)
CC = $(CC_normal)
CXX = $(CXX_normal)
AR = $(AR_normal)
DEPEND = $(DEPEND_normal)
DEPENDXX = $(DEPENDXX_normal)
else
CC = $(CC_quiet)
CXX = $(CXX_quiet)
AR = $(AR_quiet)
DEPEND = $(DEPEND_quiet)
DEPENDXX = $(DEPENDXX_quiet)
endif
# ----- Rules -----------------------------------------------------------------
@ -90,6 +94,14 @@ uninstall:
-e '$${g;p;}' -e d >$*.d; \
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $*.cpp -o $*.o
$(DEPENDXX) $*.cpp | \
sed -e \
'/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
-e '$${g;p;}' -e d >$*.d; \
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
-include $(OBJS:.o=.d)
# ----- Tests -----------------------------------------------------------------

View File

@ -44,7 +44,6 @@ Other:
- change the license from GPL to LGPL
- transform CGAL's idea of outer polygons into something we can use
- check for memory leaks
- try to generate dependencies also for *.cpp
Prerequisite:
libcgal-dev