summaryrefslogtreecommitdiff
path: root/kexec
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2007-12-13 16:18:53 +0900
committerSimon Horman <horms@verge.net.au>2007-12-19 14:50:07 +0900
commitadf85cbc1756e56c1f52f56235a3c08b3c5b8e05 (patch)
tree480e2d89501d7e51f3c7abf3291930932c3a3371 /kexec
parentac12ceecf15f637e024e6be9a030497e732a74eb (diff)
Build system simplification/standardisation
This change makes kexec-tools work more like a standard configure-make- make-install-type project: * Remove $(OBJDIR) stuff. To do an out-of-tree build, just configure from a different directory. * Use the implicit Makefile rules more, and just edit the compiler flags for specific targets. * Simplify compiler/linker flags - no need for EXTRA_* * Add TARGET_CC, and improve checks for BUILD_CC too. * Set arch-specific flags in arch-specific makefiles, not conditional on $(ARCH). * Generate dependency files in the main compile, rather than as a separate step. * Don't #include sha256.c, but re-build it into the purgatory. Still a work-in-progress. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec')
-rw-r--r--kexec/Makefile70
1 files changed, 19 insertions, 51 deletions
diff --git a/kexec/Makefile b/kexec/Makefile
index 6ad9461..6f7a49c 100644
--- a/kexec/Makefile
+++ b/kexec/Makefile
@@ -1,80 +1,48 @@
#
# kexec (linux booting linux)
#
-PURGATORY_HEX_C:= $(OBJDIR)/kexec/purgatory.c
+PURGATORY_HEX_C:= kexec/purgatory.c
$(PURGATORY_HEX_C): $(PURGATORY) $(BIN_TO_HEX)
$(MKDIR) -p $(@D)
$(BIN_TO_HEX) purgatory < $(PURGATORY) > $@
-KCFLAGS:= $(CFLAGS) $(EXTRA_CFLAGS) -Ikexec/arch/$(ARCH)/include
-
-KEXEC_C_SRCS:= kexec/kexec.c
+KEXEC_C_SRCS:= kexec/kexec.c
KEXEC_C_SRCS+= kexec/ifdown.c
-KEXEC_C_SRCS+= kexec/kexec-elf.c
-KEXEC_C_SRCS+= kexec/kexec-elf-exec.c
+KEXEC_C_SRCS+= kexec/kexec-elf.c
+KEXEC_C_SRCS+= kexec/kexec-elf-exec.c
KEXEC_C_SRCS+= kexec/kexec-elf-core.c
-KEXEC_C_SRCS+= kexec/kexec-elf-rel.c
-KEXEC_C_SRCS+= kexec/kexec-elf-boot.c
+KEXEC_C_SRCS+= kexec/kexec-elf-rel.c
+KEXEC_C_SRCS+= kexec/kexec-elf-boot.c
KEXEC_C_SRCS+= kexec/kexec-iomem.c
KEXEC_C_SRCS+= kexec/crashdump.c
KEXEC_C_SRCS+= kexec/crashdump-xen.c
KEXEC_C_GENERATED_SRCS+= $(PURGATORY_HEX_C)
-KEXEC_S_SRCS:=
+KEXEC_S_SRCS:=
KEXEC_S_GENERATED_SRCS:=
-include kexec/arch/$(ARCH)/Makefile
-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_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))
+include $(srcdir)/kexec/arch/$(ARCH)/Makefile
+
+KEXEC_C_OBJS:= $(patsubst %.c, %.o, $(KEXEC_C_SRCS) $(KEXEC_C_GENERATED_SRCS))
+KEXEC_C_DEPS:= $(patsubst %.c, %.d, $(KEXEC_C_SRCS))
+KEXEC_S_OBJS:= $(patsubst %.S, %.o, $(KEXEC_S_SRCS) $(KEXEC_S_GENERATED_SRCS))
+KEXEC_S_DEPS:= $(patsubst %.S, %.d, $(KEXEC_S_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)
KEXEC:= $(SBINDIR)/kexec
KEXEC_MANPAGE:= $(MANDIR)/man8/kexec.8
-include $(KEXEC_DEPS)
-
-$(KEXEC_C_DEPS): $(OBJDIR)/%.d: %.c
- mkdir -p $(@D)
- $(CC) $(KCFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@
-
-$(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 $<
-
-$(KEXEC_S_OBJS): $(OBJDIR)/%.o: %.S $(OBJDIR)/%.d
- mkdir -p $(@D)
- $(CC) $(KCFLAGS) -o $@ -c $<
+-include $(KEXEC_DEPS)
$(KEXEC): $(KEXEC_OBJS) $(UTIL_LIB)
- mkdir -p $(@D)
- $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(KCFLAGS) -o $@ \
- $(KEXEC_OBJS) $(UTIL_LIB) $(LIBS)
+ @$(MKDIR) -p $(@D)
+ $(LINK.o) -o $@ $^
+
+$(KEXEC): CPPFLAGS+=-I$(srcdir)/kexec/arch/$(ARCH)/include
$(KEXEC_MANPAGE): kexec/kexec.8
- $(MKDIR) -p $(MANDIR)/man8
+ @$(MKDIR) -p $(MANDIR)/man8
cp kexec/kexec.8 $(KEXEC_MANPAGE)
echo::
@echo "KEXEC_C_SRCS $(KEXEC_C_SRCS)"