diff --git a/Makefile b/Makefile index 8d780a2..a7873bd 100644 --- a/Makefile +++ b/Makefile @@ -33,9 +33,22 @@ MAKEFLAGS += --no-print-directory endif OPENCM3_DIR := $(realpath libopencm3) +EXAMPLE_RULES = elf all: build +bin: EXAMPLE_RULES += bin +hex: EXAMPLE_RULES += hex +srec: EXAMPLE_RULES += srec +list: EXAMPLE_RULES += list +images: EXAMPLE_RULES += images + +bin: build +hex: build +srec: build +list: build +images: build + build: lib examples lib: @@ -54,7 +67,7 @@ lib: EXAMPLE_DIRS:=$(sort $(dir $(wildcard $(addsuffix /*/*/Makefile,$(addprefix examples/,$(TARGETS)))))) $(EXAMPLE_DIRS): lib @printf " BUILD $@\n"; - $(Q)$(MAKE) --directory=$@ OPENCM3_DIR=$(OPENCM3_DIR) + $(Q)$(MAKE) --directory=$@ OPENCM3_DIR=$(OPENCM3_DIR) $(EXAMPLE_RULES) examples: $(EXAMPLE_DIRS) $(Q)true @@ -79,5 +92,6 @@ styleclean: $(EXAMPLE_DIRS:=.styleclean) $(Q)$(MAKE) -C $* stylecheck OPENCM3_DIR=$(OPENCM3_DIR) -.PHONY: build lib examples $(EXAMPLE_DIRS) install clean stylecheck styleclean +.PHONY: build lib examples $(EXAMPLE_DIRS) install clean stylecheck styleclean \ + bin hex srec list images diff --git a/examples/Makefile.rules b/examples/Makefile.rules index 055f0a3..293ed84 100644 --- a/examples/Makefile.rules +++ b/examples/Makefile.rules @@ -123,7 +123,13 @@ LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group .SECONDEXPANSION: .SECONDARY: -all: images +all: elf + +elf: $(BINARY).elf +bin: $(BINARY).bin +hex: $(BINARY).hex +srec: $(BINARY).srec +list: $(BINARY).list images: $(BINARY).images flash: $(BINARY).flash @@ -228,6 +234,6 @@ else $(*).elf endif -.PHONY: images clean stylecheck styleclean +.PHONY: images clean stylecheck styleclean elf bin hex srec list -include $(OBJS:.o=.d) \ No newline at end of file