view misc/Makefile @ 640:df21e61d2343

Rename color dump utility. Install it.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Tue, 08 Aug 2017 10:40:34 +0300
parents 06d957e2cdce
children cffd91855f61
line wrap: on
line source

SHELL = /bin/sh

# Disable built in pattern rules.
MAKEFLAGS += -r
# Disable built in variables.
MAKEFLAGS += -R
# Disable built in suffix rules.
.SUFFIXES:
# Delete target file if command fails.
.DELETE_ON_ERROR:
# Default target.
.DEFAULT_GOAL = all

################################################################
# Platform definition.

uname-s := $(shell uname -s)

build_os = unix
ifneq '' '$(filter MINGW%,$(uname-s))'
  build_os = mingw
endif
ifneq '' '$(filter CYGWIN%,$(uname-s))'
  build_os = cygwin
endif
ifeq 'SunOS' '$(uname-s)'
  build_os = solaris
endif

################################################################
# Path definitions.

ifeq '' '$(prefix)'
  ifneq '' '$(HOME)'
    prefix = $(HOME)/usr
  else
    $(error HOME env var and prefix var are not set!)
  endif
endif

bindir = $(prefix)/bin

################################################################
# Build toolchain definitions.

INSTALL_PROGRAM := install -m 755
INSTALL_DATA := install -m 644
ifeq 'solaris' '$(build_os)'
  INSTALL_PROGRAM := ginstall -m 755
  INSTALL_DATA := ginstall -m 644
endif

################################################################
# Files definitions.

FILES = trac-digest.sh find-ext.sh line-count.sh $(wildcard cleanupdoc-*.sh) mymake.sh my-ascii.sh my-colors.sh

################################################################
# Build targets.

.PHONY: all
all:

.PHONY: check
check:

.PHONY: install
install:
	[ -d $(bindir) ] || mkdir -p $(bindir)
	for file in $(FILES); do \
		filenoext=$${file%.sh}; \
		filenoext=$${filenoext%.py}; \
		$(INSTALL_PROGRAM) $$file $(bindir)/$$filenoext; \
	done

.PHONY: uninstall
uninstall:
	for file in $(FILES); do \
		filenoext=$${file%.sh}; \
		filenoext=$${filenoext%.py}; \
		[ -e $(bindir)/$$file ] && if rm $(bindir)/$$file; then :; else echo Unable to delete $(bindir)/$$file; exit 1; fi || :; \
		[ -e $(bindir)/$$filenoext ] && if rm $(bindir)/$$filenoext; then :; else echo Unable to delete $(bindir)/$$filenoext; exit 1; fi || :; \
	done

.PHONY: distclean
distclean: clean

.PHONY: clean
clean: