Skip to content

Instantly share code, notes, and snippets.

@fdavidcl
Forked from mroman42/compilatodo.sh
Last active August 29, 2015 14:01
Show Gist options
  • Save fdavidcl/dedf154e3de34ffeccd4 to your computer and use it in GitHub Desktop.
Save fdavidcl/dedf154e3de34ffeccd4 to your computer and use it in GitHub Desktop.
#!/bin/bash
# David Charte, Ignacio Cordón y Mario Román
# Parámetros
# 1 - regla para encontrar los archivos a compilar
# 2 - argumento a pasar al programa
CFLAGS="-flto -fopenmp -fwhole-program -Wall -Wl,--no-as-needed"
CXXFLAGS="$CFLAGS -std=c++0x"
LDFLAGS="-lm -lrt"
OPTS="-O0 -O1 -O2 -O3 -Os"
FILES=`ls $1`
for code in $FILES
do
for opt in $OPTS
do
name="${code%.cc}$opt"
g++ $code $CFLAGS $CXXFLAGS $opt $LDFLAGS -o $name
echo $code - $opt - `./$name $2`
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment