Skip to content

Commit

Permalink
Improve Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
kerel-fs committed Mar 14, 2017
1 parent a8b74f6 commit 1580e4c
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
VERSION = $(shell cat VERSION.txt)

# USE_RPI_GPU_FFT = 1

FLAGS = -Wall -O3 -ffast-math -DVERSION=$(VERSION)
LIBS = -lpthread -lm -ljpeg -lconfig -lrt
LDLIBS = -lpthread -lm -ljpeg -lconfig -lrt -lfftw3 -lfftw3f -lrtlsdr

#####

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

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

#ifndef __MACH__ # _POSIX_TIMERS # OSX has no clock_gettime() and thus not -lrt (but _POSIX_TIMERS seem not to be defined in make ?)
#LIBS += -lrt
#endif

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

all: gsm_scan ogn-rf r2fft_test
#####

ogn-rf: Makefile ogn-rf.cc rtlsdr.h thread.h fft.h buffer.h image.h
g++ $(FLAGS) $(GPU_FLAGS) -o ogn-rf ogn-rf.cc $(GPU_SRC) $(LIBS) -lrtlsdr -lfftw3 -lfftw3f
ifdef USE_RPI_GPU_FFT
sudo chown root ogn-rf
sudo chmod a+s ogn-rf
endif
all: gsm_scan ogn-rf r2fft_test

gsm_scan: Makefile gsm_scan.cc rtlsdr.h fft.h buffer.h image.h
g++ $(FLAGS) $(GPU_FLAGS) -o gsm_scan gsm_scan.cc $(GPU_SRC) $(LIBS) -lrtlsdr -lfftw3 -lfftw3f
ifdef USE_RPI_GPU_FFT
sudo chown root gsm_scan
sudo chmod a+s gsm_scan
endif
ogn-rf: src/ogn-rf.cc src/thread.h src/rtlsdr.h src/fft.h src/buffer.h src/image.h
g++ $(FLAGS) $(GPU_FLAGS) -o $@ $< $(GPU_SRC) $(LDLIBS)

gsm_scan: src/gsm_scan.cc src/fft.h src/buffer.h src/image.h
g++ $(FLAGS) $(GPU_FLAGS) -o $@ $< $(GPU_SRC) $(LDLIBS)

r2fft_test: src/r2fft_test.cc src/r2fft.h src/fft.h
g++ $(FLAGS) $(GPU_FLAGS) -o $@ $< $(GPU_SRC) $(LDLIBS)

r2fft_test: Makefile r2fft_test.cc r2fft.h fft.h
g++ $(FLAGS) -o r2fft_test r2fft_test.cc -lm -lfftw3 -lfftw3f
clean:
$(RM) gsm_scan ogn-rf r2fft_test

.PHONY: clean

0 comments on commit 1580e4c

Please sign in to comment.