diff --git a/.gitignore b/.gitignore index d2da255..f30b46c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.o *.a +*.d *.elf *.img *.lst diff --git a/Makefile b/Makefile index af90028..fa62367 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ all: $(TARGET) $(TARGET): $(OBJS) $(LIBS) @echo " LINK $@" - $(Q)$(CC) $(CFLAGS) -o $(TARGET).elf -Xlinker -Map=$(TARGET).map -T linker.ld -nostartfiles $(OBJS) $(LIBS) + $(Q)$(CXX) $(CFLAGS) -o $(TARGET).elf -Xlinker -Map=$(TARGET).map -T linker.ld -nostartfiles $(OBJS) $(LIBS) $(Q)$(PREFIX)objdump -d $(TARGET).elf | $(PREFIX)c++filt > $(TARGET).lst $(Q)$(PREFIX)objcopy $(TARGET).elf -O binary $(TARGET).img @@ -30,4 +30,4 @@ clean: $(Q)$(RM) $(OBJS) $(TARGET).elf $(TARGET).map $(TARGET).lst $(TARGET).img $(MAKE) -C uspi clean -include Makefile.rules \ No newline at end of file +include Makefile.rules diff --git a/Makefile.rules b/Makefile.rules index 56054c1..f880116 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -12,6 +12,7 @@ PREFIX ?= arm-none-eabi- CC = $(PREFIX)gcc CPP = $(PREFIX)g++ +CXX = $(PREFIX)g++ AS = $(CC) LD = $(PREFIX)ld AR = $(PREFIX)ar @@ -39,10 +40,13 @@ else endif AFLAGS += $(ARCH) -CFLAGS += $(ARCH) -Wall -Wno-unused-variable -Wno-unused-but-set-variable -Wno-psabi -fsigned-char -fno-builtin -Ofast -DNDEBUG +CFLAGS += $(ARCH) -MMD -MP -Wall -Wno-unused-variable -Wno-unused-but-set-variable -Wno-psabi -fsigned-char -fno-builtin -Ofast -DNDEBUG CPPFLAGS := $(CFLAGS) $(CPPFLAGS) -fno-exceptions -fno-rtti -std=c++0x -Wno-write-strings CFLAGS += -fno-delete-null-pointer-checks -fdata-sections -ffunction-sections -u _printf_float -std=gnu99 +DEPENDS := $(patsubst %.o,%.d,$(OBJS)) +-include $(DEPENDS) + .PHONY: clean %.o: %.S