include config.mk

.PHONY: all
all:
	@echo Below Make GOALS are supported
	@echo - make Sign_psi_ram
	@echo - make Sign_bootsystem
	@echo - make clean_bootloader
	@echo - make Sign_ebl
	@echo - make Sign_BSP
	@echo - make clean_BSP

.PHONY: pre_build
	@chmod 755 $(FLSTOOL)
	@chmod 755 $(FWPGEN)

.PHONY: Sign_psi_ram
Sign_psi_ram: pre_build
	@make -f $(BL_FLS_DIR)/Makefile sign_psi_ram
	cp -f $(BL_FLS_DIR)/output/* $(BSP_FLS_DIR)/input/.

.PHONY: Sign_bootloader
Sign_bootloader:pre_build
	@make -f $(BL_FLS_DIR)/Makefile sign_bootloader
	cp -f $(BL_FLS_DIR)/output/* $(BSP_FLS_DIR)/input/.


.PHONY: Sign_ebl
Sign_ebl: pre_build
	@make -f $(BSP_FLS_DIR)/Makefile sign_ebl
	cp -f $(BSP_FLS_DIR)/input/ebl_signed.fls $(BL_FLS_DIR)/input/.

.PHONY: Sign_BSP
Sign_BSP:pre_build
	@make -f $(BSP_FLS_DIR)/Makefile all

.PHONY: clean_bootloader
clean_bootloader:
	@make -f $(BL_FLS_DIR)/Makefile clean

.PHONY: clean_BSP
clean_BSP:
	@make -f $(BSP_FLS_DIR)/Makefile clean

.PHONY: sign_all
Sign_all: Sign_psi_ram Sign_ebl Sign_bootloader Sign_BSP

.PHONY: clean_all
clean_all:
	rm -rf $(BL_FLS_DIR)/outputs
	rm -rf $(BSP_FLS_DIR)/outputs

