Makefile update for aarch64

This commit is contained in:
Marcin Kondej 2019-09-19 10:05:51 +02:00
parent 0495997622
commit d0de6f5b9a
1 changed files with 19 additions and 15 deletions

View File

@ -1,30 +1,34 @@
CC = gcc
STD_CFLAGS = -Wall -std=gnu99 -c -g -O3
STD_CFLAGS = -Wall -std=gnu99 -c -g
# Enable ARM-specific options only on ARM, and compilation of the app only on ARM
UNAME := $(shell uname -m)
# Determine Raspberry Pi version (if 2 or greater)
RPI_VERSION := $(shell cat /proc/device-tree/model | grep -a -o "Raspberry\sPi\s[0-9]" | grep -o "[0-9]")
# Determine the hardware platform and set propper compilation flags
ifeq ($(UNAME), armv6l)
CFLAGS = $(STD_CFLAGS) -march=armv6 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=1
ARCH_CFLAGS = -march=armv6 -O3 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math
TARGET = 1
else ifeq ($(UNAME), armv7l)
RPI_VERSION := $(shell cat /proc/device-tree/model | grep -a -o "Raspberry\sPi\s[0-9]" | grep -o "[0-9]")
ifeq ($(shell expr $(RPI_VERSION) \>= 4), 1)
CFLAGS = $(STD_CFLAGS) -march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=4
else
CFLAGS = $(STD_CFLAGS) -march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=2
else ifeq ($(shell expr $(RPI_VERSION) \> 1), 1)
ifeq ($(UNAME), armv7l)
ARCH_CFLAGS = -march=armv7-a -O3 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math
else ifeq ($(UNAME), aarch64)
ARCH_CFLAGS = -march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt -ffast-math
endif
ifeq ($(shell expr $(RPI_VERSION) \>= 4), 1)
TARGET = 4
else
TARGET = 2
endif
TARGET = 1
else ifeq ($(UNAME), aarch64)
CFLAGS = $(STD_CFLAGS) -march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt -ffast-math -DRASPI=2
TARGET = 1
else
CFLAGS = $(STD_CFLAGS)
TARGET = 0
ARCH_CFLAGS = -O3
TARGET = other
endif
CFLAGS = $(STD_CFLAGS) $(ARCH_CFLAGS) -DRASPI=$(TARGET)
ifeq ($(TARGET), 1)
ifneq ($(TARGET), other)
app: rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o mailbox.o
$(CC) -o pi_fm_rds rds.o waveforms.o mailbox.o pi_fm_rds.o fm_mpx.o control_pipe.o -lm -lsndfile