From c1c73c0d0030b6b4a90529a26992893941a10e35 Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Fri, 1 May 2015 21:28:53 -0700 Subject: [PATCH] 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