From 90cc5460aa0e9ca10a0d7c8c44064fd14789f750 Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Fri, 1 May 2015 17:09:39 -0700 Subject: [PATCH 1/7] build-sys: add $(top_srcdir) to include search dir This is required for out-of-tree build to work, since many source files include e.g. proc/*.h which is not under the include/ directory. Tested that `make distcheck` starts working after this patch. Signed-off-by: Filipe Brandenburger --- Makefile.am | 1 + lib/Makefile.am | 5 ++++- proc/Makefile.am | 1 + ps/Makefile.am | 1 + top/Makefile.am | 1 + 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 45feab1d..9a9130c4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,6 +2,7 @@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ + -I$(top_srcdir) \ -I$(top_srcdir)/include \ -DLOCALEDIR=\"$(localedir)\" diff --git a/lib/Makefile.am b/lib/Makefile.am index 56c36a2f..f09cb8c0 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,4 +1,7 @@ -AM_CPPFLAGS = -include $(top_builddir)/config.h -I$(top_srcdir)/include +AM_CPPFLAGS = \ + -include $(top_builddir)/config.h \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include AM_CPPFLAGS += -DTEST_PROGRAM diff --git a/proc/Makefile.am b/proc/Makefile.am index f000dbcb..5b0e84cc 100644 --- a/proc/Makefile.am +++ b/proc/Makefile.am @@ -1,6 +1,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ + -I$(top_srcdir) \ -I$(top_srcdir)/include \ -DLOCALEDIR=\"$(localedir)\" diff --git a/ps/Makefile.am b/ps/Makefile.am index e46f496f..c8e949aa 100644 --- a/ps/Makefile.am +++ b/ps/Makefile.am @@ -1,5 +1,6 @@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ + -I$(top_srcdir) \ -I$(top_srcdir)/include \ -DLOCALEDIR=\"$(localedir)\" diff --git a/top/Makefile.am b/top/Makefile.am index bba36bc9..0cad3195 100644 --- a/top/Makefile.am +++ b/top/Makefile.am @@ -1,5 +1,6 @@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ + -I$(top_srcdir) \ -I$(top_srcdir)/include \ -DLOCALEDIR=\"$(localedir)\" From 04d96fe1361bd4afee449aa691da9c52d4f27a12 Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Fri, 1 May 2015 16:42:33 -0700 Subject: [PATCH 2/7] build-sys: remove AC_PROG_RANLIB from configure.ac This suppresses the following warning from libtoolize 2.4.2: libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT' Tested that this does not break the build and that both `make check` and `make distcheck` continue working as expected. Signed-off-by: Filipe Brandenburger --- configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.ac b/configure.ac index 79ba3c7e..051b1747 100644 --- a/configure.ac +++ b/configure.ac @@ -41,7 +41,6 @@ AC_PROG_INSTALL AC_PROG_LN_S PKG_PROG_PKG_CONFIG AC_PROG_MAKE_SET -AC_PROG_RANLIB # Checks for header files. AC_HEADER_MAJOR From b56fd9d3586a08a75a7d9caa81171dcfb67bdb4b Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Fri, 1 May 2015 17:43:51 -0700 Subject: [PATCH 3/7] build-sys: split test cases in lib/ into their own files In order to avoid compiling the same source files twice, with and without the TEST_PROGRAM define. Tested that the build still works and that `make distcheck` works as expected. Tested that the test_* programs in lib/ keep working. (Though they are not really invoked by `make check` and in particular test_nsutils is quite useless, test_fileutils also quite poor.) Signed-off-by: Filipe Brandenburger --- lib/Makefile.am | 11 +++++------ lib/fileutils.c | 10 ---------- lib/nsutils.c | 15 --------------- lib/strutils.c | 14 -------------- lib/test_fileutils.c | 10 ++++++++++ lib/test_nsutils.c | 15 +++++++++++++++ lib/test_strutils.c | 38 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 68 insertions(+), 45 deletions(-) create mode 100644 lib/test_fileutils.c create mode 100644 lib/test_nsutils.c create mode 100644 lib/test_strutils.c diff --git a/lib/Makefile.am b/lib/Makefile.am index f09cb8c0..d88e750f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,12 +1,11 @@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ -I$(top_srcdir) \ - -I$(top_srcdir)/include - -AM_CPPFLAGS += -DTEST_PROGRAM + -I$(top_srcdir)/include \ + -DLOCALEDIR=\"$(localedir)\" noinst_PROGRAMS = test_strutils test_fileutils test_nsutils -test_strutils_SOURCES = strutils.c -test_fileutils_SOURCES = fileutils.c -test_nsutils_SOURCES = nsutils.c +test_strutils_SOURCES = test_strutils.c strutils.c +test_fileutils_SOURCES = test_fileutils.c fileutils.c +test_nsutils_SOURCES = test_nsutils.c nsutils.c diff --git a/lib/fileutils.c b/lib/fileutils.c index 1ade3d80..14c7452f 100644 --- a/lib/fileutils.c +++ b/lib/fileutils.c @@ -43,13 +43,3 @@ void close_stdout(void) if (close_stream(stderr) != 0) _exit(EXIT_FAILURE); } - -#ifdef TEST_PROGRAM -#include -int main(int argc, char *argv[]) -{ - atexit(close_stdout); - printf("Hello, World!\n"); - return EXIT_SUCCESS; -} -#endif /* TEST_PROGRAM */ diff --git a/lib/nsutils.c b/lib/nsutils.c index d1cc6c96..673258ec 100644 --- a/lib/nsutils.c +++ b/lib/nsutils.c @@ -8,13 +8,6 @@ #include "proc/readproc.h" #include "nsutils.h" -#ifdef TEST_PROGRAM -const char *get_ns_name(int id) -{ - return NULL; -} -#endif /* TEST_PROGRAM */ - /* we need to fill in only namespace information */ int ns_read(pid_t pid, proc_t *ns_task) { @@ -35,11 +28,3 @@ int ns_read(pid_t pid, proc_t *ns_task) } return rc; } - -#ifdef TEST_PROGRAM -int main(int argc, char *argv[]) -{ - printf("Hello, World!\n"); - return EXIT_SUCCESS; -} -#endif /* TEST_PROGRAM */ diff --git a/lib/strutils.c b/lib/strutils.c index 1b84f8ab..0fd3cf71 100644 --- a/lib/strutils.c +++ b/lib/strutils.c @@ -60,17 +60,3 @@ double strtod_or_err(const char *str, const char *errmesg) error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str); return 0; } - -#ifdef TEST_PROGRAM -int main(int argc, char *argv[]) -{ - if (argc < 2) { - error(EXIT_FAILURE, 0, "no arguments"); - } else if (argc < 3) { - printf("%ld\n", strtol_or_err(argv[1], "strtol_or_err")); - } else { - printf("%lf\n", strtod_or_err(argv[2], "strtod_or_err")); - } - return EXIT_SUCCESS; -} -#endif /* TEST_PROGRAM */ diff --git a/lib/test_fileutils.c b/lib/test_fileutils.c new file mode 100644 index 00000000..ebfc5e25 --- /dev/null +++ b/lib/test_fileutils.c @@ -0,0 +1,10 @@ +#include +#include +#include "fileutils.h" + +int main(int argc, char *argv[]) +{ + atexit(close_stdout); + printf("Hello, World!\n"); + return EXIT_SUCCESS; +} diff --git a/lib/test_nsutils.c b/lib/test_nsutils.c new file mode 100644 index 00000000..d8f3d2cf --- /dev/null +++ b/lib/test_nsutils.c @@ -0,0 +1,15 @@ +#include +#include + +#include "nsutils.h" + +const char *get_ns_name(int id) +{ + return NULL; +} + +int main(int argc, char *argv[]) +{ + printf("Hello, World!\n"); + return EXIT_SUCCESS; +} diff --git a/lib/test_strutils.c b/lib/test_strutils.c new file mode 100644 index 00000000..4a7c7aaa --- /dev/null +++ b/lib/test_strutils.c @@ -0,0 +1,38 @@ +/* + * test_strutils.c - tests for strutils.c routines + * This file was copied from util-linux at fall 2011. + * + * Copyright (C) 2010 Karel Zak + * Copyright (C) 2010 Davidlohr Bueso + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include + +#include "c.h" +#include "strutils.h" + +int main(int argc, char *argv[]) +{ + if (argc < 2) { + error(EXIT_FAILURE, 0, "no arguments"); + } else if (argc < 3) { + printf("%ld\n", strtol_or_err(argv[1], "strtol_or_err")); + } else { + printf("%lf\n", strtod_or_err(argv[2], "strtod_or_err")); + } + return EXIT_SUCCESS; +} From 0e7fe5ad241c3ff521e6192b05b71250b3370383 Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Fri, 1 May 2015 21:36:40 -0700 Subject: [PATCH 4/7] build-sys: drop unneeded $(top_srcdir) from source paths This is cleaner and we need to match paths exactly when we enable the subdir-objects automake option. Out-of-tree builds still work since automake is smart to know these are source files and that it needs to look for them in $(top_srcdir), so there is no need to make this explicit. Tested that it builds and both `make check` and `make distcheck` work. Signed-off-by: Filipe Brandenburger --- Makefile.am | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9a9130c4..a554ce12 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,7 +60,7 @@ EXTRA_DIST = \ if BUILD_PIDOF usrbin_exec_PROGRAMS += pidof dist_man_MANS += pidof.1 -pidof_SOURCES = pidof.c $(top_srcdir)/lib/fileutils.c +pidof_SOURCES = pidof.c lib/fileutils.c else EXTRA_DIST += pidof.1 endif @@ -68,7 +68,7 @@ endif if BUILD_KILL bin_PROGRAMS = kill dist_man_MANS += kill.1 -kill_SOURCES = skill.c $(top_srcdir)/lib/strutils.c $(top_srcdir)/lib/fileutils.c $(top_srcdir)/lib/nsutils.c +kill_SOURCES = skill.c lib/strutils.c lib/fileutils.c lib/nsutils.c else EXTRA_DIST += kill.1 endif @@ -80,9 +80,9 @@ usrbin_exec_PROGRAMS += \ dist_man_MANS += \ slabtop.1 \ watch.1 -slabtop_SOURCES = slabtop.c $(top_srcdir)/lib/strutils.c $(top_srcdir)/lib/fileutils.c +slabtop_SOURCES = slabtop.c lib/strutils.c lib/fileutils.c slabtop_LDADD = @NCURSES_LIBS@ -watch_SOURCES = watch.c $(top_srcdir)/lib/strutils.c $(top_srcdir)/lib/fileutils.c +watch_SOURCES = watch.c lib/strutils.c lib/fileutils.c watch_LDADD = @WATCH_NCURSES_LIBS@ endif @@ -90,8 +90,8 @@ if BUILD_SKILL usrbin_exec_PROGRAMS += \ skill \ snice -skill_SOURCES = skill.c $(top_srcdir)/lib/strutils.c $(top_srcdir)/lib/fileutils.c $(top_srcdir)/lib/nsutils.c -snice_SOURCES = skill.c $(top_srcdir)/lib/strutils.c $(top_srcdir)/lib/fileutils.c $(top_srcdir)/lib/nsutils.c +skill_SOURCES = skill.c lib/strutils.c lib/fileutils.c lib/nsutils.c +snice_SOURCES = skill.c lib/strutils.c lib/fileutils.c lib/nsutils.c dist_man_MANS += \ skill.1 \ snice.1 @@ -101,16 +101,16 @@ else snice.1 endif -free_SOURCES = free.c $(top_srcdir)/lib/strutils.c $(top_srcdir)/lib/fileutils.c -pgrep_SOURCES = pgrep.c $(top_srcdir)/lib/fileutils.c $(top_srcdir)/lib/nsutils.c -pkill_SOURCES = pgrep.c $(top_srcdir)/lib/fileutils.c $(top_srcdir)/lib/nsutils.c -pmap_SOURCES = pmap.c $(top_srcdir)/lib/fileutils.c -pwdx_SOURCES = pwdx.c $(top_srcdir)/lib/fileutils.c -sysctl_SOURCES = sysctl.c $(top_srcdir)/lib/fileutils.c -tload_SOURCES = tload.c $(top_srcdir)/lib/strutils.c $(top_srcdir)/lib/fileutils.c -uptime_SOURCES = uptime.c $(top_srcdir)/lib/fileutils.c -vmstat_SOURCES = vmstat.c $(top_srcdir)/lib/strutils.c $(top_srcdir)/lib/fileutils.c -w_SOURCES = w.c $(top_srcdir)/lib/fileutils.c +free_SOURCES = free.c lib/strutils.c lib/fileutils.c +pgrep_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c +pkill_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c +pmap_SOURCES = pmap.c lib/fileutils.c +pwdx_SOURCES = pwdx.c lib/fileutils.c +sysctl_SOURCES = sysctl.c lib/fileutils.c +tload_SOURCES = tload.c lib/strutils.c lib/fileutils.c +uptime_SOURCES = uptime.c lib/fileutils.c +vmstat_SOURCES = vmstat.c lib/strutils.c lib/fileutils.c +w_SOURCES = w.c lib/fileutils.c if EXAMPLE_FILES sysconf_DATA = sysctl.conf From c1c73c0d0030b6b4a90529a26992893941a10e35 Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Fri, 1 May 2015 21:28:53 -0700 Subject: [PATCH 5/7] build-sys: merge automake subdirs into toplevel This will be required for subdir-objects, otherwise automake will have problems with more than one Makefile.am having rules to build the same files. Tested that it builds and both `make check` and `make distcheck` work. Tested `make install` and compared the tree with the one installed before this commit, both installed the binaries to the same locations. The binaries are also in the same location in the build tree (for instance, ps/pscommand is still there.) Checked the binaries for the correct libraries linked into them. Binary sizes matched before and after this change. Signed-off-by: Filipe Brandenburger --- .gitignore | 1 + Makefile.am | 138 ++++++++++++++++++++++++++++++++++++++++++----- configure.ac | 10 ++-- lib/Makefile.am | 11 ---- proc/Makefile.am | 77 -------------------------- ps/Makefile.am | 30 ----------- top/Makefile.am | 31 ----------- 7 files changed, 128 insertions(+), 170 deletions(-) delete mode 100644 lib/Makefile.am delete mode 100644 proc/Makefile.am delete mode 100644 ps/Makefile.am delete mode 100644 top/Makefile.am diff --git a/.gitignore b/.gitignore index af093353..bebea7dd 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ .deps .libs .version +.dirstamp ABOUT-NLS aclocal.m4 autom4te.cache diff --git a/Makefile.am b/Makefile.am index a554ce12..0d6f0fd2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,23 +6,29 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -DLOCALEDIR=\"$(localedir)\" +PACKAGE_VERSION = @PACKAGE_VERSION@ + ACLOCAL_AMFLAGS = -I m4 SUBDIRS = \ include \ - lib \ man-po \ po \ - proc \ - ps \ - testsuite \ - top + testsuite AM_CFLAGS = -Iproc AM_LDFLAGS = ./proc/libprocps.la +transform = s/pscommand/ps/; $(program_transform_name) + +bin_PROGRAMS = \ + ps/pscommand + sbin_PROGRAMS = \ sysctl +lib_LTLIBRARIES = \ + proc/libprocps.la + usrbin_exec_PROGRAMS = \ free \ pgrep \ @@ -45,7 +51,8 @@ dist_man_MANS = \ tload.1 \ uptime.1 \ vmstat.8 \ - w.1 + w.1 \ + ps/ps.1 EXTRA_DIST = \ autogen.sh \ @@ -55,8 +62,15 @@ EXTRA_DIST = \ Documentation/CodingStyle \ Documentation/TODO \ sysctl.conf \ + ps/HACKING \ + ps/regression \ $(DIST_MAN_POTS) +procpsngdir = $(docdir) +dist_procpsng_DATA = \ + Documentation/BUGS \ + Documentation/FAQ + if BUILD_PIDOF usrbin_exec_PROGRAMS += pidof dist_man_MANS += pidof.1 @@ -66,7 +80,7 @@ else endif if BUILD_KILL -bin_PROGRAMS = kill +bin_PROGRAMS += kill dist_man_MANS += kill.1 kill_SOURCES = skill.c lib/strutils.c lib/fileutils.c lib/nsutils.c else @@ -76,14 +90,25 @@ endif if WITH_NCURSES usrbin_exec_PROGRAMS += \ slabtop \ - watch + watch \ + top/top dist_man_MANS += \ slabtop.1 \ - watch.1 + watch.1 \ + top/top.1 slabtop_SOURCES = slabtop.c lib/strutils.c lib/fileutils.c slabtop_LDADD = @NCURSES_LIBS@ watch_SOURCES = watch.c lib/strutils.c lib/fileutils.c watch_LDADD = @WATCH_NCURSES_LIBS@ +top_top_SOURCES = \ + top/top.h \ + top/top.c \ + top/top_nls.h \ + top/top_nls.c \ + lib/fileutils.c +top_top_LDADD = @NCURSES_LIBS@ $(DL_LIB) +dist_procpsng_DATA += \ + top/README.top endif if BUILD_SKILL @@ -112,15 +137,100 @@ uptime_SOURCES = uptime.c lib/fileutils.c vmstat_SOURCES = vmstat.c lib/strutils.c lib/fileutils.c w_SOURCES = w.c lib/fileutils.c +# proc/libprocps.la + +# See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html +LIBprocps_CURRENT=4 +LIBprocps_REVISION=0 +LIBprocps_AGE=0 + +proc_libprocps_la_LIBADD = $(LIB_KPARTS) + +if WITH_SYSTEMD +proc_libprocps_la_LIBADD += @SYSTEMD_LIBS@ +endif + +proc_libprocps_la_LDFLAGS = \ + -version-info $(LIBprocps_CURRENT):$(LIBprocps_REVISION):$(LIBprocps_AGE) \ + -no-undefined \ + -Wl,--version-script=$(top_srcdir)/proc/libprocps.sym + +proc_libprocps_la_SOURCES = \ + proc/alloc.c \ + proc/alloc.h \ + proc/devname.c \ + proc/devname.h \ + proc/escape.c \ + proc/escape.h \ + proc/ksym.c \ + proc/procps.h \ + proc/pwcache.c \ + proc/pwcache.h \ + proc/readproc.c \ + proc/readproc.h \ + proc/sig.c \ + proc/sig.h \ + proc/slab.c \ + proc/slab.h \ + proc/sysinfo.c \ + proc/sysinfo.h \ + proc/version.c \ + proc/version.h \ + proc/wchan.h \ + proc/whattime.c \ + proc/whattime.h + +proc_libprocps_la_includedir = $(includedir)/proc/ +proc_libprocps_la_include_HEADERS = \ + proc/alloc.h \ + proc/devname.h \ + proc/escape.h \ + proc/procps.h \ + proc/pwcache.h \ + proc/readproc.h \ + proc/sig.h \ + proc/slab.h \ + proc/sysinfo.h \ + proc/version.h \ + proc/wchan.h \ + proc/whattime.h + +dist_man_MANS += \ + proc/openproc.3 \ + proc/readproc.3 \ + proc/readproctab.3 + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = \ + proc/libprocps.pc + +EXTRA_DIST += proc/libprocps.sym + +# ps/pscommand + +ps_pscommand_SOURCES = \ + ps/common.h \ + ps/display.c \ + ps/global.c \ + ps/help.c \ + ps/output.c \ + ps/parser.c \ + ps/select.c \ + ps/sortformat.c \ + ps/stacktrace.c \ + lib/fileutils.c + +# lib/test_* binaries +noinst_PROGRAMS = lib/test_strutils lib/test_fileutils lib/test_nsutils + +lib_test_strutils_SOURCES = lib/test_strutils.c lib/strutils.c +lib_test_fileutils_SOURCES = lib/test_fileutils.c lib/fileutils.c +lib_test_nsutils_SOURCES = lib/test_nsutils.c lib/nsutils.c + if EXAMPLE_FILES sysconf_DATA = sysctl.conf endif -procpsngdir = $(docdir) -dist_procpsng_DATA = \ - Documentation/BUGS \ - Documentation/FAQ - BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.version: diff --git a/configure.ac b/configure.ac index 051b1747..2f804bba 100644 --- a/configure.ac +++ b/configure.ac @@ -274,12 +274,8 @@ AC_CHECK_FUNCS([__fpending alarm atexit dup2 getpagesize gettimeofday iswprint m AC_CONFIG_FILES([Makefile include/Makefile - lib/Makefile - man-po/Makefile - po/Makefile.in - proc/Makefile + man-po/Makefile + po/Makefile.in proc/libprocps.pc - ps/Makefile - testsuite/Makefile - top/Makefile]) + testsuite/Makefile]) AC_OUTPUT diff --git a/lib/Makefile.am b/lib/Makefile.am deleted file mode 100644 index d88e750f..00000000 --- a/lib/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -AM_CPPFLAGS = \ - -include $(top_builddir)/config.h \ - -I$(top_srcdir) \ - -I$(top_srcdir)/include \ - -DLOCALEDIR=\"$(localedir)\" - -noinst_PROGRAMS = test_strutils test_fileutils test_nsutils - -test_strutils_SOURCES = test_strutils.c strutils.c -test_fileutils_SOURCES = test_fileutils.c fileutils.c -test_nsutils_SOURCES = test_nsutils.c nsutils.c diff --git a/proc/Makefile.am b/proc/Makefile.am deleted file mode 100644 index 5b0e84cc..00000000 --- a/proc/Makefile.am +++ /dev/null @@ -1,77 +0,0 @@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -AM_CPPFLAGS = \ - -include $(top_builddir)/config.h \ - -I$(top_srcdir) \ - -I$(top_srcdir)/include \ - -DLOCALEDIR=\"$(localedir)\" - -# -# See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -LIBprocps_CURRENT=4 -LIBprocps_REVISION=0 -LIBprocps_AGE=0 - -lib_LTLIBRARIES = libprocps.la - -if WITH_SYSTEMD -AM_LDFLAGS = @SYSTEMD_LIBS@ -endif - -libprocps_ladir = $(ladir) -libprocps_la_LIBADD = $(LIB_KPARTS) -libprocps_la_LDFLAGS = \ - $(AM_LDFLAGS) \ - $(all_libraries) \ - -version-info $(LIBprocps_CURRENT):$(LIBprocps_REVISION):$(LIBprocps_AGE) \ - -no-undefined \ - -Wl,--version-script=$(top_srcdir)/proc/libprocps.sym - -dist_man_MANS = \ - openproc.3 \ - readproc.3 \ - readproctab.3 - -EXTRA_DIST = libprocps.sym - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libprocps.pc - -libprocps_la_SOURCES = \ - alloc.c \ - alloc.h \ - devname.c \ - devname.h \ - escape.c \ - escape.h \ - ksym.c \ - procps.h \ - pwcache.c \ - pwcache.h \ - readproc.c \ - readproc.h \ - sig.c \ - sig.h \ - slab.c \ - slab.h \ - sysinfo.c \ - sysinfo.h \ - version.c \ - version.h \ - wchan.h \ - whattime.c \ - whattime.h - -libprocps_la_includedir = $(includedir)/proc/ -libprocps_la_include_HEADERS = \ - alloc.h \ - devname.h \ - escape.h \ - procps.h \ - pwcache.h \ - readproc.h \ - sig.h \ - slab.h \ - sysinfo.h \ - version.h \ - wchan.h \ - whattime.h diff --git a/ps/Makefile.am b/ps/Makefile.am deleted file mode 100644 index c8e949aa..00000000 --- a/ps/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -AM_CPPFLAGS = \ - -include $(top_builddir)/config.h \ - -I$(top_srcdir) \ - -I$(top_srcdir)/include \ - -DLOCALEDIR=\"$(localedir)\" - -AM_LDFLAGS = ../proc/libprocps.la - -dist_man_MANS = ps.1 - -# Use `ginstall' in the definition of PROGRAMS and in dependencies to avoid -# confusion with the `install' target. The install rule transforms `ginstall' -# to install before applying any user-specified name transformations. -transform = s/pscommand/ps/; $(program_transform_name) -bin_PROGRAMS = pscommand -pscommand_SOURCES = \ - common.h \ - display.c \ - global.c \ - help.c \ - output.c \ - parser.c \ - select.c \ - sortformat.c \ - stacktrace.c \ - $(top_srcdir)/lib/fileutils.c - -EXTRA_DIST = \ - HACKING \ - regression diff --git a/top/Makefile.am b/top/Makefile.am deleted file mode 100644 index 0cad3195..00000000 --- a/top/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -AM_CPPFLAGS = \ - -include $(top_builddir)/config.h \ - -I$(top_srcdir) \ - -I$(top_srcdir)/include \ - -DLOCALEDIR=\"$(localedir)\" - -AM_LDFLAGS = ../proc/libprocps.la -AM_LDFLAGS += $(DL_LIB) - -if WITH_NCURSES -usrbin_exec_PROGRAMS = \ - top - -top_SOURCES = \ - top.h \ - top.c \ - top_nls.h \ - top_nls.c \ - $(top_srcdir)/lib/fileutils.c - -dist_man_MANS = \ - top.1 - -top_LDADD = @NCURSES_LIBS@ -endif - -EXTRA_DIST = - -procpsngdir = $(docdir) -dist_procpsng_DATA = \ - README.top From edd66515ef75140f99814ee6ca8bfb2032e2a88f Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Fri, 1 May 2015 16:48:21 -0700 Subject: [PATCH 6/7] build-sys: enable "subdir-objects" automake option Otherwise, automake 1.14 will warn that this option will become the default in an upcoming release, which will cause problems for the procps-ng build. Now that the automake rules were merged in the top level Makefile.am, it is possible to enable "subdir-objects" without breaking the build or the dist. Tested that it builds and both `make check` and `make distcheck` work. Tested that `make install` works and produces the same tree before and after this change. Confirmed that binaries are also placed in the same locations in the build tree. Signed-off-by: Filipe Brandenburger --- Makefile.am | 2 -- configure.ac | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0d6f0fd2..3d0a09fe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,3 @@ -#AUTOMAKE_OPTIONS = subdir-objects - AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ -I$(top_srcdir) \ diff --git a/configure.ac b/configure.ac index 2f804bba..4b647415 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ AC_CONFIG_MACRO_DIR([m4]) AC_INIT([procps-ng], m4_esyscmd([misc/git-version-gen .tarball-version]), [procps@freelists.org],,[http://gitorious.org/procps]) -AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability tar-pax no-dist-gzip dist-xz]) +AM_INIT_AUTOMAKE([foreign 1.11 subdir-objects -Wall -Wno-portability tar-pax no-dist-gzip dist-xz]) AM_SILENT_RULES([yes]) AC_CONFIG_SRCDIR([free.c]) AC_CONFIG_HEADERS([config.h]) From 430b559ba2826f80dffa840622ae0fc744000b13 Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Fri, 1 May 2015 23:27:13 -0700 Subject: [PATCH 7/7] build-sys: install binaries in bindir (get rid of usrbin_execdir) The "usrbin_execdir" hack meant to install some binaries in /bin and others in /usr/bin. However: - It is very inflexible: not much control on the final directory name and it is not possible to get rid of the usr/bin suffix without patching the build system. - It is hard to use: it requires configure to receive --exec_prefix=/ and other settings do not make much sense. It is not very obvious that that setting needs to be passed and it takes a while to figure it out. - It produces garbage with the default setup: the default prefix of /usr/local ends up installing the binaries under /usr/local/usr/bin which does not make any sense. Furthermore, the requirement to split binaries in /bin and /usr/bin is not that strong since some distributions adopted the /usr merge and so would agree to just deploy all binaries to /usr/bin directly. Distributions that would still like to split /bin from /usr/bin should actually move binaries such as `ps` and `kill` to /bin after the install of procps-ng is complete. After all, they are the ones responsible for determining what are the binaries that need to be in the root partition and that list depends on their early boot init scripts, so it is possible that the list must be augmented with other binaries from this package. Therefore, I propose here to get rid of that hack and simply install all the binaries to bindir instead, which solves the problems described above and simplifies the build and install of procps-ng. Tested that it builds and both `make check` and `make distcheck` work. Tested that `make install` works and produces the expected tree, the only difference being the absence of the bogus /usr/local/usr/bin directory and now all binaries are merged into /usr/local/bin as expected. Signed-off-by: Filipe Brandenburger --- Makefile.am | 22 ++++++++++------------ configure.ac | 3 --- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3d0a09fe..07c45e71 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,15 +19,7 @@ AM_LDFLAGS = ./proc/libprocps.la transform = s/pscommand/ps/; $(program_transform_name) bin_PROGRAMS = \ - ps/pscommand - -sbin_PROGRAMS = \ - sysctl - -lib_LTLIBRARIES = \ - proc/libprocps.la - -usrbin_exec_PROGRAMS = \ + ps/pscommand \ free \ pgrep \ pkill \ @@ -38,6 +30,12 @@ usrbin_exec_PROGRAMS = \ vmstat \ w +sbin_PROGRAMS = \ + sysctl + +lib_LTLIBRARIES = \ + proc/libprocps.la + dist_man_MANS = \ free.1 \ pgrep.1 \ @@ -70,7 +68,7 @@ dist_procpsng_DATA = \ Documentation/FAQ if BUILD_PIDOF -usrbin_exec_PROGRAMS += pidof +bin_PROGRAMS += pidof dist_man_MANS += pidof.1 pidof_SOURCES = pidof.c lib/fileutils.c else @@ -86,7 +84,7 @@ else endif if WITH_NCURSES -usrbin_exec_PROGRAMS += \ +bin_PROGRAMS += \ slabtop \ watch \ top/top @@ -110,7 +108,7 @@ dist_procpsng_DATA += \ endif if BUILD_SKILL -usrbin_exec_PROGRAMS += \ +bin_PROGRAMS += \ skill \ snice skill_SOURCES = skill.c lib/strutils.c lib/fileutils.c lib/nsutils.c diff --git a/configure.ac b/configure.ac index 4b647415..550344e2 100644 --- a/configure.ac +++ b/configure.ac @@ -69,9 +69,6 @@ AC_FUNC_MMAP AC_FUNC_REALLOC AC_FUNC_STRTOD -usrbin_execdir='${exec_prefix}/usr/bin' -AC_SUBST([usrbin_execdir]) - AM_GNU_GETTEXT_VERSION([0.14.1]) AM_GNU_GETTEXT([external]) if test -d "$srcdir/po"