Commit a9812206 authored by Pali Rohár's avatar Pali Rohár Committed by Manish Pandey
Browse files

Makefile: Do not mark file targets as .PHONY target



Only non-file targets should be set a .PHONY. Otherwise if file target is
set as .PHONY then targets which depends on those file .PHONY targets would
be always rebuilt even when their prerequisites are not changed.

File target which needs to be always rebuilt can be specified in Make
system via having a prerequisite on some .PHONY target, instead of marking
whole target as .PHONY. In Makefile projects it is common to create empty
.PHONY target named FORCE for this purpose.

This patch changes all file targets which are set as .PHONY to depends on
new .PHONY target FORCE, to ensure that these file targets are always
rebuilt (as before). Basically they are those targets which calls external
make subprocess.

After FORCE target is specified in main Makefile, remove it from other
Makefile files to prevent duplicate definitions.
Signed-off-by: default avatarPali Rohár <pali@kernel.org>
Change-Id: Iee3b4e0de93879b95eb29a1745a041538412e69e
parent f422a7bf
...@@ -1245,8 +1245,7 @@ checkpatch: locate-checkpatch ...@@ -1245,8 +1245,7 @@ checkpatch: locate-checkpatch
certtool: ${CRTTOOL} certtool: ${CRTTOOL}
.PHONY: ${CRTTOOL} ${CRTTOOL}: FORCE
${CRTTOOL}:
${Q}${MAKE} PLAT=${PLAT} USE_TBBR_DEFS=${USE_TBBR_DEFS} COT=${COT} OPENSSL_DIR=${OPENSSL_DIR} CRTTOOL=${CRTTOOL} --no-print-directory -C ${CRTTOOLPATH} ${Q}${MAKE} PLAT=${PLAT} USE_TBBR_DEFS=${USE_TBBR_DEFS} COT=${COT} OPENSSL_DIR=${OPENSSL_DIR} CRTTOOL=${CRTTOOL} --no-print-directory -C ${CRTTOOLPATH}
@${ECHO_BLANK_LINE} @${ECHO_BLANK_LINE}
@echo "Built $@ successfully" @echo "Built $@ successfully"
...@@ -1288,8 +1287,7 @@ fiptool: ${FIPTOOL} ...@@ -1288,8 +1287,7 @@ fiptool: ${FIPTOOL}
fip: ${BUILD_PLAT}/${FIP_NAME} fip: ${BUILD_PLAT}/${FIP_NAME}
fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME}
.PHONY: ${FIPTOOL} ${FIPTOOL}: FORCE
${FIPTOOL}:
@${ECHO_BLANK_LINE} @${ECHO_BLANK_LINE}
@echo "Building $@" @echo "Building $@"
ifdef UNIX_MK ifdef UNIX_MK
...@@ -1302,12 +1300,10 @@ endif ...@@ -1302,12 +1300,10 @@ endif
@${ECHO_BLANK_LINE} @${ECHO_BLANK_LINE}
sptool: ${SPTOOL} sptool: ${SPTOOL}
.PHONY: ${SPTOOL} ${SPTOOL}: FORCE
${SPTOOL}:
${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" SPTOOL=${SPTOOL} --no-print-directory -C ${SPTOOLPATH} ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" SPTOOL=${SPTOOL} --no-print-directory -C ${SPTOOLPATH}
.PHONY: libraries romlib.bin: libraries FORCE
romlib.bin: libraries
${Q}${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} ENABLE_BTI=${ENABLE_BTI} ARM_ARCH_MINOR=${ARM_ARCH_MINOR} INCLUDES='${INCLUDES}' DEFINES='${DEFINES}' --no-print-directory -C ${ROMLIBPATH} all ${Q}${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} ENABLE_BTI=${ENABLE_BTI} ARM_ARCH_MINOR=${ARM_ARCH_MINOR} INCLUDES='${INCLUDES}' DEFINES='${DEFINES}' --no-print-directory -C ${ROMLIBPATH} all
# Call print_memory_map tool # Call print_memory_map tool
...@@ -1320,8 +1316,7 @@ doc: ...@@ -1320,8 +1316,7 @@ doc:
enctool: ${ENCTOOL} enctool: ${ENCTOOL}
.PHONY: ${ENCTOOL} ${ENCTOOL}: FORCE
${ENCTOOL}:
${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} --no-print-directory -C ${ENCTOOLPATH} ${Q}${MAKE} PLAT=${PLAT} BUILD_INFO=0 OPENSSL_DIR=${OPENSSL_DIR} ENCTOOL=${ENCTOOL} --no-print-directory -C ${ENCTOOLPATH}
@${ECHO_BLANK_LINE} @${ECHO_BLANK_LINE}
@echo "Built $@ successfully" @echo "Built $@ successfully"
...@@ -1375,3 +1370,6 @@ help: ...@@ -1375,3 +1370,6 @@ help:
@echo "" @echo ""
@echo "example: build all targets for the FVP platform:" @echo "example: build all targets for the FVP platform:"
@echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"
.PHONY: FORCE
FORCE:;
...@@ -41,7 +41,6 @@ $(eval $(call add_define,ARM_ROTPK_LOCATION_ID)) ...@@ -41,7 +41,6 @@ $(eval $(call add_define,ARM_ROTPK_LOCATION_ID))
# Force generation of the new hash if ROT_KEY is specified # Force generation of the new hash if ROT_KEY is specified
ifdef ROT_KEY ifdef ROT_KEY
HASH_PREREQUISITES = $(ROT_KEY) FORCE HASH_PREREQUISITES = $(ROT_KEY) FORCE
FORCE:
else else
HASH_PREREQUISITES = $(ROT_KEY) HASH_PREREQUISITES = $(ROT_KEY)
endif endif
......
...@@ -211,6 +211,3 @@ mrvl_flash: ...@@ -211,6 +211,3 @@ mrvl_flash:
$(error "Platform '${PLAT}' for target '$@' requires WTP. Please set WTP to point to the right directory") $(error "Platform '${PLAT}' for target '$@' requires WTP. Please set WTP to point to the right directory")
endif # WTP endif # WTP
.PHONY: FORCE
FORCE:;
...@@ -166,6 +166,3 @@ ${DOIMAGETOOL}: FORCE ...@@ -166,6 +166,3 @@ ${DOIMAGETOOL}: FORCE
.PHONY: mrvl_flash .PHONY: mrvl_flash
mrvl_flash: ${BUILD_PLAT}/${BOOT_IMAGE} ${DOIMAGETOOL} mrvl_flash: ${BUILD_PLAT}/${BOOT_IMAGE} ${DOIMAGETOOL}
${DOIMAGETOOL} ${DOIMAGE_FLAGS} ${BUILD_PLAT}/${BOOT_IMAGE} ${BUILD_PLAT}/${FLASH_IMAGE} ${DOIMAGETOOL} ${DOIMAGE_FLAGS} ${BUILD_PLAT}/${BOOT_IMAGE} ${BUILD_PLAT}/${FLASH_IMAGE}
.PHONY: FORCE
FORCE:;
...@@ -26,7 +26,5 @@ PLAT_INCLUDES += -I$(MV_DDR_PATH) \ ...@@ -26,7 +26,5 @@ PLAT_INCLUDES += -I$(MV_DDR_PATH) \
BLE_LINKERFILE := $(BLE_PATH)/ble.ld.S BLE_LINKERFILE := $(BLE_PATH)/ble.ld.S
FORCE:
$(MV_DDR_LIB): FORCE $(MV_DDR_LIB): FORCE
@+make -C $(MV_DDR_PATH) --no-print-directory PLAT_INCLUDES="$(PLAT_INCLUDES)" PLATFORM=$(PLAT) ARCH=AARCH64 OBJ_DIR=$(BUILD_PLAT)/ble @+make -C $(MV_DDR_PATH) --no-print-directory PLAT_INCLUDES="$(PLAT_INCLUDES)" PLATFORM=$(PLAT) ARCH=AARCH64 OBJ_DIR=$(BUILD_PLAT)/ble
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment