From 60a247d75c24771b9352e50e724542a8b047c2cc Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 1 May 2010 16:14:45 +0200 Subject: Makefile: Support PREFIX & DESTDIR --- Makefile | 22 +++++++++++----------- config.mk | 8 ++++++++ 2 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 config.mk diff --git a/Makefile b/Makefile index 64612c4..03564b6 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,21 @@ -prefix = /usr/local +include config.mk -default: build/tibtoa.1 +all: build/tibtoa.1 -build/%.1: bin/% +build/tibtoa.1: bin/tibtoa mkdir -p build - pod2man $< > $@ + pod2man bin/tibtoa > $@ install: build/tibtoa.1 - mkdir -p $(prefix)/bin $(prefix)/share/man/man1 - cp bin/tibtoa $(prefix)/bin/tibtoa - cp build/tibtoa.1 $(prefix)/share/man/man1/tibtoa.1 - chmod 755 $(prefix)/bin/tibtoa - chmod 644 $(prefix)/share/man/man1/tibtoa.1 + mkdir -p ${bin_dir} ${man_dir}/man1 + cp bin/tibtoa ${bin_dir}/tibtoa + cp build/tibtoa.1 ${man_dir}/man1/tibtoa.1 + chmod 755 ${bin_dir}/tibtoa + chmod 644 ${man_dir}/man1/tibtoa.1 uninstall: - rm -f $(prefix)/bin/tibtoa - rm -f $(prefix)/share/man/man1/tibtoa.1 + rm -f ${bin_dir}/tibtoa + rm -f ${man_dir}/man1/tibtoa.1 clean: rm -rf build diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..701725a --- /dev/null +++ b/config.mk @@ -0,0 +1,8 @@ +# Prefix for all installed files +PREFIX ?= /usr/local + +# Directories for manuals, executables, docs, data, etc. +main_dir = ${DESTDIR}${PREFIX} +man_dir = ${main_dir}/share/man +bin_dir = ${main_dir}/bin +doc_dir = ${main_dir}/share/doc -- cgit v1.2.3