$(OBJDIR)/kexec/purgatory.c is a target and needs special treatment,
else calling make clean on an already clean tree will cause it -
and as a result a whole bunch of other stuff - to be built only
to be immediately cleaned.

There are some more pathological cases, where users manually
removed .d files, and then these are regenerated (but not removed)
on make clean. However this change does ensure that the following
is a bit more sensible.

  make clean; make clean
    
Signed-OFf-By: Simon Horman <[EMAIL PROTECTED]>

diff --git a/kexec/Makefile b/kexec/Makefile
index bf99b03..d6da94d 100644
--- a/kexec/Makefile
+++ b/kexec/Makefile
@@ -16,14 +16,19 @@ KEXEC_C_SRCS+= kexec/kexec-elf-exec.c 
 KEXEC_C_SRCS+= kexec/kexec-elf-rel.c 
 KEXEC_C_SRCS+= kexec/kexec-elf-boot.c 
 KEXEC_C_SRCS+= kexec/crashdump.c
-KEXEC_C_SRCS+= $(PURGATORY_HEX_C)
+KEXEC_C_GENERATED_SRCS+= $(PURGATORY_HEX_C)
 KEXEC_S_SRCS:= 
+KEXEC_S_GENERATED_SRCS:= 
 include kexec/arch/$(ARCH)/Makefile
 
-KEXEC_C_OBJS:= $(patsubst %.c, $(OBJDIR)/%.o, $(KEXEC_C_SRCS))
+KEXEC_C_OBJS:= $(patsubst %.c, $(OBJDIR)/%.o, $(KEXEC_C_SRCS) \
+              $(KEXEC_C_GENERATED_SRCS))
 KEXEC_C_DEPS:= $(patsubst %.c, $(OBJDIR)/%.d, $(KEXEC_C_SRCS))
-KEXEC_S_OBJS:= $(patsubst %.S, $(OBJDIR)/%.o, $(KEXEC_S_SRCS))
+KEXEC_C_DUMMY_DEPS:= $(patsubst %.c, $(OBJDIR)/%.d, $(KEXEC_C_GENERATED_SRCS))
+KEXEC_S_OBJS:= $(patsubst %.S, $(OBJDIR)/%.o, $(KEXEC_S_SRCS) \
+              $(KEXEC_S_GENERATED_SRCS))
 KEXEC_S_DEPS:= $(patsubst %.S, $(OBJDIR)/%.d, $(KEXEC_S_SRCS))
+KEXEC_S_DUMMY_DEPS:= $(patsubst %.c, $(OBJDIR)/%.d, $(KEXEC_S_GENERATED_SRCS))
 KEXEC_SRCS:= $(KEXEC_C_SRCS) $(KEXEC_S_SRCS)
 KEXEC_OBJS:= $(KEXEC_C_OBJS) $(KEXEC_S_OBJS)
 KEXEC_DEPS:= $(KEXEC_C_DEPS) $(KEXEC_S_DEPS)
@@ -40,6 +45,18 @@ include $(KEXEC_DEPS)
        mkdir -p $(@D)
        $(CC) $(KCFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst 
%.d,%.o,$(@))|' > $@
 
+# This is needed to ensure that the rule below that depend
+# on each .c file having a .d file don't break
+$(KEXEC_C_DUMMY_DEPS): $(OBJDIR)/%.d: %.c
+       mkdir -p $(@D)
+       touch $@
+
+# This is needed to ensure that the rule below that depend
+# on each .S file having a .d file don't break
+$(KEXEC_S_DUMMY_DEPS): $(OBJDIR)/%.d: %.S
+       mkdir -p $(@D)
+       touch $@
+
 $(KEXEC_C_OBJS): $(OBJDIR)/%.o: %.c $(OBJDIR)/%.d
        mkdir -p $(@D)
        $(CC) $(KCFLAGS) -o $@ -c $<

--

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/

_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to