Skip to content
Snippets Groups Projects
Commit ae524e91 authored by Juan Carrano's avatar Juan Carrano
Browse files

Makefile.include: flash: do not peek into MAKECMDGOALS.

When flash-only was introduced (in #8373), the `flash` rule was
made conditionally dependent on `all` by looking for `flash-only`
in MAKECMDGOALS. This was done to avoid code duplication.

There's a cleaner way, by using canned recipes. When we upgrade the
requirements to gnu make 4, the flash recipe can be defined as ?=.
parent c6b8cbea
No related branches found
No related tags found
No related merge requests found
...@@ -511,16 +511,19 @@ distclean: ...@@ -511,16 +511,19 @@ distclean:
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
-@rm -rf $(BINDIRBASE) -@rm -rf $(BINDIRBASE)
# if make target != 'flash-only', add target 'all' to ensure build before flash define flash-recipe
ifeq (,$(filter flash-only, $(MAKECMDGOALS))) $(call check_cmd,$(FLASHER),Flash program)
BUILD_BEFORE_FLASH = all $(FLASHER) $(FFLAGS)
endif endef
# Do not add dependencies to "flash" directly, use FLASHDEPS, as this is shared
# with flash-only too
flash: $(BUILD_BEFORE_FLASH) $(FLASHDEPS) flash: all $(FLASHDEPS)
$(call check_cmd,$(FLASHER),Flash program) $(flash-recipe)
$(FLASHER) $(FFLAGS)
flash-only: flash flash-only: $(FLASHDEPS)
$(flash-recipe)
preflash: $(BUILD_BEFORE_FLASH) preflash: $(BUILD_BEFORE_FLASH)
$(PREFLASHER) $(PREFFLAGS) $(PREFLASHER) $(PREFFLAGS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment