Make

From XennisWiki
Jump to: navigation, search

[...] Make is a utility that automatically builds executable programs and libraries from source code by reading files called Makefiles which specify how to derive the target program. Though integrated development environments and language-specific compiler features can also be used to manage a build process, Make remains widely used, especially in Unix. (Wikipedia)

Install

Debian
apt-get install make
Windows

see article Cygwin

Usage

Simple Makefile

Exemplary Makefile with the targets install and clean

install:
	@echo "Install"
	npm install
	bower install

clean:
	rm -r bower_components/

Execute for instance make install to run the install target.

Variables

image = example.org/java

build:
	docker build -t $(image):latest .

Call target from subdirectory

push:
	$(MAKE) -C <dir> <task>

Get value from shell

GIT_HASH = $(shell git rev-parse --short HEAD)

See also

External links