# Makefile to build sysstat commands # (C) 1999-2021 Sebastien GODARD (sysstat orange.fr) # Version and package name VERSION = @PACKAGE_VERSION@ PACKAGE = @PACKAGE_NAME@ # Needed by docdir PACKAGE_TARNAME = $(PACKAGE)-$(VERSION) # Compiler to use CC = @CC@ # Other commands CHMOD = @CHMOD@ CHOWN = @CHOWN@ LN_S = @LN_S@ AR = @AR@ # Full path to prevent from using aliases CP = @PATH_CP@ CHKCONFIG = @PATH_CHKCONFIG@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_BIN = @INSTALL_BIN@ ifndef HAVE_SENSORS HAVE_SENSORS = @HAVE_SENSORS@ endif LFSENSORS = DFSENSORS = ifeq ($(HAVE_SENSORS),y) LFSENSORS = @LFSENSORS@ DFSENSORS = @DFSENSORS@ endif ifndef HAVE_SENSORS32 HAVE_SENSORS32 = @HAVE_SENSORS32@ endif LFSENSORS32 = DFSENSORS32 = ifeq ($(HAVE_SENSORS32),y) LFSENSORS32 = @LFSENSORS32@ DFSENSORS32 = @DFSENSORS32@ endif HAVE_PCP = @HAVE_PCP@ LFPCP = DFPCP = ifeq ($(HAVE_PCP),y) LFPCP = @LFPCP@ DFPCP = @DFPCP@ endif # Directories ifndef PREFIX PREFIX = @prefix@ endif ifndef DESTDIR DESTDIR = $(RPM_BUILD_ROOT) endif # These two variables are needed by other ones (eg bindir) prefix = $(PREFIX) exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ ifndef SA_LIB_DIR SA_LIB_DIR = @SA_LIB_DIR@ endif SADC_PATH = $(SA_LIB_DIR)/sadc ifndef SA_DIR SA_DIR = @SA_DIR@ endif BIN_DIR = @bindir@ ifndef MAN_DIR # With recent versions of autoconf, mandir defaults to ${datarootdir}/man # (i.e. $prefix/share/man) MAN_DIR = @mandir@ endif MAN1_DIR = $(MAN_DIR)/man1 MAN5_DIR = $(MAN_DIR)/man5 MAN8_DIR = $(MAN_DIR)/man8 ifndef DOC_DIR DOC_DIR = @docdir@ endif NLS_DIR = $(PREFIX)/share/locale ifndef SYSCONFIG_DIR SYSCONFIG_DIR = @SYSCONFIG_DIR@ endif ifndef SYSCONFIG_FILE SYSCONFIG_FILE = @SYSCONFIG_FILE@ endif # Compiler flags ifndef CFLAGS CFLAGS = @CFLAGS@ endif CFLAGS += -Wall -Wstrict-prototypes -pipe -O2 -fno-tree-slp-vectorize ifndef DFLAGS DFLAGS = @DFLAGS@ endif DFLAGS += -DSA_DIR=\"$(SA_DIR)\" -DSADC_PATH=\"$(SADC_PATH)\" DFLAGS += $(DFSENSORS) $(DFSENSORS32) DFLAGS += $(DFPCP) ifdef TFLAGS DFLAGS += $(TFLAGS) endif ifndef LFLAGS LFLAGS = @STRIP@ @LDFLAGS@ endif # Commands ifndef MSGFMT MSGFMT = @MSGFMT@ endif ifndef XGETTEXT XGETTEXT = @XGETTEXT@ endif ifndef MSGMERGE MSGMERGE = @MSGMERGE@ endif ifndef ZIP ZIP = @ZIP@ endif # Settings SYSMACROS = @SYSMACROS@ ifeq ($(SYSMACROS),y) DFLAGS += -DHAVE_SYS_SYSMACROS_H endif LINUX_SCHED = @LINUX_SCHED@ ifeq ($(LINUX_SCHED),y) DFLAGS += -DHAVE_LINUX_SCHED_H endif PCP_IMPL = @PCP_IMPL@ ifeq ($(PCP_IMPL),y) DFLAGS += -DHAVE_PCP_IMPL_H endif SYSPARAM = @SYSPARAM@ ifeq ($(SYSPARAM),y) DFLAGS += -DHAVE_SYS_PARAM_H endif ifndef TGLIB32 TGLIB32 = @TGLIB32@ endif ifndef NLS NLS = @NLS@ endif LFLAGS += @LFINTL@ ifeq ($(NLS),y) REQUIRE_NLS = -DUSE_NLS -DPACKAGE=\"$(PACKAGE)\" -DLOCALEDIR=\"$(NLS_DIR)\" endif ifdef REQUIRE_NLS DFLAGS += $(REQUIRE_NLS) endif ifndef LTO LTO = @LTO@ endif ifndef GCC_AR GCC_AR = @GCC_AR@ endif ifeq ($(LTO),y) AR = $(GCC_AR) CFLAGS += -flto LD = gcc LDFLAGS += $(CFLAGS) endif ifndef INSTALL_CRON INSTALL_CRON = @INSTALL_CRON@ endif ifndef CRON_OWNER CRON_OWNER = @CRON_OWNER@ endif MAN_GROUP = @MAN_GROUP@ ifndef IGNORE_FILE_ATTRIBUTES IGNORE_FILE_ATTRIBUTES = @IGNORE_FILE_ATTRIBUTES@ endif ifeq ($(IGNORE_FILE_ATTRIBUTES),y) MANGRPARG = else MANGRPARG = -g $(MAN_GROUP) endif ifndef CLEAN_SA_DIR CLEAN_SA_DIR = @CLEAN_SA_DIR@ endif ifndef COMPRESS_MANPG COMPRESS_MANPG = @COMPRESS_MANPG@ endif ifndef INSTALL_DOC INSTALL_DOC = @INSTALL_DOC@ endif ifndef COPY_ONLY COPY_ONLY = @COPY_ONLY@ endif # Systemd SYSTEMCTL = @SYSTEMCTL@ SYSTEMD_UNIT_DIR = @SYSTEMD_UNIT_DIR@ SYSTEMD_SLEEP_DIR = @SYSTEMD_SLEEP_DIR@ ifndef USE_CROND USE_CROND = @USE_CROND@ endif ifeq ($(USE_CROND),y) SYSTEMD_UNIT_DIR = endif # Run-command directories ifndef RC_DIR RC_DIR = @RC_DIR@ endif RC0_DIR = $(RC_DIR)/rc0.d RC1_DIR = $(RC_DIR)/rc1.d RC2_DIR = $(RC_DIR)/rc2.d RC3_DIR = $(RC_DIR)/rc3.d RC4_DIR = $(RC_DIR)/rc4.d RC5_DIR = $(RC_DIR)/rc5.d RC6_DIR = $(RC_DIR)/rc6.d ifndef INIT_DIR INIT_DIR = @INIT_DIR@ endif ifndef INITD_DIR INITD_DIR = @INITD_DIR@ endif SOURCE_CODE= $(wildcard *.c *.h) NLSPO= $(wildcard nls/*.po) NLSGMO= $(NLSPO:.po=.gmo) NLSPOT= $(NLSPO:.po=.pot) %.gmo: %.po $(MSGFMT) -o $@ $< %.pot: %.po $(MSGMERGE) -U $< nls/sysstat.pot %.o: %.c $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< % : %.o $(CC) -o $@ $(CFLAGS) $^ $(LFLAGS) all: sadc sar sadf iostat tapestat mpstat pidstat cifsiostat locales common_light.o: common.c version.h common.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< common.o: common.c version.h common.h systest.o: systest.c systest.h sa_common_light.o: sa_common.c version.h sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< sa_common.o: sa_common.c version.h sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h ioconf.o: ioconf.c ioconf.h common.h sysconfig.h act_sadc.o: activity.c sa.h common.h rd_stats.h rd_sensors.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< act_sar.o: activity.c sa.h common.h rd_stats.h rd_sensors.h pr_stats.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SAR $(DFLAGS) $< act_sadf.o: activity.c sa.h common.h rd_stats.h rd_sensors.h rndr_stats.h xml_stats.h json_stats.h svg_stats.h raw_stats.h pcp_stats.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADF $(DFLAGS) $< rd_stats.o: rd_stats.c common.h rd_stats.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< rd_stats_light.o: rd_stats.c common.h rd_stats.h ioconf.h sysconfig.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< count.o: count.c common.h rd_stats.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< count_light.o: count.c common.h rd_stats.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< rd_sensors.o: rd_sensors.c common.h rd_sensors.h rd_stats.h pr_stats.o: pr_stats.c sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h pr_stats.h rndr_stats.o: rndr_stats.c sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h rndr_stats.h xml_stats.o: xml_stats.c sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h xml_stats.h json_stats.o: json_stats.c sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h json_stats.h svg_stats.o: svg_stats.c sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h svg_stats.h raw_stats.o: raw_stats.c sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h raw_stats.h pcp_stats.o: pcp_stats.c sa.h pcp_stats.h sa_wrap.o: sa_wrap.c sa.h common.h rd_stats.h count.h rd_sensors.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< format_sadf.o: format.c sadf.h sa.h common.h rd_stats.h rd_sensors.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADF $(DFLAGS) $< format_sar.o: format.c sa.h common.h rd_stats.h rd_sensors.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SAR $(DFLAGS) $< pcp_def_metrics.o: pcp_def_metrics.c sadf_misc.o: sadf_misc.c sadf.h pcp_def_metrics.h sa.h common.h rd_stats.h rd_sensors.h sa_conv.o: sa_conv.c version.h sadf.h sa.h common.h rd_stats.h rd_sensors.h sa_conv.h # Explicit rules needed to prevent possible file corruption # when using parallel execution. libsyscom.a: common.o ioconf.o systest.o $(AR) rvs $@ $? # Ditto librdstats.a: rd_stats.o count.o $(AR) rvs $@ $? librdstats_light.a: rd_stats_light.o count_light.o $(AR) rvs $@ $? # librdsensors.a: librdsensors.a(rd_sensors.o) librdsensors.a: rd_sensors.o $(AR) rvs $@ $? sadc.o: sadc.c sa.h version.h common.h rd_stats.h rd_sensors.h sadc: LFLAGS += $(LFSENSORS) sadc: sadc.o act_sadc.o sa_wrap.o sa_common_light.o common_light.o systest.o librdstats.a librdsensors.a libsyscom.a sar.o: sar.c sa.h version.h common.h rd_stats.h rd_sensors.h sar: sar.o act_sar.o format_sar.o sa_common.o pr_stats.o librdstats_light.a libsyscom.a sadf.o: sadf.c sadf.h version.h sa.h common.h rd_stats.h rd_sensors.h sadf: LFLAGS += $(LFPCP) sadf: sadf.o act_sadf.o format_sadf.o sadf_misc.o pcp_def_metrics.o sa_conv.o rndr_stats.o xml_stats.o json_stats.o svg_stats.o raw_stats.o pcp_stats.o sa_common.o librdstats_light.a libsyscom.a iostat.o: iostat.c iostat.h version.h common.h ioconf.h sysconfig.h rd_stats.h count.h iostat: iostat.o librdstats_light.a libsyscom.a tapestat.o: tapestat.c tapestat.h version.h common.h count.h rd_stats.h tapestat: tapestat.o librdstats_light.a libsyscom.a pidstat.o: pidstat.c pidstat.h version.h common.h rd_stats.h count.h pidstat: pidstat.o librdstats_light.a libsyscom.a mpstat.o: mpstat.c mpstat.h version.h common.h rd_stats.h count.h mpstat: mpstat.o librdstats_light.a libsyscom.a cifsiostat.o: cifsiostat.c cifsiostat.h count.h rd_stats.h version.h common.h cifsiostat: cifsiostat.o librdstats_light.a libsyscom.a # inisar: Old sar version tests/ini/sa_common.o: tests/ini/sa_common.c tests/ini/iniversion.h tests/ini/sa.h tests/ini/common.h tests/ini/rd_stats.h tests/ini/rd_sensors.h tests/ini/ioconf.h tests/ini/inisysconfig.h tests/ini/act_sar.o: tests/ini/activity.c tests/ini/sa.h tests/ini/common.h tests/ini/rd_stats.h tests/ini/rd_sensors.h tests/ini/pr_stats.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SAR $(DFLAGS) $< tests/ini/rd_stats_light.o: tests/ini/rd_stats.c tests/ini/common.h tests/ini/rd_stats.h tests/ini/ioconf.h tests/ini/inisysconfig.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/ini/count_light.o: tests/ini/count.c tests/ini/common.h tests/ini/rd_stats.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/ini/libsyscom.a: tests/ini/common.o tests/ini/ioconf.o $(AR) rvs $@ $? tests/ini/format_sar.o: tests/ini/format.c tests/ini/sa.h tests/ini/common.h tests/ini/rd_stats.h tests/ini/rd_sensors.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SAR $(DFLAGS) $< tests/ini/pr_stats.o: tests/ini/pr_stats.c tests/ini/sa.h tests/ini/common.h tests/ini/rd_stats.h tests/ini/rd_sensors.h tests/ini/ioconf.h tests/ini/inisysconfig.h tests/ini/pr_stats.h tests/ini/librdstats_light.a: tests/ini/rd_stats_light.o tests/ini/count_light.o $(AR) rvs $@ $? tests/ini/inisar.o: tests/ini/inisar.c tests/ini/sa.h tests/ini/iniversion.h tests/ini/common.h tests/ini/rd_stats.h tests/ini/rd_sensors.h tests/ini/inisar: tests/ini/inisar.o tests/ini/act_sar.o tests/ini/format_sar.o tests/ini/sa_common.o tests/ini/pr_stats.o tests/ini/librdstats_light.a tests/ini/libsyscom.a # sar32/sadc32: 32-bit versions of sar/sadc tests/32bits/sadc32.o: sadc.c sa.h version.h common.h rd_stats.h rd_sensors.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/sar32.o: sar.c sa.h version.h common.h rd_stats.h rd_sensors.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/act_sadc32.o: activity.c sa.h common.h rd_stats.h rd_sensors.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/act_sar32.o: activity.c sa.h common.h rd_stats.h rd_sensors.h pr_stats.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SAR $(DFLAGS) $< tests/32bits/sa_wrap32.o: sa_wrap.c sa.h common.h rd_stats.h count.h rd_sensors.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/sa_common_light32.o: sa_common.c version.h sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/sa_common32.o: sa_common.c version.h sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/common_light32.o: common.c version.h common.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/systest32.o: systest.c systest.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/libsyscom32.a: tests/32bits/common32.o tests/32bits/ioconf32.o tests/32bits/systest32.o $(AR) rvs $@ $? tests/32bits/librdstats32.a: tests/32bits/rd_stats32.o tests/32bits/count32.o $(AR) rvs $@ $? tests/32bits/librdstats_light32.a: tests/32bits/rd_stats_light32.o tests/32bits/count_light32.o $(AR) rvs $@ $? tests/32bits/librdsensors32.a: tests/32bits/rd_sensors32.o $(AR) rvs $@ $? tests/32bits/rd_stats32.o: rd_stats.c common.h rd_stats.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/rd_stats_light32.o: rd_stats.c common.h rd_stats.h ioconf.h sysconfig.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/count32.o: count.c common.h rd_stats.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/count_light32.o: count.c common.h rd_stats.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/format_sar32.o: format.c sa.h common.h rd_stats.h rd_sensors.h $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SAR $(DFLAGS) $< tests/32bits/pr_stats32.o: pr_stats.c sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h pr_stats.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/common32.o: common.c version.h common.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/ioconf32.o: ioconf.c ioconf.h common.h sysconfig.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/rd_sensors32.o: rd_sensors.c common.h rd_sensors.h rd_stats.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/sadc32: LFLAGS += $(LFSENSORS32) tests/32bits/sadc32: tests/32bits/sadc32.o tests/32bits/act_sadc32.o tests/32bits/sa_wrap32.o tests/32bits/sa_common_light32.o tests/32bits/common_light32.o tests/32bits/systest32.o tests/32bits/librdstats32.a tests/32bits/librdsensors32.a tests/32bits/sar32: tests/32bits/sar32.o tests/32bits/act_sar32.o tests/32bits/format_sar32.o tests/32bits/sa_common32.o tests/32bits/pr_stats32.o tests/32bits/librdstats_light32.a tests/32bits/libsyscom32.a ifdef REQUIRE_NLS locales: $(NLSGMO) else locales: endif nls/sysstat.pot: $(wildcard *.c) $(XGETTEXT) -o $@ -k_ --msgid-bugs-address="sysstat orange.fr" $^ # Phony targets .PHONY: clean distclean install install_base install_all uninstall copyyear \ uninstall_base uninstall_all dist bdist xdist gitdist squeeze simtest extratest install_man: man/sadc.8 man/sar.1 man/sadf.1 man/sa1.8 man/sa2.8 man/sysstat.5 ifeq ($(INSTALL_DOC),y) mkdir -p $(DESTDIR)$(MAN1_DIR) mkdir -p $(DESTDIR)$(MAN5_DIR) mkdir -p $(DESTDIR)$(MAN8_DIR) rm -f $(DESTDIR)$(MAN8_DIR)/sa1.8* $(INSTALL_DATA) $(MANGRPARG) man/sa1.8 $(DESTDIR)$(MAN8_DIR) rm -f $(DESTDIR)$(MAN8_DIR)/sa2.8* $(INSTALL_DATA) $(MANGRPARG) man/sa2.8 $(DESTDIR)$(MAN8_DIR) rm -f $(DESTDIR)$(MAN8_DIR)/sadc.8* $(INSTALL_DATA) $(MANGRPARG) man/sadc.8 $(DESTDIR)$(MAN8_DIR) rm -f $(DESTDIR)$(MAN1_DIR)/sar.1* $(INSTALL_DATA) $(MANGRPARG) man/sar.1 $(DESTDIR)$(MAN1_DIR) rm -f $(DESTDIR)$(MAN1_DIR)/sadf.1* $(INSTALL_DATA) $(MANGRPARG) man/sadf.1 $(DESTDIR)$(MAN1_DIR) rm -f $(DESTDIR)$(MAN5_DIR)/sysstat.5* $(INSTALL_DATA) $(MANGRPARG) man/sysstat.5 $(DESTDIR)$(MAN5_DIR) rm -f $(DESTDIR)$(MAN1_DIR)/iostat.1* $(INSTALL_DATA) $(MANGRPARG) man/iostat.1 $(DESTDIR)$(MAN1_DIR) rm -f $(DESTDIR)$(MAN1_DIR)/tapestat.1* $(INSTALL_DATA) $(MANGRPARG) man/tapestat.1 $(DESTDIR)$(MAN1_DIR) rm -f $(DESTDIR)$(MAN1_DIR)/mpstat.1* $(INSTALL_DATA) $(MANGRPARG) man/mpstat.1 $(DESTDIR)$(MAN1_DIR) rm -f $(DESTDIR)$(MAN1_DIR)/pidstat.1* $(INSTALL_DATA) $(MANGRPARG) man/pidstat.1 $(DESTDIR)$(MAN1_DIR) rm -f $(DESTDIR)$(MAN1_DIR)/cifsiostat.1* $(INSTALL_DATA) $(MANGRPARG) man/cifsiostat.1 $(DESTDIR)$(MAN1_DIR) ifeq ($(COMPRESS_MANPG),y) $(ZIP) $(DESTDIR)$(MAN8_DIR)/sa1.8 $(ZIP) $(DESTDIR)$(MAN8_DIR)/sa2.8 $(ZIP) $(DESTDIR)$(MAN8_DIR)/sadc.8 $(ZIP) $(DESTDIR)$(MAN1_DIR)/sar.1 $(ZIP) $(DESTDIR)$(MAN1_DIR)/sadf.1 $(ZIP) $(DESTDIR)$(MAN5_DIR)/sysstat.5 $(ZIP) $(DESTDIR)$(MAN1_DIR)/iostat.1 $(ZIP) $(DESTDIR)$(MAN1_DIR)/tapestat.1 $(ZIP) $(DESTDIR)$(MAN1_DIR)/mpstat.1 $(ZIP) $(DESTDIR)$(MAN1_DIR)/pidstat.1 $(ZIP) $(DESTDIR)$(MAN1_DIR)/cifsiostat.1 endif endif squeeze: catalogs="$(SOURCE_CODE)"; \ for c in $$catalogs; do \ echo "Squeezing file: $$c"; \ sed 's/[\t ]*$$//g' $$c > squeeze.tmp; \ mv squeeze.tmp $$c; \ done # Update Makefile.in by hand - Restore mode for iconfig. copyyear: catalogs="$(SOURCE_CODE) iconfig README.md sa1.in sa2.in sysconfig.in sysstat.in version.in"; \ for c in $$catalogs; do \ echo "Updating file: $$c"; \ sed 's/-2021/-2022/g' $$c > copyyear.tmp; \ mv copyyear.tmp $$c; \ done install_nls: locales ifdef REQUIRE_NLS catalogs='$(NLSGMO)'; \ for c in $$catalogs; do \ c=`basename $$c`; \ c=`echo $$c | sed 's/\.gmo$$//'`; \ mkdir -p $(DESTDIR)$(NLS_DIR)/$$c/LC_MESSAGES; \ echo "NLS: Installing $$c file..." ; \ $(INSTALL_DATA) nls/$$c.gmo $(DESTDIR)$(NLS_DIR)/$$c/LC_MESSAGES/$(PACKAGE).mo; \ done endif install_base: all sa1 sa2 sysstat.sysconfig install_man install_nls mkdir -p $(DESTDIR)$(SA_LIB_DIR) mkdir -p $(DESTDIR)$(SA_DIR) ifeq ($(CLEAN_SA_DIR),y) find $(DESTDIR)$(SA_DIR) -type f | grep -E "/sar?[0-9]{2,8}(\.(Z|gz|bz2|xz|lz|lzo))?$$" | xargs rm -f find $(DESTDIR)$(SA_DIR) -type f | grep -E "/sar?[0-9]{2,8}$$" | xargs rm -f endif mkdir -p $(DESTDIR)$(BIN_DIR) mkdir -p $(DESTDIR)$(DOC_DIR) mkdir -p $(DESTDIR)$(SYSCONFIG_DIR) $(INSTALL_BIN) sa1 $(DESTDIR)$(SA_LIB_DIR) $(INSTALL_BIN) sa2 $(DESTDIR)$(SA_LIB_DIR) $(INSTALL_BIN) sadc $(DESTDIR)$(SA_LIB_DIR) $(INSTALL_BIN) sar $(DESTDIR)$(BIN_DIR) $(INSTALL_BIN) sadf $(DESTDIR)$(BIN_DIR) $(INSTALL_BIN) iostat $(DESTDIR)$(BIN_DIR) $(INSTALL_BIN) tapestat $(DESTDIR)$(BIN_DIR) $(INSTALL_BIN) mpstat $(DESTDIR)$(BIN_DIR) $(INSTALL_BIN) pidstat $(DESTDIR)$(BIN_DIR) $(INSTALL_BIN) cifsiostat $(DESTDIR)$(BIN_DIR) $(INSTALL_DATA) sysstat.ioconf $(DESTDIR)$(SYSCONFIG_DIR) $(INSTALL_DATA) sysstat.sysconfig $(DESTDIR)$(SYSCONFIG_DIR)/$(SYSCONFIG_FILE) ifeq ($(INSTALL_DOC),y) $(INSTALL_DATA) CHANGES $(DESTDIR)$(DOC_DIR) $(INSTALL_DATA) COPYING $(DESTDIR)$(DOC_DIR) $(INSTALL_DATA) CREDITS $(DESTDIR)$(DOC_DIR) $(INSTALL_DATA) README.md $(DESTDIR)$(DOC_DIR) $(INSTALL_DATA) FAQ.md $(DESTDIR)$(DOC_DIR) $(INSTALL_DATA) *.lsm $(DESTDIR)$(DOC_DIR) endif ifdef SYSTEMD_UNIT_DIR install_all: install_base cron/sysstat-collect.service cron/sysstat-collect.timer \ cron/sysstat.sleep cron/sysstat-summary.service cron/sysstat-summary.timer else install_all: install_base cron/crontab sysstat \ cron/sysstat.crond cron/sysstat.cron.daily cron/sysstat.cron.hourly endif ifneq ($(IGNORE_FILE_ATTRIBUTES),y) $(CHOWN) $(CRON_OWNER) $(DESTDIR)$(SA_DIR) endif ifdef SYSTEMD_UNIT_DIR mkdir -p $(DESTDIR)$(SYSTEMD_UNIT_DIR) else if [ -d /etc/cron.d ]; then \ mkdir -p $(DESTDIR)/etc/cron.d; \ elif [ -d /etc/cron.hourly -a -d /etc/cron.daily ]; then \ mkdir -p $(DESTDIR)/etc/cron.hourly $(DESTDIR)/etc/cron.daily; \ fi if [ -d $(INIT_DIR) ]; then \ mkdir -p $(DESTDIR)$(INIT_DIR); \ elif [ -d $(RC_DIR) ]; then \ mkdir -p $(DESTDIR)$(RC_DIR); \ fi endif ifdef SYSTEMD_SLEEP_DIR mkdir -p $(DESTDIR)$(SYSTEMD_SLEEP_DIR) endif if [ -z "$(SYSTEMD_UNIT_DIR)" -o ! -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \ if [ -d $(DESTDIR)/etc/cron.d ]; then \ $(INSTALL_DATA) cron/sysstat.crond $(DESTDIR)/etc/cron.d/sysstat; \ elif [ -d $(DESTDIR)/etc/cron.hourly -a -d $(DESTDIR)/etc/cron.daily ]; then \ $(INSTALL_BIN) cron/sysstat.cron.hourly $(DESTDIR)/etc/cron.hourly/sysstat; \ $(INSTALL_BIN) cron/sysstat.cron.daily $(DESTDIR)/etc/cron.daily/sysstat; \ fi \ fi ifeq ($(COPY_ONLY),n) if [ \( -z "$(SYSTEMD_UNIT_DIR)" -o ! -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" \) -a ! -d $(DESTDIR)/etc/cron.d ]; then \ if [ ! -d $(DESTDIR)/etc/cron.hourly -o ! -d $(DESTDIR)/etc/cron.daily ]; then \ su $(CRON_OWNER) -c "crontab -l > /tmp/crontab-$(CRON_OWNER).save"; \ $(CP) -a /tmp/crontab-$(CRON_OWNER).save ./crontab-$(CRON_OWNER).`date '+%Y%m%d.%H%M%S'`.save; \ echo "USER'S PREVIOUS CRONTAB SAVED IN CURRENT DIRECTORY (USING .save SUFFIX)."; \ su $(CRON_OWNER) -c "crontab cron/crontab"; \ fi \ fi endif if [ -n "$(SYSTEMD_UNIT_DIR)" -a -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \ $(INSTALL_DATA) sysstat.service $(DESTDIR)$(SYSTEMD_UNIT_DIR); \ $(INSTALL_DATA) cron/sysstat-collect.service $(DESTDIR)$(SYSTEMD_UNIT_DIR); \ $(INSTALL_DATA) cron/sysstat-collect.timer $(DESTDIR)$(SYSTEMD_UNIT_DIR); \ $(INSTALL_DATA) cron/sysstat-summary.service $(DESTDIR)$(SYSTEMD_UNIT_DIR); \ $(INSTALL_DATA) cron/sysstat-summary.timer $(DESTDIR)$(SYSTEMD_UNIT_DIR); \ elif [ -d $(DESTDIR)$(INIT_DIR) ]; then \ $(INSTALL_BIN) sysstat $(DESTDIR)$(INIT_DIR)/sysstat; \ if [ "$(COPY_ONLY)" = "n" ]; then \ if [ -x "$(CHKCONFIG)" ]; then \ cd $(DESTDIR)$(INIT_DIR) && $(CHKCONFIG) --add sysstat; \ else \ [ -d $(DESTDIR)$(RC2_DIR) ] || mkdir -p $(DESTDIR)$(RC2_DIR); \ [ -d $(DESTDIR)$(RC3_DIR) ] || mkdir -p $(DESTDIR)$(RC3_DIR); \ [ -d $(DESTDIR)$(RC5_DIR) ] || mkdir -p $(DESTDIR)$(RC5_DIR); \ cd $(DESTDIR)$(RC2_DIR) && $(LN_S) -f ../$(INITD_DIR)/sysstat S01sysstat; \ cd $(DESTDIR)$(RC3_DIR) && $(LN_S) -f ../$(INITD_DIR)/sysstat S01sysstat; \ cd $(DESTDIR)$(RC5_DIR) && $(LN_S) -f ../$(INITD_DIR)/sysstat S01sysstat; \ fi \ fi \ elif [ -d $(DESTDIR)$(RC_DIR) ]; then \ $(INSTALL_BIN) sysstat $(DESTDIR)$(RC_DIR)/rc.sysstat; \ if [ "$(COPY_ONLY)" = "n" ]; then \ if [ -x "$(CHKCONFIG)" ]; then \ cd $(DESTDIR)$(RC_DIR) && $(CHKCONFIG) --add rc.sysstat; \ else \ [ -d $(DESTDIR)$(RC2_DIR) ] || mkdir -p $(DESTDIR)$(RC2_DIR); \ [ -d $(DESTDIR)$(RC3_DIR) ] || mkdir -p $(DESTDIR)$(RC3_DIR); \ [ -d $(DESTDIR)$(RC5_DIR) ] || mkdir -p $(DESTDIR)$(RC5_DIR); \ cd $(DESTDIR)$(RC2_DIR) && $(LN_S) -f ../rc.sysstat S01sysstat; \ cd $(DESTDIR)$(RC3_DIR) && $(LN_S) -f ../rc.sysstat S01sysstat; \ cd $(DESTDIR)$(RC5_DIR) && $(LN_S) -f ../rc.sysstat S01sysstat; \ fi \ fi \ fi if [ -n "$(SYSTEMD_UNIT_DIR)" -a -n "$(SYSTEMD_SLEEP_DIR)" -a -d "$(DESTDIR)$(SYSTEMD_SLEEP_DIR)" ]; then \ $(INSTALL_BIN) cron/sysstat.sleep $(DESTDIR)$(SYSTEMD_SLEEP_DIR); \ fi ifeq ($(COPY_ONLY),n) if [ -n "$(SYSTEMD_UNIT_DIR)" -a -x "$(SYSTEMCTL)" ]; then \ $(SYSTEMCTL) enable sysstat.service; \ fi endif uninstall_man: ifeq ($(INSTALL_DOC),y) rm -f $(DESTDIR)$(MAN8_DIR)/sadc.8* rm -f $(DESTDIR)$(MAN8_DIR)/sa1.8* rm -f $(DESTDIR)$(MAN8_DIR)/sa2.8* rm -f $(DESTDIR)$(MAN1_DIR)/sar.1* rm -f $(DESTDIR)$(MAN1_DIR)/sadf.1* rm -f $(DESTDIR)$(MAN5_DIR)/sysstat.5* rm -f $(DESTDIR)$(MAN1_DIR)/iostat.1* rm -f $(DESTDIR)$(MAN1_DIR)/tapestat.1* rm -f $(DESTDIR)$(MAN1_DIR)/mpstat.1* rm -f $(DESTDIR)$(MAN1_DIR)/pidstat.1* rm -f $(DESTDIR)$(MAN1_DIR)/cifsiostat.1* endif uninstall_nls: ifdef REQUIRE_NLS -catalogs='$(NLSGMO)'; \ for c in $$catalogs; do \ c=`basename $$c`; \ c=`echo $$c | sed 's/\.gmo$$//'`; \ rm -f $(DESTDIR)$(PREFIX)/share/locale/$$c/LC_MESSAGES/$(PACKAGE).mo; \ rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/$$c/LC_MESSAGES 2>/dev/null; \ rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/$$c 2>/dev/null; \ done endif uninstall_base: uninstall_man uninstall_nls rm -f $(DESTDIR)$(SA_LIB_DIR)/sadc rm -f $(DESTDIR)$(SA_LIB_DIR)/sa1 rm -f $(DESTDIR)$(SA_LIB_DIR)/sa2 rm -f $(DESTDIR)$(BIN_DIR)/sar rm -f $(DESTDIR)$(BIN_DIR)/sadf rm -f $(DESTDIR)$(BIN_DIR)/iostat rm -f $(DESTDIR)$(BIN_DIR)/tapestat rm -f $(DESTDIR)$(BIN_DIR)/mpstat rm -f $(DESTDIR)$(BIN_DIR)/pidstat rm -f $(DESTDIR)$(BIN_DIR)/cifsiostat -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(SA_LIB_DIR) -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(SA_DIR)/[0-9]????? -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(SA_DIR) # No need to keep sysstat scripts, config files and links since # the binaries have been deleted. rm -f $(DESTDIR)$(INIT_DIR)/sysstat rm -f $(DESTDIR)$(RC_DIR)/rc.sysstat rm -f $(DESTDIR)$(SYSCONFIG_DIR)/$(SYSCONFIG_FILE) rm -f $(DESTDIR)$(SYSCONFIG_DIR)/sysstat.ioconf rm -f $(DESTDIR)$(RC2_DIR)/S??sysstat rm -f $(DESTDIR)$(RC2_DIR)/S??rc.sysstat rm -f $(DESTDIR)$(RC3_DIR)/S??sysstat rm -f $(DESTDIR)$(RC3_DIR)/S??rc.sysstat rm -f $(DESTDIR)$(RC5_DIR)/S??sysstat rm -f $(DESTDIR)$(RC5_DIR)/S??rc.sysstat # Delete possible kill entries installed by chkconfig rm -f $(DESTDIR)$(RC0_DIR)/K??sysstat rm -f $(DESTDIR)$(RC0_DIR)/K??rc.sysstat rm -f $(DESTDIR)$(RC1_DIR)/K??sysstat rm -f $(DESTDIR)$(RC1_DIR)/K??rc.sysstat rm -f $(DESTDIR)$(RC4_DIR)/K??sysstat rm -f $(DESTDIR)$(RC4_DIR)/K??rc.sysstat rm -f $(DESTDIR)$(RC6_DIR)/K??sysstat rm -f $(DESTDIR)$(RC6_DIR)/K??rc.sysstat # Vixie cron entries also can be safely deleted here rm -f $(DESTDIR)/etc/cron.d/sysstat # Id. for Slackware cron entries rm -f $(DESTDIR)/etc/cron.hourly/sysstat rm -f $(DESTDIR)/etc/cron.daily/sysstat ifeq ($(INSTALL_DOC),y) rm -f $(DESTDIR)$(DOC_DIR)/* -rmdir $(DESTDIR)$(DOC_DIR) endif @echo "Please ignore the errors above, if any." uninstall_all: uninstall_base ifeq ($(COPY_ONLY),n) -if [ -z "$(SYSTEMD_UNIT_DIR)" -o ! -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \ su $(CRON_OWNER) -c "crontab -l > /tmp/crontab-$(CRON_OWNER).old" ; \ $(CP) -a /tmp/crontab-$(CRON_OWNER).old ./crontab-$(CRON_OWNER).`date '+%Y%m%d.%H%M%S'`.old ; \ echo "USER'S CRONTAB SAVED IN CURRENT DIRECTORY (USING .old SUFFIX)." ; \ su $(CRON_OWNER) -c "crontab -r" ; \ fi -if [ -n "$(SYSTEMD_UNIT_DIR)" -a -x "$(SYSTEMCTL)" ]; then \ $(SYSTEMCTL) disable sysstat.service; \ fi endif if [ -n "$(SYSTEMD_UNIT_DIR)" -a -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \ rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysstat.service; \ rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysstat-collect.service; \ rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysstat-collect.timer; \ rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysstat-summary.service; \ rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysstat-summary.timer; \ fi if [ -n "$(SYSTEMD_UNIT_DIR)" -a -n "$(SYSTEMD_SLEEP_DIR)" -a -d "$(DESTDIR)$(SYSTEMD_SLEEP_DIR)" ]; then \ rm -f $(DESTDIR)$(SYSTEMD_SLEEP_DIR)/sysstat.sleep; \ fi ifeq ($(INSTALL_CRON),y) uninstall: uninstall_all else uninstall: uninstall_base endif ifeq ($(INSTALL_CRON),y) install: install_all else install: install_base endif ifdef REQUIRE_NLS po-files: nls/sysstat.pot $(NLSPOT) else po-files: endif TESTDIR="tests" TESTRUN="/bin/sh" TESTLIST:=$(shell ls $(TESTDIR) | grep -E '^[0-9]+$$' | sort -n) EXTRADIR="tests/extra" EXTRALIST:=$(shell ls $(EXTRADIR) | grep -E '^[0-9]+$$' | sort -n) testcomp: tests/ini/inisar sa32bit ifeq ($(TGLIB32),yes) sa32bit: DFLAGS += -DARCH32 sa32bit: CFLAGS += -m32 sa32bit: tests/32bits/sadc32 tests/32bits/sar32 else sa32bit: endif unit: @echo $(X) 2>&1 @cat $(TESTDIR)/$(X) | $(TESTRUN) extraunit: @echo $(X) 2>&1 @cat $(EXTRADIR)/$(X) | $(TESTRUN) # Use "do_test" script to make the following targets simtest: DFLAGS += -DTEST simtest: all testcomp @$(foreach x, $(TESTLIST), $(MAKE) X=$x unit || exit;) rm -f tests/root ln -s root1 tests/root @echo Simulation tests: Success! extratest: DFLAGS += -DTEST extratest: all @$(foreach x, $(EXTRALIST), $(MAKE) X=$x extraunit || exit;) rm -f tests/root ln -s root1 tests/root @echo Extra simulation tests: Success! clean: rm -f sadc sar sadf iostat tapestat mpstat pidstat cifsiostat *.o *.a core TAGS tests/*.tmp tests/extra/*.tmp rm -f nfsiostat* man/nfsiostat* rm -f tests/sa[0123]* rm -f tests/root ln -s root1 tests/root rm -f tests/ini/inisar tests/32bits/sadc32 tests/32bits/sar32 rm -f tests/ini/*.o tests/ini/*.a tests/ini/core tests/pcpar.* tests/extra/pcpar-ssr.* rm -f tests/32bits/*.o tests/32bits/*.a tests/32bits/core find nls -name "*.gmo" -exec rm -f {} \; almost-distclean: clean nls/sysstat.pot rm -f sa1 sa2 sysstat cron/crontab version.h sysconfig.h rm -f sysstat.sysconfig cron/sysstat.crond cron/sysstat.cron.daily sysstat.service rm -f cron/sysstat-collect.service cron/sysstat-collect.timer rm -f cron/sysstat-summary.service cron/sysstat-summary.timer cron/sysstat.sleep rm -f cron/sysstat.cron.hourly cron/sysstat.crond.sample cron/sysstat.crond.sample.in rm -f man/sa1.8 man/sa2.8 man/sadc.8 man/sadf.1 man/sar.1 man/iostat.1 man/sysstat.5 rm -f tests/variables tests/data rm -f man/cifsiostat.1 rm -f *.log config.status rm -rf autom4te.cache rm -f *.save *.old .*.swp data find . -name "*~" -exec rm -f {} \; distclean: almost-distclean rm -f Makefile maintainer-clean: distclean rm -f configure dist: almost-distclean cd .. && (tar --exclude=Makefile --exclude=.git -cvf - sysstat-$(VERSION) | gzip -v9 > sysstat-$(VERSION).tar.gz) bdist: almost-distclean cd .. && (tar --exclude=Makefile --exclude=.git -cvf - sysstat-$(VERSION) | bzip2 > sysstat-$(VERSION).tar.bz2) xdist: almost-distclean cd .. && (tar --exclude=Makefile --exclude=.git -cvf - sysstat-$(VERSION) | xz > sysstat-$(VERSION).tar.xz) gitdist: almost-distclean cd .. && (tar --exclude=Makefile -cvf - sysstat-$(VERSION) | bzip2 > sysstat-$(VERSION)-git.tar.bz2) tags: etags ./*.[hc]