Skip to content

Commit

Permalink
Makefile update for aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
markondej committed Sep 19, 2019
1 parent 0495997 commit d0de6f5
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -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]")
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)
CFLAGS = $(STD_CFLAGS) -march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=4
TARGET = 4
else
CFLAGS = $(STD_CFLAGS) -march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=2
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
Expand Down

0 comments on commit d0de6f5

Please sign in to comment.