1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
# -*- mode: makefile-gmake; -*-
#
# Copyright
#
# Copyright (C) 2014-2025 Jari Aalto <jari.aalto@cante.net>
#
# License
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Description
#
# Makefile to package, install and generate documentation.
# See "make help".
ifneq (,)
This makefile requires GNU Make.
endif
ifneq (,$(wildcard /etc/rc.conf))
OS = bsd
INSTALL_OPT_USE_SHORT = short
endif
PACKAGE = splitpatch
BIN = bin/$(PACKAGE).rb
VERSION =
MAKEFILE = Makefile
DESTDIR =
PREFIX ?= /usr
prefix = $(PREFIX)
exec_prefix = $(prefix)
man_prefix = $(prefix)/share
mandir = $(man_prefix)/man
bindir = $(exec_prefix)/bin
sharedir = $(prefix)/share
BINDIR = $(DESTDIR)$(bindir)
DOCDIR = $(DESTDIR)$(sharedir)/doc
# 1 = regular, 5 = conf, 6 = games, 8 = daemons
MANDIR = $(DESTDIR)$(mandir)
MANDIR1 = $(MANDIR)/man1
MAKE_OPT_CHDIR = --directory
INSTALL_OPT_MODE = --mode
INSTALL_OPT_MKDIR = --directory
ifneq (,$(INSTALL_OPT_USE_SHORT))
INSTALL_OPT_MODE = -m
INSTALL_OPT_MKDIR = -d
endif
INSTALL = /usr/bin/install
INSTALL_BIN = $(INSTALL) $(INSTALL_OPT_MODE) 755
INSTALL_MMKDIR = $(INSTALL) $(INSTALL_OPT_MODE) 755 $(INSTALL_OPT_MKDIR)
INSTALL_DATA = $(INSTALL) $(INSTALL_OPT_MODE) 644
INSTALL_SUID = $(INSTALL) $(INSTALL_OPT_MODE) 4755
RM = rm --force
LN = ln --symbolic --relative
# all - Call target 'doc'
.PHONY: all
all: doc
.PHONY: help
help:
awk '/^# [^ -]+ - / {sub("^# [^ -]+ - ", ""); print}' $(MAKEFILE) | sort
# clean - Clean generated files
.PHONY: clean
clean:
# clean
-rm --force *[#~] *.\#*
$(MAKE) $(MAKE_OPT_CHDIR) man $@
# distclean - Clean all generated files
.PHONY: distclean
distclean: clean
# realclean - Clean totally all generated files
.PHONY: realclean
realclean: clean
# doc - Generate documentation
.PHONY: doc
doc:
$(MAKE) $(MAKE_OPT_CHDIR) man all
# install-man - Install manual pages to MANDIR1
.PHONY: install-man
install-man: doc
# install-man
$(INSTALL_MKDIR) $(MANDIR1)
$(INSTALL_DATA) man/*.1 $(MANDIR1)
# install-bin - Install program to BINDIR
.PHONY: install-bin
install-bin:
# install-bin
$(INSTALL_MKDIR) $(BINDIR)
$(INSTALL_BIN) $(BIN) $(BINDIR)/$(PACKAGE)
# install-bin - symlink program to BINDIR
.PHONY: install-bin-symlink
install-bin-symlink:
# install-bin
$(INSTALL_MKDIR) $(BINDIR)
$(LN) $(BIN) $(BINDIR)/$(PACKAGE)/
# install - install program and manual pages
.PHONY: install
install: install-bin install-man
# uninstall - uninstall program and manual pages
.PHONY: uninstall
uninstall:
$(RM) $(BINDIR)/$(PACKAGE)
$(RM) $(MANDIR1)/$(PACKAGE).1
# End of file
|