aboutsummaryrefslogtreecommitdiff
path: root/Makefile.include.in
diff options
context:
space:
mode:
authorelupus <elupus@xbmc.org>2011-07-23 20:22:40 +0200
committerelupus <elupus@xbmc.org>2011-07-23 20:57:07 +0200
commitafc1bf87b1a4582643ebd8e62ae3943204455a2b (patch)
tree685b3652543e55a16ee80455db41eb36258a107c /Makefile.include.in
parent6697e565c23fb648b0bd274fb06a282beae33be7 (diff)
fixed: make sure .P files get deleted on ctrl+C
Diffstat (limited to 'Makefile.include.in')
-rw-r--r--Makefile.include.in106
1 files changed, 49 insertions, 57 deletions
diff --git a/Makefile.include.in b/Makefile.include.in
index 93cd32eac8..04fcbf8574 100644
--- a/Makefile.include.in
+++ b/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