Skip to content

Commit

Permalink
Makefile: Add arch independent installation rules
Browse files Browse the repository at this point in the history
  • Loading branch information
kerel-fs committed May 19, 2017
1 parent 262e6b5 commit 9d6fdc8
Showing 1 changed file with 44 additions and 9 deletions.
53 changes: 44 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,45 @@ VERSION = $(shell cat VERSION.txt)
FLAGS = -Wall -O3 -ffast-math -DVERSION=$(VERSION)
LDLIBS = -lpthread -lm -ljpeg -lconfig -lrt -lfftw3 -lfftw3f -lrtlsdr -ldl

prefix = /usr/local
#####

ifneq ("$(wildcard /opt/vc/src/hello_pi/hello_fft)","")
TARGET=RASPBERRYPI
TARGETS = X64 ARM

ifeq ($(TARGET),)
HOST_UNAME="$(shell uname -m)"
ifeq ($(HOST_UNAME), "x86_64")
TARGET = X64
else ifeq ($(HOST_UNAME), "armv7l")
TARGET = ARM
ifneq ("$(wildcard /opt/vc/src/hello_pi/hello_fft)","")
USE_RPI_GPU_FFT = 1
endif
else
$(error Unknown host architecture: $(HOST_UNAME), manually specify TARGET from $(TARGETS))
endif
else
ifeq ($(filter $(TARGET),$(TARGETS)),)
$(error Unknown target: $(TARGET))
endif
endif

ifeq ($(TARGET),RASPBERRYPI)
USE_RPI_GPU_FFT = 1
FLAGS += -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -march=armv6zk -mfpu=vfp

ifeq ($(TARGET),ARM)
FLAGS += -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -march=armv6zk -mfpu=vfp
ifdef USE_RPI_GPU_FFT
OGN_DECODE_PATH=rpi-gpu-bin
else
OGN_DECODE_PATH=arm-bin
endif
else ifeq ($(TARGET), X64)
OGN_DECODE_PATH=x64-bin
endif

ifdef USE_RPI_GPU_FFT
LDLIBS += -ldl
GPU_FLAGS = -DUSE_RPI_GPU_FFT
GPU_SRC = src/mailbox.c src/gpu_fft.c src/gpu_fft_base.c src/gpu_fft_twiddles.c src/gpu_fft_shaders.c
LDLIBS += -ldl
GPU_FLAGS = -DUSE_RPI_GPU_FFT
GPU_SRC = src/mailbox.c src/gpu_fft.c src/gpu_fft_base.c src/gpu_fft_twiddles.c src/gpu_fft_shaders.c
endif

#####
Expand All @@ -36,4 +60,15 @@ r2fft_test: src/r2fft_test.cc src/r2fft.h src/fft.h
clean:
$(RM) gsm_scan ogn-rf r2fft_test

.PHONY: all clean

install: ogn-rf gsm_scan
install -D ogn-rf $(DESTDIR)$(prefix)/bin/ogn-rf
install -D gsm_scan $(DESTDIR)$(prefix)/bin/gsm_scan
install -D $(OGN_DECODE_PATH)/ogn-decode $(DESTDIR)$(prefix)/bin/ogn-decode

uninstall:
$(RM) $(DESTDIR)$(prefix)/bin/ogn-rf
$(RM) $(DESTDIR)$(prefix)/bin/gsm_scan
$(RM) $(DESTDIR)$(prefix)/bin/ogn-decode

.PHONY: all clean install uninstall

0 comments on commit 9d6fdc8

Please sign in to comment.