This file is indexed.

/usr/include/pcp/builddefs is in pcp-conf 3.9.10.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
#
# Copyright (c) 2012-2014 Red Hat.
# Copyright (c) 2008 Aconex.  All Rights Reserved.
# Copyright (c) 2000,2003,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.
# 

# Common gmake macros for building
#
# src/include/builddefs.  Generated from builddefs.in by configure.
#
ifndef _BUILDDEFS_INCLUDED_
_BUILDDEFS_INCLUDED_ = 1

ifndef _PCP_CONF_INCLUDED_
_PCP_CONF_INCLUDED_ = 1
include $(PCP_DIR)/etc/pcp.conf
endif

# General package information
PACKAGE_VERSION ?= 3.9.10
PACKAGE_MAJOR ?= 3
PACKAGE_MINOR ?= 9
PACKAGE_REVISION ?= 10
PACKAGE_BUILD ?= 1
PACKAGE_NAME ?= pcp
PACKAGE_CONFIGURE ?=  --with-systemd=no
PACKAGE_DISTRIBUTION ?= debian
SGI_CHROOT_BUILD ?= 0
SGI_ISSP_BUILD ?= 0

BUILDRULES = $(PCP_INC_DIR)/buildrules

# LCFLAGS, LLDFLAGS, LLDLIBS, LDIRT may be specified in local makefiles.

# turn on all warnings by default
ifeq "yes" "yes"
WARN_OFF = -Wall
else
WARN_OFF =
endif

LIBPCP_ABIDIR ?= src
PCPLIB_LDFLAGS = -L$(TOPDIR)/src/libpcp/$(LIBPCP_ABIDIR) \
		 -L$(TOPDIR)/src/libpcp_pmda/$(LIBPCP_ABIDIR)
# backward compatibility
PCP_LIBS = $(PCPLIB_LDFLAGS)

# platform-specific CFLAGS, LDLIBS, and shared library extension
#
# Note:
# 	Need PCFLAGS setting here to match the CFLAGS settings in
# 	../../configure.ac (likewise for PLDFLAGS and LDFLAGS).
#
TARGET_OS = linux
PCFLAGS = -fPIC -fno-strict-aliasing -D_GNU_SOURCE -fstack-protector-all -D_FORTIFY_SOURCE=2
PLDFLAGS = 
ifneq (, $(filter linux kfreebsd gnu, $(TARGET_OS)))
DSOSUFFIX = so
endif
ifeq "$(TARGET_OS)" "darwin"
DSOSUFFIX = dylib
CASE_INSENSITIVE_FS=1
endif
ifeq "$(TARGET_OS)" "mingw"
DSOSUFFIX = dll
EXECSUFFIX = .exe
SHELLSUFFIX = .sh
PLDLIBS = -lwsock32
endif
ifeq "$(TARGET_OS)" "solaris"
PLDFLAGS += -fPIC
PLDLIBS = -lnsl -lsocket -lresolv -ldl -lposix4
DSOSUFFIX = so
endif
ifeq "$(TARGET_OS)" "aix"
DSOSUFFIX = so
# -qcpluscmt
#	allow C++-style // as comment preamble
# -brtl
#       use run-time linker
# -bnoipath
#       do not use path to DSOs from the build, use default search path
#       rules
# (and does not accept -Wall as a valid option)
PLDFLAGS += -brtl -bnoipath
WARN_OFF =
endif
ifeq "$(TARGET_OS)" "freebsd"
DSOSUFFIX = so
endif
ifeq "$(TARGET_OS)" "netbsd"
DSOSUFFIX = so
endif

CFLAGS_ABI = 
CFLAGS_OPT = -O2 -g
CFLAGS += $(PCFLAGS) $(LCFLAGS) $(WARN_OFF) $(CFLAGS_OPT) \
	-DPCP_DEBUG -DPCP_VERSION=\"$(PCP_VERSION)\" \
	-I$(TOPDIR)/src/include -I$(TOPDIR)/src/include/pcp

PIECFLAGS = -fPIE
PIELDFLAGS = -pie -Wl,-z,relro -Wl,-z,now
INVISIBILITY = -fvisibility=hidden	# hide shared library symbols

NSSCFLAGS = -I/usr/include/nss
NSPRCFLAGS = -I/usr/include/nspr
SASLCFLAGS = -I/usr/include/sasl
AVAHICFLAGS = 

LDFLAGS += $(PLDFLAGS) $(WARN_OFF) $(PCP_LIBS) $(LLDFLAGS)

SRCFILES = GNUmakefile $(HFILES) $(CFILES) $(CXXFILES) $(MFILES) \
	$(LSRCFILES) $(LFILES) $(YFILES) $(PYFILES)

LDLIBS = $(LLDLIBS) $(PLDLIBS)
MAKEOPTS = --no-print-directory

ifdef PROJECT
QTDIRDIRT = build debug release .obj .ui .moc .qrc *.xcodeproj *.app
QTDIRT = *.a *.o ui_* moc_* qrc_* Info.plist Makefile* object_script.*
endif
DEPDIRT = dep dep.bak
MANDIRT = *.[1-9].gz *.[1-9].bz2 *.[1-9].lzma *.[1-9].xz *.[1-9].tmp
LIBDIRT = $(LIBTARGET) $(STATICLIBTARGET)
CDIRT = $(OBJECTS) $(CMDTARGET) $(CXXMDTARGET)
DIRT = $(LDIRT) $(DEPDIRT) $(MANDIRT) $(QTDIRT) $(CDIRT) $(LIBDIRT)
DIRDIRT = $(LDIRDIRT) $(QTDIRDIRT)

OBJECTS = $(ASFILES:.s=.o) \
          $(CFILES:.c=.o) \
          $(CXXFILES:.cxx=.o) \
          $(FFILES:.f=.o) \
          $(LFILES:.l=.o) \
          $(YFILES:%.y=%.tab.o)

#NB: don't override $(MAKE); gnumake sets it well, propagating -j etc.
#MAKE	= /usr/bin/make
CC	= gcc
CXX	= g++
LD	= /usr/bin/ld
AWK	= /usr/bin/gawk --posix
SED	= /bin/sed
CPP	= gcc -E
LEX	= flex
YACC	= bison -y
ECHO	= /bin/echo
LN_S	= ln -s
GREP    = grep
GIT	= 
PYTHON	= python
DTRACE  = 
QMAKE	= /usr/bin/qmake-qt4

INSTALL_SH = $(PCP_BINADM_DIR)/install-sh
INSTALL	= $(INSTALL_SH) -o $(PCP_USER_INSTALL) -g $(PCP_GROUP_INSTALL)

CCF	= $(CC) $(CFLAGS)
CXXF	= $(CXX) $(CFLAGS) $(CXXFLAGS)
# NB: don't use $(MAKEF), since that suppresses gnumake's subdir parallelization
#MAKEF	= $(MAKE) $(MAKEOPTS)
LDF	= $(LD) $(LDFLAGS)
MAKEDEPEND = /bin/true

ifeq "$(TARGET_OS)" "freebsd"
# gmake on FreeBSD has a strange default rule that passes insufficient
# flags to cc/ld for the link step.  This change prevents errors like
# undefined reference to `__stack_chk_fail_local'
#
LDFLAGS += $(CFLAGS)
endif

ZIP	= /bin/gzip
BZIP2	= /bin/bzip2
LZMA	= /usr/bin/lzma
XZ	= /usr/bin/xz
TAR	= /bin/tar
RPMPROG	= 
PACKAGE_MAKER = 
HDIUTIL = 
MKINSTALLP = 
DLLTOOL = 
RPMBUILD= 
RPM	= 
POD2MAN = /usr/bin/pod2man
DPKG	= 
MAKEPKG	= 
GENPMDA = $(PCP_BIN_DIR)/genpmda
PKGMK	= 
MD5SUM	= /usr/bin/md5sum
XMLTO	= 
DBLATEX	= 
PUBLICAN = 
BOOK_TOOLCHAIN = 

HAVE_GZIPPED_MANPAGES = true
HAVE_BZIP2ED_MANPAGES = false
HAVE_LZMAED_MANPAGES = false
HAVE_XZED_MANPAGES = false
PCP_MAN_DIR = /usr/share/man
PCP_BOOKS_DIR = /usr/share/doc/pcp-doc
PCP_ICONS_DIR = /usr/share/pcp-gui/pixmaps
PCP_DESKTOP_DIR = /usr/share/applications

NEED_OLD_TBL_HEADER = true
RDYNAMIC_FLAG = -rdynamic
QT_RELEASE = release

ENABLE_SHARED = 
ENABLE_SECURE = true
ENABLE_PROBES = false
ENABLE_AVAHI = false
ENABLE_QT = true
ENABLE_SYSTEMD = false
ENABLE_PAPI = 

# additional libraries needed for particular functions
LIB_FOR_BASENAME = 
LIB_FOR_DLOPEN = -ldl
LIB_FOR_REGEX = 
LIB_FOR_MATH = -lm
LIB_FOR_READLINE = -lreadline
LIB_FOR_CURSES = 
LIB_FOR_PTHREADS = -lpthread
LIB_FOR_RT = 
LIB_FOR_NSS = -lnss3
LIB_FOR_NSPR = -lnspr4
LIB_FOR_SASL = -lsasl2
LIB_FOR_SSL = -lssl3
LIB_FOR_AVAHI = 
LIB_FOR_ATOMIC = -latomic

HAVE_LIBMICROHTTPD = 1
HAVE_RPMLIB = 0

SHELL = /bin/sh
IMAGES_DIR = $(TOPDIR)/all-images
DIST_DIR = $(TOPDIR)/dist

# env vars to be set before you can run a PCP binary in the build
# environment ... needed for tools like newhelp
#
# default, then special case for different platforms
#
RUN_IN_BUILD_ENV = PCP_CONF=$(TOPDIR)/src/include/pcp.conf LD_LIBRARY_PATH=$(TOPDIR)/src/libpcp/src:$(TOPDIR)/src/libpcp_pmda/src:$$LD_LIBRARY_PATH HOME=`pwd` PCP_ALT_CPP=$(TOPDIR)/src/pmcpp/pmcpp
ifeq "$(TARGET_OS)" "darwin"
RUN_IN_BUILD_ENV = PCP_CONF=$(TOPDIR)/src/include/pcp.conf DYLD_LIBRARY_PATH=$(TOPDIR)/src/libpcp/src:$(TOPDIR)/src/libpcp_pmda/src:$$DYLD_LIBRARY_PATH HOME=`pwd` PCP_ALT_CPP=$(TOPDIR)/src/pmcpp/pmcpp
endif
ifeq "$(TARGET_OS)" "aix"
RUN_IN_BUILD_ENV = PCP_CONF=$(TOPDIR)/src/include/pcp.conf LIBPATH=$(TOPDIR)/src/libpcp/src:$(TOPDIR)/src/libpcp_pmda/src:$$LIBPATH HOME=`pwd` PCP_ALT_CPP=$(TOPDIR)/src/pmcpp/pmcpp
endif
ifeq "$(TARGET_OS)" "mingw"
RUN_IN_BUILD_ENV = PCP_CONF=$(TOPDIR)/src/include/pcp.conf PATH=$(TOPDIR)/src/libpcp/src:$(TOPDIR)/src/libpcp_pmda/src:$$PATH USERPROFILE=`pwd` PCP_ALT_CPP=`pwd`/$(TOPDIR)/src/pmcpp/pmcpp
endif

SUBDIRS_MAKERULE = \
	+for d in `echo $^ `; do \
	    if test -d "$$d" -a -f "$$d/GNUmakefile"; then \
		$(ECHO) === $$d ===; \
		$(MAKE) $(MAKEOPTS) -C $$d $@ || exit $$?; \
	    fi; \
	done

# prepare symbols file for the GNU toolchain (linker) for DSO PMDAs
VERSION_SCRIPT_MAKERULE = \
	@rm -f $@; \
	echo "{" >$@; \
	echo "    global: $(PMDAINIT);" >>$@; \
	echo "    local: *;" >>$@; \
	echo "};" >>$@; \

# prepare domain.h used during the PMDA build process for each PMDA
DOMAIN_MAKERULE = \
	@rm -f $@; \
	echo "/*" >$@; \
	echo " * built from $<" >>$@; \
	echo " */" >>$@; \
	$(AWK) <$< '\
	    $$1=="\#define" && $$2 == "$(DOMAIN)" {\
		print "\#define $(DOMAIN) " $$3 >>"$@"; found++ \
	    }\
	    END {\
		if (found == 0) { \
		    print "Botch: no define for domain $(DOMAIN) in $<"; \
		    system("rm '$@'"); \
		    exit(1) \
		}\
		if (found > 1) { \
		    print "Botch: multiple defines for domain $(DOMAIN) in $<";\
		    print "... see $@ for details"; \
		    system("rm '$@'"); \
		    exit(1) \
		}\
        	exit(0) \
            }' || ( rm -f $@ && false )

DOMAIN_PERLRULE = \
	@export perldomain=`sed -n \
		-e '/PCP::PMDA->new/s/[^0-9]*$$//' \
		-e '/PCP::PMDA->new/s/^[^0-9]*//p' pmda$(IAM).pl`; \
	$(AWK) <$< '\
	    BEGIN {\
		domain = toupper("$(IAM)") \
	    }\
	    $$1=="\#define" && $$2 == domain { \
		pmd=$$3; found++ \
	    }\
	    END {\
		if (found == 0) {\
		    print "Botch: no define for domain " domain " in $<"; \
		    exit(1) \
		}\
	        if (found > 1) {\
		    print "Botch: multiple defines of domain " domain " in $<";\
		    exit(1) \
		}\
		if (pmd != "'"$$perldomain"'") {\
		    print "Botch: domain number in ../../pmns/stdpmid (" pmd ") does not match domain number in Perl source ("'"$$perldomain"'")"; \
		    exit(1) \
		}\
		exit(0) \
	    }'

DOMAIN_PYTHONRULE = \
	@export pythondomain=`sed -n \
		-e '/PMDA(/s/[^0-9]*$$//' \
		-e '/PMDA(/s/^[^0-9]*//p' $(PYSCRIPT)`; \
	$(AWK) <$< '\
	    BEGIN {\
		domain = toupper("$(IAM)") \
	    }\
	    $$1=="\#define" && $$2 == domain { \
		pmd=$$3; found++ \
	    }\
	    END {\
		if (found == 0) {\
		    print "Botch: no define for domain " domain " in $<"; \
		    exit(1) \
		}\
	        if (found > 1) {\
		    print "Botch: multiple defines of domain " domain " in $<";\
		    exit(1) \
		}\
		if (pmd != "'"$$pythondomain"'") {\
		    print "Botch: domain number in ../../pmns/stdpmid (" pmd ") does not match domain number in Python source ("'"$$pythondomain"'")"; \
		    exit(1) \
		}\
		exit(0) \
	    }'

POD_OPTIONS = --section=$(MAN_SECTION) --release=$(PCP_VERSION) \
		--center="Performance Co-Pilot" --date="Performance Co-Pilot"
POD_MAKERULE = $(POD2MAN) $(POD_OPTIONS) $^ $@

ifeq "$(TARGET_OS)" "mingw"
INSTALL_MAN =
else
INSTALL_MAN = \
    test -z "$$MAN_PAGES" && MAN_PAGES="$(MAN_PAGES)"; \
    for d in `echo $$MAN_PAGES`; do \
	first=true; \
	base=`echo $$d | sed -e 's/\.[0-9]//g'`; \
	$(AWK) <$$d ' \
BEGIN { state=0; print "'"$$base"'" } \
$$1==".ds" { ds["\\\\\\*\\("$$2] = $$3 } \
$$1==".SH" && $$2=="NAME" { state=1; next } \
$$1==".SH" && state==1	{ exit } \
/^\./ { next } \
state==1 { for (i=1;i<=NF;i++) { \
             if ($$i=="\\-" || $$i=="-") exit; \
	     gsub ("\\\\f3", "", $$i); gsub ("\\\\f1.*", "", $$i); \
	     for ( d in ds ) sub (d, ds[d], $$i); \
	     print $$i \
	   } \
	 }' \
	| LC_COLLATE=POSIX $(PCP_SORT_PROG) -u \
	| while read m; do \
	    [ -z "$$m" -o "$$m" = "\\" ] && continue; \
	    t=$(MAN_DEST)/$$m.$(MAN_SECTION); \
	    if $$first; then \
		_tfx= ;\
		if $(NEED_OLD_TBL_HEADER) ; then \
		    $(SED) -e "1s/^'\\\\\"! tbl.*/'\\\\\" t/" $$d > $$d.tmp; _tfx=.tmp; \
		fi; \
		if $(HAVE_GZIPPED_MANPAGES) ; then \
		    $(ZIP) -c $$d$$_tfx > $$d.gz; _tfx=.gz; _sfx=.gz; \
		fi; \
		if $(HAVE_BZIP2ED_MANPAGES) ; then \
		    $(BZIP2) -c $$d$$_tfx > $$d.bz2; _tfx=.bz2; _sfx=.bz2; \
		fi; \
		if $(HAVE_LZMAED_MANPAGES) ; then \
		    $(LZMA) -c $$d$$_tfx > $$d.lzma; _tfx=.lzma; _sfx=.lzma; \
		fi; \
		if $(HAVE_XZED_MANPAGES) ; then \
		    $(XZ) -c $$d$$_tfx > $$d.xz; _tfx=.xz; _sfx=.xz; \
		fi; \
		u=$$m.$(MAN_SECTION)$$_sfx; \
		echo $(INSTALL) -m 644 $${d}$$_tfx $${t}$$_sfx; \
		$(INSTALL) -m 644 $${d}$$_tfx $${t}$$_sfx; \
	    else \
		if test ! -z $(CASE_INSENSITIVE_FS) -a $(CASE_INSENSITIVE_FS); then \
		    if test "`echo $$u | tr 'a-z' 'A-Z'`" != "`basename $${t}$$_sfx | tr 'a-z' 'A-Z'`"; then \
			echo $(INSTALL) -S $$u $${t}$$_sfx; \
			$(INSTALL) -S $$u $${t}$$_sfx; \
		    fi \
		else \
		    echo $(INSTALL) -S $$u $${t}$$_sfx; \
		    $(INSTALL) -S $$u $${t}$$_sfx; \
		fi \
	    fi; \
	    first=false; \
	done; \
    done
endif

PERL_INSTALL_BASE = /usr
PERL_INSTALLDIRS = vendor

# MakeMaker INSTALL_BASE needs to be unset for proper vendor_perl paths to be used for --prefix=/usr;
ifeq "$(PERL_INSTALL_BASE)" "/usr"
ifneq "$(TARGET_OS)" "darwin"
MAKEMAKER_EXTRA_OPTIONS=
else
MAKEMAKER_EXTRA_OPTIONS=INSTALL_BASE=$(PERL_INSTALL_BASE)  INSTALLBASE=$(PERL_INSTALL_BASE)
endif
else
MAKEMAKER_EXTRA_OPTIONS=INSTALL_BASE=$(PERL_INSTALL_BASE)  INSTALLBASE=$(PERL_INSTALL_BASE)
endif

PERL_MAKE_MAKEFILE = \
	export PCP_TOPDIR=`cd $(TOPDIR) && pwd`; \
	NSS_CFLAGS="$(NSS_CFLAGS)" NSPR_CFLAGS="$(NSPR_CFLAGS)" \
        TARGET_OS="$(TARGET_OS)" CC="$(CC) $(CFLAGS_ABI)" perl Makefile.PL $(MAKEMAKER_EXTRA_OPTIONS) $(MAKEMAKER_OPTIONS)

# Collect files from a Perl "make -f Makefile install" below
# src/perl to build the PCP Perl packaging list, and also clean up
# the installed files to remove unwanted files and make the DSO
# executable
#
# Usage is $(call PERL_GET_FILELIST,listfile,base)
# where listfile is something like $(TOPDIR)/perl-pcp-pmda.list and
# base is the DSO basename like PMDA.
#
# We need different versions for the different installation and
# packaging regimes.
#
ifeq "$(PACKAGE_DISTRIBUTION)" "debian"
# For Debian packaging, this is not needed
PERL_GET_FILELIST =
else
ifeq "$(PACKAGE_DISTRIBUTION)" "gentoo"
# Gentoo cannot rely on the .packlist files from the install, so create
# a temporary pack.list file
PERL_GET_FILELIST = \
	$(PERLMAKE) -f Makefile install DESTDIR=$$DIST_ROOT \
	| tee pack.list; \
	sed -n -e '/\.bs$$/d' -e 's/\.[0-9]pm$$/&.gz/' -e "s@^Installing $$DIST_ROOT@@p" <pack.list >$(1) || exit 1; \
	if [ -s $(1) ]; then rm -f pack.list; \
	else echo "Arrgh ... no files to include in package via $(1), see pack.list"; exit 1; \
	fi; \
	find $$DIST_ROOT/$(PERL_INSTALL_BASE) -name perllocal.pod -exec rm -f '{}' ';' ; \
	find $$DIST_ROOT/$(PERL_INSTALL_BASE) -name \*.bs  -exec rm -f '{}' ';' ; \
	find $$DIST_ROOT/$(PERL_INSTALL_BASE) -name $(2).so -exec chmod 755 '{}' ';'
else
ifeq "$(PACKAGE_DISTRIBUTION)" "freebsd"
# FreeBSD Perl packaging is a broken mystery at this point in time
# 1. there is no .packlist files being created
# 2. $(PERLMAKE) -f Makefile install DESTDIR=$$DIST_ROOT does not work
# so disable the packaging pro tem
PERL_GET_FILELIST =
else
# Everyone else ... includes the RPM-based packaging platforms
ifeq "$(PACKAGE_DISTRIBUTION)" "mandriva"
	man_suffix=lzma
else
	man_suffix=gz
endif
PERL_GET_FILELIST = \
	$(PERLMAKE) -f Makefile install DESTDIR=$$DIST_ROOT; \
	find $$DIST_ROOT/$(PERL_INSTALL_BASE) -name .packlist -exec mv '{}' $(1) ';' ; \
	if [ -s $(1) ] ; then \
	    _sfx=.gz; \
	    $(HAVE_BZIP2ED_MANPAGES) && _sfx=.bz2; \
	    $(HAVE_LZMAED_MANPAGES) && _sfx=.lzma; \
	    $(HAVE_XZED_MANPAGES) && _sfx=.xz; \
	    sed -n -e '/\.bs$$/d' -e 's/\.[0-9]pm$$/&'"$$_sfx/" -e "s@^$$DIST_ROOT@@p" $(1) >$(1).tmp; \
	    mv $(1).tmp $1; \
	else echo "Arrgh ... no files to include in package via $(1)"; exit 1; \
	fi; \
	find $$DIST_ROOT/$(PERL_INSTALL_BASE) -name perllocal.pod -exec rm -f '{}' ';' ; \
	find $$DIST_ROOT/$(PERL_INSTALL_BASE) -name \*.bs  -exec rm -f '{}' ';' ; \
	find $$DIST_ROOT/$(PERL_INSTALL_BASE) -name $(2).so -exec chmod 755 '{}' ';'
endif
endif
endif

# Create perl manifest files explicitly for some distributions
ifeq "$(shell [ '$(PACKAGE_DISTRIBUTION)' = cocoa \
                -o '$(PACKAGE_DISTRIBUTION)' = macosx \
                -o '$(PACKAGE_DISTRIBUTION)' = gentoo \
                -o '$(PACKAGE_DISTRIBUTION)' = solaris \
                -o '$(PACKAGE_DISTRIBUTION)' = freebsd \
	      ] && echo 1)" "1"
# Gather installed Perl files before packaging
PERL_INSTALL = \
	if [ -n "$(DIST_MANIFEST)" ]; then \
	    if [ "`echo $(TOPDIR)/perl-pcp-*.list`" != "$(TOPDIR)/perl-pcp-*.list" ]; then \
		cat $(TOPDIR)/perl-pcp-*.list | while read f; do \
		    bn=`basename $$f .gz`; \
		    dn=`dirname $$f`; \
		    $(INSTALL) -d $$dn || exit 1; \
		    src=`find */blib -name $$bn`; \
		    if [ -x $$src ] ; then mode=0755; else mode=0644; fi; \
		    $(INSTALL) -m $$mode $$src $$dn/$$bn || exit 1; \
		done; \
	    fi; \
	fi
else
PERL_INSTALL =
endif

SYSTEMD_CFLAGS=
SYSTEMD_LIBS=
PMDA_SYSTEMD=

IB_LIBS=
PMDA_INFINIBAND=


#
# Python platform-specific installation quirks
PYTHON_PREFIX=/usr
SETUP_PY_BUILD_OPTIONS = --include-dirs=$(TOPDIR)/src/include
SETUP_PY_BUILD_OPTIONS += --library-dirs=$(TOPDIR)/src/libpcp/src:$(TOPDIR)/src/libpcp_pmda/src:$(TOPDIR)/src/libpcp_gui/src:$(TOPDIR)/src/libpcp_import/src:$(TOPDIR)/src/libpcp_mmv/src
SETUP_PY_INSTALL_OPTIONS = --skip-build
SETUP_PY_INSTALL_OPTIONS += --root=$${DIST_ROOT-/}
SETUP_PY_INSTALL_OPTIONS += --record=$(TOPDIR)/python-pcp.list
ifeq "$(PYTHON_PREFIX)" "/usr"
ifeq "$(PACKAGE_DISTRIBUTION)" "debian"
SETUP_PY_INSTALL_OPTIONS += --install-layout=deb
endif
else
SETUP_PY_INSTALL_OPTIONS += --prefix=$(PYTHON_PREFIX)
endif
# RPM byte-compiles and installs results in our DIST_ROOT, cater for this:
ifeq "$(shell [ '$(TARGET_OS)' = linux -a '$(PACKAGE_DISTRIBUTION)' != gentoo \
	      ] && echo 1)" "1"
# Linux and not Gentoo (which needs tarball packaging)
PYTHON_INSTALL = \
	$(AWK) '{print} /.pyc$$/ {sub(/.pyc$$/,".pyo"); print}' \
		< $(TOPDIR)/python-pcp.list > $(TOPDIR)/python-pcp.list.rpm; \
	cat $(TOPDIR)/python-pcp.list.rpm | while read f; do \
	    touch $${DIST_ROOT-/}$$f; \
	done
else
ifeq "$(shell [ '$(PACKAGE_DISTRIBUTION)' = cocoa \
                -o '$(PACKAGE_DISTRIBUTION)' = macosx \
                -o '$(PACKAGE_DISTRIBUTION)' = gentoo \
                -o '$(PACKAGE_DISTRIBUTION)' = solaris \
                -o '$(PACKAGE_DISTRIBUTION)' = freebsd \
	      ] && echo 1)" "1"
# Gather installed Python files before packaging
# Lines in python-pcp.list are like this
# /usr/lib/python2.7/site-packages/pcp.py
# /usr/lib/python2.7/site-packages/pcp.pyc
# /usr/lib/python2.7/site-packages/pmapi.so
# /usr/lib/python2.7/site-packages/pcp-0.2-py2.7.egg-info
#
# Matching build artifacts are below src/python/build
#
PYTHON_INSTALL = \
	if [ -n "$(DIST_MANIFEST)" ]; then \
	    cat $(TOPDIR)/python-pcp.list \
	    | while read f; do \
		bn=`basename $$f`; \
		dn=`dirname $$f`; \
		$(INSTALL) -d $$dn || exit 1; \
		src=`find $(TOPDIR)/src/python/build -name $$bn`; \
		$(INSTALL) $$src $$f || exit 1; \
	    done; \
	fi
else
PYTHON_INSTALL = 
endif
endif

# Qt magic for build/installs across all the supported platforms
ifeq ($(PCP_PLATFORM),darwin)
QTMAKE = $(QMAKE) -spec macx-g++ CONFIG+=$(QT_RELEASE) && make -f Makefile
MACBUILD = build/$(QT_RELEASE)/$(COMMAND).app/Contents
BINARY = $(MACBUILD)/MacOS/$(COMMAND)
LNMAKE = test ! -f $(BINARY) -o -L $(COMMAND) || $(LN_S) $(BINARY) $(COMMAND)
WINDOW = mac
endif
ifeq ($(PCP_PLATFORM),mingw)
QTMAKE = $(QMAKE) CONFIG+=$(QT_RELEASE) && $(MAKE) -f Makefile
BINARY = $(QT_RELEASE)/$(COMMAND)
LNMAKE =
WINDOW = win
endif
ifeq "$(findstring $(PCP_PLATFORM),darwin mingw)" ""
QTMAKE = $(QMAKE) CONFIG+=$(QT_RELEASE) && $(MAKE) $(MAKEOPTS) -f Makefile
BINARY = build/$(QT_RELEASE)/$(COMMAND)
LNMAKE = test ! -f $(BINARY) -o -L $(COMMAND) || $(LN_S) $(BINARY) $(COMMAND)
WINDOW = x11
endif

ifeq ($(PCP_PLATFORM),darwin)
INSTALL_DIRECTORY_HIERARCHY=\
	d=$(1); while [ "$$d" != "$(2)" -a "$$d" != "/" -a "$$d" != "." ] ; do \
                echo $$d; d=`dirname $$d`; done | sort | while read id; do \
                $(INSTALL) -m 755 -d $$id || exit 1; done

INSTALL_QT_RESOURCES=\
	printf "[Paths]\nPlugins=/Library/PCP/Plugins\n\n" > qt.conf; \
	$(INSTALL) -m 644 qt.conf $(1)/qt.conf; \
	rm qt.conf; \
	find frameworks -type d -name qt_menu.nib | while read nib; do \
                $(INSTALL) -m 755 -d $(1)/qt_menu.nib || exit 1; \
                find $$nib -type f | while read nibs; do \
                        f=`basename $$nibs`; \
                        $(INSTALL) -m 644 $$nibs $(1)/qt_menu.nib/$$f || exit 1; \
                done; \
        done

MAC_APPSUPPORT_DIR=/Library/PCP
MAC_FRAMEWORKS_DIR=$(MAC_APPSUPPORT_DIR)/Frameworks

# WARNING!
# This rule modified the binary it was given, once modified the
# binary cannot be used with this rule again.
# If the binary is installed then it's important to call this
# rule before calling install rule for the binary.
INSTALL_QT_FRAMEWORKS=\
    otool -L $(1) | awk '{if (NR != 1) {print $$1}}' |\
    egrep 'Qt.*\.framework' | while read qt; do \
	tdir=`dirname $$qt`; \
	install_name_tool -change $$qt $(MAC_FRAMEWORKS_DIR)/$$qt $(1);\
	$(call INSTALL_DIRECTORY_HIERARCHY,$(MAC_FRAMEWORKS_DIR)/$$tdir,/Library/PCP); \
	mkdir -p frameworks/$$tdir || exit 1; \
	fwqt="frameworks/$$qt"; \
	cp /Library/Frameworks/$$qt frameworks/$$qt || exit 1; \
	otool -L $$fwqt | awk '{if (NR != 1) {print $$1}}' |\
	egrep 'Qt.*\.framework' | while read dep; do \
	    install_name_tool -change $$dep $(MAC_FRAMEWORKS_DIR)/$$dep $$fwqt;\
	done; \
	$(INSTALL) frameworks/$$qt $(MAC_FRAMEWORKS_DIR)/$$qt; \
	if [ -d /Library/Frameworks/$$tdir/Resources ] ; then \
	    $(INSTALL) -d $(MAC_FRAMEWORKS_DIR)/$$tdir/Resources; \
	    (cd /Library/Frameworks/$$tdir; find Resources -type f) | \
		while read rf; do \
		    rfpath="$$tdir/$$rf"; rfd=`dirname $$rfpath`; \
		    fwpath="frameworks/$$rfpath"; brfd=`basename $$rfd`; \
		    mkdir -p frameworks/$$rfd || exit 1; \
		    cp /Library/Frameworks/$$rfpath $$fwpath || exit 1; \
		    [ $$brfd != qt_menu.nib ] || continue;  \
		    $(INSTALL) -d $(MAC_FRAMEWORKS_DIR)/$$rfd || exit 1; \
		    $(INSTALL) $$fwpath $(MAC_FRAMEWORKS_DIR)/$$rfpath;\
		done \
	fi; done
endif


# For targets that should always be rebuilt,
# define a target that is never up-to-date.
# Targets needing this should depend on $(_FORCE)
_FORCE = __force_build

PCP_USER = pcp
PCP_GROUP = pcp
PCP_USER_INSTALL = root
PCP_GROUP_INSTALL = root

PCPLIB = -lpcp
ifneq "$(PCPLIB)" "$(LIB_FOR_BASENAME)"
PCPLIB += $(LIB_FOR_BASENAME)
endif
ifeq "$(ENABLE_SHARED)" "no"
PCPLIB += $(LIB_FOR_MATH) $(LIB_FOR_PTHREADS) $(LIB_FOR_DLOPEN) $(LIB_FOR_RT)
endif
PCP_GUILIB = -lpcp_gui $(PCPLIB)
PCP_PMDALIB = -lpcp_pmda $(PCPLIB)
PCP_TRACELIB = -lpcp_trace $(PCPLIB)

ifdef PCP_ALTLIBS
ifeq ($(PCP_LIB_DIR),$(PCP_LIB32_DIR))
PCP_ALTLIBS =
else
ifneq "$(findstring $(MAKECMDGOALS),clean clobber)" ""
PCP_ALTLIBS =
endif
endif
endif

BUILD_PMMGR=yes

endif # _BUILDDEFS_INCLUDED_