Skip to content

Commit

Permalink
build-support: allow CC and CXX to be overridden.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Jun 6, 2014
1 parent 3ec5c70 commit 56a3a3c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
13 changes: 5 additions & 8 deletions GNUmakefile
@@ -1,7 +1,4 @@
ifdef CONFIG
CC = gcc
CPP = g++

VERSION = 0.97

BUNDLE = Factor.app
Expand Down Expand Up @@ -210,11 +207,11 @@ $(ENGINE): $(DLL_OBJS)
factor-lib: $(ENGINE)

factor: $(EXE_OBJS) $(DLL_OBJS)
$(TOOLCHAIN_PREFIX)$(CPP) $(LIBPATH) -L. $(DLL_OBJS) \
$(TOOLCHAIN_PREFIX)$(CXX) $(LIBPATH) -L. $(DLL_OBJS) \
$(CFLAGS) -o $(EXECUTABLE) $(LIBS) $(EXE_OBJS)

factor-console: $(EXE_OBJS) $(DLL_OBJS)
$(TOOLCHAIN_PREFIX)$(CPP) $(LIBPATH) -L. $(DLL_OBJS) \
$(TOOLCHAIN_PREFIX)$(CXX) $(LIBPATH) -L. $(DLL_OBJS) \
$(CFLAGS) $(CFLAGS_CONSOLE) -o $(CONSOLE_EXECUTABLE) $(LIBS) $(EXE_OBJS)

factor-ffi-test: $(FFI_TEST_LIBRARY)
Expand All @@ -229,16 +226,16 @@ vm/ffi_test.o: vm/ffi_test.c
$(TOOLCHAIN_PREFIX)$(CC) -c $(CFLAGS) $(FFI_TEST_CFLAGS) -o $@ $<

vm/master.hpp.gch: vm/master.hpp $(MASTER_HEADERS)
$(TOOLCHAIN_PREFIX)$(CPP) -c -x c++-header $(CFLAGS) -o $@ $<
$(TOOLCHAIN_PREFIX)$(CXX) -c -x c++-header $(CFLAGS) -o $@ $<

%.o: %.cpp vm/master.hpp.gch
$(TOOLCHAIN_PREFIX)$(CPP) -c $(CFLAGS) -o $@ $<
$(TOOLCHAIN_PREFIX)$(CXX) -c $(CFLAGS) -o $@ $<

%.o: %.S
$(TOOLCHAIN_PREFIX)$(CC) -c $(CFLAGS) -o $@ $<

%.o: %.mm vm/master.hpp.gch
$(TOOLCHAIN_PREFIX)$(CPP) -c $(CFLAGS) -o $@ $<
$(TOOLCHAIN_PREFIX)$(CXX) -c $(CFLAGS) -o $@ $<

.SUFFIXES: .mm

Expand Down
19 changes: 10 additions & 9 deletions build-support/factor.sh
Expand Up @@ -92,16 +92,16 @@ set_gcc() {
macosx)
xcode_major=`xcodebuild -version | sed -E -ne 's/^Xcode ([0-9]+).*$/\1/p'`
if [[ $xcode_major -ge 4 ]]; then
CC=clang
CPP=clang++
[ -z "$CC" ] && CC=clang
[ -z "$CXX" ] && CXX=clang++
else
CC=gcc
CPP=g++
[ -z "$CC" ] && CC=gcc
[ -z "$CXX" ] && CXX=g++
fi
;;
*)
CC=gcc
CPP=g++
[ -z "$CC" ] && CC=gcc
[ -z "$CXX" ] && CXX=g++
;;
esac
}
Expand Down Expand Up @@ -232,7 +232,7 @@ c_find_word_size() {
$ECHO "Finding WORD..."
C_WORD=factor-word-size
write_test_program
gcc -o $C_WORD $C_WORD.c
$CC -o $C_WORD $C_WORD.c
WORD=$(./$C_WORD)
check_ret $C_WORD
$DELETE -f $C_WORD*
Expand Down Expand Up @@ -294,6 +294,7 @@ echo_build_info() {
$ECHO GIT_URL=$GIT_URL
$ECHO DOWNLOADER=$DOWNLOADER
$ECHO CC=$CC
$ECHO CXX=$CXX
$ECHO MAKE=$MAKE
$ECHO COPY=$COPY
$ECHO DELETE=$DELETE
Expand Down Expand Up @@ -345,7 +346,7 @@ parse_build_info() {
if [[ $OS == linux && $ARCH == ppc ]] ; then WORD=32; fi
if [[ $OS == linux && $ARCH == arm ]] ; then WORD=32; fi
if [[ $OS == macosx && $ARCH == ppc ]] ; then WORD=32; fi

$ECHO "OS=$OS"
$ECHO "ARCH=$ARCH"
$ECHO "WORD=$WORD"
Expand All @@ -354,13 +355,13 @@ parse_build_info() {
find_build_info() {
find_os
find_architecture
set_gcc
find_word_size
set_factor_binary
set_factor_library
set_factor_image
set_build_info
set_downloader
set_gcc
set_make
echo_build_info
}
Expand Down

0 comments on commit 56a3a3c

Please sign in to comment.