From 06d491f9e44f92443f61b7414099d67a8d2c313a Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 4 Jun 2011 16:26:58 +0200 Subject: [PATCH] build-sys: take autotools in use again This will revert change at Oct 2002 when autotools support was removed. Unlike before the package developers are expected to use ./autogen.sh to generate ./configure script, and run make after that. The build system is also able to create, with make dist, a tar ball release which compiles correctly, and has files which seemed to be important to have. The patch removes few unnecessary files, but no everything. Files procps.lsm and procps.spec in git repository are useless as is, but I left them lying around for someone who can make more justified call about removal of them. Last, but not least package version number is set 3.3.0 to distinct this procps from the sourceforge's upstream procps. Please notice that libproc relese is kept as 3.2.8. Signed-off-by: Sami Kerola --- .gitignore | 33 +++++- ChangeLog | 0 Makefile | 262 ----------------------------------------------- Makefile.am | 73 +++++++++++++ autogen.sh | 78 ++++++++++++++ configure.ac | 149 +++++++++++++++++++++++++++ proc/Makefile.am | 47 +++++++++ proc/module.mk | 130 ----------------------- proc/readproc.c | 4 +- proc/version.c | 4 +- ps/Makefile.am | 28 +++++ ps/module.mk | 40 -------- ps/p | 6 -- t | 6 -- v | 6 -- 15 files changed, 408 insertions(+), 458 deletions(-) create mode 100644 ChangeLog delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 proc/Makefile.am delete mode 100644 proc/module.mk create mode 100644 ps/Makefile.am delete mode 100755 ps/module.mk delete mode 100755 ps/p delete mode 100755 t delete mode 100755 v diff --git a/.gitignore b/.gitignore index f2a3c565..f46326d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,44 @@ +aclocal.m4 +autom4te.cache +compile +config.guess +config.h +config.h.in +config.log +config.status +config.sub +configure +depcomp +.deps +.libs free +INSTALL +install-sh kill +libtool +*.lo +ltmain.sh +m4/ +Makefile +Makefile.in +missing +*.o pgrep pkill pmap proc/.depend -proc/libproc-3.2.8.so -ps/ps +proc/libproc.la +proc/Makefile +proc/Makefile.in +ps/Makefile +ps/Makefile.in +ps/pscommand pwdx skill slabtop snice +*.so +stamp-h1 sysctl tload top diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..e69de29b diff --git a/Makefile b/Makefile deleted file mode 100644 index e453453c..00000000 --- a/Makefile +++ /dev/null @@ -1,262 +0,0 @@ -# procps Makefile -# Albert Cahalan, 2002-2004 -# -# Recursive make is considered harmful: -# http://google.com/search?q=%22recursive+make+considered+harmful%22 -# -# For now this Makefile uses explicit dependencies. The project -# hasn't grown big enough to need something complicated, and the -# dependency tracking files are an ugly annoyance. -# -# This file includes */module.mk files which add on to variables: -# FOO += bar/baz -# -# -# Set (or uncomment) SKIP if you wish to avoid something. -# For example, you may prefer the /bin/kill from util-linux or bsdutils. - - -VERSION := 3 -SUBVERSION := 2 -MINORVERSION := 8 -TARVERSION := $(VERSION).$(SUBVERSION).$(MINORVERSION) - -############ vars - -# so you can disable them or choose alternates -ldconfig := ldconfig -ln_f := ln -f -ln_sf := ln -sf -install := install -D --owner 0 --group 0 - -# Lame x86-64 /lib64 and /usr/lib64 abomination: -lib64 := lib$(shell [ -d /lib64 ] && echo 64) - -usr/bin := $(DESTDIR)/usr/bin/ -bin := $(DESTDIR)/bin/ -sbin := $(DESTDIR)/sbin/ -usr/proc/bin := $(DESTDIR)/usr/bin/ -man1 := $(DESTDIR)/usr/share/man/man1/ -man5 := $(DESTDIR)/usr/share/man/man5/ -man8 := $(DESTDIR)/usr/share/man/man8/ -lib := $(DESTDIR)/$(lib64)/ -usr/lib := $(DESTDIR)/usr/$(lib64)/ -usr/include := $(DESTDIR)/usr/include/ - -#SKIP := $(bin)kill $(man1)kill.1 - -BINFILES := $(usr/bin)uptime $(usr/bin)tload $(usr/bin)free $(usr/bin)w \ - $(usr/bin)top $(usr/bin)vmstat $(usr/bin)watch $(usr/bin)skill \ - $(usr/bin)snice $(bin)kill $(sbin)sysctl $(usr/bin)pmap \ - $(usr/proc/bin)pgrep $(usr/proc/bin)pkill $(usr/bin)slabtop \ - $(usr/proc/bin)pwdx - -MANFILES := $(man1)uptime.1 $(man1)tload.1 $(man1)free.1 $(man1)w.1 \ - $(man1)top.1 $(man1)watch.1 $(man1)skill.1 $(man1)kill.1 \ - $(man1)snice.1 $(man1)pgrep.1 $(man1)pkill.1 $(man1)pmap.1 \ - $(man5)sysctl.conf.5 $(man8)vmstat.8 $(man8)sysctl.8 \ - $(man1)slabtop.1 $(man1)pwdx.1 - -TARFILES := AUTHORS BUGS NEWS README TODO COPYING COPYING.LIB \ - Makefile procps.lsm procps.spec v t README.top CodingStyle \ - sysctl.conf minimal.c $(notdir $(MANFILES)) dummy.c \ - uptime.c tload.c free.c w.c top.c vmstat.c watch.c skill.c \ - sysctl.c pgrep.c top.h pmap.c slabtop.c pwdx.c - -# Stuff (tests, temporary hacks, etc.) left out of the standard tarball -# plus the top-level Makefile to make it work stand-alone. -_TARFILES := Makefile - -CURSES := -lncurses - -# This seems about right for the dynamic library stuff. -# Something like this is probably needed to make the SE Linux -# library loading not conflict with embedded systems stuff. -# -#ifeq ($(SHARED),1) -#ldl := -ldl -#LIBTYPE := -DSHAREDLIB -#else -#LIBTYPE := -DSTATICLIB -#endif - -# Preprocessor flags. -PKG_CPPFLAGS := -D_GNU_SOURCE -I proc -CPPFLAGS := -I/usr/include/ncurses -ALL_CPPFLAGS := $(PKG_CPPFLAGS) $(CPPFLAGS) - -# Left out -Wconversion due to noise in glibc headers. -# Left out -Wunreachable-code and -Wdisabled-optimization -# because gcc spews many useless warnings with them. -# -# Since none of the PKG_CFLAGS things are truly required -# to compile procps, they might best be moved to CFLAGS. -# On the other hand, they aren't normal -O -g things either. -# -# Note that -O2 includes -fomit-frame-pointer only if the arch -# doesn't lose some debugging ability. -# -PKG_CFLAGS := -fno-common -ffast-math \ - -W -Wall -Wshadow -Wcast-align -Wredundant-decls \ - -Wbad-function-cast -Wcast-qual -Wwrite-strings -Waggregate-return \ - -Wstrict-prototypes -Wmissing-prototypes -# Note that some stuff below is conditional on CFLAGS containing -# an option that starts with "-g". (-g, -g2, -g3, -ggdb, etc.) -CFLAGS := -O2 -s -ALL_CFLAGS := $(PKG_CFLAGS) $(CFLAGS) - -PKG_LDFLAGS := -Wl,-warn-common -LDFLAGS := -ALL_LDFLAGS := $(PKG_LDFLAGS) $(LDFLAGS) - -############ Add some extra flags if gcc allows - -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(MAKECMDGOALS),tar) -ifneq ($(MAKECMDGOALS),extratar) -ifneq ($(MAKECMDGOALS),beta) - -# Unlike the kernel one, this check_gcc goes all the way to -# producing an executable. There might be a -m64 that works -# until you go looking for a 64-bit curses library. -check_gcc = $(shell if $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) dummy.c $(ALL_LDFLAGS) $(1) -o /dev/null $(CURSES) > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) - -# Be 64-bit if at all possible. In a cross-compiling situation, one may -# do "make m64=-m32 lib64=lib" to produce 32-bit executables. DO NOT -# attempt to use a 32-bit executable on a 64-bit kernel. Packagers MUST -# produce separate executables for ppc and ppc64, s390 and s390x, -# i386 and x86-64, mips and mips64, sparc and sparc64, and so on. -# Failure to do so will cause data corruption. -m64 := $(call check_gcc,-m64,$(call check_gcc,-mabi=64,)) -ALL_CFLAGS += $(m64) - -ALL_CFLAGS += $(call check_gcc,-Wdeclaration-after-statement,) -ALL_CFLAGS += $(call check_gcc,-Wpadded,) -ALL_CFLAGS += $(call check_gcc,-Wstrict-aliasing,) - -# Adding -fno-gcse might be good for those files which -# use computed goto. -#ALL_CFLAGS += $(call check_gcc,-fno-gcse,) - -# if not debugging, enable things that could confuse gdb -ifeq (,$(findstring -g,$(filter -g%,$(CFLAGS)))) -ALL_CFLAGS += $(call check_gcc,-fweb,) -ALL_CFLAGS += $(call check_gcc,-frename-registers,) -ALL_CFLAGS += $(call check_gcc,-fomit-frame-pointer,) -endif - -# in case -O3 is enabled, avoid bloat -ALL_CFLAGS += $(call check_gcc,-fno-inline-functions,) - -endif -endif -endif -endif - -############ misc. - -# free.c pmap.c sysctl.c uptime.c vmstat.c watch.c pgrep.c skill.c tload.c top.c w.c -# utmp.c oldtop.c tmp-junk.c minimal.c - -.SUFFIXES: -.SUFFIXES: .a .o .c .s .h - -.PHONY: all clean do_all install tar extratar beta - -ALL := $(notdir $(BINFILES)) - -CLEAN := $(notdir $(BINFILES)) - -DIRS := - -INSTALL := $(BINFILES) $(MANFILES) - -# want this rule first, use := on ALL, and ALL not filled in yet -all: do_all - --include proc/module.mk --include ps/module.mk - -do_all: $(ALL) - -junk := DEADJOE *~ *.o core gmon.out - -# Remove $(junk) from all $(DIRS) -CLEAN += $(junk) $(foreach dir,$(DIRS),$(addprefix $(dir), $(junk))) - -########## -# not maintained because it isn't really needed: -# -#SRC := -#OBJ := $(patsubst %.c,%.o, $(filter %.c,$(SRC))) -# -#ifneq ($(MAKECMDGOALS),clean) -#-include $(OBJ:.o=.d) -#endif -# -#%.d: %.c -# depend.sh $(ALL_CPPFLAGS) $(ALL_CFLAGS) $< > $@ -############ - -# don't want to type "make procps-$(TARVERSION).tar.gz" -tar: $(TARFILES) - mkdir procps-$(TARVERSION) - (tar cf - $(TARFILES)) | (cd procps-$(TARVERSION) && tar xf -) - tar cf procps-$(TARVERSION).tar procps-$(TARVERSION) - gzip -9 procps-$(TARVERSION).tar - -extratar: $(_TARFILES) - mkdir procps-$(TARVERSION) - (tar cf - $(_TARFILES)) | (cd procps-$(TARVERSION) && tar xf -) - tar cf extra-$(TARVERSION).tar procps-$(TARVERSION) - gzip -9 extra-$(TARVERSION).tar - -beta: $(TARFILES) $(_TARFILES) - mkdir beta-$(TARVERSION) - (tar cf - $(TARFILES) $(_TARFILES)) | (cd beta-$(TARVERSION) && tar xf -) - tar cf beta-$(TARVERSION).tar beta-$(TARVERSION) - gzip -9 beta-$(TARVERSION).tar - -clean: - rm -f $(CLEAN) - -###### install - -$(BINFILES) : all - $(install) --mode a=rx $(notdir $@) $@ - -$(MANFILES) : all - $(install) --mode a=r $(notdir $@) $@ - -install: $(filter-out $(SKIP) $(addprefix $(DESTDIR),$(SKIP)),$(INSTALL)) - cd $(usr/bin) && $(ln_f) skill snice - cd $(usr/proc/bin) && $(ln_f) pgrep pkill - -############ prog.c --> prog.o - -top.o : top.h - -%.o : %.c - $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< - -w.o: w.c - $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(W_SHOWFROM) -c $< - -############ prog.o --> prog - -pmap w uptime tload free sysctl vmstat utmp pgrep skill pwdx: % : %.o $(LIBPROC) - $(CC) $(ALL_CFLAGS) $^ $(ALL_LDFLAGS) -o $@ - -slabtop top: % : %.o $(LIBPROC) - $(CC) $(ALL_CFLAGS) $^ $(ALL_LDFLAGS) -o $@ $(CURSES) - -watch: % : %.o - $(CC) $(ALL_CFLAGS) $^ $(ALL_LDFLAGS) -o $@ $(CURSES) - -############ progX --> progY - -snice kill: skill - $(ln_f) skill $@ - -pkill: pgrep - $(ln_f) pgrep pkill diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..2fc3cc73 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,73 @@ +AM_CPPFLAGS = -include $(top_builddir)/config.h + +ACLOCAL_AMFLAGS = -I m4 +SUBDIRS = proc ps + +AM_CFLAGS = -Iproc +AM_LDFLAGS = ./proc/libproc.la + +sbin_PROGRAMS = \ + sysctl + +bin_PROGRAMS = \ + kill + +usrbin_exec_PROGRAMS = \ + free \ + pgrep \ + pkill \ + pmap \ + pwdx \ + skill \ + snice \ + tload \ + uptime \ + vmstat \ + w + +dist_man_MANS = \ + free.1 \ + kill.1 \ + pgrep.1 \ + pkill.1 \ + pmap.1 \ + pwdx.1 \ + skill.1 \ + snice.1 \ + sysctl.8 \ + sysctl.conf.5 \ + tload.1 \ + uptime.1 \ + vmstat.8 \ + w.1 + +if HAVE_NCURSES +usrbin_exec_PROGRAMS += \ + slabtop \ + top \ + watch +top_SOURCES = top.c top.h +dist_man_MANS += \ + slabtop.1 \ + top.1 \ + watch.1 +slabtop_LDADD = @NCURSES_LIBS@ +top_LDADD = @NCURSES_LIBS@ +watch_LDADD = @NCURSES_LIBS@ +endif + +kill_SOURCES = skill.c +snice_SOURCES = skill.c +pkill_SOURCES = pgrep.c + +sysconf_DATA = sysctl.conf + +EXTRA_DIST = \ + autogen.sh \ + BUGS \ + CodingStyle \ + COPYING.LIB \ + dummy.c \ + README.top \ + tmp-junk.c \ + $(sysconf_DATA) diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..6704036d --- /dev/null +++ b/autogen.sh @@ -0,0 +1,78 @@ +#!/bin/sh +# +# Helps generate autoconf/automake stuff, when code is checked +# out from SCM. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +THEDIR=`pwd` +cd $srcdir +DIE=0 + +test -f top.c || { + echo + echo "You must run this script in the top-level procps directory" + echo + DIE=1 +} + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed to generate procps build system." + echo + DIE=1 +} +(autoheader --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoheader installed to generate procps build system." + echo "The autoheader command is part of the GNU autoconf package." + echo + DIE=1 +} +(libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have libtool-2 installed to generate procps build system." + echo + DIE=1 +} +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have automake installed to generate procps build system." + echo + DIE=1 +} + +ltver=$(libtoolize --version | awk '/^libtoolize/ { print $4 }') +test ${ltver##2.} = "$ltver" && { + echo "You must have libtool version >= 2.x.x, but you have $ltver." + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +echo +echo "Generate build-system by:" +echo " aclocal: $(aclocal --version | head -1)" +echo " autoconf: $(autoconf --version | head -1)" +echo " autoheader: $(autoheader --version | head -1)" +echo " automake: $(automake --version | head -1)" +echo " libtoolize: $(libtoolize --version | head -1)" + +rm -rf autom4te.cache + +set -e +libtoolize --force $LT_OPTS +aclocal -I m4 $AL_OPTS +autoconf $AC_OPTS +autoheader $AH_OPTS + +automake --add-missing $AM_OPTS + +cd $THEDIR + +echo +echo "Now type '$srcdir/configure' and 'make' to compile." +echo diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..5220f949 --- /dev/null +++ b/configure.ac @@ -0,0 +1,149 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.64]) +AC_CONFIG_MACRO_DIR([m4]) +AC_INIT([procps], + [3.3.0], + [procps@freelists.org],,[http://gitorious.org/procps]) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([dummy.c]) +AC_CONFIG_HEADERS([config.h]) + +# Checks for programs. +AC_GNU_SOURCE +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_INSTALL +AC_PROG_LN_S + +# Checks for libraries. +AC_CHECK_LIB([ncurses], [setupterm]) + +# Checks for header files. +AC_HEADER_MAJOR +AC_CHECK_HEADERS([\ + fcntl.h \ + langinfo.h \ + limits.h \ + locale.h \ + netinet/in.h \ + stdlib.h \ + string.h \ + sys/file.h \ + sys/ioctl.h \ + sys/param.h \ + sys/time.h \ + termios.h \ + unistd.h \ + utmp.h \ + values.h \ + wchar.h \ + wctype.h +]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_HEADER_STDBOOL +AC_CHECK_MEMBERS([struct stat.st_rdev]) +AC_C_INLINE +AC_C_RESTRICT +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_TYPE_UID_T + +dnl libtool +LT_INIT + +# Checks for library functions. +AC_FUNC_ERROR_AT_LINE +AC_FUNC_FORK +AC_FUNC_MALLOC +AC_FUNC_MBRTOWC +AC_FUNC_MMAP +AC_FUNC_REALLOC +AC_FUNC_STRTOD +AC_CHECK_FUNCS([\ + alarm \ + getpagesize \ + gettimeofday \ + iswprint \ + memchr \ + memmove \ + memset \ + munmap \ + nl_langinfo \ + putenv \ + regcomp \ + select \ + setlocale \ + strcasecmp \ + strchr \ + strcspn \ + strdup \ + strerror \ + strncasecmp \ + strpbrk \ + strrchr \ + strspn \ + strstr \ + strtol \ + strtoul \ + uname \ + utmpname \ + wcwidth +]) + +usrbin_execdir='${exec_prefix}/usr/bin' +AC_SUBST([usrbin_execdir]) + +dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION, [VARSUFFIX = $1])) +dnl The VARSUFFIX is optional and overrides the default behaviour. For example: +dnl UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX +dnl UTIL_CHECK_LIB(yyy, func) generates have_yyy and HAVE_LIBYYY +dnl --------------------------------- +AC_DEFUN([UTIL_CHECK_LIB], [ + m4_define([suffix], m4_default([$3],$1)) + [have_]suffix=yes + m4_ifdef([$3], + [AC_CHECK_LIB([$1], [$2], [AC_DEFINE(AS_TR_CPP([HAVE_LIB]suffix), 1)], [[have_]suffix=no])], + [AC_CHECK_LIB([$1], [$2], [], [[have_]suffix=no])]) + AM_CONDITIONAL(AS_TR_CPP([HAVE_]suffix), [test [$have_]suffix = yes]) +]) + +AC_ARG_WITH([ncurses], + AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version + (--without-ncurses disables all ncurses(w) support)]), + [], with_ncurses=auto +) +AM_CONDITIONAL(HAVE_NCURSES, false) + +if test "x$with_ncurses" != xno; then + have_ncurses=no + AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [ + if test "x$with_ncurses" = xauto; then + UTIL_CHECK_LIB(ncursesw, initscr, ncurses) + if test "x$have_ncurses" = xyes; then + AC_CHECK_HEADERS([ncursesw/ncurses.h]) + NCURSES_LIBS="-lncursesw" + fi + fi + if test "x$have_ncurses" = xno; then + UTIL_CHECK_LIB(ncurses, initscr) + if test "x$have_ncurses" = xyes; then + NCURSES_LIBS="-lncurses" + fi + fi + ]) + if test "x$have_ncurses" = xno; then + AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)]) + fi +fi +AC_SUBST([NCURSES_LIBS]) + +AC_CONFIG_FILES([ +Makefile +proc/Makefile +ps/Makefile +]) +AC_OUTPUT diff --git a/proc/Makefile.am b/proc/Makefile.am new file mode 100644 index 00000000..2f31b572 --- /dev/null +++ b/proc/Makefile.am @@ -0,0 +1,47 @@ +AM_CPPFLAGS = -include $(top_builddir)/config.h + +lib_LTLIBRARIES = libproc.la + +libproc_ladir = $(ladir) +libproc_la_LIBADD = $(LIB_KPARTS) +libproc_la_LDFLAGS = $(all_libraries) -release 3.2.8 -no-undefined + +libproc_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 + +libproc_la_includedir = $(includedir)/proc/ +libproc_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/proc/module.mk b/proc/module.mk deleted file mode 100644 index af203348..00000000 --- a/proc/module.mk +++ /dev/null @@ -1,130 +0,0 @@ -# This file gets included into the main Makefile, in the top directory. - -# Ideally, we want something like this: -# -# /lib/libproc.so.w ELF soname ('w' is a digit, starting from 1) -# /lib/procps-x.y.z.so file itself (x.y.z is the procps version) -# /lib/libproc.so for linking, UNSUPPORTED -# /usr/lib/libproc.a for linking, UNSUPPORTED -# proc/libproc.so.w as above, if testing with LD_LIBRARY_PATH -# proc/whatever if testing with LD_PRELOAD -# proc/libproc.a for static build -# -# Without a stable ABI, there's no point in having any of that. -# Without a stable API, there's no point in having the *.a file. -# -# A new ELF soname is required for every big ABI change. To conserve -# numbers for future use, the ELF soname can be set equal to the -# file name until some future date when a stable ABI is declared. - -SHARED := 1 - -# for lib$(NAME).so and /usr/include/($NAME) and such -NAME := proc - -LIBVERSION := $(VERSION).$(SUBVERSION).$(MINORVERSION) -ABIVERSION := 0 - -SOFILE := lib$(NAME)-$(LIBVERSION).so -ifneq ($(ABIVERSION),0) -SOLINK := lib$(NAME).so -SONAME := lib$(NAME).so.$(ABIVERSION) -else -SONAME := $(SOFILE) -SOLINK := $(SOFILE) -endif - -ANAME := lib$(NAME).a - -############ - -FPIC := -fpic - -ifeq ($(SHARED),1) -ALL += proc/$(SONAME) -INSTALL += ldconfig -LIBFLAGS := -DSHARED=1 $(FPIC) -# This is in gcc 3.5, but exported functions must be marked. -#LIBFLAGS += $(call check_gcc,-fvisibility=hidden,) -LIBPROC := proc/$(SONAME) -else -ALL += proc/$(ANAME) -#INSTALL += $(usr/lib)$(ANAME) -LIBFLAGS := -DSHARED=0 -LIBPROC := proc/$(ANAME) -endif - -LIBSRC := $(wildcard proc/*.c) -LIBHDR := $(wildcard proc/*.h) -LIBOBJ := $(LIBSRC:.c=.o) - -# Separate rule for this directory, to use -fpic or -fPIC -$(filter-out proc/version.o,$(LIBOBJ)): proc/%.o: proc/%.c - $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(LIBFLAGS) $< -o $@ - -LIB_X := COPYING module.mk library.map -TARFILES += $(LIBSRC) $(LIBHDR) $(addprefix proc/,$(LIB_X)) - - -# Clean away all output files, .depend, and symlinks. -# Use wildcards in case the version has changed. -CLEAN += proc/.depend proc/lib*.so* proc/lib*.a $(LIBOBJ) -DIRS += proc/ - -proc/$(ANAME): $(LIBOBJ) - $(AR) rcs $@ $^ - -#proc/$(SONAME): proc/library.map -proc/$(SONAME): $(LIBOBJ) - $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -shared -Wl,-soname,$(SONAME) -Wl,--version-script=proc/library.map -o $@ $^ -lc - - -# AUTOMATIC DEPENDENCY GENERATION -- GCC AND GNUMAKE DEPENDENT -proc/.depend: $(LIBSRC) $(LIBHDR) - $(strip $(CC) $(ALL_CPPFLAGS) $(LIB_CFLAGS) -MM -MG $(LIBSRC) > $@) - -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(MAKECMDGOALS),tar) -ifneq ($(MAKECMDGOALS),extratar) -ifneq ($(MAKECMDGOALS),beta) --include proc/.depend -endif -endif -endif -endif - -#################### install rules ########################### - -$(lib)$(SOFILE) : proc/$(SONAME) - $(install) --mode a=rx $< $@ - -ifneq ($(SOLINK),$(SOFILE)) -.PHONY: $(lib)$(SOLINK) -$(lib)$(SOLINK) : $(lib)$(SOFILE) - cd $(lib) && $(ln_sf) $(SOFILE) $(SOLINK) -endif - -ifneq ($(SONAME),$(SOFILE)) -.PHONY: $(lib)$(SONAME) -$(lib)$(SONAME) : $(lib)$(SOFILE) - cd $(lib) && $(ln_sf) $(SOFILE) $(SONAME) -endif - -.PHONY: ldconfig -ldconfig : $(lib)$(SONAME) $(lib)$(SOLINK) - $(ldconfig) - -$(usr/lib)$(ANAME) : proc/$(ANAME) - $(install) --mode a=r $< $@ - -# Junk anyway... supposed to go in /usr/include/$(NAME) -#INSTALL += $(addprefix $(include),$(HDRFILES)) -# -#$(addprefix $(include),$(HDRFILES)): $(include)% : proc/% -#$(include)% : proc/% -# $(install) --mode a=r $< $@ - -################################################################## - -proc/version.o: proc/version.c proc/version.h - $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(LIBFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c -o $@ $< diff --git a/proc/readproc.c b/proc/readproc.c index f71c514c..61279065 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -6,9 +6,7 @@ * May be distributed under the conditions of the * GNU Library General Public License; a copy is in COPYING */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif + #include "version.h" #include "readproc.h" #include "alloc.h" diff --git a/proc/version.c b/proc/version.c index 0c3a48f1..f516343d 100644 --- a/proc/version.c +++ b/proc/version.c @@ -7,9 +7,7 @@ * Redistributable under the terms of the * GNU Library General Public License; see COPYING */ -#ifdef HAVE_CONFIG_H -#include -#endif + #include #include #include "version.h" diff --git a/ps/Makefile.am b/ps/Makefile.am new file mode 100644 index 00000000..43af2cfe --- /dev/null +++ b/ps/Makefile.am @@ -0,0 +1,28 @@ +AM_CPPFLAGS = -include $(top_builddir)/config.h + +AM_CFLAGS = -I../proc +AM_LDFLAGS = ../proc/libproc.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 + +EXTRA_DIST = \ + HACKING \ + it \ + regression \ + TRANSLATION diff --git a/ps/module.mk b/ps/module.mk deleted file mode 100755 index 2902a3aa..00000000 --- a/ps/module.mk +++ /dev/null @@ -1,40 +0,0 @@ -# This file gets included into the main Makefile, in the top directory. - -INSTALL += $(bin)ps $(man1)ps.1 - -# files to remove -CLEAN += ps/ps ps/debug - -# a directory for cleaning -DIRS += ps/ - -# a file to create -ALL += ps/ps - -PS_C := display global help output parser select sortformat -PSNAMES := $(addprefix ps/,$(PS_C)) -PSOBJ := $(addsuffix .o,$(PSNAMES)) -PSSRC := $(addsuffix .c,$(PSNAMES)) - -PS_X := COPYING HACKING TRANSLATION common.h module.mk it p ps.1 regression -TARFILES += $(PSSRC) $(addprefix ps/,$(PS_X)) - -ps/ps: $(PSOBJ) $(LIBPROC) - $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -o $@ $^ $(ldl) - -# This just adds the stacktrace code -ps/debug: $(PSOBJ) stacktrace.o $(LIBPROC) - $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -o $@ $^ -lefence $(ldl) - -$(PSOBJ): %.o: %.c ps/common.h $(LIBPROC) - $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) $< -o $@ - -ps/stacktrace.o: ps/stacktrace.c - - -$(bin)ps: ps/ps - $(install) --mode a=rx $< $@ - -$(man1)ps.1 : ps/ps.1 - $(install) --mode a=r $< $@ - -rm -f $(DESTDIR)/var/catman/cat1/ps.1.gz $(DESTDIR)/var/man/cat1/ps.1.gz diff --git a/ps/p b/ps/p deleted file mode 100755 index 10064fa3..00000000 --- a/ps/p +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# -# Wow, using $* causes great pain with: ps "pid,user pcpu,pmem" -# The "$@" won't break that into 2 arguments. -# -LD_LIBRARY_PATH=../proc exec ./ps "$@" diff --git a/t b/t deleted file mode 100755 index 3842ee03..00000000 --- a/t +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# -# Wow, using $* causes great pain with embedded spaces in arguments. -# The "$@" won't break that into 2 arguments. -# -LD_LIBRARY_PATH=proc exec ./top "$@" diff --git a/v b/v deleted file mode 100755 index f23230b5..00000000 --- a/v +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# -# Wow, using $* causes great pain with embedded spaces in arguments. -# The "$@" won't break that into 2 arguments. -# -LD_LIBRARY_PATH=proc exec ./vmstat "$@"