summaryrefslogtreecommitdiff
path: root/src/pmdas/trace/GNUmakefile
blob: 64d2512c207e7987fec5dba3cca535889225fec1 (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
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
#
# Copyright (c) 2000-2001,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

IAM	= trace
DOMAIN	= TRACE

PMDADIR	= $(PCP_PMDAS_DIR)/$(IAM)
DEMODIR	= $(PCP_DEMOS_DIR)/$(IAM)

SCRIPTS	= Install Remove
OTHERS	= pmns root 
DFILES	= help README 
DEMOS	= app1.c app2.c app3.c fapp1.f japp1.java
DEMOFILES = README.demos Makefile.proto GNUmakefile.stub stub.c
APPS	= app1$(EXECSUFFIX) app2$(EXECSUFFIX) app3$(EXECSUFFIX)

LCFLAGS = -I.
LLDFLAGS= -L$(TOPDIR)/src/libpcp/src -L$(TOPDIR)/src/libpcp_trace/src
LLDLIBS = $(PCP_TRACELIB)

LDIRT	= *.log *.dir *.pag *.o $(APPS) tmp.c \
	  pmtrace.c Makefile.demos

LSRCFILES= $(SCRIPTS) $(OTHERS) $(DEMOS) $(DEMOFILES) $(DFILES)

SUBDIRS	= src

default:	$(SUBDIRS) Makefile.demos build-me
	$(SUBDIRS_MAKERULE)

include $(BUILDRULES)

ifneq "$(TARGET_OS)" "mingw"
build-me:	demos

install:	$(SUBDIRS) Makefile.demos
	$(SUBDIRS_MAKERULE)
	$(INSTALL) -m 755 -d $(PMDADIR)
	$(INSTALL) -m 755 $(SCRIPTS) $(PMDADIR)
	$(INSTALL) -m 644 $(OTHERS) $(DFILES) $(PMDADIR)
	$(INSTALL) -m 755 -d $(DEMODIR)
	$(INSTALL) -m 644 Makefile.demos $(DEMODIR)/Makefile
	$(INSTALL) -m 644 README.demos $(DEMODIR)/README
	$(INSTALL) -m 644 GNUmakefile.stub $(DEMODIR)/Makefile.stub
	$(INSTALL) -m 644 stub.c pmtrace.c $(DEMOS) $(DEMODIR)

else
build-me:
install:	$(SUBDIRS)
endif

demos:	$(APPS) pmtrace.c

pmtrace.c:	$(TOPDIR)/src/pmtrace/pmtrace.c
	rm -f $@ && cp $< $@

app1.o:	app1.c $(TOPDIR)/src/include/pcp/pmapi.h
	@rm -f tmp.c
	sed -e 's;<pcp/\(.*\)>;"\1";' app1.c >tmp.c
	$(CCF) -c -o $@ tmp.c
	@rm -f tmp.c

app2.o:	app2.c $(TOPDIR)/src/include/pcp/pmapi.h
	@rm -f tmp.c
	sed -e 's;<pcp/\(.*\)>;"\1";' app2.c >tmp.c
	$(CCF) -c -o $@ tmp.c
	@rm -f tmp.c

app3.o:	app3.c $(TOPDIR)/src/include/pcp/pmapi.h
	@rm -f tmp.c
	sed -e 's;<pcp/\(.*\)>;"\1";' app3.c >tmp.c
	$(CCF) -c -o $@ tmp.c
	@rm -f tmp.c

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

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

app3$(EXECSUFFIX):	app3.o
	$(CCF) -o $@ $(LDFLAGS) app3.o $(LDLIBS) $(LIB_FOR_PTHREADS)

default_pcp:	default

install_pcp:	install

.NOTPARALLEL:
Makefile.demos:	Makefile.proto
	rm -f $@
	sed \
		-e 's/PTHREAD_LIB/$(LIB_FOR_PTHREADS)/' \
		-e 's/DLOPEN_LIB/$(LIB_FOR_DLOPEN)/' \
		-e 's/MATH_LIB/$(LIB_FOR_MATH)/' \
		<$^ >$@