Skip to content

Commit

Permalink
Some small improvements to the build_tools
Browse files Browse the repository at this point in the history
Summary: Closes facebook#3664

Differential Revision: D7459433

Pulled By: sagar0

fbshipit-source-id: 3817e5d45fc70e83cb26f9800eaa0f4566c8dc0e
  • Loading branch information
adamretter authored and facebook-github-bot committed Apr 3, 2018
1 parent 04c11b8 commit 12b400e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
24 changes: 18 additions & 6 deletions build_tools/build_detect_platform
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
#
# Detects OS we're compiling on and outputs a file specified by the first
# argument, which in turn gets read while processing Makefile.
Expand Down Expand Up @@ -66,11 +66,23 @@ rm -f "$OUTPUT"
touch "$OUTPUT"

if test -z "$CC"; then
CC=cc
if [ -x "$(command -v cc)" ]; then
CC=cc
elif [ -x "$(command -v clang)" ]; then
CC=clang
else
CC=cc
fi
fi

if test -z "$CXX"; then
CXX=g++
if [ -x "$(command -v g++)" ]; then
CXX=g++
elif [ -x "$(command -v clang++)" ]; then
CXX=clang++
else
CXX=g++
fi
fi

# Detect OS
Expand All @@ -87,7 +99,7 @@ if test -z "$CLANG_SCAN_BUILD"; then
fi

if test -z "$CLANG_ANALYZER"; then
CLANG_ANALYZER=$(which clang++ 2> /dev/null)
CLANG_ANALYZER=$(command -v clang++ 2> /dev/null)
fi

if test -z "$FIND"; then
Expand Down Expand Up @@ -498,9 +510,9 @@ if test -z "$PORTABLE"; then
elif test -n "`echo $TARGET_ARCHITECTURE | grep ^arm`"; then
# TODO: Handle this with approprite options.
COMMON_FLAGS="$COMMON_FLAGS"
elif [ "$TARGET_OS" == IOS ]; then
elif [ "$TARGET_OS" == "IOS" ]; then
COMMON_FLAGS="$COMMON_FLAGS"
elif [ "$TARGET_OS" != AIX ] && [ "$TARGET_OS" != SunOS ]; then
elif [ "$TARGET_OS" != "AIX" ] && [ "$TARGET_OS" != "SunOS" ]; then
COMMON_FLAGS="$COMMON_FLAGS -march=native "
elif test "$USE_SSE"; then
COMMON_FLAGS="$COMMON_FLAGS -msse4.2 -mpclmul"
Expand Down
2 changes: 1 addition & 1 deletion build_tools/version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
if [ "$#" = "0" ]; then
echo "Usage: $0 major|minor|patch|full"
exit 1
Expand Down

0 comments on commit 12b400e

Please sign in to comment.