Skip to content

Instantly share code, notes, and snippets.

@TheZ3ro
Created October 3, 2016 11:01
Show Gist options
  • Save TheZ3ro/b6c2da7688a5956b5de9fe249ecea935 to your computer and use it in GitHub Desktop.
Save TheZ3ro/b6c2da7688a5956b5de9fe249ecea935 to your computer and use it in GitHub Desktop.
main.cpp
#if 0
# Who needs a makefile? Just run ./main.cpp [arguments]
set -eu
./configure.sh
gcc_flags="--std=c++14 -Wall -O2 -g -DNDEBUG"
linker_flags="-lstdc++ -lpthread -ldl"
mkdir -p build
obj_files=""
for source_path in *.cpp; do
obj_path="build/${source_path%.cpp}.o"
obj_files="$obj_files $obj_path"
if [ ! -f $obj_path ] || [ $obj_path -ot $source_path ]; then
echo "Compiling $source_path to $obj_path..."
gcc $gcc_flags \
-I libs -I libs/emilib \
-c $source_path -o $obj_path
fi
done
echo "Linking..."
gcc $gcc_flags $linker_flags $obj_files -o wfc.bin
# Run it:
mkdir -p output
./wfc.bin $@
exit
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment