Files
mckernel/kernel/Makefile.in
Masamichi Takagi 8129dec2f7 Fix out-of-tree build
<build>/ihk/cokernel/Makefile.common is not found when
<build>/mckernel/kernel/Makfile tries to perform
"Make -C <build>/ihk/{cokernel,ikc}" from mckernel/kernel
2016-12-01 16:44:01 +09:00

46 lines
1.1 KiB
Makefile

BUILD_TARGET ?= @TARGET@
KERNDIR=@KERNDIR@
VPATH=@abs_srcdir@
IHKBASE ?= $(VPATH)/../../ihk/cokernel
O ?= $(CURDIR)/build
V ?= $(VERBOSE)
KERNEL = kernel.img
KERNELS = $(addsuffix /$(KERNEL),$(addprefix $(O)/,$(BUILD_TARGET)))
SUBCMD_OPTS = V='$(V)' BUILD_IHK_COKERNEL=@abs_builddir@/../../ihk/cokernel
$(if $(O),,$(error Specify the compilation target directory))
#$(if $(shell ls $(IHKBASE)/Makefile),,\
# $(error IHK is not found in $(IHKBASE)))
.PHONY: all clean depend install
all: $(O) $(KERNELS)
$(O):
mkdir -p $(O)
%/kernel.img: %/Makefile
@echo 'Building for' $(dir $@)
@make --no-print-directory -C $(dir $@) $(SUBCMD_OPTS)
%/Makefile: Makefile.build FORCE
@mkdir -p $(dir $@)
@echo 'SRC = $(SRC)' > $@
@echo 'IHKBASE = $(IHKBASE)' >> $@
@echo 'TARGET = $(notdir $(patsubst %/,%,$(dir $@)))' >> $@
@echo 'TARGETDIR = $$(shell echo $$(TARGET) | sed "s/-/\//")' >> $@
@cat Makefile.build >> $@
@rm -f $(dir $@)/Makefile.dep
clean:
rm -rf $(O)
install:
mkdir -p -m 755 $(KERNDIR)
install -m 755 $(O)/$(BUILD_TARGET)/kernel.img $(KERNDIR)/mckernel.img
FORCE: