Change project name to 'Make-it-Quick', and make it installable

This simplifies the management of projects using make-it-quick by
putting the makefile include files in a shared location
(typically /usr/local/include/make-it-quick)
This commit is contained in:
Christophe de Dinechin 2018-04-03 16:44:24 +02:00
parent 4d77ac826f
commit 198ad6420d
21 changed files with 198 additions and 150 deletions

View File

@ -1,10 +1,10 @@
#******************************************************************************
# Makefile<build> 'build' project
# Makefile<make-it-quick> Make-It-Quick project
#******************************************************************************
#
# File Description:
#
# A sample maefile for 'build'
# Top-level makefile for 'make-it-quick'
#
#
#
@ -15,42 +15,30 @@
#
#******************************************************************************
# (C) 2017-2018 Christophe de Dinechin <christophe@dinechin.org>
# This software is licensed under the GNU General Public License v3
# See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
# Define the path to 'build' (can be a git submodule in your project)
# Things to install
PREFIX_HDR=$(PREFIX)include/make-it-quick/
HDR_INSTALL= \
config.arm-linux-gnu.mk \
config.auto.mk \
config.cygwin.mk \
config.gnu.mk \
config.linux.mk \
config.macosx-clang.mk \
config.macosx.mk \
config.mingw.mk \
config.mk \
config.msys.mk \
config.unix.mk \
config.vs2013-64.mk \
config.vs2013.mk \
rules.mk
# Include the makefile rules with special BUILD path
BUILD=./
# Define the source code
SOURCES=hello.cpp
# Define libraries we use in that project
LIBRARIES=lib1/lib1.dll lib2/lib2.lib
# Define the product of the build (.exe will be removed for Unix builds)
PRODUCTS=hello.exe
# Define configuration options
CONFIG= <stdio.h> \
<unistd.h> \
<nonexistent.h> \
<sys/time.h> \
<sys/improbable.h> \
<iostream> \
clearenv \
libm \
liboony \
sbrk
# Define what to test
TESTS=product count-characters
# Define what to benchmark
BENCHMARKS=product
# Include the makefile rules
include $(BUILD)rules.mk
count-characters.test:
@echo Output has `$(TEST_ENV) $(OBJPRODUCTS) | wc -c` characters, should be 35
TESTS=example/

120
README.md
View File

@ -1,9 +1,9 @@
# build
# Make-It-Quick (MIQ)
A simple makefile-based build system for C / C++ programs
## Features
Build is a simple build system destined to make it easy to build C or
Make-It-Quick is a simple build system destined to make it easy to build C or
C++ programs without having to write lengthy makefiles or going
through the complexity of tools such as `automake` or `cmake`. It is
well suited for relatively small programs, although it has been used
@ -30,7 +30,7 @@ for at least one much larger program.
only built the first time, unless you request a "deep" build)
* Portable (tested on Linux, macOS and Windows platforms)
You can find examples of how I use 'build' in other projects:
You can find examples of how 'Make-It-Quick' is used in other projects:
* [SPICE - Simple Protocol for Independent Computing Environments](https://github.com/c3d/spice)
* [Flight recorder](https://github.com/c3d/recorder/blob/master/Makefile)
@ -38,31 +38,19 @@ You can find examples of how I use 'build' in other projects:
* [ELFE programming language](https://github.com/c3d/elfe/blob/master/src/Makefile)
* [XL reboot](https://github.com/c3d/xl/blob/master/Makefile)
## Using build
## Using Make-It-Quick
To use `build`, you create a `Makefile`. A minimal makefile only needs
To use `make-it-quick`, you create a `Makefile`. A minimal makefile only needs
to specify the name of the `SOURCES`, the name of the build `PRODUCTS`,
and include the `rules.mk` file, which contains the makefile rules:
and include the `make-it-quick/rules.mk` file, which contains the makefile rules:
BUILD=build/
SOURCES=my-super-tool.cpp helper.c
PRODUCTS=my-super-tool.exe
include $(BUILD)rules.mk
include make-it-quick/rules.mk
That's all you need to get started. There is a small sample `Makefile`
in this distribution.
Note that the `BUILD` variable requires a trailing `/`. This is a
general convention in `build` for variables that denote directories
(Rationale: You can leave these variables empty for the current
directory).
For consistency across projects, it is recommended to leave `build`
in the `build` subdirectory. You can typically add `build` as a
submodule in your project using:
git submodule add https://github.com/c3d/build.git
In order to get a summary of the available build targets, use `make help`.
@ -85,18 +73,18 @@ example, on Linux, `LIB_EXT` is set to `.a`.
## Building the products
If you simply type `make`, a default build is launched. This is what
you should see if you do that in the `build` directory itself:
you should see if you do that in the `make-it-quick` directory itself:
build> make
make-it-quick> make
****************************************************************
* The BUILDENV environment variable is not set
* You will accelerate builds by setting it as appropriate for
* your system. The best guess is BUILDENV=macosx-clang
* Attempting to build opt with macosx-clang DIR=/build
* Attempting to build opt with macosx-clang DIR=/make-it-quick
****************************************************************
[BEGIN] opt macosx-clang in [top]/build
[BEGIN] opt macosx-clang in [top]/make-it-quick
[GENERATE] CONFIG_HAVE_stdio.c
[CONFIG] stdio
[GENERATE] CONFIG_HAVE_unistd.c
@ -109,38 +97,45 @@ you should see if you do that in the `build` directory itself:
[CONFIG] sys.sl.improbable
[GENERATE] CONFIG_HAVE_iostream.cpp
[CONFIG] iostream
[COPY] config/check_clearenv.c => objects/macosx-clang/opt/build/CONFIG_CHECK_clearenv.c
[COPY] config/check_clearenv.c => objects/macosx-clang/opt/make-it-quick/CONFIG_CHECK_clearenv.c
[CONFIG] clearenv
[GENERATE] CONFIG_LIBm.c
[CONFIG] libm
[GENERATE] CONFIG_LIBoony.c
[CONFIG] liboony
[COPY] config/check_sbrk.c => objects/macosx-clang/opt/build/CONFIG_CHECK_sbrk.c
[COPY] config/check_sbrk.c => objects/macosx-clang/opt/make-it-quick/CONFIG_CHECK_sbrk.c
[CONFIG] sbrk
[GENERATE] config.h
[COMPILE 1/1] hello.cpp
[BUILD] hello
[END] opt macosx-clang in [top]/build
[END] opt macosx-clang in [top]/make-it-quick
real 0m2.243s
user 0m1.206s
sys 0m0.750s
The output of the build will be located by default in `.objects`.
The output of the build will be located by default in the top-level
directory for the build, or the directory specified by the `OUTPUT`
environment variable if it's set.
Temoprary files are placed in the `.objects` directory, or the
directory set by the `OBJFILES` environment variable if it's set.
There are subdirectories corresponding to the build environment and
the build target, so the final product could be for instance under
`.objects/macosx-clang/opt/hello`. This is explained below.
The log files will be located by default in `.logs`, the latest
one being called `make.log`.
one being called `make.log`, or in the directory specified by the
`LOGS` environment variable.
You can clean the build products with `make clean` and force a clean
build with `make rebuild`.
### Build tips
The `build` makefiles are self-documented. You can get information
about the avaiable build targets using `make help`.
The makefiles are self-documented. You can get information
about the avaiable build targets using `make help`, and add your
own documentation by adding dependencies to the `help` target.
There are three primary build targets, `debug`, `opt` and
`release`, which are described in detail below. Build objects for
@ -166,15 +161,16 @@ environment variable, e.g.
## Testing the products
Use `make test` to test the product. The simplest possible test is to
simply run the generated program. You can do this by adding a `TESTS`
variable to your `Makefile`:
Use `make test` or `make check` to test the product. The `check` target ensures
that everything is rebuilt before testing.
The simplest possible test is to simply run the generated program. You
can do this by adding a `TESTS` variable to your `Makefile`:
BUILD=build/
SOURCES=hello.cpp
PRODUCTS=hello.exe
TESTS=product
include $(BUILD)rules.mk
include make-it-quick/rules.mk
If you run `make test` (or `make check`) on the sample makefile found in the
distribution directory, you will run the `hello` program, after
@ -249,12 +245,13 @@ you do `make clean`, you only clean `opt` objects since this is the
default target. If you want to clean debug objects, use `make debug-clean`.
Similarly, you can do a release install with `make release-install`.
(Note that you can make `debug` your default target, see below).
Note that you can make `debug` your default target by setting the
`TARGET` environment variable, see below.
## Environment variables
Several environment variables control the behavior of `build`. The
Several environment variables control the behavior of `make-it-quick`. The
variables that can be configured are found at the beginning of `config.mk`.
Note that all directory names should end with a trailing `/`.
Some of the most useful environment variables include:
@ -293,7 +290,7 @@ Some of the most useful environment variables include:
## Hierarchical projects
Often, a project is made of several directories or libraries. In
`build`, this is supported with two makefile variables:
`make-it-quick`, this is supported with two makefile variables:
* `SUBDIRS` lists subdirectories of the top-level directory that
must be built every time.
@ -304,6 +301,9 @@ Often, a project is made of several directories or libraries. In
dynamically. Note that the `PRODUCTS` in the corresponding
subdirectory should match and produce the correct output.
* `TOP` is the top-level directory, which is used for example when
you build `make top-debug`.
Subdirectories are re-built everytime a top-level build is started,
whereas libraries are re-built only if they are missing. It is
possible to force a re-build of libraries using the `d-` or `deep-`
@ -317,12 +317,12 @@ available on some platforms or after installing specific
dependencies. Tools such as `autoconf` and `automake` address this
problem in a separate build step.
The `build` configuration step is designed to generate a `config.h`
The `make-it-quick` configuration step is designed to generate a `config.h`
file with a content that is close enough to the output of `autoconf`
to allow a same project to be adapted for `build` with minimal changes
to allow a same project to be adapted for `make-it-quick` with minimal changes
in the source code.
In `build`, you specify the configuration dependencies using the
In `make-it-quick`, you specify the configuration dependencies using the
`CONFIG` variable, which will define the various conditions you want
to test for. The result of the tests will be stored in a `config.h`
header file.
@ -364,8 +364,8 @@ The following configuration options are recognized:
For function names, a source file in the `config/` subdirectory will
specify how you test for the given function, and possibly return
additional output that will be integrated in the `config.h` file. The
file name begins with `check_` followed by the function being
tested, and can be located either in the `build` directory, or in the
file name begins with `check_` followed by the function being tested,
and can be located either in the `make-it-quick` directory, or in the
project directory. The `build/config` directory contains a few
examples of such tests for simple functions.
@ -388,11 +388,11 @@ returned by `sbrk(0)` different with each run.
## Package dependencies
A `build` project can depend on other packages and use `pkg-config` to
easily get the required compilation or link flags. The `PKGCONFIGS`
variable lists the name of the required packages. if the name ends
with `?`, the package is optional, and the build with succceed even if
the package is not present.
A `make-it-quick` project can depend on other packages and use
`pkg-config` to easily get the required compilation or link flags. The
`PKGCONFIGS` variable lists the name of the required packages. if the
name ends with `?`, the package is optional, and the build with
succceed even if the package is not present.
For example, `PKGCONFIGS` may look like this, in which case packages
`pixman-1` and `gstreamer-1.0` are required, whereas package `openssl`
@ -413,21 +413,21 @@ There a few utility targets, in particular:
## Redistribution
The 'build' project is released under the GNU General Public License
version 3. The project author's reading of said license is that it only
"contaminates" derivative products, but not products created *using* the
product. In other words:
The `make-it-quick` project is released under the GNU General Public
License version 3. The project author's reading of said license is
that it only "contaminates" derivative products, but not products
created *using* the product. In other words:
* Creating derivative software, e.g. a 'nanotoconf' project that uses
'build' code, requires you to comply with the GPL, and in particular
to redistribute your code in source form. The fact that it's really
hard to distribute makefiles in binary form should help you comply
with this anyway :-)
`make-it-quick` code, requires you to comply with the GPL, and in
particular to redistribute your code in source form. The fact that
it's really hard to distribute makefiles in binary form should help
you comply with this anyway :-)
* Building software using 'build' does not make that software GPL, any
more than building it using GCC or GNU Make. I believe that 'build'
can legally be used for proprietary software or for software using
any other open-source license.
* Building software using `make-it-quick` does not make that software
GPL, any more than building it using GCC or GNU Make. I believe that
`make-it-quick` can legally be used for proprietary software or for
software using any other open-source license.
As long as I (Christophe de Dinechin) am the sole author / maintainer
of this software, this interpretation will prevail. If you believe

View File

@ -1,5 +1,5 @@
#******************************************************************************
# config.auto.mk Recorder project
# config.auto.mk Make-It-Quick project
#******************************************************************************
#
# File Description:
@ -14,8 +14,8 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
# Identification of the default build environment

View File

@ -1,5 +1,5 @@
#******************************************************************************
# config.cygwin.mk Recorder project
# config.cygwin.mk Make-It-Quick project
#******************************************************************************
#
# File Description:
@ -15,8 +15,8 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
DEFINES_cygwin=CONFIG_CYGWIN UNICODE _WIN32 WIN32

View File

@ -1,5 +1,5 @@
#******************************************************************************
# config.gnu.mk Recorder project
# config.gnu.mk Make-It-Quick project
#******************************************************************************
#
# File Description:
@ -14,8 +14,8 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
#------------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
#******************************************************************************
# config.linux.mk Recorder project
# config.linux.mk Make-It-Quick project
#******************************************************************************
#
# File Description:
@ -15,11 +15,11 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
DEFINES_linux=CONFIG_LINUX
OS_NAME_linux= linux
OS_NAME_linux=linux
include $(BUILD)config.gnu.mk

View File

@ -1,5 +1,5 @@
#******************************************************************************
# config.macosx-clang.mk Recorder project
# config.macosx-clang.mk Make-It-Quick project
#******************************************************************************
#
# File Description:
@ -13,8 +13,8 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
#------------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
#******************************************************************************
# config.macosx.mk Recorder project
# config.macosx.mk Make-It-Quick project
#******************************************************************************
#
# File Description:
@ -15,8 +15,8 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
OS_NAME_macosx= macosx

View File

@ -1,5 +1,5 @@
#******************************************************************************
# config.mingw.mk Recorder project
# config.mingw.mk Make-It-Quick project
#******************************************************************************
#
# File Description:
@ -15,8 +15,8 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
#------------------------------------------------------------------------------

View File

@ -1,10 +1,10 @@
#******************************************************************************
# config.mk 'Build' project
# config.mk Make-It-Quick project
#******************************************************************************
#
# File Description:
#
# This is the shared makefile configuration file for 'build'
# This is the shared makefile configuration file Make-It-Quick
# This where the location of specific directories should be specified
#
#
@ -14,8 +14,8 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
# Use /bin/sh as a basic shell, since it is faster than bash

View File

@ -1,5 +1,5 @@
#******************************************************************************
# config.msys.mk Recorder project
# config.msys.mk Make-It-Quick project
#******************************************************************************
#
# File Description:
@ -15,8 +15,8 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
include $(BUILD)config.mingw.mk

View File

@ -1,5 +1,5 @@
#******************************************************************************
# config.unix.mk Recorder project
# config.unix.mk Make-It-Quick project
#******************************************************************************
#
# File Description:
@ -15,8 +15,8 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
DEFINES_unix=

View File

@ -1,5 +1,5 @@
#******************************************************************************
# config.vs2013-64.mk Recorder project
# config.vs2013-64.mk Make-It-Quick project
#******************************************************************************
#
# File Description:
@ -15,8 +15,8 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
DEFINES_vs2013-64= WIN32

View File

@ -1,5 +1,5 @@
#******************************************************************************
# config.vs2013.mk Recorder project
# config.vs2013.mk Make-it-Quick project
#******************************************************************************
#
# File Description:
@ -15,8 +15,8 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
#This software is licensed under the GNU General Public License v3
#See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
#------------------------------------------------------------------------------

60
example/Makefile Normal file
View File

@ -0,0 +1,60 @@
#******************************************************************************
# Makefile<example> Make-It-Quick project
#******************************************************************************
#
# File Description:
#
# A makefile example for the Make-It-Quick project
#
#
#
#
#
#
#
#
#******************************************************************************
# (C) 2017-2018 Christophe de Dinechin <christophe@dinechin.org>
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
# Define the source code
SOURCES=hello.cpp
# Define libraries we use in that project
LIBRARIES=lib1/lib1.dll lib2/lib2.lib
# Define the product of the build (.exe will be removed for Unix builds)
PRODUCTS=hello.exe
# Define configuration options
CONFIG= <stdio.h> \
<unistd.h> \
<nonexistent.h> \
<sys/time.h> \
<sys/improbable.h> \
<iostream> \
clearenv \
libm \
liboony \
sbrk
# Define what to test
TESTS=product count-characters
# Define what to benchmark
BENCHMARKS=product
# Define what to test
TESTS=product count-characters
# Define what to benchmark
BENCHMARKS=product
# Include the makefile rules
BUILD=../
include $(BUILD)rules.mk
count-characters.test:
@echo Output has `$(TEST_ENV) $(OBJPRODUCTS) | wc -c` characters, should be 35

View File

@ -1,10 +1,10 @@
#******************************************************************************
# Makefile<lib1> XL - An extensible language
# Makefile<lib1> Make-It-Quick project
#******************************************************************************
#
# File Description:
#
#
# A simple example to build a small DLL
#
#
#
@ -14,13 +14,13 @@
#
#
#******************************************************************************
# (C) 2018 Christophe de Dinechin <christophe@dinechin.org>
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
# (C) 2017-2018 Christophe de Dinechin <christophe@dinechin.org>
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
BUILD=../
SOURCES=lib1.c
PRODUCTS=lib1.dll
BUILD?=make-it-quick/
include $(BUILD)rules.mk

View File

@ -1,5 +1,5 @@
#******************************************************************************
# Makefile<lib2> XL - An extensible language
# Makefile<lib2> Make-It-Quick project
#******************************************************************************
#
# File Description:
@ -14,14 +14,13 @@
#
#
#******************************************************************************
# (C) 2018 Christophe de Dinechin <christophe@dinechin.org>
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
# (C) 2017-2018 Christophe de Dinechin <christophe@dinechin.org>
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
BUILD=../
SOURCES=lib2.c
PRODUCTS=lib2.lib
BUILD?=make-it-quick/
include $(BUILD)rules.mk

View File

@ -1,5 +1,5 @@
#******************************************************************************
# rules.mk Recorder project
# rules.mk Make-it-Quick project
#******************************************************************************
#
# File Description:
@ -14,11 +14,12 @@
#
#******************************************************************************
# (C) 1992-2018 Christophe de Dinechin <christophe@dinechin.org>
# This software is licensed under the GNU General Public License v3
# See file COPYING for details.
# This software is licensed under the GNU General Public License v3
# See LICENSE file for details.
#******************************************************************************
# Include the Makefile configuration and local variables
BUILD?=make-it-quick/
include $(BUILD)config.mk
# Default build settings (definitions in specific config..mkXYZ)
@ -79,7 +80,7 @@ LINK_WINPUTS= $(patsubst %,"%", $(shell cygpath -aw $(LINK_INPUTS)))
endif
PRINT_DIR= --no-print-directory
RECURSE_BUILDENV=$(BUILDENV)
RECURSE_CMD= $(MAKE) $(PRINT_DIR) TARGET=$(TARGET) BUILDENV=$(RECURSE_BUILDENV) BUILD="$(abspath $(BUILD))/" TOP="$(abspath $(TOP))/" $(RECURSE) COLOR_FILTER=
RECURSE_CMD= $(MAKE) $(PRINT_DIR) TARGET=$(TARGET) BUILDENV=$(RECURSE_BUILDENV) TOP="$(abspath $(TOP))/" $(RECURSE) COLOR_FILTER=
MAKEFILE_DEPS:= $(MAKEFILE_LIST)
NOT_PARALLEL?= .NOTPARALLEL
BUILD_LOW?= 0