From 5b35c7d7a1be8fefd9caf072a4542f9bada0d33f Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Sun, 17 Apr 2016 00:21:24 +0000 Subject: [PATCH] rules: provide better feedback on missing libraries. If the library files are missing (haven't been built) it's better to get a failure message saying that, rather than a failed dependency with no rules to generated it. Before: (I'd manually removed the f4 library) ``` $ make clean all V=1 Using ../../../../../libopencm3/ path to library rm -f *.o *.d *.elf *.bin *.hex *.srec *.list *.map make: *** No rule to make target `adc-dac-printf.elf', needed by `elf'. Stop. ``` After: ``` $ make clean all V=1 Using ../../../../../libopencm3/ path to library rm -f *.o *.d *.elf *.bin *.hex *.srec *.list *.map arm-none-eabi-gcc -Os -g -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -MD -Wall -Wundef -I../../../../../libopencm3//include -DSTM32F4 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -o adc-dac-printf.o -c adc-dac-printf.c arm-none-eabi-gcc --static -nostartfiles -L../../../../../libopencm3//lib -T../stm32f4-discovery.ld -Wl,-Map=adc-dac-printf.map -Wl,--gc-sections -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 adc-dac-printf.o -lopencm3_stm32f4 -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -o adc-dac-printf.elf /home/karlp/tools/gcc-arm-none-eabi-4_9-2015q2/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: cannot find -lopencm3_stm32f4 collect2: error: ld returned 1 exit status make: *** [adc-dac-printf.elf] Error 1 ``` I strongly feel that the latter is far more informative. --- examples/Makefile.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Makefile.rules b/examples/Makefile.rules index def65ac..8fc56ff 100644 --- a/examples/Makefile.rules +++ b/examples/Makefile.rules @@ -158,7 +158,7 @@ $(LDSCRIPT): @#printf " OBJDUMP $(*).list\n" $(Q)$(OBJDUMP) -S $(*).elf > $(*).list -%.elf %.map: $(OBJS) $(LDSCRIPT) $(LIB_DIR)/lib$(LIBNAME).a +%.elf %.map: $(OBJS) $(LDSCRIPT) @#printf " LD $(*).elf\n" $(Q)$(LD) $(LDFLAGS) $(ARCH_FLAGS) $(OBJS) $(LDLIBS) -o $(*).elf