aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore21
-rw-r--r--Make.am41
-rw-r--r--Makefile103
-rw-r--r--configure.ac15
-rw-r--r--install.am7
-rw-r--r--runcap.34
-rw-r--r--runcap.m439
-rw-r--r--shared.am6
-rw-r--r--static.am6
-rw-r--r--t/Makefile.am (renamed from t/Makefile)27
-rwxr-xr-xt/testsuite16
11 files changed, 153 insertions, 132 deletions
diff --git a/.gitignore b/.gitignore
index a712fcb..fcda02c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,24 @@ core
6.gdbinit 6.gdbinit
7tmp 7tmp
8*.tar.gz 8*.tar.gz
9.deps
10Makefile
11Makefile.in
12.deps
13.libs/
14aclocal.m4
15autom4te.cache/
16compile
17config.guess
18config.log
19config.status
20config.sub
21configure
22depcomp
23*.lo
24install-sh
25*.in
26*.la
27libtool
28ltmain.sh
29missing
diff --git a/Make.am b/Make.am
new file mode 100644
index 0000000..fe56d41
--- /dev/null
+++ b/Make.am
@@ -0,0 +1,41 @@
1# Main Makefile.am source for runcap
2# Copyright (C) 2017 Sergey Poznyakoff
3#
4# Runcap is free software; you can redistribute it and/or modify it
5# under the terms of the GNU General Public License as published by the
6# Free Software Foundation; either version 3 of the License, or (at your
7# option) any later version.
8#
9# Runcap is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with Runcap. If not, see <http://www.gnu.org/licenses/>.
16
17# The runcap library can be built in three distinct flavours:
18# 1. as a standalone library
19# 2. as a shared convenience library
20# 3. as a static convenience library
21# Due to various Automake/libtools subtleties, the three builds cannot be
22# defined in a single Makefile.am. Therefore, three distinct Automake sources
23# are provided for each of the above types. Each of them contains the rules
24# and variables for its particular build flavour, and obtains common rules and
25# and variables by including Make.am. The actual build flavour is determined by
26# the second argument to the RUNCAP_SETUP macro invocation (see runcap.m4).
27# The files and the corresponding 2nd argument for each build type are:
28# 1. install.am install
29# 2. shared.am shared
30# 3. static.am static
31
32RUNCAP_SRC = \
33 getc.c\
34 getl.c\
35 runcap.c\
36 seek.c\
37 tell.c
38EXTRA_DIST = Make.am installed.am shared.am static.am
39check:
40 $(MAKE) -C t check
41SUBDIRS = . t
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 47bcf17..0000000
--- a/Makefile
+++ /dev/null
@@ -1,103 +0,0 @@
1# runcap - run program and capture its output
2# Copyright (C) 2017 Sergey Poznyakoff
3#
4# Runcap is free software; you can redistribute it and/or modify it
5# under the terms of the GNU General Public License as published by the
6# Free Software Foundation; either version 3 of the License, or (at your
7# option) any later version.
8#
9# Runcap is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with Runcap. If not, see <http://www.gnu.org/licenses/>.
16
17PREFIX = /usr
18BINDIR = $(PREFIX)/bin
19MANDIR = $(PREFIX)/share/man
20
21MAN3DIR = $(MANDIR)/man3
22MAN3FILES = runcap.3
23
24# The install program. Use cp(1) if not available.
25INSTALL = install
26# Program to make directory hierarchy.
27MKHIER = install -d
28
29# Compiler options
30O = -ggdb -Wall
31
32PROJECT = libruncap
33VERSION = 1.0
34
35SOURCES = runcap.c getc.c getl.c seek.c tell.c
36OBJECTS = $(SOURCES:.c=.o)
37HEADERS = runcap.h
38
39CFLAGS = $(O)
40LDFLAGS =
41ARFLAGS = cru
42
43.c.o:
44 $(CC) -c -o$@ $(CPPFLAGS) $(CFLAGS) $<
45
46all: libruncap.a
47
48$(OBJECTS): $(HEADERS)
49
50libruncap.a: $(OBJECTS)
51 ar $(ARFLAGS) libruncap.a $(OBJECTS)
52 ranlib libruncap.a
53
54clean: subdirs-clean
55 rm -f libruncap.a $(OBJECTS)
56
57subdirs-clean:
58 @$(MAKE) -C t clean
59
60install: install-lib install-headers install-man
61
62install-lib: libruncap.a
63 $(MKHIER) $(DESTDIR)$(LIBDIR)
64 $(INSTALL) libruncap.a $(DESTDIR)$(LIBDIR)
65
66install-headers: runcap.h
67 $(MKHIER) $(DESTDIR)$(INCLUDEDIR)
68 $(INSTALL) runcap.h $(DESTDIR)$(INCLUDEDIR)
69
70install-man:;
71 $(MKHIER) $(DESTDIR)$(MAN3DIR)
72 $(INSTALL) $(MAN3FILES) $(DESTDIR)$(MAN3DIR)
73
74.PHONY: check distdir
75check: all
76 $(MAKE) -C t check
77
78DISTDIR=$(PROJECT)-$(VERSION)
79DISTFILES=Makefile $(SOURCES) $(HEADERS) $(MAN3FILES)
80
81distdir:
82 test -d $(DISTDIR) || mkdir $(DISTDIR)
83 cp $(DISTFILES) $(DISTDIR)
84 $(MAKE) -C t distdir TOPDISTDIR=`cd $(DISTDIR); pwd`
85
86dist: distdir
87 tar hzcf $(DISTDIR).tar.gz $(DISTDIR)
88 rm -rf $(DISTDIR)
89
90distcheck: dist
91 @mkdir _build _inst; \
92 cd _build; \
93 tar xzf ../$(DISTDIR).tar.gz; \
94 if $(MAKE) -C $(DISTDIR) check \
95 && $(MAKE) -C $(DISTDIR) install DESTDIR=`cd ../_inst; pwd`; then \
96 cd ..; \
97 rm -rf _build _inst; \
98 echo "$(DISTDIR).tar.gz is ready for distribution";\
99 else \
100 echo "Please, inspect " `pwd`;\
101 fi
102
103
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..365a128
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,15 @@
1AC_PREREQ(2.63)
2AC_INIT([libruncap], [1.0], [gray+runcap@gnu.org.ua])
3AC_CONFIG_SRCDIR([runcap.c])
4AM_INIT_AUTOMAKE([1.11 foreign tar-ustar silent-rules])
5
6# Enable silent rules by default:
7AM_SILENT_RULES([yes])
8
9# Checks for programs.
10AC_PROG_CC
11
12RUNCAP_SETUP([.],[install])
13
14# Generate files
15AC_OUTPUT
diff --git a/install.am b/install.am
new file mode 100644
index 0000000..3426aee
--- /dev/null
+++ b/install.am
@@ -0,0 +1,7 @@
1# Automake settings for a standalone installable build of runcap.
2# See Make.am for details.
3include Make.am
4lib_LTLIBRARIES=libruncap.la
5libruncap_la_SOURCES = $(RUNCAP_SRC)
6include_HEADERS=runcap.h
7dist_man_MANS=runcap.3
diff --git a/runcap.3 b/runcap.3
index 61e7337..0a5a89c 100644
--- a/runcap.3
+++ b/runcap.3
@@ -1,5 +1,5 @@
1.\" This file is part of runcap -*- nroff -*- 1.\" This file is part of runcap -*- nroff -*-
2.\" Copyright (C) 2016 Sergey Poznyakoff 2.\" Copyright (C) 2017 Sergey Poznyakoff
3.\" 3.\"
4.\" Runcap is free software; you can redistribute it and/or modify 4.\" Runcap is free software; you can redistribute it and/or modify
5.\" it under the terms of the GNU General Public License as published by 5.\" it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
13.\" 13.\"
14.\" You should have received a copy of the GNU General Public License 14.\" You should have received a copy of the GNU General Public License
15.\" along with runcap. If not, see <http://www.gnu.org/licenses/>. 15.\" along with runcap. If not, see <http://www.gnu.org/licenses/>.
16.TH RUNCAP 2 "July 24, 2017" "RUNCAP" "User Commands" 16.TH RUNCAP 2 "August 19, 2017" "RUNCAP" "User Commands"
17.SH NAME 17.SH NAME
18runcap \- run external process and capture its stdout and stderr 18runcap \- run external process and capture its stdout and stderr
19.SH SYNOPSIS 19.SH SYNOPSIS
diff --git a/runcap.m4 b/runcap.m4
new file mode 100644
index 0000000..cd4c234
--- /dev/null
+++ b/runcap.m4
@@ -0,0 +1,39 @@
1# This file is part of runcap -*- autoconf -*-
2# Copyright (C) 2017 Sergey Poznyakoff
3#
4# Runcap is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# Runcap is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with Runcap. If not, see <http://www.gnu.org/licenses/>.
16AC_DEFUN([RUNCAP_SETUP],[
17 m4_pushdef([runcapdir],m4_if($1,[.],,$1,,[runcap/],$1/))
18 AC_SUBST([RUNCAP_INC],['-I$(top_srcdir)/]runcapdir')
19 AC_SUBST([RUNCAP_BUILD_TYPE])
20