xref: /OK3568_Linux_fs/buildroot/package/pifmrds/0001-Makefile-cross-compile-friendly.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunMakefile: make it cross-compile (and Buildroot) friendly.
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunThe current Makefile makes heavy assumptions that it is doing native
4*4882a593Smuzhiyuncompilation on the RPi, as it checks that `uname -m` is an ARM machine.
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThis is wrong in the cross-compilation case.
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunRemove the conditional altogether, and do not override the CFLAGS
9*4882a593Smuzhiyunas passed in the environment (Buildroot passes proper CFLAGS).
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun[intial patch by: Eric Limpens <limpens@gmail.com>]
12*4882a593SmuzhiyunSigned-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
13*4882a593Smuzhiyun
14*4882a593Smuzhiyundiff -durN pifmrds-c67306ea9b8d827f45e0d90279d367e97119bcb1.orig/src/Makefile pifmrds-c67306ea9b8d827f45e0d90279d367e97119bcb1/src/Makefile
15*4882a593Smuzhiyun--- pifmrds-c67306ea9b8d827f45e0d90279d367e97119bcb1.orig/src/Makefile	2014-05-04 18:21:40.000000000 +0200
16*4882a593Smuzhiyun+++ pifmrds-c67306ea9b8d827f45e0d90279d367e97119bcb1/src/Makefile	2014-06-21 16:38:31.971804343 +0200
17*4882a593Smuzhiyun@@ -1,20 +1,8 @@
18*4882a593Smuzhiyun CC = gcc
19*4882a593Smuzhiyun-STD_CFLAGS = -Wall -std=gnu99 -c -g -O3
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun-# Enable ARM-specific options only on ARM, and compilation of the app only on ARM
22*4882a593Smuzhiyun-UNAME := $(shell uname -m)
23*4882a593Smuzhiyun-
24*4882a593Smuzhiyun-ifeq ($(UNAME), armv6l)
25*4882a593Smuzhiyun-	CFLAGS = $(STD_CFLAGS) -march=armv6 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math
26*4882a593Smuzhiyun-
27*4882a593Smuzhiyun app: rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o
28*4882a593Smuzhiyun 	$(CC) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -lm -lsndfile
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun-else
31*4882a593Smuzhiyun-	CFLAGS = $(STD_CFLAGS)
32*4882a593Smuzhiyun-endif
33*4882a593Smuzhiyun-
34*4882a593Smuzhiyun-
35*4882a593Smuzhiyun rds_wav: rds.o waveforms.o rds_wav.o fm_mpx.o
36*4882a593Smuzhiyun 	$(CC) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o -lm -lsndfile
37*4882a593Smuzhiyun
38