Jump to: navigation, search

The Trivial Build System

The simplest build system is the one not requiring any software. There are several approaches.

Manual Build

Write a note in your source on how to build. Or don't, if it is obvious.

// compile: g++ -oprogram -lm program.cpp

IDE Build

If you use Vim as IDE, you could specify a makeprg in your source. Here it is done using the Universal Text Linking (UTL) URL syntax:

// <URL:vimscript:set mp=g++\ -oprogram\ -lm\ program.cpp>

A Vim user can just place the cursor on the URL and press <Leader>gu and then type :make to build. Unfortunately, the makeprg cannot be specified using modelines, but you could use Vim Directory Environment Configuration.

Self-Contained Build Script

The source file could serve as a build script itself. Here is an example using bash as interpreter:

#/* Compile: sh program.cpp                                              
    g++ program.cpp -oprogram                                         
... // C++ program follows here

Thus, the source file is bilingual :).

This could also be combined with the Vim UTL URL:

#/* Compile: sh program.cpp <URL:vimscript:set mp=.\ %>
    g++ program.cpp -oprogram                                         
... // C++ program follows here

or specified using Vim Directory Environment Configuration.

Pages in category "Build Systems"

The following 4 pages are in this category, out of 4 total.