Browse Source

fix(cert_create): let distclean Makefile target remove the cert_create tool

For some targets, Make recursively invokes itself in subdirectories.
When delegating the distclean target to tools/cert_create/Makefile,
the submake is called with the clean target instead of realclean.
Because of this, the submake never removes the cert_create executable.

A proper but more intrusive fix would
* avoid confusion about the semantics by following traditions or using
  new names
  https://www.gnu.org/prep/standards/standards.html#Standard-Targets
* avoid typing errors with the special $@ variable.
Something like:

In tools/cert_create/Makefile:
mostlyclean:
  # Remove most objects but keep some results.
        $(call SHELL_DELETE_ALL, src/build_msg.o ${OBJECTS})
clean: mostlyclean
  # mostlyclean, then remove things built by Make.
        $(call SHELL_DELETE,${BINARY})
distclean: clean
  # clean, then remove things built by ./configure (none here).
realclean maintainer-clean: distclean
  # distclean, then remove things built by autootols (none here).

In Makefile:
mostlyclean clean distclean realclean maintainer-clean:
	$(MAKE) -C subdir1 $@
	$(MAKE) -C subdir2 $@

Signed-off-by: Nicolas Boulenguez <nicolas@debian.org>
Change-Id: Iabfeca3da5724ab90a56ad6dcd6870d0a1d6b07f
pull/1985/head
Nicolas Boulenguez 4 years ago
committed by Manish Pandey
parent
commit
e15591aaf4
  1. 2
      Makefile

2
Makefile

@ -1360,7 +1360,7 @@ else
${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean
endif
${Q}${MAKE} --no-print-directory -C ${SPTOOLPATH} clean
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} realclean
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean
${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean

Loading…
Cancel
Save