Update Makefile
replaced detecting pi version using /proc/device-tree/model w/ a prompt asking you to select your pi's arm architecture.
This commit is contained in:
parent
dc5d94be02
commit
06f437e61e
31
src/Makefile
31
src/Makefile
|
|
@ -1,34 +1,27 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
STD_CFLAGS = -Wall -std=gnu99 -c -g
|
STD_CFLAGS = -Wall -std=gnu99 -c -g
|
||||||
|
|
||||||
# Enable ARM-specific options only on ARM, and compilation of the app only on ARM
|
# Prompt user to select architecture
|
||||||
UNAME := $(shell uname -m)
|
ARCH_PROMPT := "Select the architecture (1 for armv6l, 2 for armv7l, 3 for aarch64): "
|
||||||
|
ARCH_CHOICE := $(shell read -p $(ARCH_PROMPT) arch && echo $$arch)
|
||||||
|
|
||||||
# Determine Raspberry Pi version (if 2 or greater)
|
# Determine hardware platform and set proper compilation flags based on user choice
|
||||||
RPI_VERSION := $(shell cat /proc/device-tree/model | grep -a -o "Raspberry\sPi\s[0-9]" | grep -o "[0-9]")
|
ifeq ($(ARCH_CHOICE), 1)
|
||||||
|
|
||||||
# Determine the hardware platform and set proper compilation flags
|
|
||||||
ifeq ($(UNAME), armv6l)
|
|
||||||
ARCH_CFLAGS = -march=armv6 -O3 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math
|
ARCH_CFLAGS = -march=armv6 -O3 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math
|
||||||
TARGET = 1
|
TARGET = 1
|
||||||
else ifeq ($(shell expr $(RPI_VERSION) \> 1), 1)
|
else ifeq ($(ARCH_CHOICE), 2)
|
||||||
ifeq ($(UNAME), armv7l)
|
|
||||||
ARCH_CFLAGS = -march=armv7-a -O3 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math
|
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
|
TARGET = 2
|
||||||
endif
|
else ifeq ($(ARCH_CHOICE), 3)
|
||||||
|
ARCH_CFLAGS = -march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt -ffast-math
|
||||||
|
TARGET = 3
|
||||||
else
|
else
|
||||||
ARCH_CFLAGS = -O3
|
$(error Invalid architecture choice. Please choose 1 for armv6l, 2 for armv7l, or 3 for aarch64.)
|
||||||
TARGET = other
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS = $(STD_CFLAGS) $(ARCH_CFLAGS) -DRASPI=$(TARGET)
|
CFLAGS = $(STD_CFLAGS) $(ARCH_CFLAGS) -DRASPI=$(TARGET)
|
||||||
|
|
||||||
ifneq ($(TARGET), other)
|
ifneq ($(TARGET), 4)
|
||||||
|
|
||||||
app: rds.o waveforms.o pi_fm_rds.o rds_strings.o fm_mpx.o control_pipe.o mailbox.o
|
app: rds.o waveforms.o pi_fm_rds.o rds_strings.o fm_mpx.o control_pipe.o mailbox.o
|
||||||
$(CC) $(LDFLAGS) -o pi_fm_rds rds.o rds_strings.o waveforms.o mailbox.o pi_fm_rds.o fm_mpx.o control_pipe.o -lsndfile -lm
|
$(CC) $(LDFLAGS) -o pi_fm_rds rds.o rds_strings.o waveforms.o mailbox.o pi_fm_rds.o fm_mpx.o control_pipe.o -lsndfile -lm
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue