diff mbox

[TINYCOMPRESS,RESEND] makefile.linux: allow env to override CROSS_COMPILE and CC

Message ID 1415096322-445-1-git-send-email-qais.yousef@imgtec.com (mailing list archive)
State New, archived
Headers show

Commit Message

Qais Yousef Nov. 4, 2014, 10:18 a.m. UTC
allow env variables to override them without having to modify the makefile.

Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
---
I'm not sure why but I think the first send didn't reach the list, hence
resending.

 makefile.linux | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox

Patch

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}