summaryrefslogtreecommitdiff
path: root/src/pmns/GNUmakefile
blob: 32ebe34155b064a494aa6e9ce4e4604165ba6372 (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
#
# Copyright (c) 2000-2001 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
-include ./GNUlocaldefs

PMNS_VAR_DIR = $(PCP_VAR_DIR)/pmns
PMNS_BIN_DIR = $(PCP_BINADM_DIR)
PMNS_LIB_DIR = $(PCP_SHARE_DIR)/lib

# Take control here ... do not need to search in libpcp_pmda directory
# for libpcp_pmda DSO, and it is not even built yet for a virgin make.
#
PCPLIB_LDFLAGS = -L$(TOPDIR)/src/libpcp/src

CFILES  = pmnsmerge.c pmnsutil.c pmnsdel.c
HFILES  = pmnsutil.h
TARGETS = pmnsmerge$(EXECSUFFIX) pmnsdel$(EXECSUFFIX)
SCRIPTS = pmnsadd
LOCKERS	= lockpmns unlockpmns
STDPMID = stdpmid.pcp stdpmid.local

LSRCFILES = Make.stdpmid GNUmakefile.install Rebuild ReplacePmnsSubtree \
	    $(STDPMID) $(SCRIPTS) $(LOCKERS)

LLDLIBS = $(PCPLIB)
LDIRT	= *.log *.pmns stdpmid .NeedRebuild build.script $(TARGETS)

default:	$(SCRIPTS) $(LOCKERS) $(TARGETS) \
		GNUmakefile.install .NeedRebuild Rebuild ReplacePmnsSubtree stdpmid

include $(BUILDRULES)

pmnsmerge$(EXECSUFFIX):      pmnsmerge.o pmnsutil.o
	$(CCF) -o $@ $(LDFLAGS) pmnsmerge.o pmnsutil.o $(LDLIBS)

pmnsdel$(EXECSUFFIX):        pmnsdel.o pmnsutil.o
	$(CCF) -o $@ $(LDFLAGS) pmnsdel.o pmnsutil.o $(LDLIBS)

.NeedRebuild:
	echo "This file flags the rc scripts to rebuild the PMNS" > .NeedRebuild

# All PMNS config stuff goes in $PCP_VAR_DIR/pmns
# For platforms that want it, the .NeedRebuild hook is added there,
# else a manual touch(1) here is as close as it gets unfortunately.
#
install:	default
	$(INSTALL) -m 755 $(TARGETS) $(SCRIPTS) $(PMNS_BIN_DIR)
	$(INSTALL) -m 755 $(LOCKERS) ReplacePmnsSubtree $(PMNS_LIB_DIR)
	$(INSTALL) -m 644 GNUmakefile.install $(PMNS_VAR_DIR)/Makefile
	$(INSTALL) -m 755 Rebuild $(PMNS_VAR_DIR)/Rebuild
	$(INSTALL) -m 755 Make.stdpmid $(PMNS_VAR_DIR)/Make.stdpmid
	$(INSTALL) -m 644 $(STDPMID) $(PMNS_VAR_DIR)
ifeq (, $(filter redhat debian, $(PACKAGE_DISTRIBUTION)))
	$(INSTALL) -m 644 .NeedRebuild $(PMNS_VAR_DIR)/.NeedRebuild
endif

stdpmid:	$(STDPMID)
	rm -f build.script
	$(AWK) <Make.stdpmid >build.script '\
/^. \$$PCP_DIR/	{ print "PCP_CONF=../include/pcp.conf"; print ". ../include/pcp.env"; next }\
		{ print }'
	sh ./build.script

default_pcp:	default

install_pcp:	install