blob: eae88561233b48ab56f798f3c782d77b46bc16a5 [file] [log] [blame]
Ingo Molnard24e4732009-04-20 13:32:07 +02001# The default target of this Makefile is...
2all::
Ingo Molnare0143ba2009-03-23 21:29:59 +01003
Ingo Molnard24e4732009-04-20 13:32:07 +02004# Define V=1 to have a more verbose compile.
5#
6# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
7# or vsnprintf() return -1 instead of number of characters which would
8# have been written to the final string if enough space had been available.
9#
10# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
11# when attempting to read from an fopen'ed directory.
12#
13# Define NO_OPENSSL environment variable if you do not have OpenSSL.
14# This also implies MOZILLA_SHA1.
15#
Ingo Molnard24e4732009-04-20 13:32:07 +020016# Define CURLDIR=/foo/bar if your curl header and library files are in
17# /foo/bar/include and /foo/bar/lib directories.
18#
Ingo Molnard24e4732009-04-20 13:32:07 +020019# Define EXPATDIR=/foo/bar if your expat header and library files are in
20# /foo/bar/include and /foo/bar/lib directories.
21#
22# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
23#
24# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
25# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
26#
27# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
28# do not support the 'size specifiers' introduced by C99, namely ll, hh,
29# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
30# some C compilers supported these specifiers prior to C99 as an extension.
31#
32# Define NO_STRCASESTR if you don't have strcasestr.
33#
34# Define NO_MEMMEM if you don't have memmem.
35#
Ingo Molnard24e4732009-04-20 13:32:07 +020036# Define NO_STRTOUMAX if you don't have strtoumax in the C library.
37# If your compiler also does not support long long or does not have
38# strtoull, define NO_STRTOULL.
39#
40# Define NO_SETENV if you don't have setenv in the C library.
41#
42# Define NO_UNSETENV if you don't have unsetenv in the C library.
43#
44# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
45#
46# Define NO_SYS_SELECT_H if you don't have sys/select.h.
47#
Ingo Molnar07800602009-04-20 15:00:56 +020048# Define NO_SYMLINK_HEAD if you never want .perf/HEAD to be a symbolic link.
Ingo Molnard24e4732009-04-20 13:32:07 +020049# Enable it on Windows. By default, symrefs are still used.
50#
51# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
52# tests. These tests take up a significant amount of the total test time
53# but are not needed unless you plan to talk to SVN repos.
54#
55# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
Ingo Molnar07800602009-04-20 15:00:56 +020056# installed in /sw, but don't want PERF to link against any libraries
Ingo Molnard24e4732009-04-20 13:32:07 +020057# installed there. If defined you may specify your own (or Fink's)
58# include directories and library directories by defining CFLAGS
59# and LDFLAGS appropriately.
60#
61# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
Ingo Molnar07800602009-04-20 15:00:56 +020062# have DarwinPorts installed in /opt/local, but don't want PERF to
Ingo Molnard24e4732009-04-20 13:32:07 +020063# link against any libraries installed there. If defined you may
64# specify your own (or DarwinPort's) include directories and
65# library directories by defining CFLAGS and LDFLAGS appropriately.
66#
67# Define PPC_SHA1 environment variable when running make to make use of
68# a bundled SHA1 routine optimized for PowerPC.
69#
70# Define ARM_SHA1 environment variable when running make to make use of
71# a bundled SHA1 routine optimized for ARM.
72#
73# Define MOZILLA_SHA1 environment variable when running make to make use of
74# a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
75# on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
76# choice) has very fast version optimized for i586.
77#
78# Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
79#
80# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
81#
82# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
83# Patrick Mauritz).
84#
85# Define NO_MMAP if you want to avoid mmap.
86#
87# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
88#
89# Define NO_PREAD if you have a problem with pread() system call (e.g.
90# cygwin.dll before v1.5.22).
91#
92# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
93# generally faster on your platform than accessing the working directory.
94#
95# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
96# the executable mode bit, but doesn't really do so.
97#
98# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
99#
100# Define NO_SOCKADDR_STORAGE if your platform does not have struct
101# sockaddr_storage.
102#
103# Define NO_ICONV if your libc does not properly support iconv.
104#
105# Define OLD_ICONV if your library has an old iconv(), where the second
106# (input buffer pointer) parameter is declared with type (const char **).
107#
108# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
109#
110# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
111# that tells runtime paths to dynamic libraries;
112# "-Wl,-rpath=/path/lib" is used instead.
113#
Ingo Molnar07800602009-04-20 15:00:56 +0200114# Define USE_NSEC below if you want perf to care about sub-second file mtimes
Ingo Molnard24e4732009-04-20 13:32:07 +0200115# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
116# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
117# randomly break unless your underlying filesystem supports those sub-second
118# times (my ext3 doesn't).
119#
120# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
121# "st_ctim"
122#
123# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
124# available. This automatically turns USE_NSEC off.
125#
Ingo Molnar07800602009-04-20 15:00:56 +0200126# Define USE_STDEV below if you want perf to care about the underlying device
Ingo Molnard24e4732009-04-20 13:32:07 +0200127# change being considered an inode change from the update-index perspective.
128#
129# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
130# field that counts the on-disk footprint in 512-byte blocks.
131#
132# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
133#
134# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
135#
136# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
137# MakeMaker (e.g. using ActiveState under Cygwin).
138#
139# Define NO_PERL if you do not want Perl scripts or libraries at all.
140#
Ingo Molnard24e4732009-04-20 13:32:07 +0200141# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
142# is a simplified version of the merge sort used in glibc. This is
143# recommended if Git triggers O(n^2) behavior in your platform's qsort().
144#
Ingo Molnar07800602009-04-20 15:00:56 +0200145# Define NO_EXTERNAL_GREP if you don't want "perf grep" to ever call
Ingo Molnard24e4732009-04-20 13:32:07 +0200146# your external grep (e.g., if your system lacks grep, if its grep is
Ingo Molnar07800602009-04-20 15:00:56 +0200147# broken, or spawning external process is slower than built-in grep perf has).
Ingo Molnare0143ba2009-03-23 21:29:59 +0100148
Ingo Molnar07800602009-04-20 15:00:56 +0200149PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
Ingo Molnar148be2c2009-04-27 08:02:14 +0200150 @$(SHELL_PATH) util/PERF-VERSION-GEN
Ingo Molnar07800602009-04-20 15:00:56 +0200151-include PERF-VERSION-FILE
Ingo Molnare0143ba2009-03-23 21:29:59 +0100152
Ingo Molnard24e4732009-04-20 13:32:07 +0200153uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
154uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
155uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
156uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
157uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
158uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
Peter Zijlstrade9ac072009-04-08 15:01:31 +0200159
Ingo Molnard24e4732009-04-20 13:32:07 +0200160# CFLAGS and LDFLAGS are for the users to override from the command line.
Peter Zijlstrade9ac072009-04-08 15:01:31 +0200161
Ingo Molnar16f762a2009-05-27 09:10:38 +0200162CFLAGS = -ggdb3 -Wall -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement
Arnaldo Carvalho de Melo62eb9392009-05-18 14:28:47 -0300163LDFLAGS = -lpthread -lrt -lelf
Ingo Molnard24e4732009-04-20 13:32:07 +0200164ALL_CFLAGS = $(CFLAGS)
165ALL_LDFLAGS = $(LDFLAGS)
166STRIP ?= strip
167
168# Among the variables below, these:
Ingo Molnar07800602009-04-20 15:00:56 +0200169# perfexecdir
Ingo Molnard24e4732009-04-20 13:32:07 +0200170# template_dir
171# mandir
172# infodir
173# htmldir
Ingo Molnar07800602009-04-20 15:00:56 +0200174# ETC_PERFCONFIG (but not sysconfdir)
Ingo Molnard24e4732009-04-20 13:32:07 +0200175# can be specified as a relative path some/where/else;
Ingo Molnar07800602009-04-20 15:00:56 +0200176# this is interpreted as relative to $(prefix) and "perf" at
Ingo Molnard24e4732009-04-20 13:32:07 +0200177# runtime figures out where they are based on the path to the executable.
178# This can help installing the suite in a relocatable way.
179
180prefix = $(HOME)
181bindir_relative = bin
182bindir = $(prefix)/$(bindir_relative)
183mandir = share/man
184infodir = share/info
Ingo Molnar07800602009-04-20 15:00:56 +0200185perfexecdir = libexec/perf-core
Ingo Molnard24e4732009-04-20 13:32:07 +0200186sharedir = $(prefix)/share
Ingo Molnar07800602009-04-20 15:00:56 +0200187template_dir = share/perf-core/templates
188htmldir = share/doc/perf-doc
Ingo Molnard24e4732009-04-20 13:32:07 +0200189ifeq ($(prefix),/usr)
190sysconfdir = /etc
Ingo Molnar07800602009-04-20 15:00:56 +0200191ETC_PERFCONFIG = $(sysconfdir)/perfconfig
Ingo Molnard24e4732009-04-20 13:32:07 +0200192else
193sysconfdir = $(prefix)/etc
Ingo Molnar07800602009-04-20 15:00:56 +0200194ETC_PERFCONFIG = etc/perfconfig
Ingo Molnard24e4732009-04-20 13:32:07 +0200195endif
196lib = lib
197# DESTDIR=
198
Ingo Molnard24e4732009-04-20 13:32:07 +0200199export prefix bindir sharedir sysconfdir
200
201CC = gcc
202AR = ar
203RM = rm -f
204TAR = tar
205FIND = find
206INSTALL = install
207RPMBUILD = rpmbuild
Ingo Molnard24e4732009-04-20 13:32:07 +0200208PTHREAD_LIBS = -lpthread
209
Ingo Molnard24e4732009-04-20 13:32:07 +0200210# sparse is architecture-neutral, which means that we need to tell it
211# explicitly what architecture to check for. Fix this up for yours..
212SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
213
214
215
216### --- END CONFIGURATION SECTION ---
217
218# Those must not be GNU-specific; they are shared with perl/ which may
219# be built by a different compiler. (Note that this is an artifact now
220# but it still might be nice to keep that distinction.)
221BASIC_CFLAGS =
222BASIC_LDFLAGS =
223
224# Guard against environment variables
225BUILTIN_OBJS =
226BUILT_INS =
227COMPAT_CFLAGS =
228COMPAT_OBJS =
229LIB_H =
230LIB_OBJS =
Ingo Molnard24e4732009-04-20 13:32:07 +0200231SCRIPT_PERL =
232SCRIPT_SH =
233TEST_PROGRAMS =
234
Ingo Molnar07800602009-04-20 15:00:56 +0200235#
236# No scripts right now:
237#
Ingo Molnard24e4732009-04-20 13:32:07 +0200238
Ingo Molnar07800602009-04-20 15:00:56 +0200239# SCRIPT_SH += perf-am.sh
240
241#
242# No Perl scripts right now:
243#
244
245# SCRIPT_PERL += perf-add--interactive.perl
Ingo Molnard24e4732009-04-20 13:32:07 +0200246
247SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
Ingo Molnar07800602009-04-20 15:00:56 +0200248 $(patsubst %.perl,%,$(SCRIPT_PERL))
Ingo Molnard24e4732009-04-20 13:32:07 +0200249
250# Empty...
251EXTRA_PROGRAMS =
252
Ingo Molnar07800602009-04-20 15:00:56 +0200253# ... and all the rest that could be moved out of bindir to perfexecdir
Ingo Molnard24e4732009-04-20 13:32:07 +0200254PROGRAMS += $(EXTRA_PROGRAMS)
Ingo Molnar07800602009-04-20 15:00:56 +0200255
256#
Ingo Molnar125e7022009-04-20 16:13:46 +0200257# Single 'perf' binary right now:
Ingo Molnar07800602009-04-20 15:00:56 +0200258#
Ingo Molnar125e7022009-04-20 16:13:46 +0200259PROGRAMS += perf
Ingo Molnard24e4732009-04-20 13:32:07 +0200260
261# List built-in command $C whose implementation cmd_$C() is not in
262# builtin-$C.o but is linked in as part of some other command.
Ingo Molnar07800602009-04-20 15:00:56 +0200263#
264# None right now:
265#
266# BUILT_INS += perf-init $X
Ingo Molnard24e4732009-04-20 13:32:07 +0200267
Ingo Molnar07800602009-04-20 15:00:56 +0200268# what 'all' will build and 'install' will install, in perfexecdir
Ingo Molnard24e4732009-04-20 13:32:07 +0200269ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
270
Ingo Molnar07800602009-04-20 15:00:56 +0200271# what 'all' will build but not install in perfexecdir
272OTHER_PROGRAMS = perf$X
Ingo Molnard24e4732009-04-20 13:32:07 +0200273
274# Set paths to tools early so that they can be used for version tests.
275ifndef SHELL_PATH
276 SHELL_PATH = /bin/sh
277endif
278ifndef PERL_PATH
279 PERL_PATH = /usr/bin/perl
280endif
281
282export PERL_PATH
283
Ingo Molnar07800602009-04-20 15:00:56 +0200284LIB_FILE=libperf.a
Ingo Molnard24e4732009-04-20 13:32:07 +0200285
Ingo Molnar07800602009-04-20 15:00:56 +0200286LIB_H += ../../include/linux/perf_counter.h
Thomas Gleixner6eda5832009-05-01 18:29:57 +0200287LIB_H += perf.h
Arnaldo Carvalho de Melo35a50c82009-05-18 16:24:49 -0300288LIB_H += util/list.h
289LIB_H += util/rbtree.h
Ingo Molnar148be2c2009-04-27 08:02:14 +0200290LIB_H += util/levenshtein.h
291LIB_H += util/parse-options.h
Ingo Molnar8ad8db32009-05-26 11:10:09 +0200292LIB_H += util/parse-events.h
Ingo Molnar148be2c2009-04-27 08:02:14 +0200293LIB_H += util/quote.h
294LIB_H += util/util.h
295LIB_H += util/help.h
296LIB_H += util/strbuf.h
Arnaldo Carvalho de Meloa0055ae2009-06-01 17:50:19 -0300297LIB_H += util/string.h
Ingo Molnar148be2c2009-04-27 08:02:14 +0200298LIB_H += util/run-command.h
Ingo Molnara930d2c2009-05-27 09:50:13 +0200299LIB_H += util/sigchain.h
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -0300300LIB_H += util/symbol.h
Ingo Molnard24e4732009-04-20 13:32:07 +0200301
Ingo Molnar148be2c2009-04-27 08:02:14 +0200302LIB_OBJS += util/abspath.o
303LIB_OBJS += util/alias.o
304LIB_OBJS += util/config.o
305LIB_OBJS += util/ctype.o
Ingo Molnara930d2c2009-05-27 09:50:13 +0200306LIB_OBJS += util/environment.o
Ingo Molnar148be2c2009-04-27 08:02:14 +0200307LIB_OBJS += util/exec_cmd.o
308LIB_OBJS += util/help.o
309LIB_OBJS += util/levenshtein.o
310LIB_OBJS += util/parse-options.o
Ingo Molnar8ad8db32009-05-26 11:10:09 +0200311LIB_OBJS += util/parse-events.o
Ingo Molnar148be2c2009-04-27 08:02:14 +0200312LIB_OBJS += util/path.o
Arnaldo Carvalho de Melo35a50c82009-05-18 16:24:49 -0300313LIB_OBJS += util/rbtree.o
Ingo Molnar148be2c2009-04-27 08:02:14 +0200314LIB_OBJS += util/run-command.o
315LIB_OBJS += util/quote.o
316LIB_OBJS += util/strbuf.o
Arnaldo Carvalho de Meloa0055ae2009-06-01 17:50:19 -0300317LIB_OBJS += util/string.o
Ingo Molnar148be2c2009-04-27 08:02:14 +0200318LIB_OBJS += util/usage.o
319LIB_OBJS += util/wrapper.o
Ingo Molnara930d2c2009-05-27 09:50:13 +0200320LIB_OBJS += util/sigchain.o
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -0300321LIB_OBJS += util/symbol.o
Ingo Molnara930d2c2009-05-27 09:50:13 +0200322LIB_OBJS += util/pager.o
Ingo Molnard24e4732009-04-20 13:32:07 +0200323
Ingo Molnard24e4732009-04-20 13:32:07 +0200324BUILTIN_OBJS += builtin-help.o
Ingo Molnare33e0a42009-04-20 15:58:01 +0200325BUILTIN_OBJS += builtin-record.o
Arnaldo Carvalho de Melo8fa66bd2009-05-18 12:45:42 -0300326BUILTIN_OBJS += builtin-report.o
Ingo Molnarddcacfa2009-04-20 15:37:32 +0200327BUILTIN_OBJS += builtin-stat.o
Ingo Molnar07800602009-04-20 15:00:56 +0200328BUILTIN_OBJS += builtin-top.o
Ingo Molnard24e4732009-04-20 13:32:07 +0200329
Ingo Molnar07800602009-04-20 15:00:56 +0200330PERFLIBS = $(LIB_FILE)
Ingo Molnard24e4732009-04-20 13:32:07 +0200331EXTLIBS =
332
333#
334# Platform specific tweaks
335#
336
337# We choose to avoid "if .. else if .. else .. endif endif"
338# because maintaining the nesting to match is a pain. If
339# we had "elif" things would have been much nicer...
340
Ingo Molnard24e4732009-04-20 13:32:07 +0200341-include config.mak.autogen
342-include config.mak
343
344ifeq ($(uname_S),Darwin)
345 ifndef NO_FINK
346 ifeq ($(shell test -d /sw/lib && echo y),y)
347 BASIC_CFLAGS += -I/sw/include
348 BASIC_LDFLAGS += -L/sw/lib
349 endif
350 endif
351 ifndef NO_DARWIN_PORTS
352 ifeq ($(shell test -d /opt/local/lib && echo y),y)
353 BASIC_CFLAGS += -I/opt/local/include
354 BASIC_LDFLAGS += -L/opt/local/lib
355 endif
356 endif
357 PTHREAD_LIBS =
358endif
359
360ifndef CC_LD_DYNPATH
361 ifdef NO_R_TO_GCC_LINKER
362 # Some gcc does not accept and pass -R to the linker to specify
363 # the runtime dynamic library path.
364 CC_LD_DYNPATH = -Wl,-rpath,
365 else
366 CC_LD_DYNPATH = -R
367 endif
368endif
369
Ingo Molnard24e4732009-04-20 13:32:07 +0200370ifdef ZLIB_PATH
371 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
372 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
373endif
374EXTLIBS += -lz
375
Ingo Molnard24e4732009-04-20 13:32:07 +0200376ifdef NEEDS_SOCKET
377 EXTLIBS += -lsocket
378endif
379ifdef NEEDS_NSL
380 EXTLIBS += -lnsl
381endif
382ifdef NO_D_TYPE_IN_DIRENT
383 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
384endif
385ifdef NO_D_INO_IN_DIRENT
386 BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
387endif
388ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
389 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
390endif
391ifdef USE_NSEC
392 BASIC_CFLAGS += -DUSE_NSEC
393endif
394ifdef USE_ST_TIMESPEC
395 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
396endif
397ifdef NO_NSEC
398 BASIC_CFLAGS += -DNO_NSEC
399endif
400ifdef NO_C99_FORMAT
401 BASIC_CFLAGS += -DNO_C99_FORMAT
402endif
403ifdef SNPRINTF_RETURNS_BOGUS
404 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
405 COMPAT_OBJS += compat/snprintf.o
406endif
407ifdef FREAD_READS_DIRECTORIES
408 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
409 COMPAT_OBJS += compat/fopen.o
410endif
411ifdef NO_SYMLINK_HEAD
412 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
413endif
414ifdef NO_STRCASESTR
415 COMPAT_CFLAGS += -DNO_STRCASESTR
416 COMPAT_OBJS += compat/strcasestr.o
417endif
Ingo Molnard24e4732009-04-20 13:32:07 +0200418ifdef NO_STRTOUMAX
419 COMPAT_CFLAGS += -DNO_STRTOUMAX
420 COMPAT_OBJS += compat/strtoumax.o
421endif
422ifdef NO_STRTOULL
423 COMPAT_CFLAGS += -DNO_STRTOULL
424endif
425ifdef NO_SETENV
426 COMPAT_CFLAGS += -DNO_SETENV
427 COMPAT_OBJS += compat/setenv.o
428endif
429ifdef NO_MKDTEMP
430 COMPAT_CFLAGS += -DNO_MKDTEMP
431 COMPAT_OBJS += compat/mkdtemp.o
432endif
433ifdef NO_UNSETENV
434 COMPAT_CFLAGS += -DNO_UNSETENV
435 COMPAT_OBJS += compat/unsetenv.o
436endif
437ifdef NO_SYS_SELECT_H
438 BASIC_CFLAGS += -DNO_SYS_SELECT_H
439endif
440ifdef NO_MMAP
441 COMPAT_CFLAGS += -DNO_MMAP
442 COMPAT_OBJS += compat/mmap.o
443else
444 ifdef USE_WIN32_MMAP
445 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
446 COMPAT_OBJS += compat/win32mmap.o
447 endif
448endif
449ifdef NO_PREAD
450 COMPAT_CFLAGS += -DNO_PREAD
451 COMPAT_OBJS += compat/pread.o
452endif
453ifdef NO_FAST_WORKING_DIRECTORY
454 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
455endif
456ifdef NO_TRUSTABLE_FILEMODE
457 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
458endif
459ifdef NO_IPV6
460 BASIC_CFLAGS += -DNO_IPV6
461endif
462ifdef NO_UINTMAX_T
463 BASIC_CFLAGS += -Duintmax_t=uint32_t
464endif
465ifdef NO_SOCKADDR_STORAGE
466ifdef NO_IPV6
467 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
468else
469 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
470endif
471endif
472ifdef NO_INET_NTOP
473 LIB_OBJS += compat/inet_ntop.o
474endif
475ifdef NO_INET_PTON
476 LIB_OBJS += compat/inet_pton.o
477endif
478
479ifdef NO_ICONV
480 BASIC_CFLAGS += -DNO_ICONV
481endif
482
483ifdef OLD_ICONV
484 BASIC_CFLAGS += -DOLD_ICONV
485endif
486
487ifdef NO_DEFLATE_BOUND
488 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
489endif
490
491ifdef PPC_SHA1
492 SHA1_HEADER = "ppc/sha1.h"
493 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
494else
495ifdef ARM_SHA1
496 SHA1_HEADER = "arm/sha1.h"
497 LIB_OBJS += arm/sha1.o arm/sha1_arm.o
498else
499ifdef MOZILLA_SHA1
500 SHA1_HEADER = "mozilla-sha1/sha1.h"
501 LIB_OBJS += mozilla-sha1/sha1.o
502else
503 SHA1_HEADER = <openssl/sha.h>
504 EXTLIBS += $(LIB_4_CRYPTO)
505endif
506endif
507endif
508ifdef NO_PERL_MAKEMAKER
509 export NO_PERL_MAKEMAKER
510endif
511ifdef NO_HSTRERROR
512 COMPAT_CFLAGS += -DNO_HSTRERROR
513 COMPAT_OBJS += compat/hstrerror.o
514endif
515ifdef NO_MEMMEM
516 COMPAT_CFLAGS += -DNO_MEMMEM
517 COMPAT_OBJS += compat/memmem.o
518endif
519ifdef INTERNAL_QSORT
520 COMPAT_CFLAGS += -DINTERNAL_QSORT
521 COMPAT_OBJS += compat/qsort.o
522endif
523ifdef RUNTIME_PREFIX
524 COMPAT_CFLAGS += -DRUNTIME_PREFIX
525endif
526
Ingo Molnard24e4732009-04-20 13:32:07 +0200527ifdef DIR_HAS_BSD_GROUP_SEMANTICS
528 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
529endif
530ifdef NO_EXTERNAL_GREP
531 BASIC_CFLAGS += -DNO_EXTERNAL_GREP
532endif
533
Ingo Molnard24e4732009-04-20 13:32:07 +0200534ifeq ($(PERL_PATH),)
535NO_PERL=NoThanks
536endif
537
538QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
539QUIET_SUBDIR1 =
540
541ifneq ($(findstring $(MAKEFLAGS),w),w)
542PRINT_DIR = --no-print-directory
543else # "make -w"
544NO_SUBDIR = :
545endif
546
547ifneq ($(findstring $(MAKEFLAGS),s),s)
548ifndef V
549 QUIET_CC = @echo ' ' CC $@;
550 QUIET_AR = @echo ' ' AR $@;
551 QUIET_LINK = @echo ' ' LINK $@;
552 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
553 QUIET_GEN = @echo ' ' GEN $@;
554 QUIET_SUBDIR0 = +@subdir=
555 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
556 $(MAKE) $(PRINT_DIR) -C $$subdir
557 export V
558 export QUIET_GEN
559 export QUIET_BUILT_IN
560endif
561endif
562
563ifdef ASCIIDOC8
564 export ASCIIDOC8
565endif
566
567# Shell quote (do not use $(call) to accommodate ancient setups);
568
569SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
Ingo Molnar07800602009-04-20 15:00:56 +0200570ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
Ingo Molnard24e4732009-04-20 13:32:07 +0200571
572DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
573bindir_SQ = $(subst ','\'',$(bindir))
574bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
575mandir_SQ = $(subst ','\'',$(mandir))
576infodir_SQ = $(subst ','\'',$(infodir))
Ingo Molnar07800602009-04-20 15:00:56 +0200577perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
Ingo Molnard24e4732009-04-20 13:32:07 +0200578template_dir_SQ = $(subst ','\'',$(template_dir))
579htmldir_SQ = $(subst ','\'',$(htmldir))
580prefix_SQ = $(subst ','\'',$(prefix))
581
582SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
583PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
Ingo Molnard24e4732009-04-20 13:32:07 +0200584
Ingo Molnar07800602009-04-20 15:00:56 +0200585LIBS = $(PERFLIBS) $(EXTLIBS)
Ingo Molnard24e4732009-04-20 13:32:07 +0200586
587BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
588 $(COMPAT_CFLAGS)
589LIB_OBJS += $(COMPAT_OBJS)
590
591ALL_CFLAGS += $(BASIC_CFLAGS)
592ALL_LDFLAGS += $(BASIC_LDFLAGS)
593
594export TAR INSTALL DESTDIR SHELL_PATH
595
596
597### Build rules
598
599SHELL = $(SHELL_PATH)
600
Ingo Molnar07800602009-04-20 15:00:56 +0200601all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS
Ingo Molnard24e4732009-04-20 13:32:07 +0200602ifneq (,$X)
Ingo Molnar07800602009-04-20 15:00:56 +0200603 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
Ingo Molnard24e4732009-04-20 13:32:07 +0200604endif
605
606all::
Ingo Molnard24e4732009-04-20 13:32:07 +0200607
608please_set_SHELL_PATH_to_a_more_modern_shell:
609 @$$(:)
610
611shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
612
Ingo Molnar07800602009-04-20 15:00:56 +0200613strip: $(PROGRAMS) perf$X
614 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) perf$X
Ingo Molnard24e4732009-04-20 13:32:07 +0200615
Ingo Molnar07800602009-04-20 15:00:56 +0200616perf.o: perf.c common-cmds.h PERF-CFLAGS
617 $(QUIET_CC)$(CC) -DPERF_VERSION='"$(PERF_VERSION)"' \
618 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
Ingo Molnard24e4732009-04-20 13:32:07 +0200619 $(ALL_CFLAGS) -c $(filter %.c,$^)
620
Ingo Molnar07800602009-04-20 15:00:56 +0200621perf$X: perf.o $(BUILTIN_OBJS) $(PERFLIBS)
622 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ perf.o \
Ingo Molnard24e4732009-04-20 13:32:07 +0200623 $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
624
Ingo Molnar07800602009-04-20 15:00:56 +0200625builtin-help.o: builtin-help.c common-cmds.h PERF-CFLAGS
Ingo Molnard24e4732009-04-20 13:32:07 +0200626 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
Ingo Molnar07800602009-04-20 15:00:56 +0200627 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
628 '-DPERF_MAN_PATH="$(mandir_SQ)"' \
629 '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
Ingo Molnard24e4732009-04-20 13:32:07 +0200630
Ingo Molnar07800602009-04-20 15:00:56 +0200631$(BUILT_INS): perf$X
Ingo Molnard24e4732009-04-20 13:32:07 +0200632 $(QUIET_BUILT_IN)$(RM) $@ && \
Ingo Molnar07800602009-04-20 15:00:56 +0200633 ln perf$X $@ 2>/dev/null || \
634 ln -s perf$X $@ 2>/dev/null || \
635 cp perf$X $@
Ingo Molnard24e4732009-04-20 13:32:07 +0200636
Ingo Molnar148be2c2009-04-27 08:02:14 +0200637common-cmds.h: util/generate-cmdlist.sh command-list.txt
Ingo Molnard24e4732009-04-20 13:32:07 +0200638
Ingo Molnar07800602009-04-20 15:00:56 +0200639common-cmds.h: $(wildcard Documentation/perf-*.txt)
Ingo Molnar148be2c2009-04-27 08:02:14 +0200640 $(QUIET_GEN)util/generate-cmdlist.sh > $@+ && mv $@+ $@
Ingo Molnard24e4732009-04-20 13:32:07 +0200641
642$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
643 $(QUIET_GEN)$(RM) $@ $@+ && \
644 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
645 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
646 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
Ingo Molnar07800602009-04-20 15:00:56 +0200647 -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \
Ingo Molnard24e4732009-04-20 13:32:07 +0200648 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
649 $@.sh >$@+ && \
650 chmod +x $@+ && \
651 mv $@+ $@
652
Ingo Molnard24e4732009-04-20 13:32:07 +0200653configure: configure.ac
654 $(QUIET_GEN)$(RM) $@ $<+ && \
Ingo Molnar07800602009-04-20 15:00:56 +0200655 sed -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \
Ingo Molnard24e4732009-04-20 13:32:07 +0200656 $< > $<+ && \
657 autoconf -o $@ $<+ && \
658 $(RM) $<+
659
Ingo Molnar07800602009-04-20 15:00:56 +0200660# These can record PERF_VERSION
661perf.o perf.spec \
Ingo Molnard24e4732009-04-20 13:32:07 +0200662 $(patsubst %.sh,%,$(SCRIPT_SH)) \
663 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
Ingo Molnar07800602009-04-20 15:00:56 +0200664 : PERF-VERSION-FILE
Ingo Molnard24e4732009-04-20 13:32:07 +0200665
Ingo Molnar07800602009-04-20 15:00:56 +0200666%.o: %.c PERF-CFLAGS
Ingo Molnard24e4732009-04-20 13:32:07 +0200667 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
Ingo Molnar07800602009-04-20 15:00:56 +0200668%.s: %.c PERF-CFLAGS
Ingo Molnard24e4732009-04-20 13:32:07 +0200669 $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
670%.o: %.S
671 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
672
Ingo Molnar148be2c2009-04-27 08:02:14 +0200673util/exec_cmd.o: util/exec_cmd.c PERF-CFLAGS
Ingo Molnard24e4732009-04-20 13:32:07 +0200674 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
Ingo Molnar07800602009-04-20 15:00:56 +0200675 '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
Ingo Molnard24e4732009-04-20 13:32:07 +0200676 '-DBINDIR="$(bindir_relative_SQ)"' \
677 '-DPREFIX="$(prefix_SQ)"' \
678 $<
679
Ingo Molnar07800602009-04-20 15:00:56 +0200680builtin-init-db.o: builtin-init-db.c PERF-CFLAGS
681 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_PERF_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
Ingo Molnard24e4732009-04-20 13:32:07 +0200682
Ingo Molnar148be2c2009-04-27 08:02:14 +0200683util/config.o: util/config.c PERF-CFLAGS
Ingo Molnar07800602009-04-20 15:00:56 +0200684 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
Ingo Molnard24e4732009-04-20 13:32:07 +0200685
Ingo Molnar07800602009-04-20 15:00:56 +0200686perf-%$X: %.o $(PERFLIBS)
Ingo Molnard24e4732009-04-20 13:32:07 +0200687 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
688
Ingo Molnard24e4732009-04-20 13:32:07 +0200689$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
Ingo Molnar07800602009-04-20 15:00:56 +0200690$(patsubst perf-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
Ingo Molnard24e4732009-04-20 13:32:07 +0200691builtin-revert.o wt-status.o: wt-status.h
692
693$(LIB_FILE): $(LIB_OBJS)
694 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
695
Ingo Molnarc1c23652009-05-30 12:38:51 +0200696doc:
697 $(MAKE) -C Documentation all
698
699man:
700 $(MAKE) -C Documentation man
701
702html:
703 $(MAKE) -C Documentation html
704
705info:
706 $(MAKE) -C Documentation info
707
708pdf:
709 $(MAKE) -C Documentation pdf
710
Ingo Molnard24e4732009-04-20 13:32:07 +0200711TAGS:
712 $(RM) TAGS
713 $(FIND) . -name '*.[hcS]' -print | xargs etags -a
714
715tags:
716 $(RM) tags
717 $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
718
719cscope:
720 $(RM) cscope*
721 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
722
723### Detect prefix changes
724TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
Ingo Molnar07800602009-04-20 15:00:56 +0200725 $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
Ingo Molnard24e4732009-04-20 13:32:07 +0200726
Ingo Molnar07800602009-04-20 15:00:56 +0200727PERF-CFLAGS: .FORCE-PERF-CFLAGS
Ingo Molnard24e4732009-04-20 13:32:07 +0200728 @FLAGS='$(TRACK_CFLAGS)'; \
Ingo Molnar07800602009-04-20 15:00:56 +0200729 if test x"$$FLAGS" != x"`cat PERF-CFLAGS 2>/dev/null`" ; then \
Ingo Molnard24e4732009-04-20 13:32:07 +0200730 echo 1>&2 " * new build flags or prefix"; \
Ingo Molnar07800602009-04-20 15:00:56 +0200731 echo "$$FLAGS" >PERF-CFLAGS; \
Ingo Molnard24e4732009-04-20 13:32:07 +0200732 fi
733
734# We need to apply sq twice, once to protect from the shell
Ingo Molnar07800602009-04-20 15:00:56 +0200735# that runs PERF-BUILD-OPTIONS, and then again to protect it
Ingo Molnard24e4732009-04-20 13:32:07 +0200736# and the first level quoting from the shell that runs "echo".
Ingo Molnar07800602009-04-20 15:00:56 +0200737PERF-BUILD-OPTIONS: .FORCE-PERF-BUILD-OPTIONS
Ingo Molnard24e4732009-04-20 13:32:07 +0200738 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
739 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
740 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
741 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
742
Ingo Molnard24e4732009-04-20 13:32:07 +0200743### Testing rules
744
Ingo Molnar6f06ccb2009-04-20 15:22:22 +0200745#
746# None right now:
747#
748# TEST_PROGRAMS += test-something$X
Ingo Molnard24e4732009-04-20 13:32:07 +0200749
750all:: $(TEST_PROGRAMS)
751
752# GNU make supports exporting all variables by "export" without parameters.
753# However, the environment gets quite big, and some programs have problems
754# with that.
755
756export NO_SVN_TESTS
757
Ingo Molnard24e4732009-04-20 13:32:07 +0200758check: common-cmds.h
759 if sparse; \
760 then \
Ingo Molnar148be2c2009-04-27 08:02:14 +0200761 for i in *.c */*.c; \
Ingo Molnard24e4732009-04-20 13:32:07 +0200762 do \
763 sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
764 done; \
765 else \
766 echo 2>&1 "Did you mean 'make test'?"; \
767 exit 1; \
768 fi
769
770remove-dashes:
771 ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
772
773### Installation rules
774
775ifneq ($(filter /%,$(firstword $(template_dir))),)
776template_instdir = $(template_dir)
777else
778template_instdir = $(prefix)/$(template_dir)
779endif
780export template_instdir
781
Ingo Molnar07800602009-04-20 15:00:56 +0200782ifneq ($(filter /%,$(firstword $(perfexecdir))),)
783perfexec_instdir = $(perfexecdir)
Ingo Molnard24e4732009-04-20 13:32:07 +0200784else
Ingo Molnar07800602009-04-20 15:00:56 +0200785perfexec_instdir = $(prefix)/$(perfexecdir)
Ingo Molnard24e4732009-04-20 13:32:07 +0200786endif
Ingo Molnar07800602009-04-20 15:00:56 +0200787perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
788export perfexec_instdir
Ingo Molnard24e4732009-04-20 13:32:07 +0200789
790install: all
791 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
Ingo Molnar7fbd5542009-05-30 12:38:51 +0200792 $(INSTALL) perf$X '$(DESTDIR_SQ)$(bindir_SQ)'
Mike Galbraithc1079ab2009-06-02 10:17:34 +0200793ifdef BUILT_INS
794 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
795 $(INSTALL) $(BUILT_INS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
Ingo Molnard24e4732009-04-20 13:32:07 +0200796ifneq (,$X)
Ingo Molnar07800602009-04-20 15:00:56 +0200797 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), $(RM) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$p';)
Ingo Molnard24e4732009-04-20 13:32:07 +0200798endif
Mike Galbraithc1079ab2009-06-02 10:17:34 +0200799endif
Ingo Molnard24e4732009-04-20 13:32:07 +0200800
Ingo Molnarc1c23652009-05-30 12:38:51 +0200801install-doc:
802 $(MAKE) -C Documentation install
803
804install-man:
805 $(MAKE) -C Documentation install-man
806
807install-html:
808 $(MAKE) -C Documentation install-html
809
810install-info:
811 $(MAKE) -C Documentation install-info
812
813install-pdf:
814 $(MAKE) -C Documentation install-pdf
815
816quick-install-doc:
817 $(MAKE) -C Documentation quick-install
818
819quick-install-man:
820 $(MAKE) -C Documentation quick-install-man
821
822quick-install-html:
823 $(MAKE) -C Documentation quick-install-html
824
825
Ingo Molnard24e4732009-04-20 13:32:07 +0200826### Maintainer's dist rules
Mike Galbraithc1079ab2009-06-02 10:17:34 +0200827#
828# None right now
829#
830#
831# perf.spec: perf.spec.in
832# sed -e 's/@@VERSION@@/$(PERF_VERSION)/g' < $< > $@+
833# mv $@+ $@
834#
835# PERF_TARNAME=perf-$(PERF_VERSION)
836# dist: perf.spec perf-archive$(X) configure
837# ./perf-archive --format=tar \
838# --prefix=$(PERF_TARNAME)/ HEAD^{tree} > $(PERF_TARNAME).tar
839# @mkdir -p $(PERF_TARNAME)
840# @cp perf.spec configure $(PERF_TARNAME)
841# @echo $(PERF_VERSION) > $(PERF_TARNAME)/version
842# $(TAR) rf $(PERF_TARNAME).tar \
843# $(PERF_TARNAME)/perf.spec \
844# $(PERF_TARNAME)/configure \
845# $(PERF_TARNAME)/version
846# @$(RM) -r $(PERF_TARNAME)
847# gzip -f -9 $(PERF_TARNAME).tar
848#
849# htmldocs = perf-htmldocs-$(PERF_VERSION)
850# manpages = perf-manpages-$(PERF_VERSION)
851# dist-doc:
852# $(RM) -r .doc-tmp-dir
853# mkdir .doc-tmp-dir
854# $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
855# cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
856# gzip -n -9 -f $(htmldocs).tar
857# :
858# $(RM) -r .doc-tmp-dir
859# mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
860# $(MAKE) -C Documentation DESTDIR=./ \
861# man1dir=../.doc-tmp-dir/man1 \
862# man5dir=../.doc-tmp-dir/man5 \
863# man7dir=../.doc-tmp-dir/man7 \
864# install
865# cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
866# gzip -n -9 -f $(manpages).tar
867# $(RM) -r .doc-tmp-dir
868#
869# rpm: dist
870# $(RPMBUILD) -ta $(PERF_TARNAME).tar.gz
Ingo Molnard24e4732009-04-20 13:32:07 +0200871
Ingo Molnard24e4732009-04-20 13:32:07 +0200872### Cleaning rules
873
874distclean: clean
Mike Galbraithc1079ab2009-06-02 10:17:34 +0200875# $(RM) configure
Ingo Molnare0143ba2009-03-23 21:29:59 +0100876
877clean:
Ingo Molnar148be2c2009-04-27 08:02:14 +0200878 $(RM) *.o */*.o $(LIB_FILE)
Ingo Molnar07800602009-04-20 15:00:56 +0200879 $(RM) $(ALL_PROGRAMS) $(BUILT_INS) perf$X
Ingo Molnard24e4732009-04-20 13:32:07 +0200880 $(RM) $(TEST_PROGRAMS)
881 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
882 $(RM) -r autom4te.cache
883 $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
Ingo Molnar07800602009-04-20 15:00:56 +0200884 $(RM) -r $(PERF_TARNAME) .doc-tmp-dir
885 $(RM) $(PERF_TARNAME).tar.gz perf-core_$(PERF_VERSION)-*.tar.gz
Ingo Molnard24e4732009-04-20 13:32:07 +0200886 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
Ingo Molnarc1c23652009-05-30 12:38:51 +0200887 $(MAKE) -C Documentation/ clean
Ingo Molnar6f06ccb2009-04-20 15:22:22 +0200888 $(RM) PERF-VERSION-FILE PERF-CFLAGS PERF-BUILD-OPTIONS
Ingo Molnard24e4732009-04-20 13:32:07 +0200889
890.PHONY: all install clean strip
891.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Ingo Molnar07800602009-04-20 15:00:56 +0200892.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
893.PHONY: .FORCE-PERF-BUILD-OPTIONS
Ingo Molnard24e4732009-04-20 13:32:07 +0200894
Ingo Molnar07800602009-04-20 15:00:56 +0200895### Make sure built-ins do not have dups and listed in perf.c
Ingo Molnard24e4732009-04-20 13:32:07 +0200896#
897check-builtins::
898 ./check-builtins.sh
899
900### Test suite coverage testing
901#
Mike Galbraithc1079ab2009-06-02 10:17:34 +0200902# None right now
903#
904# .PHONY: coverage coverage-clean coverage-build coverage-report
905#
906# coverage:
907# $(MAKE) coverage-build
908# $(MAKE) coverage-report
909#
910# coverage-clean:
911# rm -f *.gcda *.gcno
912#
913# COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
914# COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
915#
916# coverage-build: coverage-clean
917# $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
918# $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
919# -j1 test
920#
921# coverage-report:
922# gcov -b *.c */*.c
923# grep '^function.*called 0 ' *.c.gcov */*.c.gcov \
924# | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
925# | tee coverage-untested-functions