Mercurial > utils
changeset 532:11e5d1fd39e4
Document Makefile sections.
author | Oleksandr Gavenko <gavenkoa@gmail.com> |
---|---|
date | Sun, 18 Nov 2012 21:05:35 +0200 |
parents | 857d8ecc26be |
children | 92596e6224c1 |
files | printarg/Makefile |
diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/printarg/Makefile Mon Nov 12 23:09:25 2012 +0200 +++ b/printarg/Makefile Sun Nov 18 21:05:35 2012 +0200 @@ -11,6 +11,9 @@ # Default target. .DEFAULT_GOAL = all +################################################################ +# Setup out of source build. + S := $(dir $(abspath $(firstword $(MAKEFILE_LIST)))) B := $(abspath .)/ ifeq '' '$(filter %/,${B})' @@ -20,6 +23,9 @@ $(shell mkdir -p ${B}) endif +################################################################ +# Installation directories. + ifeq '' '$(prefix)' ifneq '' '$(HOME)' prefix = $(HOME)/usr @@ -32,6 +38,9 @@ mandir = $(prefix)/share/man man1dir = $(mandir)/man1 +################################################################ +# Platform definition. + build_os = unix ifneq '' '$(COMSPEC)' build_os = windows @@ -62,6 +71,9 @@ endif endif +################################################################ +# Build toolchain definition. + CC := gcc STRIP := strip ifneq '$(build)' '$(host)' @@ -86,11 +98,17 @@ EXE_SUFFIX = .exe endif +################################################################ +# Project files. + C_FILES = $(wildcard ${S}*.c) O_FILES = $(patsubst ${S}%.c,${B}%.o,$(C_FILES)) APP = printarg$(EXE_SUFFIX) +################################################################ +# Build targets. + .PHONY: all all: ${B}$(APP) @@ -107,6 +125,9 @@ check: ${B}$(APP) $< hello world +################################################################ +# Install/uninstall targets. + .PHONY: install install: ${B}$(APP) [ -d $(bindir) ] || mkdir -p $(bindir) @@ -120,6 +141,9 @@ [ -e $$file ] && if rm $$file; then :; else echo Unable to delete $$file; exit 1; fi || :; \ done +################################################################ +# Packaging targets. + .PHONY: dist-src dist-src: mkdir ${B}printarg @@ -131,6 +155,9 @@ dist-cygwin: dist-src cygport printarg.cygport prep compile test install package finish +################################################################ +# Clean targets. + .PHONY: distclean distclean: clean