build: fix some broken dependencies in Makefiles that were causing targets to get rebuild when they did not need to be rebuilt

This commit is contained in:
misson20000 2020-10-16 20:18:11 -07:00
commit 190fed22e2
6 changed files with 33 additions and 20 deletions

View file

@ -73,7 +73,7 @@ dist-no-debug: all
cp fusee/fusee-secondary/fusee-secondary-experimental.bin atmosphere-$(AMSVER)/atmosphere/fusee-secondary.bin
cp fusee/fusee-secondary/fusee-secondary-experimental.bin atmosphere-$(AMSVER)/sept/payload.bin
cp sept/sept-primary/sept-primary.bin atmosphere-$(AMSVER)/sept/sept-primary.bin
cp sept/sept-secondary/sept-secondary.bin atmosphere-$(AMSVER)/sept/sept-secondary.bin
cp sept/sept-secondary/sept-secondary.bin atmosphere-$(AMSVER)/sept/sept-secondary.bin || true
cp sept/sept-secondary/sept-secondary_00.enc atmosphere-$(AMSVER)/sept/sept-secondary_00.enc
cp sept/sept-secondary/sept-secondary_01.enc atmosphere-$(AMSVER)/sept/sept-secondary_01.enc
cp sept/sept-secondary/sept-secondary_dev_00.enc atmosphere-$(AMSVER)/sept/sept-secondary_dev_00.enc
@ -126,7 +126,7 @@ dist: dist-no-debug
cp fusee/fusee-mtc/fusee-mtc.elf atmosphere-$(AMSVER)-debug/fusee-mtc.elf
cp fusee/fusee-secondary/fusee-secondary-experimental.elf atmosphere-$(AMSVER)-debug/fusee-secondary.elf
cp sept/sept-primary/sept-primary.elf atmosphere-$(AMSVER)-debug/sept-primary.elf
cp sept/sept-secondary/sept-secondary.elf atmosphere-$(AMSVER)-debug/sept-secondary.elf
cp sept/sept-secondary/sept-secondary.elf atmosphere-$(AMSVER)-debug/sept-secondary.elf || true
cp sept/sept-secondary/key_derivation/key_derivation.elf atmosphere-$(AMSVER)-debug/sept-secondary-key-derivation.elf
cp exosphere/loader_stub/loader_stub.elf atmosphere-$(AMSVER)-debug/exosphere-loader-stub.elf
cp exosphere/program/program.elf atmosphere-$(AMSVER)-debug/exosphere-program.elf

View file

@ -5,14 +5,17 @@ define ATMOSPHERE_ADD_TARGET
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
$(strip $1): exosphere$(strip $2).bin check_warmboot_$(strip $1)
@cp warmboot/warmboot$(strip $2).bin warmboot$(strip $2).bin
$(strip $1): exosphere$(strip $2).bin warmboot$(strip $2).bin
exosphere$(strip $2).bin: loader_stub/loader_stub$(strip $2).bin
@cp loader_stub/loader_stub$(strip $2).bin exosphere$(strip $2).bin
@printf LENY >> exosphere$(strip $2).bin
@echo "Built exosphere$(strip $2).bin..."
warmboot$(strip $2).bin: warmboot/warmboot$(strip $2).bin
@cp warmboot/warmboot$(strip $2).bin warmboot$(strip $2).bin
@echo "Built warmboot$(strip $2).bin..."
check_program_$(strip $1):
@$$(MAKE) -C program $(strip $1)
@ -22,6 +25,8 @@ check_warmboot_$(strip $1):
loader_stub/loader_stub$(strip $2).bin: check_program_$(strip $1)
@$$(MAKE) -C loader_stub $(strip $1)
warmboot/warmboot$(strip $2).bin: check_warmboot_$(strip $1)
clean-$(strip $1): clean-program-$(strip $1) clean-loader_stub-$(strip $1) clean-warmboot-$(strip $1)
@rm -rf exosphere$(strip $2).bin warmboot$(strip $2).bin

View file

@ -216,7 +216,7 @@ sept_primary.bin.o sept_primary_bin.h: sept-primary.bin
@echo $(notdir $<)
@$(_bin2o)
sept_secondary_00.enc.o sept_secondary_00.h: sept-secondary_00.enc
sept_secondary_00.enc.o sept_secondary_00_enc.h: sept-secondary_00.enc
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(_bin2o)

View file

@ -123,15 +123,24 @@ check_rebootstub:
check_key_derivation:
@$(MAKE) -C key_derivation
$(BUILD): check_rebootstub check_key_derivation
ifeq ($(strip $(SEPT_00_ENC_PATH)),)
$(BUILD): check_rebootstub check_key_derivation
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
else
$(BUILD): $(TOPDIR)/$(TARGET)_00.enc $(TOPDIR)/$(TARGET)_01.enc $(TOPDIR)/$(TARGET)_dev_00.enc $(TOPDIR)/$(TARGET)_dev_01.enc
@touch $(TOPDIR)/$(TARGET).bin
$(TOPDIR)/$(TARGET)_00.enc: $(SEPT_00_ENC_PATH)
@cp $(SEPT_00_ENC_PATH) $(TOPDIR)/$(TARGET)_00.enc
$(TOPDIR)/$(TARGET)_01.enc: $(SEPT_01_ENC_PATH)
@cp $(SEPT_01_ENC_PATH) $(TOPDIR)/$(TARGET)_01.enc
$(TOPDIR)/$(TARGET)_dev_00.enc: $(SEPT_DEV_00_ENC_PATH)
@cp $(SEPT_DEV_00_ENC_PATH) $(TOPDIR)/$(TARGET)_dev_00.enc
$(TOPDIR)/$(TARGET)_dev_01.enc: $(SEPT_DEV_01_ENC_PATH)
@cp $(SEPT_DEV_01_ENC_PATH) $(TOPDIR)/$(TARGET)_dev_01.enc
endif

View file

@ -24,16 +24,6 @@ SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) fusee-primary.bin
#---------------------------------------------------------------------------------
# boot has a custom bin2o rule for fusee-primary -> fusee_primary
#---------------------------------------------------------------------------------
define _bin2o
bin2s $< | $(AS) -o $(@)
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _ | tr - _)`"_end[];" > `(echo $(<F) | tr . _ | tr - _)`.h
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _ | tr - _)`"[];" >> `(echo $(<F) | tr . _ | tr - _)`.h
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _ | tr - _)`_size";" >> `(echo $(<F) | tr . _ | tr - _)`.h
endef
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
@ -106,14 +96,23 @@ $(OUTPUT).kip : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
boot_power_utils.o: fusee_primary.bin.o fusee_primary_bin.h
boot_power_utils.o: fusee-primary.bin.o fusee_primary_bin.h
#---------------------------------------------------------------------------------
# boot has a custom bin2o rule for fusee-primary -> fusee_primary
#---------------------------------------------------------------------------------
define _bin2o
bin2s $< | $(AS) -o $(@)
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _ | tr - _)`"_end[];" > `(echo $(<F) | tr . _ | tr - _)`.h
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _ | tr - _)`"[];" >> `(echo $(<F) | tr . _ | tr - _)`.h
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _ | tr - _)`_size";" >> `(echo $(<F) | tr . _ | tr - _)`.h
endef
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
fusee_primary.bin.o fusee_primary_bin.h: fusee-primary.bin
fusee-primary.bin.o fusee_primary_bin.h: fusee-primary.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(_bin2o)
%.bin.o : %.bin

View file

@ -16,7 +16,7 @@
#include <stratosphere.hpp>
#include "boot_power_utils.hpp"
#include "boot_pmic_driver.hpp"
#include "fusee-primary_bin.h"
#include "fusee_primary_bin.h"
namespace ams::boot {