@ -829,31 +829,68 @@ The most useful thing to do right now is to provide new services.
<aname="build.zsh"></a>
### [Build.zsh][build.zsh]: makefile creation. <side-note>*for mere mortals*</side-note>
A `Makefile` is very useful to share your project, <u>whatever your project is</u>, no matter if it is an application, a library, the language used, etc.
Build.zsh creates a makefile from a simple declarative configuration file.
A `Makefile` should:
- **build the application**<br/>
This means a few things:
- compile and link your applications
- handle dependencies between files to build
- rebuild only updated parts of the application, for incremental builds
- allow users to rebuid any part of your project independently
- **compile and link the application**
- **handle dependencies** and **rebuild only updated parts of the application** *for incremental builds*
- **allow users to rebuid any part of your project independently**
- **install the application**<br/>
The default installation root directory is `/usr/local` but you should be able to change that easily (and with an environment variable).
The default installation root directory is `/usr/local` but you should be able to change that easily (with an environment variable or through configuration).
- **create a tarball of the project**<br/>
Very useful to share your project, <u>whatever your project is</u>.
No matter if it is an application, a library, the language used, etc.
- **have a `make help`**
This tarball includes your application, its man-pages, the Makefile to build it, etc.
- **have a `make help`** *everybody needs help*
- *(BONUS)* have colors. I like colors.
**How-to generate a Makefile using `Build.zsh`**
```zsh
$ ls project.zsh # we need to create this file, we'll cover that in a moment
project.zsh
```
```zsh
$ build.zsh -c # -c is for colors. I like colors. Really.
```
```zsh
$ ls Makefile # tadaaaaa you made a Makefile
Makefile
```
You can invoke your newly created Makefile with `make help` to know what can it do for you.
For example, it can create a tarball with `make dist`.
Here is a quick example of what `build.zsh` can do:
**How-to make a `project.zsh` for `build.zsh`**
```zsh
package=my-application
version=2.18.3
# File `project.zsh`
package=my-application # Name of your package.
version=2.18.3 # Version of the package (will follow the application version, probably).
# targets = all the applications we want to compile in the project
targets=(my-application)
# Then, we tell the language of these applications.
# Here, my-application is coded in Crystal.
# build.zsh comes with a number of back-ends: https://git.baguette.netlib.re/Baguette/build.zsh/src/branch/master/build
type[my-application]=crystal
# sources are the sources of the application
sources[my-application]=src/main.cr
# The application depends on a number of files.
# Each modification of one of these files = we have to re-compile.
depends[my-application]="$(find src -type f | grep -v main.cr)"
# target = all the
target=()
# Finally, we want to know what are the files we want in the tarball (made though `make dist`).