-
Notifications
You must be signed in to change notification settings - Fork 81
/
Makefile.rules
58 lines (49 loc) · 2.16 KB
/
Makefile.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# To show build commands: make V=1
ifneq ($(V),1)
Q := @
endif
#use RASPPI = 1BRev1 for Raspberry Pi 1B Rev 1 (26 IOports) (GPIO0/1/21)
#use RASPPI = 1BRev2 for Raspberry Pi 1B Rev 2 (26 IOports) (GPIO2/3/27)
#use RASPPI = 1BPlus for Raspberry Pi 1B+ (40 I/OPorts)
RASPPI ?= 3
PREFIX ?= arm-none-eabi-
CC = $(PREFIX)gcc
CPP = $(PREFIX)g++
AS = $(CC)
LD = $(PREFIX)ld
AR = $(PREFIX)ar
ifeq ($(strip $(RASPPI)),0)
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -mno-unaligned-access -DRPIZERO=1 -DEXPERIMENTALZERO=1
CFLAGS += -DRPIZERO=1 -DRASPPI=1
else ifeq ($(strip $(RASPPI)),1BRev1)
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -mno-unaligned-access-DRPI1BREV1=1 -DEXPERIMENTALZERO=1
CFLAGS += -DRPI1BREV1=1 -DRASPPI=1
else ifeq ($(strip $(RASPPI)),1BRev2)
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -mno-unaligned-access-DRPI1BREV2=1 -DEXPERIMENTALZERO=1
CFLAGS += -DRPI1BREV2=1 -DRASPPI=1
else ifeq ($(strip $(RASPPI)),1BPlus)
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -mno-unaligned-access -DRPI1BPLUS=1 -DEXPERIMENTALZERO=1
CFLAGS += -DRPI1BPLUS=1 -DRASPPI=1
else ifeq ($(strip $(RASPPI)),2)
ARCH ?= -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -marm -mno-unaligned-access -DRPI2=1 -DEXPERIMENTALZERO=1
CFLAGS += -DRPI2=1
else ifeq ($(strip $(RASPPI)),3)
ARCH ?= -march=armv8-a+crc -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -marm -mno-unaligned-access -DRPI3=1
CFLAGS += -DRPI3=1
else
$(error RASPPI must be one of: 0, 1BRev1, 1BRev2, 1BPlus, 2, 3)
endif
AFLAGS += $(ARCH)
CFLAGS += $(ARCH) -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
.PHONY: clean
%.o: %.S
@echo " AS $@"
$(Q)$(AS) $(AFLAGS) $(INCLUDE) -c -o $@ $<
%.o: %.c
@echo " CC $@"
$(Q)$(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $<
%.o: %.cpp
@echo " CPP $@"
$(Q)$(CPP) $(CPPFLAGS) $(INCLUDE) -c -o $@ $<