diff --git a/Makefile b/Makefile index a061136f2..7dc704265 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,9 @@ default: prebuild boot.elf postbuild prebuild: postbuild: +.PHONY: tests +test: prebuild test.elf postbuild + include Makefile.$(PLATFORM) ifndef USE_LIBA $(error Makefile.PLATFORM should define USE_LIBA) @@ -31,15 +34,15 @@ endif CFLAGS = -std=c99 CXXFLAGS = -std=c++11 -fno-exceptions -fno-unwind-tables -fno-rtti -products := boot.elf boot.hex boot.bin +products := boot.elf boot.hex boot.bin test.elf test.hex test.bin #objs += external/freertos/tasks.o external/freertos/list.o external/freertos/queue.o external/freertos/portable/GCC/ARM_CM4F/port.o external/freertos/portable/MemMang/heap_1.o #objs += $(addprefix external/newlib/libc/, string/memset.o string/memcpy.o string/strlen.o) lib/private/mem5.o: CFLAGS += -w -objs += src/hello.o - +products += src/hello.o +boot.elf: src/hello.o ifeq ($(VERBOSE),1) .PHONY: toolchain_info output_size @@ -90,9 +93,9 @@ run: boot.elf @echo "OBJCOPY $@" @$(OBJCOPY) -O binary $< $@ -boot.elf: $(objs) +%.elf: $(objs) @echo "LD $@" - @$(LD) $(LDFLAGS) $(objs) -o $@ + @$(LD) $(LDFLAGS) $^ -o $@ %.o: %.c @echo "CC $@" diff --git a/quiz/Makefile b/quiz/Makefile index a208e82d7..f59cd18c4 100644 --- a/quiz/Makefile +++ b/quiz/Makefile @@ -9,7 +9,6 @@ $(symbols_file): $(tests) runner_objs += $(addprefix quiz/src/, runner.o symbols.o) test_objs = $(subst .c,.o, $(subst .cpp,.o,$(tests))) +products += test.elf $(runner_objs) $(test_objs) test.elf: $(objs) $(runner_objs) $(test_objs) - @echo "LD $@" - @$(LD) $(LDFLAGS) $(objs) $(test_objs) -o $@