forked from benjsc/splitpatch
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
146 lines (126 loc) · 3.62 KB
/
Makefile
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
136
137
138
139
140
141
142
143
144
145
146
# -*- mode: makefile-gmake; -*-
#
# Copyright
#
# Copyright (C) 2014-2025 Jari Aalto <[email protected]>
#
# 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
SHELL = /bin/sh
INSTALL = install
# Use --long install(1) options by default
OPT_SORT =
ifeq ($(findstring install,$(INSTALL)),install)
# "command" is in POSIX. More portable than which(1)
ifeq (,$(shell command -v install))
$(error FATAL: program install(1) not found in PATH)
endif
GNU := $(findstring GNU,$(shell install --version))
endif
ifndef GNU
$(info INFO: non GNU, switching to OPT_SHORT)
OPT_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
MANDIR = $(DESTDIR)$(mandir)
MANDIR1 = $(MANDIR)/man1
RM = rm --force
LN = ln --symbolic
MAKE_OPT_CHDIR = --directory
INSTALL_OPT_MODE = --mode
INSTALL_OPT_MKDIR = --directory
ifdef OPT_SHORT
RM = rm -f
LN = ln -s
INSTALL_OPT_MODE = -m
INSTALL_OPT_MKDIR = -d
endif
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
# all - Call target 'help'
.PHONY: all
all: help
# help - Display targets to call
.PHONY: help
help:
@awk '/^# [^ -]+ - / {sub("^# ", ""); print}' $(MAKEFILE)
# doc - Generate documentation
.PHONY: doc
doc:
$(MAKE) OPT_SHORT=$(OPT_SHORT) $(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-symlink
$(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 page
.PHONY: uninstall
uninstall:
# uninstall
$(RM) $(BINDIR)/$(PACKAGE)
$(RM) $(MANDIR1)/$(PACKAGE).1
# clean - Clean generated files
.PHONY: clean
clean:
# clean
-rm --force *[#~] *.\#*
$(MAKE) $(MAKE_OPT_CHDIR) man $@
# distclean - Clean all generated files
.PHONY: distclean
distclean: clean
$(MAKE) OPT_SHORT=$(OPT_SHORT) $(MAKE_OPT_CHDIR) man clean
# realclean - Clean totally all generated files
.PHONY: realclean
realclean: clean
# End of file