vbos/scripts/Makefile.build
Michael Shaw a252a3f8e9 kv2: initialize memory manager, early pci devices
Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
2026-05-12 03:00:45 -04:00

54 lines
1.3 KiB
INI

# SPDX-License-Identifier: GPL-2.0-only
#
# Master makefile build script for object files in the kernel
#
# Important to remember that this is run at the project-root-level,
# all of it, as it is invoked with $(MAKE) -f
ifneq ($(shell test -e .config && echo -n yes),yes)
$(error Please type `make config` to generate a config)
endif
-include .config
export
obj-y :=
subdir-y :=
include $(obj)/Makefile
subdir-y :=
real-objs-y :=
subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
real-objs-y := $(addprefix $(obj)/, $(filter-out %/, $(obj-y)))
subdir-objs-y := $(foreach d,$(subdir-y),$(obj)/$(d)/built-in.o)
deps := $(real-objs-y:.o=.d)
_all: $(obj)/built-in.o
$(obj)/%.o: $(obj)/%.c
$(Q)echo " CC $@"
$(Q)$(CC) $(CFLAGS) -c $< -o $@
$(obj)/%.o: $(obj)/%.S
$(Q)echo " CC $@"
$(Q)$(CC) $(CFLAGS) -c $< -o $@
$(obj)/built-in.o: $(real-objs-y) $(subdir-objs-y)
$(Q)echo " LD $@"
$(Q)$(LD) -r -o $@ $(real-objs-y) $(foreach d,$(subdir-y),$(obj)/$(d)/built-in.o)
.PHONY: _clean
_clean: $(subdir-y)
$(Q)echo " CLEAN $(obj)"
@rm -rf $(obj)/built-in.o $(real-objs-y) $(deps)
$(subdir-y): FORCE
$(Q)$(MAKE) --no-print-directory -f scripts/Makefile.build $(MAKECMDGOALS) obj=$(obj)/$@
$(obj)/%/built-in.o: FORCE
$(Q)$(MAKE) --no-print-directory -f scripts/Makefile.build obj=$(patsubst %/,%,$(dir $@))
FORCE:
-include $(deps)