Meso build targets (#1196)

* meso: commit wip (thanks fincs) rewrite to support build targets

* meso: commit mostly-working build system

* meso: correct .o dependencies in kernel/kldr

* libstratosphere: fix building after PCH related build changes

Co-authored-by: fincs <fincs@devkitpro.org>
This commit is contained in:
SciresM
2020-10-27 13:55:19 -07:00
committed by GitHub
parent 1c71d12d9d
commit ac04e02a08
8 changed files with 218 additions and 105 deletions

View File

@@ -1,26 +1,41 @@
TARGETS := kernel.bin kernel_ldr.bin
CLEAN_TARGETS := $(foreach target,$(TARGETS),$(target:.bin=)-clean)
ATMOSPHERE_BUILD_CONFIGS :=
all: release
SUBFOLDERS := $(MODULES)
define ATMOSPHERE_ADD_TARGET
all: mesosphere.bin
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
clean: $(CLEAN_TARGETS)
@rm -f mesosphere.bin
$(strip $1): mesosphere$(strip $2).bin
mesosphere.bin: $(TARGETS)
@python build_mesosphere.py
@echo "Built mesosphere.bin..."
mesosphere$(strip $2).bin: kernel/kernel$(strip $2).bin kernel_ldr/kernel_ldr$(strip $2).bin
@python build_mesosphere.py kernel_ldr/kernel_ldr$(strip $2).bin kernel/kernel$(strip $2).bin mesosphere$(strip $2).bin
@echo "Built mesosphere$(strip $2).bin..."
$(TARGETS): check_libmeso
$(MAKE) -C $(@:.bin=)
@cp $(@:.bin=)/$(@) $(@)
kernel/kernel$(strip $2).bin: check_libmeso$(strip $1)
@$$(MAKE) -C kernel $(strip $1)
check_libmeso:
@$(MAKE) --no-print-directory -C ../libraries/libmesosphere
kernel_ldr/kernel_ldr$(strip $2).bin: check_libmeso$(strip $1)
@$$(MAKE) -C kernel_ldr $(strip $1)
$(CLEAN_TARGETS):
$(MAKE) -C $(@:-clean=) clean
@rm -f $(@:-clean=).bin
check_libmeso$(strip $1):
@$$(MAKE) -C ../libraries/libmesosphere $(strip $1)
.PHONY: all clean $(CLEAN_TARGETS)
clean-$(strip $1):
@$$(MAKE) -C ../libraries/libmesosphere clean-$(strip $1)
@$$(MAKE) -C kernel clean-$(strip $1)
@$$(MAKE) -C kernel_ldr clean-$(strip $1)
@rm -f mesosphere$(strip $2).bin
endef
$(eval $(call ATMOSPHERE_ADD_TARGET, release, ,))
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug,))
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit,))
clean:
@$(MAKE) -C ../libraries/libmesosphere clean
@$(MAKE) -C kernel clean
@$(MAKE) -C kernel_ldr clean
@rm -f mesosphere*.bin
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))