summaryrefslogtreecommitdiff
path: root/kexec/Makefile
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2006-09-22 10:46:12 +0900
committerSimon Horman <horms@verge.net.au>2006-10-06 12:46:16 +0900
commita9df6cb0ac92be0a87eb03ed28d398912915d2ed (patch)
tree63b15845575275f8f0edc8e0c3d9c734a81126c8 /kexec/Makefile
parent80826bf7234184cef22756a11337657c65b89bf3 (diff)
downloadkexec-tools-a9df6cb0ac92be0a87eb03ed28d398912915d2ed.tar.gz
build-no-partial-rebuild-on-clean
[BUILD] Don't do a partial build on clean $(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 <horms@verge.net.au>
Diffstat (limited to 'kexec/Makefile')
-rw-r--r--kexec/Makefile23
1 files changed, 20 insertions, 3 deletions
diff --git a/kexec/Makefile b/kexec/Makefile
index f8c2f18..7a26106 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 @@ $(KEXEC_S_DEPS): $(OBJDIR)/%.d: %.S
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 $<