Commit c7eb0b74 authored by Alex Bennée's avatar Alex Bennée Committed by Radim Krčmář
Browse files

Makefile: add explicit directories target

This is slightly clumsy way to ensure the directory structure for the
out-of-tree build is made first. The PHONY target is depended on by
make all first which runs mkdir for all OBJDIRS.

If an architecture target needs deeper nesting it needs to add
directories to OBJDIRS so it can be picked up by the directories rule.

Signed-off-by: default avatarAlex Bennée <>
Signed-off-by: default avatarRadim Krčmář <>
parent 6d90fad2
......@@ -12,6 +12,7 @@ VPATH = $(SRCDIR)
libdirs-get = $(shell [ -d "lib/$(1)" ] && echo "lib/$(1) lib/$(1)/asm")
ARCH_LIBDIRS := $(call libdirs-get,$(ARCH)) $(call libdirs-get,$(TEST_DIR))
DESTDIR := $(PREFIX)/share/kvm-unit-tests/
......@@ -38,6 +39,8 @@ LIBFDT_archive = $(LIBFDT_objdir)/libfdt.a
LIBFDT_include = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_INCLUDES))
LIBFDT_version = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_VERSION))
OBJDIRS += $(LIBFDT_objdir)
#include architecture specific make rules
include $(SRCDIR)/$(TEST_DIR)/Makefile
......@@ -77,12 +80,18 @@ $(LIBFDT_archive): CFLAGS += -ffreestanding -I lib -I lib/libfdt -Wno-sign-compa
$(LIBFDT_archive): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
$(AR) rcs $@ $^
# Build directory target
.PHONY: directories
@mkdir -p $(OBJDIRS)
%.o: %.S
$(CC) $(CFLAGS) -c -nostdlib -o $@ $<
-include */.*.d */*/.*.d
all: $(shell git -C $(SRCDIR) rev-parse --verify --short=8 HEAD >build-head 2>/dev/null)
all: directories $(shell git -C $(SRCDIR) rev-parse --verify --short=8 HEAD >build-head 2>/dev/null)
standalone: all
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment