Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed: make sure .P files get deleted on ctrl+C

  • Loading branch information...
commit afc1bf87b1a4582643ebd8e62ae3943204455a2b 1 parent 6697e56
@elupus elupus authored
Showing with 49 additions and 57 deletions.
  1. +49 −57 Makefile.include.in
View
106 Makefile.include.in
@@ -66,67 +66,59 @@ ifneq ($(V), 1)
SILENT_AR =@echo "AR $@";
endif
+OBJS+=$(filter %.o,$(SRCS:.cpp=.o))
+OBJS+=$(filter %.o,$(SRCS:.c=.o))
+OBJS+=$(filter %.o,$(SRCS:.S=.o))
+OBJS+=$(filter %.o,$(SRCS:.mm=.o))
+OBJS+=$(filter %.o,$(SRCS:.m=.o))
+
+DEPS+=$(filter %.P,$(OBJS:.o=.P))
+
+GEN_DEPS=\
+ cp $*.d $*.P \
+ && sed -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P \
+ && rm -f $*.d \
+ || rm -f $*.P $@
+
+%.o: %.cpp
+ @rm -f $@
+ $(SILENT_CPP) $(CXX) -MD -c $(CXXFLAGS) $(DEFINES) $(INCLUDES) $< -o $@ \
+ && $(GEN_DEPS)
+
+%.o: %.cc
+ @rm -f $@
+ $(SILENT_CC) $(CXX) -MD -c $(CXXFLAGS) $(DEFINES) $(INCLUDES) $< -o $@ \
+ && $(GEN_DEPS)
+
+%.o: %.c
+ @rm -f $@
+ $(SILENT_CC) $(CC) -MD -c $(CFLAGS) $(DEFINES) $(INCLUDES) $< -o $@ \
+ && $(GEN_DEPS)
+
+%.o: %.C
+ @rm -f $@
+ $(SILENT_CC) $(CC) -MD -c $(CFLAGS) $(DEFINES) $(INCLUDES) $< -o $@ \
+ && $(GEN_DEPS)
+
+%.o: %.S
+ @rm -f $@
+ $(SILENT_CC) $(CC) -c $(CFLAGS) $(DEFINES) $(INCLUDES) $< -o $@
-.cpp.o:
- @rm -f ${<:.cpp=.o}
- $(SILENT_CPP) $(CXX) -MD -c $(CXXFLAGS) $(DEFINES) $(INCLUDES) $< -o ${<:.cpp=.o}
- @cp $*.d $*.P; \
- sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
- -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
- rm -f $*.d
-
-.cc.o:
- @rm -f ${<:.cc=.o}
- $(SILENT_CC) $(CXX) -MD -c $(CXXFLAGS) $(DEFINES) $(INCLUDES) $< -o ${<:.cc=.o}
- @cp $*.d $*.P; \
- sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
- -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
- rm -f $*.d
-
-.c.o:
- @rm -f ${<:.c=.o}
- $(SILENT_CC) $(CC) -MD -c $(CFLAGS) $(DEFINES) $(INCLUDES) $< -o ${<:.c=.o}
- @cp $*.d $*.P; \
- sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
- -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
- rm -f $*.d
-
-.C.o:
- @rm -f ${<:.C=.o}
- $(SILENT_CC) $(CC) -MD -c $(CFLAGS) $(DEFINES) $(INCLUDES) $< -o ${<:.C=.o}
- @cp $*.d $*.P; \
- sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
- -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
- rm -f $*.d
-
-.S.o:
- @rm -f ${<:.S=.o}
- $(SILENT_CC) $(CC) -c $(CFLAGS) $(DEFINES) $(INCLUDES) $< -o ${<:.S=.o}
%.h.gch : %.h
$(SILENT_GCH) $(CXX) -c $(CFLAGS) $(DEFINES) $(INCLUDES) $< -o $@
-.m.o:
- @rm -f ${<:.m=.o}
- $(SILENT_MM) $(CXX) -MD -c $(CXXFLAGS) $(DEFINES) $(INCLUDES) $< -o ${<:.m=.o}
- @cp $*.d $*.P; \
- sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
- -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
- rm -f $*.d
-
-.mm.o:
- @rm -f ${<:.mm=.o}
- $(SILENT_MM) $(CXX) -MD -c $(CXXFLAGS) $(DEFINES) $(INCLUDES) $< -o ${<:.mm=.o}
- @cp $*.d $*.P; \
- sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
- -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
- rm -f $*.d
+%.o: %.m
+ @rm -f $@
+ $(SILENT_MM) $(CXX) -MD -c $(CXXFLAGS) $(DEFINES) $(INCLUDES) $< -o $@ \
+ && $(GEN_DEPS)
+
+%.o: %.mm
+ @rm -f $@
+ $(SILENT_MM) $(CXX) -MD -c $(CXXFLAGS) $(DEFINES) $(INCLUDES) $< -o $@ \
+ && $(GEN_DEPS)
-OBJS+=$(filter %.o,$(SRCS:.cpp=.o))
-OBJS+=$(filter %.o,$(SRCS:.c=.o))
-OBJS+=$(filter %.o,$(SRCS:.S=.o))
-OBJS+=$(filter %.o,$(SRCS:.mm=.o))
-OBJS+=$(filter %.o,$(SRCS:.m=.o))
.PHONY : lib pch clean distclean distclean_evil
@@ -137,11 +129,11 @@ pch: $(PCH:.h=.h.gch)
for d in $(DIRS); do (cd "$$d"; $(MAKE) pch ); done
clean:
- $(RM) $(OBJS) *.o $(LIB) $(SLIB) $(CLEAN_FILES) $(PCH:.h=.h.gch) $(OBJS:.o=.P)
+ $(RM) $(OBJS) *.o $(LIB) $(SLIB) $(CLEAN_FILES) $(PCH:.h=.h.gch) $(DEPS)
for d in $(DIRS); do (if test -f "$$d/Makefile"; then ($(MAKE) -C "$$d" clean); fi ); done
distclean:
- $(RM) $(OBJS) *.o $(LIB) $(SLIB) $(STATICLIB) $(CLEAN_FILES) $(DISTCLEAN_FILES) $(PCH:.h=.h.gch) $(OBJS:.o=.P)
+ $(RM) $(OBJS) *.o $(LIB) $(SLIB) $(STATICLIB) $(CLEAN_FILES) $(DISTCLEAN_FILES) $(PCH:.h=.h.gch) $(DEPS)
for d in $(DIRS); do (if test -f "$$d/Makefile"; then ($(MAKE) -C "$$d" distclean || $(MAKE) -C "$$d" clean); fi ); done
if [ "$(shell pwd -P)" = "$(abs_top_srcdir)" ] || \
[ "$(shell pwd)" = "$(abs_top_srcdir)" ]; then rm -f $(AUTOGENERATED_MAKEFILES) Makefile.include Makefile; fi
Please sign in to comment.
Something went wrong with that request. Please try again.