Skip to content
Snippets Groups Projects
build.sh 1017 B
Newer Older
#!/usr/bin/env bash
##
## Copyright (C) HySoP 2011-2022
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
##         http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
set -feu -o pipefail
Jean-Baptiste Keck's avatar
Jean-Baptiste Keck committed

Jean-Baptiste Keck's avatar
Jean-Baptiste Keck committed
if [ $# -ne 4 ]; then
Jean-Baptiste Keck's avatar
Jean-Baptiste Keck committed
    echo "Usage ./build build_folder CC CXX FC"
    exit 1
fi

Jean-Baptiste Keck's avatar
Jean-Baptiste Keck committed
BUILD_FOLDER="$1"
if [ ! -d "$BUILD_FOLDER" ]; then
    echo "Folder $1 has not been generated by previous step."
    exit 1
Jean-Baptiste Keck's avatar
Jean-Baptiste Keck committed
cd $BUILD_FOLDER
if [ ! -f Makefile ]; then
    echo "The makefile has not been generated."
    exit 1
fi
Jean-Baptiste Keck's avatar
Jean-Baptiste Keck committed

CC="$2" CXX="$3" FC="$4" make VERBOSE=1 -j4
Jean-Baptiste Keck's avatar
Jean-Baptiste Keck committed

exit 0