update makefile to be able to define a target platform prefix

This commit is contained in:
Steffen Jaeckel 2013-04-18 16:41:32 +02:00
parent e5e8cc2e50
commit d0a83df7f8

View File

@ -9,8 +9,13 @@ VERSION=1.17
PLATFORM := $(shell uname | sed -e 's/_.*//')
# Compiler and Linker Names
#CC=gcc
#LD=ld
ifndef PREFIX
PREFIX=
endif
CC=$(PREFIX)gcc
LD=$(PREFIX)ld
AR=$(PREFIX)ar
# Archiver [makes .a files]
#AR=ar
@ -23,9 +28,9 @@ endif
# ranlib tools
ifndef RANLIB
ifeq ($(PLATFORM), Darwin)
RANLIB=ranlib -c
RANLIB=$(PREFIX)ranlib -c
else
RANLIB=ranlib
RANLIB=$(PREFIX)ranlib
endif
endif
@ -274,7 +279,7 @@ library: $(LIBNAME)
$(OBJECTS): $(HEADERS)
testprof/$(LIBTEST):
cd testprof ; CFLAGS="$(CFLAGS)" LIBTEST_S=$(LIBTEST_S) $(MAKE)
cd testprof ; CFLAGS="$(CFLAGS)" LIBTEST_S=$(LIBTEST_S) CC="$(CC)" LD="$(LD)" AR="$(AR)" RANLIB="$(RANLIB)" $(MAKE)
$(LIBNAME): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)