blob: 47bcf17396372f7eaeb0fea5b8569a3773feaa7f (
plain)
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
|
# runcap - run program and capture its output
# Copyright (C) 2017 Sergey Poznyakoff
#
# Runcap 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 3 of the License, or (at your
# option) any later version.
#
# Runcap 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 Runcap. If not, see <http://www.gnu.org/licenses/>.
PREFIX = /usr
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man
MAN3DIR = $(MANDIR)/man3
MAN3FILES = runcap.3
# The install program. Use cp(1) if not available.
INSTALL = install
# Program to make directory hierarchy.
MKHIER = install -d
# Compiler options
O = -ggdb -Wall
PROJECT = libruncap
VERSION = 1.0
SOURCES = runcap.c getc.c getl.c seek.c tell.c
OBJECTS = $(SOURCES:.c=.o)
HEADERS = runcap.h
CFLAGS = $(O)
LDFLAGS =
ARFLAGS = cru
.c.o:
$(CC) -c -o$@ $(CPPFLAGS) $(CFLAGS) $<
all: libruncap.a
$(OBJECTS): $(HEADERS)
libruncap.a: $(OBJECTS)
ar $(ARFLAGS) libruncap.a $(OBJECTS)
ranlib libruncap.a
clean: subdirs-clean
rm -f libruncap.a $(OBJECTS)
subdirs-clean:
@$(MAKE) -C t clean
install: install-lib install-headers install-man
install-lib: libruncap.a
$(MKHIER) $(DESTDIR)$(LIBDIR)
$(INSTALL) libruncap.a $(DESTDIR)$(LIBDIR)
install-headers: runcap.h
$(MKHIER) $(DESTDIR)$(INCLUDEDIR)
$(INSTALL) runcap.h $(DESTDIR)$(INCLUDEDIR)
install-man:;
$(MKHIER) $(DESTDIR)$(MAN3DIR)
$(INSTALL) $(MAN3FILES) $(DESTDIR)$(MAN3DIR)
.PHONY: check distdir
check: all
$(MAKE) -C t check
DISTDIR=$(PROJECT)-$(VERSION)
DISTFILES=Makefile $(SOURCES) $(HEADERS) $(MAN3FILES)
distdir:
test -d $(DISTDIR) || mkdir $(DISTDIR)
cp $(DISTFILES) $(DISTDIR)
$(MAKE) -C t distdir TOPDISTDIR=`cd $(DISTDIR); pwd`
dist: distdir
tar hzcf $(DISTDIR).tar.gz $(DISTDIR)
rm -rf $(DISTDIR)
distcheck: dist
@mkdir _build _inst; \
cd _build; \
tar xzf ../$(DISTDIR).tar.gz; \
if $(MAKE) -C $(DISTDIR) check \
&& $(MAKE) -C $(DISTDIR) install DESTDIR=`cd ../_inst; pwd`; then \
cd ..; \
rm -rf _build _inst; \
echo "$(DISTDIR).tar.gz is ready for distribution";\
else \
echo "Please, inspect " `pwd`;\
fi
|