# Makefile to build sysstat commands
-# (C) 1999-2016 Sebastien GODARD (sysstat <at> orange.fr)
+# (C) 1999-2019 Sebastien GODARD (sysstat <at> orange.fr)
# Version and package name
VERSION = @PACKAGE_VERSION@
DFSENSORS = @DFSENSORS@
endif
+HAVE_PCP = @HAVE_PCP@
+LFPCP =
+DFPCP =
+ifeq ($(HAVE_PCP),y)
+LFPCP = @LFPCP@
+DFPCP = @DFPCP@
+endif
+
# Directories
ifndef PREFIX
PREFIX = @prefix@
LFLAGS = @STRIP@
DFLAGS += -DSA_DIR=\"$(SA_DIR)\" -DSADC_PATH=\"$(SADC_PATH)\"
DFLAGS += $(DFSENSORS)
+DFLAGS += $(DFPCP)
# Commands
ifndef MSGFMT
all: sadc sar sadf iostat tapestat mpstat pidstat cifsiostat locales
-common.o: common.c version.h common.h ioconf.h sysconfig.h
+common_sadc.o: common.c version.h common.h
+ $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $<
+
+common.o: common.c version.h common.h
-sa_common.o: sa_common.c sa.h common.h ioconf.h sysconfig.h rd_stats.h
+systest.o: systest.c systest.h
+
+sa_common_sadc.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 rd_stats.h rd_sensors.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 pr_stats.h
+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 rndr_stats.h xml_stats.h json_stats.h svg_stats.h raw_stats.h
+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 ioconf.h sysconfig.h
+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
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 sysconfig.h
+rd_sensors.o: rd_sensors.c common.h rd_sensors.h rd_stats.h
-pr_stats.o: pr_stats.c sa.h ioconf.h sysconfig.h pr_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 ioconf.h sysconfig.h rndr_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 sadf.h ioconf.h sysconfig.h xml_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 sadf.h ioconf.h sysconfig.h json_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 sadf.h ioconf.h sysconfig.h svg_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 sadf.h ioconf.h sysconfig.h raw_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
-sa_wrap.o: sa_wrap.c sa.h rd_stats.h count.h rd_sensors.h prealloc.h
+pcp_stats.o: pcp_stats.c sa.h pcp_stats.h
-format_sadf.o: format.c sadf.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
+format_sar.o: format.c sa.h common.h rd_stats.h rd_sensors.h
$(CC) -o $@ -c $(CFLAGS) -DSOURCE_SAR $(DFLAGS) $<
-sadf_misc.o: sadf_misc.c sadf.h sa.h
+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 sadf.h sa.h sa_conv.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
+libsyscom.a: common.o ioconf.o systest.o
$(AR) rvs $@ $?
# Ditto
librdsensors.a: rd_sensors.o
$(AR) rvs $@ $?
-sadc.o: sadc.c sa.h version.h common.h ioconf.h sysconfig.h rd_stats.h rd_sensors.h
+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.o librdstats.a librdsensors.a libsyscom.a
-sar.o: sar.c sa.h version.h common.h ioconf.h pr_stats.h sysconfig.h
+sadc: sadc.o act_sadc.o sa_wrap.o sa_common_sadc.o common_sadc.o systest.o librdstats.a librdsensors.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
-sar: sar.o act_sar.o format_sar.o sa_common.o pr_stats.o libsyscom.a
+sadf.o: sadf.c sadf.h version.h sa.h common.h rd_stats.h rd_sensors.h
-sadf.o: sadf.c sadf.h version.h sa.h common.h ioconf.h sysconfig.h
+sadf: LFLAGS += $(LFPCP)
-sadf: sadf.o act_sadf.o format_sadf.o sadf_misc.o sa_conv.o rndr_stats.o xml_stats.o json_stats.o svg_stats.o raw_stats.o sa_common.o libsyscom.a
+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
+tapestat.o: tapestat.c tapestat.h version.h common.h count.h rd_stats.h
tapestat: tapestat.o librdstats_light.a libsyscom.a
mpstat: mpstat.o librdstats_light.a libsyscom.a
-cifsiostat.o: cifsiostat.c cifsiostat.h count.h version.h common.h
+cifsiostat.o: cifsiostat.c cifsiostat.h count.h rd_stats.h version.h common.h
cifsiostat: cifsiostat.o librdstats_light.a libsyscom.a
+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
+
ifdef REQUIRE_NLS
locales: $(NLSGMO)
else
# Phony targets
.PHONY: clean distclean install install_base install_all uninstall \
- uninstall_base uninstall_all dist bdist xdist gitdist squeeze test
+ uninstall_base uninstall_all dist bdist xdist gitdist squeeze simtest
install_man: man/sadc.8 man/sar.1 man/sadf.1 man/sa1.8 man/sa2.8 man/sysstat.5
ifeq ($(INSTALL_DOC),y)
$(INSTALL_DATA) COPYING $(DESTDIR)$(DOC_DIR)
$(INSTALL_DATA) CREDITS $(DESTDIR)$(DOC_DIR)
$(INSTALL_DATA) README.md $(DESTDIR)$(DOC_DIR)
- $(INSTALL_DATA) FAQ $(DESTDIR)$(DOC_DIR)
+ $(INSTALL_DATA) FAQ.md $(DESTDIR)$(DOC_DIR)
$(INSTALL_DATA) *.lsm $(DESTDIR)$(DOC_DIR)
endif
$(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 [ "$(COPY_ONLY)" = "n" ]; then \
if [ -x "$(CHKCONFIG)" ]; then \
cd $(DESTDIR)$(INIT_DIR) && $(CHKCONFIG) --add sysstat; \
else \
fi \
elif [ -d $(DESTDIR)$(RC_DIR) ]; then \
$(INSTALL_BIN) sysstat $(DESTDIR)$(RC_DIR)/rc.sysstat; \
- if [ "$(COPY_ONLY)" == "n" ]; then \
+ if [ "$(COPY_ONLY)" = "n" ]; then \
if [ -x "$(CHKCONFIG)" ]; then \
cd $(DESTDIR)$(RC_DIR) && $(CHKCONFIG) --add rc.sysstat; \
else \
TESTRUN="/bin/sh"
TESTLIST:=$(shell ls $(TESTDIR) | egrep '^[0-9]+$$' | sort -n)
+testcomp: tests/ini/inisar
+
unit:
@echo $(X) 2>&1
@cat $(TESTDIR)/$(X) | $(TESTRUN)
-test: all
+simtest: all testcomp
@$(foreach x, $(TESTLIST), $(MAKE) X=$x unit || exit;)
+ rm -f tests/root
+ ln -s root1 tests/root
clean:
rm -f sadc sar sadf iostat tapestat mpstat pidstat cifsiostat *.o *.a core TAGS tests/*.tmp
+ rm -f nfsiostat* man/nfsiostat*
+ rm -f tests/sa[012]*
+ rm -f tests/root
+ ln -s root1 tests/root
+ rm -f tests/ini/inisar
+ rm -f tests/ini/*.o tests/ini/*.a tests/ini/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 prealloc.h
+ 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 cron/sysstat-summary.service cron/sysstat-summary.timer
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
rm -f man/cifsiostat.1
rm -f *.log config.status
rm -rf autom4te.cache
rm -f configure
dist: almost-distclean
- cd .. && (tar --exclude=Makefile --exclude=.git --dereference -cvf - sysstat-$(VERSION) | gzip -v9 > sysstat-$(VERSION).tar.gz)
+ cd .. && (tar --exclude=Makefile --exclude=.git -cvf - sysstat-$(VERSION) | gzip -v9 > sysstat-$(VERSION).tar.gz)
bdist: almost-distclean
- cd .. && (tar --exclude=Makefile --exclude=.git --dereference -cvf - sysstat-$(VERSION) | bzip2 > sysstat-$(VERSION).tar.bz2)
+ cd .. && (tar --exclude=Makefile --exclude=.git -cvf - sysstat-$(VERSION) | bzip2 > sysstat-$(VERSION).tar.bz2)
xdist: almost-distclean
- cd .. && (tar --exclude=Makefile --exclude=.git --dereference -cvf - sysstat-$(VERSION) | xz > sysstat-$(VERSION).tar.xz)
+ cd .. && (tar --exclude=Makefile --exclude=.git -cvf - sysstat-$(VERSION) | xz > sysstat-$(VERSION).tar.xz)
gitdist: almost-distclean
- cd .. && (tar --exclude=Makefile --dereference -cvf - sysstat-$(VERSION) | bzip2 > sysstat-$(VERSION)-git.tar.bz2)
+ cd .. && (tar --exclude=Makefile -cvf - sysstat-$(VERSION) | bzip2 > sysstat-$(VERSION)-git.tar.bz2)
tags:
etags ./*.[hc]