#!/usr/bin/bash
#
# Souffle - A Datalog Compiler
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at:
# - https://opensource.org/licenses/UPL
# - <souffle root>/licenses/SOUFFLE-UPL.txt
#

CXX=g++ -std=c++17
CXXFLAGS="-Wall -Wextra  -fwrapv  -DUSE_NCURSES  -O3 -DUSE_LIBZ  -DUSE_SQLITE  -fopenmp  -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection"
LIBS="-ldl -lpthread -lsqlite3 -lz -lncursesw"

function usage() {
cat <<EOT
Usage: $0 [-hl]
  -h          Show usage
  -l          Libraries required for linking
EOT
}

while getopts "hl" opt; do
    case $opt in
        h) usage; exit 0 ;;
        l) echo $LIBS; exit 0 ;;
        \?)
            echo "Invalid option: -$OPTARG" >&2
            usage >&2
            exit 1
            ;;
    esac
done

usage >&2
exit 1
