2020-10-06 06:26:36 -05:00
|
|
|
#
|
|
|
|
# Use only LGPL or Public domain (preferred) code in libcommon, otherwise add
|
|
|
|
# your lib/file.c directly to the _SOURCES= of the target binary.
|
|
|
|
#
|
|
|
|
# THIS LIBRARY IS NOT DISTRIBUTED!
|
|
|
|
#
|
|
|
|
# It's just ar(1) archive used by build-system to keep things simple.
|
|
|
|
#
|
|
|
|
# Note that you need "make install-strip" (or proper rpm / Debian build)
|
|
|
|
# to generate binaries with only relevant stuff.
|
|
|
|
#
|
2012-06-04 03:36:37 -05:00
|
|
|
noinst_LTLIBRARIES += libcommon.la
|
|
|
|
libcommon_la_CFLAGS = $(AM_CFLAGS)
|
|
|
|
libcommon_la_SOURCES = \
|
|
|
|
lib/blkdev.c \
|
2020-09-25 10:21:57 -05:00
|
|
|
lib/buffer.c \
|
2012-06-04 03:36:37 -05:00
|
|
|
lib/canonicalize.c \
|
|
|
|
lib/crc32.c \
|
2017-11-15 23:01:38 -06:00
|
|
|
lib/crc32c.c \
|
2012-06-04 03:36:37 -05:00
|
|
|
lib/env.c \
|
2015-11-27 06:56:01 -06:00
|
|
|
lib/idcache.c \
|
2020-02-25 05:00:27 -06:00
|
|
|
lib/encode.c \
|
2012-06-04 03:36:37 -05:00
|
|
|
lib/fileutils.c \
|
2015-07-24 05:57:46 -05:00
|
|
|
lib/color-names.c \
|
2020-11-12 04:19:13 -06:00
|
|
|
lib/jsonwrt.c \
|
2012-06-04 03:36:37 -05:00
|
|
|
lib/mangle.c \
|
|
|
|
lib/match.c \
|
|
|
|
lib/mbsalign.c \
|
2017-02-16 06:04:26 -06:00
|
|
|
lib/mbsedit.c\
|
2012-06-04 03:36:37 -05:00
|
|
|
lib/md5.c \
|
|
|
|
lib/pager.c \
|
2020-10-06 06:26:36 -05:00
|
|
|
lib/procutils.c \
|
2016-10-14 06:21:17 -05:00
|
|
|
lib/pwdutils.c \
|
2012-06-04 03:36:37 -05:00
|
|
|
lib/randutils.c \
|
|
|
|
lib/strutils.c \
|
2013-09-10 06:11:02 -05:00
|
|
|
lib/timeutils.c \
|
2012-11-22 07:26:41 -06:00
|
|
|
lib/ttyutils.c \
|
2017-09-05 04:19:26 -05:00
|
|
|
lib/strv.c \
|
2017-10-13 21:31:12 -05:00
|
|
|
lib/sha1.c \
|
|
|
|
lib/signames.c
|
2012-06-04 03:36:37 -05:00
|
|
|
|
|
|
|
if LINUX
|
2012-08-08 10:19:43 -05:00
|
|
|
libcommon_la_SOURCES += \
|
|
|
|
lib/linux_version.c \
|
|
|
|
lib/loopdev.c
|
2012-06-04 03:36:37 -05:00
|
|
|
endif
|
|
|
|
|
2020-02-22 14:19:26 -06:00
|
|
|
if !HAVE_LANGINFO_H
|
2012-06-04 03:36:37 -05:00
|
|
|
libcommon_la_SOURCES += lib/langinfo.c
|
|
|
|
endif
|
|
|
|
|
2012-11-02 06:07:36 -05:00
|
|
|
if HAVE_CPU_SET_T
|
|
|
|
libcommon_la_SOURCES += lib/cpuset.c
|
|
|
|
endif
|
|
|
|
|
2016-02-29 10:45:46 -06:00
|
|
|
if HAVE_OPENAT
|
2018-10-24 07:32:29 -05:00
|
|
|
if HAVE_DIRFD
|
lib/path: new implementation
The goal is to avoid duplicate code in path.c and sysfs.c and make it
possible to define prefix for paths for all sysfs and procfs based
utils. Now we have /proc snapshots (for tests) for lscpu only. It
would be nice to have the same (for sysfs) for lsblk and another tools.
* very simple API to read numbers, strings and symlinks
* based on openat()
pc = ul_new_path("/sys/block/sda");
ul_path_read_u64(pc, &size, "size");
ul_path_read_u64(pc, &lsz, "queue/logical_block_size");
* printf-like API to generate paths, for example:
ul_path_readf_u64(pc, &num, "sda%d/size", partno)
* allow to define prefix to redirect hardcoded paths to another
location, for example:
pc = ul_new_path("/sys/block/sda");
ul_path_set_prefix(pc, "/my/regression/dump");
ul_path_read_u64(pc, &num, "size");
to read /my/regression/dump/sys/block/sda/size
* allow to extend the API by "dialects", for example for sysfs:
pc = ul_new_path(NULL);
sysfs_blkdev_init_path(pc, devno, NULL);
and use ul_path_* functions to read from @pc initialized by
sysfs_blkdev_init_path()
* add test_path binary
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-09 08:54:12 -05:00
|
|
|
libcommon_la_SOURCES += lib/path.c
|
2016-02-29 10:45:46 -06:00
|
|
|
libcommon_la_SOURCES += lib/sysfs.c
|
|
|
|
endif
|
2018-10-24 07:32:29 -05:00
|
|
|
endif
|
2015-02-27 06:57:34 -06:00
|
|
|
|
|
|
|
noinst_LTLIBRARIES += libtcolors.la
|
2017-05-30 10:10:40 -05:00
|
|
|
libtcolors_la_CFLAGS = $(AM_CFLAGS)
|
2015-07-24 05:57:46 -05:00
|
|
|
libtcolors_la_SOURCES = lib/colors.c lib/color-names.c include/colors.h include/color-names.h
|
2017-05-30 10:10:40 -05:00
|
|
|
libtcolors_la_LIBADD =
|
|
|
|
# tinfo or ncurses are optional
|
|
|
|
if HAVE_TINFO
|
|
|
|
libtcolors_la_LIBADD += $(TINFO_LIBS)
|
|
|
|
libtcolors_la_CFLAGS += $(TINFO_CFLAGS)
|
|
|
|
else
|
|
|
|
if HAVE_NCURSES
|
|
|
|
libtcolors_la_LIBADD += $(NCURSES_LIBS)
|
|
|
|
libtcolors_la_CFLAGS += $(NCURSES_CFLAGS)
|
|
|
|
endif
|
|
|
|
endif # !HAVE_TINFO
|
2015-02-27 06:57:34 -06:00
|
|
|
|
2014-03-11 04:05:32 -05:00
|
|
|
dist_man_MANS += lib/terminal-colors.d.5
|
|
|
|
|
2015-02-27 06:57:34 -06:00
|
|
|
|
2012-07-30 10:59:16 -05:00
|
|
|
check_PROGRAMS += \
|
2012-05-16 17:54:26 -05:00
|
|
|
test_blkdev \
|
2020-09-25 10:21:57 -05:00
|
|
|
test_buffer \
|
2012-05-16 17:54:26 -05:00
|
|
|
test_canonicalize \
|
2013-05-06 12:07:23 -05:00
|
|
|
test_colors \
|
2012-05-16 17:54:26 -05:00
|
|
|
test_fileutils \
|
|
|
|
test_ismounted \
|
2016-10-14 06:21:17 -05:00
|
|
|
test_pwdutils \
|
2012-05-16 17:54:26 -05:00
|
|
|
test_mangle \
|
|
|
|
test_randutils \
|
2020-04-12 13:45:53 -05:00
|
|
|
test_remove_env \
|
2012-05-16 17:54:26 -05:00
|
|
|
test_strutils \
|
2016-05-11 08:31:02 -05:00
|
|
|
test_ttyutils \
|
|
|
|
test_timeutils
|
2012-05-16 17:54:26 -05:00
|
|
|
|
2015-02-27 06:57:34 -06:00
|
|
|
|
2012-05-16 17:54:26 -05:00
|
|
|
if LINUX
|
|
|
|
if HAVE_CPU_SET_T
|
2012-07-30 10:59:16 -05:00
|
|
|
check_PROGRAMS += test_cpuset
|
2012-05-16 17:54:26 -05:00
|
|
|
endif
|
2012-07-30 10:59:16 -05:00
|
|
|
check_PROGRAMS += \
|
2012-05-16 17:54:26 -05:00
|
|
|
test_sysfs \
|
2020-11-20 04:21:41 -06:00
|
|
|
test_pager \
|
|
|
|
test_caputils
|
2012-05-16 17:54:26 -05:00
|
|
|
endif
|
|
|
|
|
2016-02-29 10:45:46 -06:00
|
|
|
if HAVE_OPENAT
|
2018-10-24 07:32:29 -05:00
|
|
|
if HAVE_DIRFD
|
2016-02-29 10:45:46 -06:00
|
|
|
check_PROGRAMS += test_procutils
|
lib/path: new implementation
The goal is to avoid duplicate code in path.c and sysfs.c and make it
possible to define prefix for paths for all sysfs and procfs based
utils. Now we have /proc snapshots (for tests) for lscpu only. It
would be nice to have the same (for sysfs) for lsblk and another tools.
* very simple API to read numbers, strings and symlinks
* based on openat()
pc = ul_new_path("/sys/block/sda");
ul_path_read_u64(pc, &size, "size");
ul_path_read_u64(pc, &lsz, "queue/logical_block_size");
* printf-like API to generate paths, for example:
ul_path_readf_u64(pc, &num, "sda%d/size", partno)
* allow to define prefix to redirect hardcoded paths to another
location, for example:
pc = ul_new_path("/sys/block/sda");
ul_path_set_prefix(pc, "/my/regression/dump");
ul_path_read_u64(pc, &num, "size");
to read /my/regression/dump/sys/block/sda/size
* allow to extend the API by "dialects", for example for sysfs:
pc = ul_new_path(NULL);
sysfs_blkdev_init_path(pc, devno, NULL);
and use ul_path_* functions to read from @pc initialized by
sysfs_blkdev_init_path()
* add test_path binary
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-09 08:54:12 -05:00
|
|
|
check_PROGRAMS += test_path
|
2016-02-29 10:45:46 -06:00
|
|
|
endif
|
2018-10-24 07:32:29 -05:00
|
|
|
endif
|
2016-02-29 10:45:46 -06:00
|
|
|
|
2020-11-20 04:21:41 -06:00
|
|
|
test_caputils_SOURCES = lib/caputils.c
|
|
|
|
test_caputils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_CAPUTILS
|
|
|
|
test_caputils_LDADD = $(LDADD) libcommon.la
|
|
|
|
|
2012-11-22 07:32:21 -06:00
|
|
|
test_ttyutils_SOURCES = lib/ttyutils.c
|
2017-01-04 04:44:37 -06:00
|
|
|
test_ttyutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_TTYUTILS
|
2016-02-22 12:48:30 -06:00
|
|
|
test_ttyutils_LDADD = $(LDADD) libcommon.la
|
2012-11-22 07:32:21 -06:00
|
|
|
|
2012-05-16 17:54:26 -05:00
|
|
|
test_blkdev_SOURCES = lib/blkdev.c
|
2016-02-22 13:20:14 -06:00
|
|
|
test_blkdev_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_BLKDEV
|
2016-02-22 12:48:30 -06:00
|
|
|
test_blkdev_LDADD = $(LDADD) libcommon.la
|
2012-05-22 08:56:29 -05:00
|
|
|
|
2012-05-16 17:54:26 -05:00
|
|
|
test_ismounted_SOURCES = lib/ismounted.c
|
2017-01-04 04:44:37 -06:00
|
|
|
test_ismounted_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_ISMOUNTED
|
2017-05-31 14:02:12 -05:00
|
|
|
test_ismounted_LDADD = libcommon.la $(LDADD)
|
2012-05-22 08:56:29 -05:00
|
|
|
|
2012-05-16 17:54:26 -05:00
|
|
|
test_mangle_SOURCES = lib/mangle.c
|
2017-01-04 04:44:37 -06:00
|
|
|
test_mangle_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_MANGLE
|
2012-05-16 17:54:26 -05:00
|
|
|
|
|
|
|
test_strutils_SOURCES = lib/strutils.c
|
2017-01-04 04:44:37 -06:00
|
|
|
test_strutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_STRUTILS
|
2012-05-22 08:56:29 -05:00
|
|
|
|
2015-07-24 07:33:25 -05:00
|
|
|
test_colors_SOURCES = lib/colors.c lib/color-names.c
|
2017-05-30 18:29:25 -05:00
|
|
|
test_colors_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_COLORS
|
|
|
|
test_colors_LDADD = $(LDADD) libtcolors.la
|
2013-05-06 12:07:23 -05:00
|
|
|
|
2012-05-16 17:54:26 -05:00
|
|
|
test_randutils_SOURCES = lib/randutils.c
|
2017-01-04 04:44:37 -06:00
|
|
|
test_randutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_RANDUTILS
|
2012-05-22 08:56:29 -05:00
|
|
|
|
2016-02-29 10:45:46 -06:00
|
|
|
if HAVE_OPENAT
|
2018-10-24 07:32:29 -05:00
|
|
|
if HAVE_DIRFD
|
2016-02-29 05:49:13 -06:00
|
|
|
test_procutils_SOURCES = lib/procutils.c
|
2017-01-04 04:44:37 -06:00
|
|
|
test_procutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_PROCUTILS
|
2012-05-16 17:54:26 -05:00
|
|
|
|
lib/path: new implementation
The goal is to avoid duplicate code in path.c and sysfs.c and make it
possible to define prefix for paths for all sysfs and procfs based
utils. Now we have /proc snapshots (for tests) for lscpu only. It
would be nice to have the same (for sysfs) for lsblk and another tools.
* very simple API to read numbers, strings and symlinks
* based on openat()
pc = ul_new_path("/sys/block/sda");
ul_path_read_u64(pc, &size, "size");
ul_path_read_u64(pc, &lsz, "queue/logical_block_size");
* printf-like API to generate paths, for example:
ul_path_readf_u64(pc, &num, "sda%d/size", partno)
* allow to define prefix to redirect hardcoded paths to another
location, for example:
pc = ul_new_path("/sys/block/sda");
ul_path_set_prefix(pc, "/my/regression/dump");
ul_path_read_u64(pc, &num, "size");
to read /my/regression/dump/sys/block/sda/size
* allow to extend the API by "dialects", for example for sysfs:
pc = ul_new_path(NULL);
sysfs_blkdev_init_path(pc, devno, NULL);
and use ul_path_* functions to read from @pc initialized by
sysfs_blkdev_init_path()
* add test_path binary
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-09 08:54:12 -05:00
|
|
|
test_path_SOURCES = lib/path.c lib/fileutils.c
|
|
|
|
if HAVE_CPU_SET_T
|
|
|
|
test_path_SOURCES += lib/cpuset.c
|
|
|
|
endif
|
|
|
|
test_path_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_PATH
|
|
|
|
test_path_LDADD = $(LDADD)
|
|
|
|
endif
|
2018-10-24 07:32:29 -05:00
|
|
|
endif
|
lib/path: new implementation
The goal is to avoid duplicate code in path.c and sysfs.c and make it
possible to define prefix for paths for all sysfs and procfs based
utils. Now we have /proc snapshots (for tests) for lscpu only. It
would be nice to have the same (for sysfs) for lsblk and another tools.
* very simple API to read numbers, strings and symlinks
* based on openat()
pc = ul_new_path("/sys/block/sda");
ul_path_read_u64(pc, &size, "size");
ul_path_read_u64(pc, &lsz, "queue/logical_block_size");
* printf-like API to generate paths, for example:
ul_path_readf_u64(pc, &num, "sda%d/size", partno)
* allow to define prefix to redirect hardcoded paths to another
location, for example:
pc = ul_new_path("/sys/block/sda");
ul_path_set_prefix(pc, "/my/regression/dump");
ul_path_read_u64(pc, &num, "size");
to read /my/regression/dump/sys/block/sda/size
* allow to extend the API by "dialects", for example for sysfs:
pc = ul_new_path(NULL);
sysfs_blkdev_init_path(pc, devno, NULL);
and use ul_path_* functions to read from @pc initialized by
sysfs_blkdev_init_path()
* add test_path binary
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-09 08:54:12 -05:00
|
|
|
|
2019-07-04 04:57:11 -05:00
|
|
|
if HAVE_PTY
|
|
|
|
check_PROGRAMS += test_pty
|
|
|
|
test_pty_SOURCES = lib/pty-session.c \
|
2019-07-30 07:29:20 -05:00
|
|
|
include/pty-session.h \
|
|
|
|
lib/monotonic.c
|
2019-07-04 04:57:11 -05:00
|
|
|
test_pty_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_PTY
|
2019-10-10 01:57:30 -05:00
|
|
|
test_pty_LDADD = $(LDADD) libcommon.la $(MATH_LIBS) $(REALTIME_LIBS) -lutil
|
2019-07-04 04:57:11 -05:00
|
|
|
endif
|
|
|
|
|
2012-05-16 17:54:26 -05:00
|
|
|
if LINUX
|
|
|
|
test_cpuset_SOURCES = lib/cpuset.c
|
2017-01-04 04:44:37 -06:00
|
|
|
test_cpuset_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_CPUSET
|
2012-05-22 08:56:29 -05:00
|
|
|
|
2018-05-11 07:28:03 -05:00
|
|
|
test_sysfs_SOURCES = lib/sysfs.c lib/path.c lib/fileutils.c
|
|
|
|
if HAVE_CPU_SET_T
|
|
|
|
test_sysfs_SOURCES += lib/cpuset.c
|
|
|
|
endif
|
2016-02-22 13:20:14 -06:00
|
|
|
test_sysfs_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_SYSFS
|
2018-05-11 07:28:03 -05:00
|
|
|
test_sysfs_LDADD = $(LDADD)
|
2012-05-16 17:54:26 -05:00
|
|
|
|
2012-05-22 08:56:29 -05:00
|
|
|
test_pager_SOURCES = lib/pager.c
|
2017-01-04 04:44:37 -06:00
|
|
|
test_pager_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_PAGER
|
2017-01-02 04:36:53 -06:00
|
|
|
|
2017-01-04 08:44:51 -06:00
|
|
|
check_PROGRAMS += test_linux_version
|
2017-01-02 04:36:53 -06:00
|
|
|
test_linux_version_SOURCES = lib/linux_version.c
|
2017-01-04 04:44:37 -06:00
|
|
|
test_linux_version_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_LINUXVERSION
|
2012-05-16 17:54:26 -05:00
|
|
|
endif
|
|
|
|
|
|
|
|
test_fileutils_SOURCES = lib/fileutils.c
|
2017-01-04 04:44:37 -06:00
|
|
|
test_fileutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_FILEUTILS
|
2012-05-22 08:56:29 -05:00
|
|
|
|
2012-05-16 17:54:26 -05:00
|
|
|
test_canonicalize_SOURCES = lib/canonicalize.c
|
2016-02-22 13:20:14 -06:00
|
|
|
test_canonicalize_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_CANONICALIZE
|
2012-05-16 17:54:26 -05:00
|
|
|
|
2016-05-11 08:31:02 -05:00
|
|
|
test_timeutils_SOURCES = lib/timeutils.c lib/strutils.c
|
|
|
|
test_timeutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_TIMEUTILS
|
2016-10-14 06:21:17 -05:00
|
|
|
|
|
|
|
test_pwdutils_SOURCES = lib/pwdutils.c
|
|
|
|
test_pwdutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM
|
2020-04-12 13:45:53 -05:00
|
|
|
|
|
|
|
test_remove_env_SOURCES = lib/env.c
|
|
|
|
test_remove_env_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM
|
2020-09-25 10:21:57 -05:00
|
|
|
|
|
|
|
test_buffer_SOURCES = lib/buffer.c
|
|
|
|
test_buffer_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_BUFFER
|