[alsa-devel] [PATCH TINYCOMPRESS] makefile.linux: allow env to override CROSS_COMPILE and CC

Qais Yousef qais.yousef at imgtec.com
Fri Oct 31 16:30:56 CET 2014


allow env variables to override them without having to modify the makefile.

Signed-off-by: Qais Yousef <qais.yousef at imgtec.com>
---
 makefile.linux | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/makefile.linux b/makefile.linux
index 81782d0af461..c4dab6d3b7d5 100644
--- a/makefile.linux
+++ b/makefile.linux
@@ -9,8 +9,8 @@ LIBOBJ = ${LIBSRC:.c=.o}
 PLAYOBJ = ${PLAYSRC:.c=.o}
 RECOBJ = ${RECSRC:.c=.o}
 
-CC = gcc
-CROSS_COMPILE =
+CROSS_COMPILE ?=
+CC ?= ${CROSS_COMPILE}gcc
 
 CFLAGS += -std=c99 -Wall -Wextra -Wunused -DVERSION=\"${VER}\" -I./include
 LDFLAGS += -L. -ltinycompress
@@ -20,19 +20,19 @@ all: libtinycompress cplay crec
 
 $(LIB): ${LIBOBJ}
 	@echo "  LD	"$@
-	@${CROSS_COMPILE}${CC} ${CFLAGS} -shared -Wl,-soname,$@.so -o $@.so ${LIBOBJ} ${LIBLDFLAGS}
+	@${CC} ${CFLAGS} -shared -Wl,-soname,$@.so -o $@.so ${LIBOBJ} ${LIBLDFLAGS}
 
 $(PLAYBIN): ${PLAYOBJ} ${LIB}
 	@echo "  LD	"$@
-	@${CROSS_COMPILE}${CC} ${CFLAGS} -o $@ ${PLAYOBJ} ${LDFLAGS}
+	@${CC} ${CFLAGS} -o $@ ${PLAYOBJ} ${LDFLAGS}
 
 $(RECBIN): ${RECOBJ} ${LIB}
 	@echo "  LD	"$@
-	@${CROSS_COMPILE}${CC} ${CFLAGS} -o $@ ${RECOBJ} ${LDFLAGS}
+	@${CC} ${CFLAGS} -o $@ ${RECOBJ} ${LDFLAGS}
 
 %.o: %.c
 	@echo "  CC	"$<
-	@${CROSS_COMPILE}${CC} ${CFLAGS} -c -fPIC -o $@ $<
+	@${CC} ${CFLAGS} -c -fPIC -o $@ $<
 
 clean:
 	@rm -rf ${BIN} ${PLAYOBJ} ${RECOBJ} ${LIB}.so ${LIBOBJ}
-- 
2.1.0



More information about the Alsa-devel mailing list