Latest tweets from eosgarden

Noxeos - Mixing C++ with C/Objective-C: http://t.co/VS5zeASf
eosgarden - 16.01.2012 / 23:01
FileSytem for iPhone is finally compatible with iOS 5 - update or download it now: http://t.co/yXqCFkC9
eosgarden - 11.01.2012 / 22:22
Noxeos - Warning flags for Clang: http://t.co/iZFQWi6f
eosgarden - 10.01.2012 / 20:36
AutoPurge - Optimize your system memory with a single click: http://t.co/9oTKasSS
eosgarden - 10.01.2012 / 20:24
Manual - Unix man pages at your fingertips: http://t.co/81rZTSeC
eosgarden - 10.01.2012 / 20:12
PropEdit 2.1.0: http://t.co/zJsERSpb
eosgarden - 10.01.2012 / 19:48
@dodyrw NodeJS binary is included in WebStart. GUI is ready, and will be available in the next version (should be released in a few days).
eosgarden - 08.01.2012 / 22:03
@dfeyer Don't know the Percona version (yet)… Is it better than MySQL?
eosgarden - 07.01.2012 / 10:59
PropEdit 2.0 has been released. Now with ACLs support! http://t.co/zJsERSpb
eosgarden - 07.01.2012 / 10:50
PropEdit 2.0 is ready!
eosgarden - 07.01.2012 / 10:07
 
 
 

About

Bin-Build is a small shell script to simplify compiling source file in C, C++ and Objective-C.
You will find below a list of it's features.
Bin-Build is realeased under the BSD License. Feel free to use it, and modify it at your convenience.
 
 

Documentation

Table of contents

  1. Overview
  2. Language detection
  3. Language settings
  4. Installation
  5. Default settings

Overview

The purpose of this script is to provide a simplified compilation command.
When compiling a source file, the invocation of the compiler is often a painful task, especially when specific options need to be passed, like compiler flags, error level, etc.
For instance, in order to compile a C file with GCC, you need to type the following kind of command:
gcc -Wall -Werror -Wextra -pedantic -std=c89 -Os -o file file.c
It can be a lot worse if using specific options.
With Bin-Build, you can replace the previous command with:
bin-build file.c
It will generate a 'file' executable, from the 'file.c' source file, using the C compiler.
You will see the following kind of output:
/usr/local/bin/bin-build: compiling file file.c

Settings:

- Language: C
- Compiler: /usr/bin/gcc
- Input file: /Users/macmade/Desktop/test.c
- Output file: /Users/macmade/Desktop/test

Compiler options:
- std=c99 - Os - pedantic
- Werror - Wall - Wextra
- Wbad-function-cast - Wdeclaration-after-statement - Werror-implicit-function-declaration
- Wmissing-braces - Wmissing-declarations - Wmissing-field-initializers
- Wmissing-prototypes - Wnested-externs - Wold-style-definition
- Wparentheses - Wreturn-type - Wshadow
- Wsign-compare - Wstrict-prototypes - Wswitch
- Wuninitialized - Wunknown-pragmas - Wunused-function
- Wunused-label - Wunused-parameter - Wunused-value
- Wunused-variable

Compiling file...

Compilation successfull
Do you want to execute the produced binary now? [y/N]

--------------------------------------------------------------------------------
Executing /Users/macmade/Desktop/test
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Process exit code: 0
--------------------------------------------------------------------------------
As you can see, once the compilation is complete, the script ask you if you want to execute the produced prgram, and gives you the program's exit code, once executed.

Language detection

Bin-Build can be used seamlessly with C, C++ and Objective-C.
The script automatically detects the programming language, based on the file extension:
  • C:           .c
  • C++:         .cpp
  • Objective-C: .m
Specific compiler settings will be used for each language.

Language settings

Settings can be configured for each language, trough environment variables:
  • C:           $BIN_BUILD_C
  • C++:         $BIN_BUILD_CPP
  • Objective-C: $BIN_BUILD_OBJC
Settings consist of the compiler arguments, separated by a ':' sign.
For instance:
export BIN_BUILD_C=-Wall:-Werror:-O2
bin-build file.c
Settings can be set for the session, as in the previous example, or globally, in your '.bash_rc' or '.profile' file.

Installation

Simply copy the script in a directory that's included in your executable path (like /usr/local/bin/), and make sure the executable flag is set.
For instance:
sudo cp bin-build.sh /usr/local/bin/bin-build
sudo chmod 755 /usr/local/bin/bin-build
You'll then be able to call the script as a normal executable:
svn-util ~/file.c

Default settings

Here are the default settings, used for each language.

C

  • std=c99
  • Os
  • pedantic
  • Werror
  • Wall
  • Wextra
  • Wbad-function-cast
  • Wdeclaration-after-statement
  • Werror-implicit-function-declaration
  • Wmissing-braces
  • Wmissing-declarations
  • Wmissing-field-initializers
  • Wmissing-prototypes
  • Wnested-externs
  • Wold-style-definition
  • Wparentheses
  • Wreturn-type
  • Wshadow
  • Wsign-compare
  • Wstrict-prototypes
  • Wswitch
  • Wuninitialized
  • Wunknown-pragmas
  • Wunused-function
  • Wunused-label
  • Wunused-parameter
  • Wunused-value
  • Wunused-variable

C++

  • Os
  • pedantic
  • Werror
  • Wall
  • Wextra
  • Wmissing-braces
  • Wmissing-field-initializers
  • Wmissing-prototypes
  • Wparentheses
  • Wreturn-type
  • Wshadow
  • Wsign-compare
  • Wswitch
  • Wuninitialized
  • Wunknown-pragmas
  • Wunused-function
  • Wunused-label
  • Wunused-parameter
  • Wunused-value
  • Wunused-variable

Objective-C

  • framework Cocoa
  • std=c99
  • Os
  • pedantic
  • Werror
  • Wall
  • Wextra
  • Wbad-function-cast
  • Wdeclaration-after-statement
  • Werror-implicit-function-declaration
  • Wmissing-braces
  • Wmissing-declarations
  • Wmissing-field-initializers
  • Wmissing-prototypes
  • Wnested-externs
  • Wold-style-definition
  • Wparentheses
  • Wreturn-type
  • Wshadow
  • Wsign-compare
  • Wstrict-prototypes
  • Wstrict-selector-match
  • Wswitch
  • Wundeclared-selector
  • Wuninitialized
  • Wunknown-pragmas
  • Wunused-function
  • Wunused-label
  • Wunused-parameter
  • Wunused-value
  • Wunused-variable