Use arm-specific version of 'ar' instead of system one
[fw/pdclib] / Makefile
index 4796dfb58065cdbb3a09ba90d9ef85aec3945a6e..cca5a4f1fc49bdb4ce1f16ebd8c9862379cafd92 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,13 +9,25 @@ bindir=$(prefix)/bin
 includedir=$(prefix)/include
 
 #CPU=cortex-m3
-CPUS=cortex-m0 cortex-m3
+CPUS=cortex-m0 cortex-m3 cortex-m4
 FIRSTCPU=cortex-m0
 CPU=none
 BUILD=build-$(CPU)
 
+# CPU specific compiler flags
+ifeq ($(CPU),cortex-m0)
+CPU_FLAGS=
+endif
+ifeq ($(CPU),cortex-m3)
+CPU_FLAGS=
+endif
+ifeq ($(CPU),cortex-m4)
+CPU_FLAGS=-mfloat-abi=hard
+endif
+
 #CC=$(bindir)/arm-none-eabi-gcc
 CC=/usr/bin/arm-none-eabi-gcc
+AR=/usr/bin/arm-none-eabi-ar
 
 # This is where you chose which platform to compile for (see 'make links' / './platform')
 PLATFORM := altos
@@ -49,7 +61,7 @@ REGDEPFILES := $(patsubst %,%.d,$(REGFILES))
 ALLFILES := $(SRCFILES) $(HDRFILES) $(AUXFILES)
 
 WARNINGS := -Wall -Wextra -pedantic -Wno-unused-parameter -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long -Wuninitialized -Wstrict-prototypes 
-PLATFORM_FLAGS=-mlittle-endian -mthumb -mcpu=$(CPU) -ffreestanding
+PLATFORM_FLAGS=-mlittle-endian -mthumb -mcpu=$(CPU) -ffreestanding $(CPU_FLAGS)
 CFLAGS := -Os -g -std=c99 -I./$(BUILD)/internals -I./testing $(WARNINGS) $(USERFLAGS) $(PLATFORM_FLAGS)
 
 .PHONY: all clean srcdist bindist test tests testdrivers regtests regtestdrivers todos fixmes find links unlink help
@@ -87,7 +99,7 @@ check: all testdrivers regtestdrivers
 
 $(PDCLIB): $(BUILD) $(OBJFILES)
        @echo " AR      $@"
-       @ar rc $@ $(OBJFILES)
+       @$(AR) rc $@ $(OBJFILES)
        @echo
 
 install-$(CPU): install-$(CPU)-lib install-hdr