summaryrefslogtreecommitdiff
path: root/src/pmieconf/GNUmakefile
blob: 9f9c63966197ed102ad659dffb289bcda60fde09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 
# Copyright (c) 2013 Red Hat.
# Copyright (c) 2000,2004 Silicon Graphics, Inc.  All Rights Reserved.
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#

TOPDIR = ../..
include	$(TOPDIR)/src/include/builddefs

MKFILE_SUBDIRS = cpu filesys memory percpu pernetif global

SUBDIRS	= $(MKFILE_SUBDIRS)

CMDTARGET = pmieconf$(EXECSUFFIX)
CFILES = pmieconf.c rules.c io.c
HFILES = rules.h

PMLOGCONF_TOOLS = $(PCP_VAR_DIR)/config/pmlogconf/tools

LSRCFILES = GNUmakefile.rules check-rules pmie_email xtractnames $(RFILES)

LLDLIBS = $(PCPLIB)
LCFLAGS = -I$(TOPDIR)/src/pmie/src
LDIRT = local $(CMDTARGET) rate-syscalls \
	pmlogconf.tmp pmlogconf \
	cpu/GNUmakefile filesys/GNUmakefile memory/GNUmakefile \
	percpu/GNUmakefile pernetif/GNUmakefile
LDIRDIRT = rules .pcp

default: $(CMDTARGET) makefiles local pmlogconf

# for src-link-pcp target from buildrules
$(SUBDIRS):	makefiles

$(CMDTARGET): $(OBJECTS)

pmieconf.o rules.o:    rules.h

.NOTPARALLEL:
makefiles:
	@for d in $(MKFILE_SUBDIRS); do \
	    rm -f $$d/GNUmakefile; \
	    cd $$d; \
	    $(LN_S) ../GNUmakefile.rules GNUmakefile; \
	    cd ..; \
	done

local: $(SUBDIRS)
	@rm -fr rules; mkdir rules
	$(SUBDIRS_MAKERULE)
	$(RUN_IN_BUILD_ENV) ./$(CMDTARGET) -F -r rules -f local

pmlogconf: $(SUBDIRS)
	@rm -f pmlogconf
	@echo "#pmlogconf-setup 2.0" >pmlogconf
	@echo "ident	metrics used by pmie(1) rules from the pmieconf(1) command" >>pmlogconf
	@echo "force	available" >>pmlogconf
	$(SUBDIRS_MAKERULE) | grep -v '===' >pmlogconf.tmp
	@$(PCP_SORT_PROG) -u pmlogconf.tmp | sed -e 's/^/	/' >>pmlogconf

install: default $(SUBDIRS)
	$(SUBDIRS_MAKERULE)
	$(INSTALL) -m 755 $(CMDTARGET) $(PCP_BIN_DIR)/$(CMDTARGET)
	$(INSTALL) -m 755 pmie_email $(PCP_BINADM_DIR)/pmie_email
	$(INSTALL) -m 644 pmlogconf $(PMLOGCONF_TOOLS)/pmieconf

include $(BUILDRULES)

default_pcp: default

install_pcp: install