📄 makefile
字号:
# Makefile to build sysstat commands# (C) 1999-2006 Sebastien GODARD (sysstat <at> wanadoo.fr)# VersionVERSION = 6.1.2include build/CONFIG# Compiler to useCC = gcc# Other commandsSED = sedCHMOD = chmodCHOWN = chown# Full path to prevent from using aliasesCP = /bin/cp# Directoriesifndef PREFIXPREFIX = /usrendififndef SA_LIB_DIRSA_LIB_DIR = /usr/lib/saendifDESTDIR = $(RPM_BUILD_ROOT)BIN_DIR = $(PREFIX)/binifndef MAN_DIR# Don't use $(PREFIX)/share/man by default: not necessarily in man path!MAN_DIR = $(PREFIX)/manendifMAN1_DIR = $(MAN_DIR)/man1MAN8_DIR = $(MAN_DIR)/man8DOC_DIR = $(PREFIX)/doc/sysstat-$(VERSION)NLS_DIR = $(PREFIX)/share/localeSYSCONFIG_DIR = /etc/sysconfig# Compiler flagsCFLAGS = -Wall -Wstrict-prototypes -pipe -O2 -fno-strength-reduceLFLAGS = -sSAS_DFLAGS += -DSA_DIR=\"$(SA_DIR)\" -DSADC_PATH=\"$(SADC_PATH)\"# NLS (National Language Support)# Package namePACKAGE = sysstat# The msgfmt commandMSGFMT = msgfmtifndef IGNORE_MAN_GROUPMANGRPARG = -g $(MAN_GROUP)elseMANGRPARG =endif# Run-command directoriesifndef RC_DIRRC_DIR = /etc/rc.dendifRC2_DIR = $(RC_DIR)/rc2.dRC3_DIR = $(RC_DIR)/rc3.dRC5_DIR = $(RC_DIR)/rc5.difndef INIT_DIRINIT_DIR = /etc/rc.d/init.dendififndef INITD_DIRINITD_DIR = init.dendif.SUFFIXES: .po .gmo%.gmo: %.po $(MSGFMT) -o $@ $<%.o: %.c $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $<% : %.o $(CC) -o $@ $(CFLAGS) $^ $(LFLAGS)all: sa1 sa2 crontab sysstat sysstat.sysconfig sysstat.crond \ sysstat.cron.daily sysstat.cron.hourly sysstat.crond.sample \ sadc sar sadf iostat mpstat localescommon.o: common.c version.h common.h ioconf.hsa_common.o: sa_common.c sa.h common.h ioconf.hioconf.o: ioconf.c ioconf.hlibsyscom.a: libsyscom.a(common.o) libsyscom.a(ioconf.o)libsyssa.a: libsyssa.a(sa_common.o)version.h: version.in $(SED) s+VERSION_NUMBER+$(VERSION)+g $< > $@sadc.o: sadc.c sa.h common.h ioconf.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $(SAS_DFLAGS) $<sadc: sadc.o libsyscom.a libsyssa.a $(CC) -o $@ $(CFLAGS) $^ $(LFLAGS)sar.o: sar.c sa.h common.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $(SAS_DFLAGS) $<sar: sar.o libsyscom.a libsyssa.asadf.o: sadf.c sadf.h sa.h common.h $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $(SAS_DFLAGS) $<sadf: sadf.o libsyscom.a libsyssa.aiostat.o: iostat.c iostat.h common.h ioconf.hiostat: iostat.o libsyscom.ampstat.o: mpstat.c mpstat.h common.hmpstat: mpstat.o libsyscom.asa1: sa1.in $(SED) s+SA_LIB_DIR+$(SA_LIB_DIR)+g $< > $@ $(CHMOD) 755 $@sa2: sa2.in $(SED) -e s+BIN_DIR+$(BIN_DIR)+g -e s+SA_DIR+$(SA_DIR)+g \ -e s+SA_LIB_DIR+$(SA_LIB_DIR)+g \ -e s+YESTERDAY+$(YESTERDAY)+g $< > $@ $(CHMOD) 755 $@sysstat.sysconfig: sysstat.sysconfig.in $(SED) s+CONFIG_HISTORY+$(HISTORY)+g $< > $@sysstat: sysstat.inifeq ($(INSTALL_CRON),y)ifeq ($(CRON_OWNER),root) $(SED) -e 's+SU ++g' -e s+SA_LIB_DIR/+$(SA_LIB_DIR)/+g \ -e 's+ QUOTE++g' -e s+INIT_DIR/+$(INIT_DIR)/+g $< > $@else $(SED) -e 's+SU SA_LIB_DIR/+su $(CRON_OWNER) -c "$(SA_LIB_DIR)/+g' \ -e 's+ QUOTE+"+g' -e s+INIT_DIR/+$(INIT_DIR)/+g $< > $@endifelse $(SED) -e 's+SU ++g' -e s+SA_LIB_DIR/+$(SA_LIB_DIR)/+g \ -e 's+ QUOTE++g' -e s+INIT_DIR/+$(INIT_DIR)/+g $< > $@endif $(CHMOD) 755 $@ crontab: crontab.sample $(SED) s+SA_LIB_DIR/+$(SA_LIB_DIR)/+g $< > $@sysstat.crond: sysstat.crond.in $(SED) -e s+USER+$(CRON_OWNER)+g \ -e s+SA_LIB_DIR/+$(SA_LIB_DIR)/+g $< > $@sysstat.crond.sample: sysstat.crond.in $(SED) -e s+USER+$(CRON_OWNER)+g \ -e s+SA_LIB_DIR/+$(SA_LIB_DIR)/+g \ -e s/^/#/ $< > $@sysstat.cron.daily: sysstat.cron.daily.in $(SED) s+SA_LIB_DIR/+$(SA_LIB_DIR)/+g $< > $@sysstat.cron.hourly: sysstat.cron.hourly.in $(SED) s+SA_LIB_DIR/+$(SA_LIB_DIR)/+g $< > $@ifdef REQUIRE_NLSlocales: nls/af.gmo nls/de.gmo nls/es.gmo nls/fr.gmo nls/it.gmo nls/ja.gmo nls/nb.gmo nls/nn.gmo nls/pl.gmo nls/pt.gmo nls/ro.gmo nls/ru.gmo nls/sk.gmoelselocales:endif# Phony targets.PHONY: clean distclean config install install_base install_all uninstall \ uninstall_base uninstall_all dist bdistinstall_base: all man/sadc.8 man/sar.1 man/sadf.1 man/sa1.8 man/sa2.8 man/iostat.1 mkdir -p $(DESTDIR)$(SA_LIB_DIR) mkdir -p $(DESTDIR)$(MAN1_DIR) mkdir -p $(DESTDIR)$(MAN8_DIR) mkdir -p $(DESTDIR)$(SA_DIR)ifeq ($(CLEAN_SA_DIR),y) rm -f $(DESTDIR)$(SA_DIR)/sa??endif mkdir -p $(DESTDIR)$(BIN_DIR) mkdir -p $(DESTDIR)$(DOC_DIR) mkdir -p $(DESTDIR)$(SYSCONFIG_DIR) install -m 755 sa1 $(DESTDIR)$(SA_LIB_DIR) install -m 644 $(MANGRPARG) man/sa1.8 $(DESTDIR)$(MAN8_DIR) install -m 755 sa2 $(DESTDIR)$(SA_LIB_DIR) install -m 644 $(MANGRPARG) man/sa2.8 $(DESTDIR)$(MAN8_DIR) install -m 755 sadc $(DESTDIR)$(SA_LIB_DIR) install -m 644 $(MANGRPARG) man/sadc.8 $(DESTDIR)$(MAN8_DIR) install -m 755 sar $(DESTDIR)$(BIN_DIR) install -m 644 $(MANGRPARG) man/sar.1 $(DESTDIR)$(MAN1_DIR) install -m 755 sadf $(DESTDIR)$(BIN_DIR) install -m 644 $(MANGRPARG) man/sadf.1 $(DESTDIR)$(MAN1_DIR) install -m 755 iostat $(DESTDIR)$(BIN_DIR) install -m 644 $(MANGRPARG) man/iostat.1 $(DESTDIR)$(MAN1_DIR) install -m 755 mpstat $(DESTDIR)$(BIN_DIR) install -m 644 $(MANGRPARG) man/mpstat.1 $(DESTDIR)$(MAN1_DIR) install -m 644 sysstat.ioconf $(DESTDIR)$(SYSCONFIG_DIR); install -m 644 CHANGES $(DESTDIR)$(DOC_DIR) install -m 644 COPYING $(DESTDIR)$(DOC_DIR) install -m 644 CREDITS $(DESTDIR)$(DOC_DIR) install -m 644 README $(DESTDIR)$(DOC_DIR) install -m 644 FAQ $(DESTDIR)$(DOC_DIR) install -m 644 *.lsm $(DESTDIR)$(DOC_DIR)ifdef REQUIRE_NLS mkdir -p $(DESTDIR)$(NLS_DIR)/af/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/de/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/es/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/fr/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/it/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/ja/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/nb/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/nn/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/pl/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/pt/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/ro/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/ru/LC_MESSAGES mkdir -p $(DESTDIR)$(NLS_DIR)/sk/LC_MESSAGES install -m 644 nls/af.gmo $(DESTDIR)$(NLS_DIR)/af/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/de.gmo $(DESTDIR)$(NLS_DIR)/de/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/es.gmo $(DESTDIR)$(NLS_DIR)/es/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/fr.gmo $(DESTDIR)$(NLS_DIR)/fr/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/it.gmo $(DESTDIR)$(NLS_DIR)/it/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/ja.gmo $(DESTDIR)$(NLS_DIR)/ja/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/nb.gmo $(DESTDIR)$(NLS_DIR)/nb/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/nn.gmo $(DESTDIR)$(NLS_DIR)/nn/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/pl.gmo $(DESTDIR)$(NLS_DIR)/pl/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/pt.gmo $(DESTDIR)$(NLS_DIR)/pt/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/ro.gmo $(DESTDIR)$(NLS_DIR)/ro/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/ru.gmo $(DESTDIR)$(NLS_DIR)/ru/LC_MESSAGES/$(PACKAGE).mo install -m 644 nls/sk.gmo $(DESTDIR)$(NLS_DIR)/sk/LC_MESSAGES/$(PACKAGE).moendifinstall_all: install_base $(CHOWN) $(CRON_OWNER) $(DESTDIR)$(SA_DIR) if [ -d $(DESTDIR)/etc/cron.d ]; then \ install -m 644 sysstat.crond $(DESTDIR)/etc/cron.d/sysstat; \ elif [ -d $(DESTDIR)/etc/cron.hourly -a -d $(DESTDIR)/etc/cron.daily ]; then \ install -m 755 sysstat.cron.hourly $(DESTDIR)/etc/cron.hourly/sysstat; \ install -m 755 sysstat.cron.daily $(DESTDIR)/etc/cron.daily/sysstat; \ else \ 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 PREVIOUS CRONTAB SAVED IN CURRENT DIRECTORY (USING .save SUFFIX)."; \ su $(CRON_OWNER) -c "crontab crontab"; \ fi if [ -d $(DESTDIR)$(INIT_DIR) ]; then \ install -m 755 sysstat $(DESTDIR)$(INIT_DIR)/sysstat; \ cd $(DESTDIR)$(RC2_DIR) && ln -sf ../$(INITD_DIR)/sysstat S03sysstat; \ cd $(DESTDIR)$(RC3_DIR) && ln -sf ../$(INITD_DIR)/sysstat S03sysstat; \ cd $(DESTDIR)$(RC5_DIR) && ln -sf ../$(INITD_DIR)/sysstat S03sysstat; \ elif [ -d $(DESTDIR)$(RC_DIR) ]; then \ install -m 755 sysstat $(DESTDIR)$(RC_DIR)/rc.sysstat; \ [ -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 -sf ../rc.sysstat S03sysstat; \ cd $(DESTDIR)$(RC3_DIR) && ln -sf ../rc.sysstat S03sysstat; \ cd $(DESTDIR)$(RC5_DIR) && ln -sf ../rc.sysstat S03sysstat; \ fi install -m 644 sysstat.sysconfig $(DESTDIR)$(SYSCONFIG_DIR)/sysstatuninstall_base: rm -f $(DESTDIR)$(SA_LIB_DIR)/sadc rm -f $(DESTDIR)$(MAN8_DIR)/sadc.8 rm -f $(DESTDIR)$(SA_LIB_DIR)/sa1 rm -f $(DESTDIR)$(MAN8_DIR)/sa1.8 rm -f $(DESTDIR)$(SA_LIB_DIR)/sa2 rm -f $(DESTDIR)$(MAN8_DIR)/sa2.8 rm -f $(DESTDIR)$(BIN_DIR)/sar rm -f $(DESTDIR)$(MAN1_DIR)/sar.1 rm -f $(DESTDIR)$(BIN_DIR)/sadf rm -f $(DESTDIR)$(MAN1_DIR)/sadf.1 rm -f $(DESTDIR)$(BIN_DIR)/iostat rm -f $(DESTDIR)$(MAN1_DIR)/iostat.1 rm -f $(DESTDIR)$(BIN_DIR)/mpstat rm -f $(DESTDIR)$(MAN1_DIR)/mpstat.1 -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(SA_LIB_DIR) -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(SA_DIR)# No need to keep sysstat script, config file 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)/sysstat rm -f $(DESTDIR)$(SYSCONFIG_DIR)/sysstat.ioconf rm -f $(DESTDIR)$(RC2_DIR)/S03sysstat rm -f $(DESTDIR)$(RC3_DIR)/S03sysstat rm -f $(DESTDIR)$(RC5_DIR)/S03sysstat# 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# Remove locale files rm -f $(DESTDIR)$(PREFIX)/share/locale/af/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/de/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/es/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/fr/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/it/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/ja/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/nb/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/nn/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/pl/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/pt/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/ro/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/ru/LC_MESSAGES/$(PACKAGE).mo rm -f $(DESTDIR)$(PREFIX)/share/locale/sk/LC_MESSAGES/$(PACKAGE).mo -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/af/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/de/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/es/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/fr/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/it/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/ja/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/nb/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/nn/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/pl/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/pt/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/ro/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/ru/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/sk/LC_MESSAGES -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/af -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/de -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/es -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/fr -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/it -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/ja -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/nb -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/nn -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/pl -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/pt -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/ro -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/ru -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/locale/sk rm -f $(DESTDIR)$(DOC_DIR)/* -rmdir $(DESTDIR)$(DOC_DIR) @echo "Please ignore the errors above, if any."# NB: Leading minus sign tells make to ignore errors...uninstall_all: uninstall_base -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 CRONTAB SAVED IN CURRENT DIRECTORY (WITH .old SUFFIX)." -su $(CRON_OWNER) -c "crontab -r"ifeq ($(INSTALL_CRON),y)uninstall: uninstall_allelseuninstall: uninstall_baseendififeq ($(INSTALL_CRON),y)install: install_allelseinstall: install_baseendifclean: rm -f sadc sa1 sa2 sysstat sar sadf iostat mpstat *.o *.a core TAGS crontab rm -f version.h sysstat.sysconfig sysstat.crond sysstat.cron.daily rm -f sysstat.cron.hourly sysstat.crond.sample find nls -name "*.gmo" -exec rm -f {} \;distclean: clean $(CP) build/CONFIG.def build/CONFIG rm -f *.save *.old .*.swp data find . -name "*~" -exec rm -f {} \;dist: distclean cd .. && (tar -cvf - sysstat-$(VERSION) | gzip -v9 > sysstat-$(VERSION).tar.gz)bdist: distclean cd .. && (tar -cvf - sysstat-$(VERSION) | bzip2 > sysstat-$(VERSION).tar.bz2)config: clean @sh build/Configure.shtags: etags ./*.[hc]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -