File: Makefile

package info (click to toggle)
rephrase 0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 184 kB
  • sloc: ansic: 844; sh: 291; makefile: 135
file content (101 lines) | stat: -rw-r--r-- 2,292 bytes parent folder | download | duplicates (2)
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
# Makefile (for compiling and installing, or building a distribution)
# Copyright (C) 2003, 2014  Phil Lanch
#
# This file is part of Rephrase.
#
# Rephrase 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; version 3.
#
# Rephrase 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/>.

SHELL		= /bin/sh

program		= rephrase
version		= 0.2

what		= $(program)-$(version)

GPG		=
ifneq (,$(GPG))
gpg_def	= -DGPG=\"$(GPG)\"
else
gpg_def	=
endif

CRYPTSETUP	=
ifneq (,$(CRYPTSETUP))
cryptsetup_def	= -DCRYPTSETUP=\"$(CRYPTSETUP)\"
else
cryptsetup_def	=
endif

PATTERN_MAX	=
ifneq (,$(PATTERN_MAX))
pattern_max_def	= -DPATTERN_MAX=\($(PATTERN_MAX)\)
else
pattern_max_def	=
endif

ARGS_MAX	=
ifneq (,$(ARGS_MAX))
args_max_def	= -DARGS_MAX=\($(ARGS_MAX)\)
else
args_max_def	=
endif

DEFS		= -DVERSION=\"$(version)\" $(gpg_def) $(cryptsetup_def) $(pattern_max_def) $(args_max_def)
CPPFLAGS	+= $(DEFS)
CFLAGS		+= -Wall

prefix		= /usr
exec_prefix	= ${prefix}
bindir		= ${exec_prefix}/bin

dirmode		= 755
binowner	= 0
bingroup	= 0
binmode		= 4711

files		= CHANGELOG COPYING install-sh Makefile mkinstalldirs README $(program).c

all: $(program)

dist: $(what).tar.gz $(what).tar.bz2

install: all
	./mkinstalldirs -m $(dirmode) $(DESTDIR)$(bindir)
	./install-sh -c -o $(binowner) -g $(bingroup) -m $(binmode) $(program) \
		$(DESTDIR)$(bindir)/$(program)

$(what).tar: $(files)
	rm -f $@
	rm -rf TREE
	mkdir TREE
	mkdir TREE/$(what)
	cp -p $(files) TREE/$(what)
	cd TREE && { tar -c -f ../$@ $(what) || { rm -f ../$@ && exit 1; }; }

$(what).tar.gz: $(what).tar
	rm -f $@
	gzip -c -9 $< > $@ || { rm -f $@ && exit 1; }

$(what).tar.bz2: $(what).tar
	rm -f $@
	bzip2 -k -9 $< || { rm -f $@ && exit 1; }

clean::
	rm -f $(program) $(program)-*.tar
	rm -rf TREE

distclean::
	$(MAKE) clean
	rm -f $(program)-*.tar.gz $(program)-*.tar.bz2

.PHONY: all dist install clean distclean