1*86470930SIngo Molnar# The default target of this Makefile is... 2*86470930SIngo Molnarall:: 3*86470930SIngo Molnar 4*86470930SIngo Molnar# Define V=1 to have a more verbose compile. 5*86470930SIngo Molnar# 6*86470930SIngo Molnar# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf() 7*86470930SIngo Molnar# or vsnprintf() return -1 instead of number of characters which would 8*86470930SIngo Molnar# have been written to the final string if enough space had been available. 9*86470930SIngo Molnar# 10*86470930SIngo Molnar# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds 11*86470930SIngo Molnar# when attempting to read from an fopen'ed directory. 12*86470930SIngo Molnar# 13*86470930SIngo Molnar# Define NO_OPENSSL environment variable if you do not have OpenSSL. 14*86470930SIngo Molnar# This also implies MOZILLA_SHA1. 15*86470930SIngo Molnar# 16*86470930SIngo Molnar# Define CURLDIR=/foo/bar if your curl header and library files are in 17*86470930SIngo Molnar# /foo/bar/include and /foo/bar/lib directories. 18*86470930SIngo Molnar# 19*86470930SIngo Molnar# Define EXPATDIR=/foo/bar if your expat header and library files are in 20*86470930SIngo Molnar# /foo/bar/include and /foo/bar/lib directories. 21*86470930SIngo Molnar# 22*86470930SIngo Molnar# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. 23*86470930SIngo Molnar# 24*86470930SIngo Molnar# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks 25*86470930SIngo Molnar# d_type in struct dirent (latest Cygwin -- will be fixed soonish). 26*86470930SIngo Molnar# 27*86470930SIngo Molnar# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.) 28*86470930SIngo Molnar# do not support the 'size specifiers' introduced by C99, namely ll, hh, 29*86470930SIngo Molnar# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t). 30*86470930SIngo Molnar# some C compilers supported these specifiers prior to C99 as an extension. 31*86470930SIngo Molnar# 32*86470930SIngo Molnar# Define NO_STRCASESTR if you don't have strcasestr. 33*86470930SIngo Molnar# 34*86470930SIngo Molnar# Define NO_MEMMEM if you don't have memmem. 35*86470930SIngo Molnar# 36*86470930SIngo Molnar# Define NO_STRTOUMAX if you don't have strtoumax in the C library. 37*86470930SIngo Molnar# If your compiler also does not support long long or does not have 38*86470930SIngo Molnar# strtoull, define NO_STRTOULL. 39*86470930SIngo Molnar# 40*86470930SIngo Molnar# Define NO_SETENV if you don't have setenv in the C library. 41*86470930SIngo Molnar# 42*86470930SIngo Molnar# Define NO_UNSETENV if you don't have unsetenv in the C library. 43*86470930SIngo Molnar# 44*86470930SIngo Molnar# Define NO_MKDTEMP if you don't have mkdtemp in the C library. 45*86470930SIngo Molnar# 46*86470930SIngo Molnar# Define NO_SYS_SELECT_H if you don't have sys/select.h. 47*86470930SIngo Molnar# 48*86470930SIngo Molnar# Define NO_SYMLINK_HEAD if you never want .perf/HEAD to be a symbolic link. 49*86470930SIngo Molnar# Enable it on Windows. By default, symrefs are still used. 50*86470930SIngo Molnar# 51*86470930SIngo Molnar# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability 52*86470930SIngo Molnar# tests. These tests take up a significant amount of the total test time 53*86470930SIngo Molnar# but are not needed unless you plan to talk to SVN repos. 54*86470930SIngo Molnar# 55*86470930SIngo Molnar# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink 56*86470930SIngo Molnar# installed in /sw, but don't want PERF to link against any libraries 57*86470930SIngo Molnar# installed there. If defined you may specify your own (or Fink's) 58*86470930SIngo Molnar# include directories and library directories by defining CFLAGS 59*86470930SIngo Molnar# and LDFLAGS appropriately. 60*86470930SIngo Molnar# 61*86470930SIngo Molnar# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X, 62*86470930SIngo Molnar# have DarwinPorts installed in /opt/local, but don't want PERF to 63*86470930SIngo Molnar# link against any libraries installed there. If defined you may 64*86470930SIngo Molnar# specify your own (or DarwinPort's) include directories and 65*86470930SIngo Molnar# library directories by defining CFLAGS and LDFLAGS appropriately. 66*86470930SIngo Molnar# 67*86470930SIngo Molnar# Define PPC_SHA1 environment variable when running make to make use of 68*86470930SIngo Molnar# a bundled SHA1 routine optimized for PowerPC. 69*86470930SIngo Molnar# 70*86470930SIngo Molnar# Define ARM_SHA1 environment variable when running make to make use of 71*86470930SIngo Molnar# a bundled SHA1 routine optimized for ARM. 72*86470930SIngo Molnar# 73*86470930SIngo Molnar# Define MOZILLA_SHA1 environment variable when running make to make use of 74*86470930SIngo Molnar# a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast 75*86470930SIngo Molnar# on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default 76*86470930SIngo Molnar# choice) has very fast version optimized for i586. 77*86470930SIngo Molnar# 78*86470930SIngo Molnar# Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin). 79*86470930SIngo Molnar# 80*86470930SIngo Molnar# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin). 81*86470930SIngo Molnar# 82*86470930SIngo Molnar# Define NEEDS_SOCKET if linking with libc is not enough (SunOS, 83*86470930SIngo Molnar# Patrick Mauritz). 84*86470930SIngo Molnar# 85*86470930SIngo Molnar# Define NO_MMAP if you want to avoid mmap. 86*86470930SIngo Molnar# 87*86470930SIngo Molnar# Define NO_PTHREADS if you do not have or do not want to use Pthreads. 88*86470930SIngo Molnar# 89*86470930SIngo Molnar# Define NO_PREAD if you have a problem with pread() system call (e.g. 90*86470930SIngo Molnar# cygwin.dll before v1.5.22). 91*86470930SIngo Molnar# 92*86470930SIngo Molnar# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is 93*86470930SIngo Molnar# generally faster on your platform than accessing the working directory. 94*86470930SIngo Molnar# 95*86470930SIngo Molnar# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support 96*86470930SIngo Molnar# the executable mode bit, but doesn't really do so. 97*86470930SIngo Molnar# 98*86470930SIngo Molnar# Define NO_IPV6 if you lack IPv6 support and getaddrinfo(). 99*86470930SIngo Molnar# 100*86470930SIngo Molnar# Define NO_SOCKADDR_STORAGE if your platform does not have struct 101*86470930SIngo Molnar# sockaddr_storage. 102*86470930SIngo Molnar# 103*86470930SIngo Molnar# Define NO_ICONV if your libc does not properly support iconv. 104*86470930SIngo Molnar# 105*86470930SIngo Molnar# Define OLD_ICONV if your library has an old iconv(), where the second 106*86470930SIngo Molnar# (input buffer pointer) parameter is declared with type (const char **). 107*86470930SIngo Molnar# 108*86470930SIngo Molnar# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound. 109*86470930SIngo Molnar# 110*86470930SIngo Molnar# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib" 111*86470930SIngo Molnar# that tells runtime paths to dynamic libraries; 112*86470930SIngo Molnar# "-Wl,-rpath=/path/lib" is used instead. 113*86470930SIngo Molnar# 114*86470930SIngo Molnar# Define USE_NSEC below if you want perf to care about sub-second file mtimes 115*86470930SIngo Molnar# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and 116*86470930SIngo Molnar# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely 117*86470930SIngo Molnar# randomly break unless your underlying filesystem supports those sub-second 118*86470930SIngo Molnar# times (my ext3 doesn't). 119*86470930SIngo Molnar# 120*86470930SIngo Molnar# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of 121*86470930SIngo Molnar# "st_ctim" 122*86470930SIngo Molnar# 123*86470930SIngo Molnar# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec" 124*86470930SIngo Molnar# available. This automatically turns USE_NSEC off. 125*86470930SIngo Molnar# 126*86470930SIngo Molnar# Define USE_STDEV below if you want perf to care about the underlying device 127*86470930SIngo Molnar# change being considered an inode change from the update-index perspective. 128*86470930SIngo Molnar# 129*86470930SIngo Molnar# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks 130*86470930SIngo Molnar# field that counts the on-disk footprint in 512-byte blocks. 131*86470930SIngo Molnar# 132*86470930SIngo Molnar# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8 133*86470930SIngo Molnar# 134*86470930SIngo Molnar# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72. 135*86470930SIngo Molnar# 136*86470930SIngo Molnar# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's 137*86470930SIngo Molnar# MakeMaker (e.g. using ActiveState under Cygwin). 138*86470930SIngo Molnar# 139*86470930SIngo Molnar# Define NO_PERL if you do not want Perl scripts or libraries at all. 140*86470930SIngo Molnar# 141*86470930SIngo Molnar# Define INTERNAL_QSORT to use Git's implementation of qsort(), which 142*86470930SIngo Molnar# is a simplified version of the merge sort used in glibc. This is 143*86470930SIngo Molnar# recommended if Git triggers O(n^2) behavior in your platform's qsort(). 144*86470930SIngo Molnar# 145*86470930SIngo Molnar# Define NO_EXTERNAL_GREP if you don't want "perf grep" to ever call 146*86470930SIngo Molnar# your external grep (e.g., if your system lacks grep, if its grep is 147*86470930SIngo Molnar# broken, or spawning external process is slower than built-in grep perf has). 148*86470930SIngo Molnar 149*86470930SIngo MolnarPERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE 150*86470930SIngo Molnar @$(SHELL_PATH) util/PERF-VERSION-GEN 151*86470930SIngo Molnar-include PERF-VERSION-FILE 152*86470930SIngo Molnar 153*86470930SIngo Molnaruname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') 154*86470930SIngo Molnaruname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') 155*86470930SIngo Molnaruname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') 156*86470930SIngo Molnaruname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') 157*86470930SIngo Molnaruname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') 158*86470930SIngo Molnaruname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') 159*86470930SIngo Molnar 160*86470930SIngo Molnar# CFLAGS and LDFLAGS are for the users to override from the command line. 161*86470930SIngo Molnar 162*86470930SIngo MolnarCFLAGS = -ggdb3 -Wall -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -O6 163*86470930SIngo MolnarLDFLAGS = -lpthread -lrt -lelf 164*86470930SIngo MolnarALL_CFLAGS = $(CFLAGS) 165*86470930SIngo MolnarALL_LDFLAGS = $(LDFLAGS) 166*86470930SIngo MolnarSTRIP ?= strip 167*86470930SIngo Molnar 168*86470930SIngo Molnar# Among the variables below, these: 169*86470930SIngo Molnar# perfexecdir 170*86470930SIngo Molnar# template_dir 171*86470930SIngo Molnar# mandir 172*86470930SIngo Molnar# infodir 173*86470930SIngo Molnar# htmldir 174*86470930SIngo Molnar# ETC_PERFCONFIG (but not sysconfdir) 175*86470930SIngo Molnar# can be specified as a relative path some/where/else; 176*86470930SIngo Molnar# this is interpreted as relative to $(prefix) and "perf" at 177*86470930SIngo Molnar# runtime figures out where they are based on the path to the executable. 178*86470930SIngo Molnar# This can help installing the suite in a relocatable way. 179*86470930SIngo Molnar 180*86470930SIngo Molnarprefix = $(HOME) 181*86470930SIngo Molnarbindir_relative = bin 182*86470930SIngo Molnarbindir = $(prefix)/$(bindir_relative) 183*86470930SIngo Molnarmandir = share/man 184*86470930SIngo Molnarinfodir = share/info 185*86470930SIngo Molnarperfexecdir = libexec/perf-core 186*86470930SIngo Molnarsharedir = $(prefix)/share 187*86470930SIngo Molnartemplate_dir = share/perf-core/templates 188*86470930SIngo Molnarhtmldir = share/doc/perf-doc 189*86470930SIngo Molnarifeq ($(prefix),/usr) 190*86470930SIngo Molnarsysconfdir = /etc 191*86470930SIngo MolnarETC_PERFCONFIG = $(sysconfdir)/perfconfig 192*86470930SIngo Molnarelse 193*86470930SIngo Molnarsysconfdir = $(prefix)/etc 194*86470930SIngo MolnarETC_PERFCONFIG = etc/perfconfig 195*86470930SIngo Molnarendif 196*86470930SIngo Molnarlib = lib 197*86470930SIngo Molnar# DESTDIR= 198*86470930SIngo Molnar 199*86470930SIngo Molnarexport prefix bindir sharedir sysconfdir 200*86470930SIngo Molnar 201*86470930SIngo MolnarCC = gcc 202*86470930SIngo MolnarAR = ar 203*86470930SIngo MolnarRM = rm -f 204*86470930SIngo MolnarTAR = tar 205*86470930SIngo MolnarFIND = find 206*86470930SIngo MolnarINSTALL = install 207*86470930SIngo MolnarRPMBUILD = rpmbuild 208*86470930SIngo MolnarPTHREAD_LIBS = -lpthread 209*86470930SIngo Molnar 210*86470930SIngo Molnar# sparse is architecture-neutral, which means that we need to tell it 211*86470930SIngo Molnar# explicitly what architecture to check for. Fix this up for yours.. 212*86470930SIngo MolnarSPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ 213*86470930SIngo Molnar 214*86470930SIngo Molnar 215*86470930SIngo Molnar 216*86470930SIngo Molnar### --- END CONFIGURATION SECTION --- 217*86470930SIngo Molnar 218*86470930SIngo Molnar# Those must not be GNU-specific; they are shared with perl/ which may 219*86470930SIngo Molnar# be built by a different compiler. (Note that this is an artifact now 220*86470930SIngo Molnar# but it still might be nice to keep that distinction.) 221*86470930SIngo MolnarBASIC_CFLAGS = 222*86470930SIngo MolnarBASIC_LDFLAGS = 223*86470930SIngo Molnar 224*86470930SIngo Molnar# Guard against environment variables 225*86470930SIngo MolnarBUILTIN_OBJS = 226*86470930SIngo MolnarBUILT_INS = 227*86470930SIngo MolnarCOMPAT_CFLAGS = 228*86470930SIngo MolnarCOMPAT_OBJS = 229*86470930SIngo MolnarLIB_H = 230*86470930SIngo MolnarLIB_OBJS = 231*86470930SIngo MolnarSCRIPT_PERL = 232*86470930SIngo MolnarSCRIPT_SH = 233*86470930SIngo MolnarTEST_PROGRAMS = 234*86470930SIngo Molnar 235*86470930SIngo Molnar# 236*86470930SIngo Molnar# No scripts right now: 237*86470930SIngo Molnar# 238*86470930SIngo Molnar 239*86470930SIngo Molnar# SCRIPT_SH += perf-am.sh 240*86470930SIngo Molnar 241*86470930SIngo Molnar# 242*86470930SIngo Molnar# No Perl scripts right now: 243*86470930SIngo Molnar# 244*86470930SIngo Molnar 245*86470930SIngo Molnar# SCRIPT_PERL += perf-add--interactive.perl 246*86470930SIngo Molnar 247*86470930SIngo MolnarSCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ 248*86470930SIngo Molnar $(patsubst %.perl,%,$(SCRIPT_PERL)) 249*86470930SIngo Molnar 250*86470930SIngo Molnar# Empty... 251*86470930SIngo MolnarEXTRA_PROGRAMS = 252*86470930SIngo Molnar 253*86470930SIngo Molnar# ... and all the rest that could be moved out of bindir to perfexecdir 254*86470930SIngo MolnarPROGRAMS += $(EXTRA_PROGRAMS) 255*86470930SIngo Molnar 256*86470930SIngo Molnar# 257*86470930SIngo Molnar# Single 'perf' binary right now: 258*86470930SIngo Molnar# 259*86470930SIngo MolnarPROGRAMS += perf 260*86470930SIngo Molnar 261*86470930SIngo Molnar# List built-in command $C whose implementation cmd_$C() is not in 262*86470930SIngo Molnar# builtin-$C.o but is linked in as part of some other command. 263*86470930SIngo Molnar# 264*86470930SIngo Molnar# None right now: 265*86470930SIngo Molnar# 266*86470930SIngo Molnar# BUILT_INS += perf-init $X 267*86470930SIngo Molnar 268*86470930SIngo Molnar# what 'all' will build and 'install' will install, in perfexecdir 269*86470930SIngo MolnarALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) 270*86470930SIngo Molnar 271*86470930SIngo Molnar# what 'all' will build but not install in perfexecdir 272*86470930SIngo MolnarOTHER_PROGRAMS = perf$X 273*86470930SIngo Molnar 274*86470930SIngo Molnar# Set paths to tools early so that they can be used for version tests. 275*86470930SIngo Molnarifndef SHELL_PATH 276*86470930SIngo Molnar SHELL_PATH = /bin/sh 277*86470930SIngo Molnarendif 278*86470930SIngo Molnarifndef PERL_PATH 279*86470930SIngo Molnar PERL_PATH = /usr/bin/perl 280*86470930SIngo Molnarendif 281*86470930SIngo Molnar 282*86470930SIngo Molnarexport PERL_PATH 283*86470930SIngo Molnar 284*86470930SIngo MolnarLIB_FILE=libperf.a 285*86470930SIngo Molnar 286*86470930SIngo MolnarLIB_H += ../../include/linux/perf_counter.h 287*86470930SIngo MolnarLIB_H += perf.h 288*86470930SIngo MolnarLIB_H += util/list.h 289*86470930SIngo MolnarLIB_H += util/rbtree.h 290*86470930SIngo MolnarLIB_H += util/levenshtein.h 291*86470930SIngo MolnarLIB_H += util/parse-options.h 292*86470930SIngo MolnarLIB_H += util/parse-events.h 293*86470930SIngo MolnarLIB_H += util/quote.h 294*86470930SIngo MolnarLIB_H += util/util.h 295*86470930SIngo MolnarLIB_H += util/help.h 296*86470930SIngo MolnarLIB_H += util/strbuf.h 297*86470930SIngo MolnarLIB_H += util/string.h 298*86470930SIngo MolnarLIB_H += util/run-command.h 299*86470930SIngo MolnarLIB_H += util/sigchain.h 300*86470930SIngo MolnarLIB_H += util/symbol.h 301*86470930SIngo MolnarLIB_H += util/color.h 302*86470930SIngo Molnar 303*86470930SIngo MolnarLIB_OBJS += util/abspath.o 304*86470930SIngo MolnarLIB_OBJS += util/alias.o 305*86470930SIngo MolnarLIB_OBJS += util/config.o 306*86470930SIngo MolnarLIB_OBJS += util/ctype.o 307*86470930SIngo MolnarLIB_OBJS += util/environment.o 308*86470930SIngo MolnarLIB_OBJS += util/exec_cmd.o 309*86470930SIngo MolnarLIB_OBJS += util/help.o 310*86470930SIngo MolnarLIB_OBJS += util/levenshtein.o 311*86470930SIngo MolnarLIB_OBJS += util/parse-options.o 312*86470930SIngo MolnarLIB_OBJS += util/parse-events.o 313*86470930SIngo MolnarLIB_OBJS += util/path.o 314*86470930SIngo MolnarLIB_OBJS += util/rbtree.o 315*86470930SIngo MolnarLIB_OBJS += util/run-command.o 316*86470930SIngo MolnarLIB_OBJS += util/quote.o 317*86470930SIngo MolnarLIB_OBJS += util/strbuf.o 318*86470930SIngo MolnarLIB_OBJS += util/string.o 319*86470930SIngo MolnarLIB_OBJS += util/usage.o 320*86470930SIngo MolnarLIB_OBJS += util/wrapper.o 321*86470930SIngo MolnarLIB_OBJS += util/sigchain.o 322*86470930SIngo MolnarLIB_OBJS += util/symbol.o 323*86470930SIngo MolnarLIB_OBJS += util/color.o 324*86470930SIngo MolnarLIB_OBJS += util/pager.o 325*86470930SIngo Molnar 326*86470930SIngo MolnarBUILTIN_OBJS += builtin-annotate.o 327*86470930SIngo MolnarBUILTIN_OBJS += builtin-help.o 328*86470930SIngo MolnarBUILTIN_OBJS += builtin-list.o 329*86470930SIngo MolnarBUILTIN_OBJS += builtin-record.o 330*86470930SIngo MolnarBUILTIN_OBJS += builtin-report.o 331*86470930SIngo MolnarBUILTIN_OBJS += builtin-stat.o 332*86470930SIngo MolnarBUILTIN_OBJS += builtin-top.o 333*86470930SIngo Molnar 334*86470930SIngo MolnarPERFLIBS = $(LIB_FILE) 335*86470930SIngo MolnarEXTLIBS = 336*86470930SIngo Molnar 337*86470930SIngo Molnar# 338*86470930SIngo Molnar# Platform specific tweaks 339*86470930SIngo Molnar# 340*86470930SIngo Molnar 341*86470930SIngo Molnar# We choose to avoid "if .. else if .. else .. endif endif" 342*86470930SIngo Molnar# because maintaining the nesting to match is a pain. If 343*86470930SIngo Molnar# we had "elif" things would have been much nicer... 344*86470930SIngo Molnar 345*86470930SIngo Molnar-include config.mak.autogen 346*86470930SIngo Molnar-include config.mak 347*86470930SIngo Molnar 348*86470930SIngo Molnarifeq ($(uname_S),Darwin) 349*86470930SIngo Molnar ifndef NO_FINK 350*86470930SIngo Molnar ifeq ($(shell test -d /sw/lib && echo y),y) 351*86470930SIngo Molnar BASIC_CFLAGS += -I/sw/include 352*86470930SIngo Molnar BASIC_LDFLAGS += -L/sw/lib 353*86470930SIngo Molnar endif 354*86470930SIngo Molnar endif 355*86470930SIngo Molnar ifndef NO_DARWIN_PORTS 356*86470930SIngo Molnar ifeq ($(shell test -d /opt/local/lib && echo y),y) 357*86470930SIngo Molnar BASIC_CFLAGS += -I/opt/local/include 358*86470930SIngo Molnar BASIC_LDFLAGS += -L/opt/local/lib 359*86470930SIngo Molnar endif 360*86470930SIngo Molnar endif 361*86470930SIngo Molnar PTHREAD_LIBS = 362*86470930SIngo Molnarendif 363*86470930SIngo Molnar 364*86470930SIngo Molnarifndef CC_LD_DYNPATH 365*86470930SIngo Molnar ifdef NO_R_TO_GCC_LINKER 366*86470930SIngo Molnar # Some gcc does not accept and pass -R to the linker to specify 367*86470930SIngo Molnar # the runtime dynamic library path. 368*86470930SIngo Molnar CC_LD_DYNPATH = -Wl,-rpath, 369*86470930SIngo Molnar else 370*86470930SIngo Molnar CC_LD_DYNPATH = -R 371*86470930SIngo Molnar endif 372*86470930SIngo Molnarendif 373*86470930SIngo Molnar 374*86470930SIngo Molnarifdef ZLIB_PATH 375*86470930SIngo Molnar BASIC_CFLAGS += -I$(ZLIB_PATH)/include 376*86470930SIngo Molnar EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib) 377*86470930SIngo Molnarendif 378*86470930SIngo MolnarEXTLIBS += -lz 379*86470930SIngo Molnar 380*86470930SIngo Molnarifdef NEEDS_SOCKET 381*86470930SIngo Molnar EXTLIBS += -lsocket 382*86470930SIngo Molnarendif 383*86470930SIngo Molnarifdef NEEDS_NSL 384*86470930SIngo Molnar EXTLIBS += -lnsl 385*86470930SIngo Molnarendif 386*86470930SIngo Molnarifdef NO_D_TYPE_IN_DIRENT 387*86470930SIngo Molnar BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT 388*86470930SIngo Molnarendif 389*86470930SIngo Molnarifdef NO_D_INO_IN_DIRENT 390*86470930SIngo Molnar BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT 391*86470930SIngo Molnarendif 392*86470930SIngo Molnarifdef NO_ST_BLOCKS_IN_STRUCT_STAT 393*86470930SIngo Molnar BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT 394*86470930SIngo Molnarendif 395*86470930SIngo Molnarifdef USE_NSEC 396*86470930SIngo Molnar BASIC_CFLAGS += -DUSE_NSEC 397*86470930SIngo Molnarendif 398*86470930SIngo Molnarifdef USE_ST_TIMESPEC 399*86470930SIngo Molnar BASIC_CFLAGS += -DUSE_ST_TIMESPEC 400*86470930SIngo Molnarendif 401*86470930SIngo Molnarifdef NO_NSEC 402*86470930SIngo Molnar BASIC_CFLAGS += -DNO_NSEC 403*86470930SIngo Molnarendif 404*86470930SIngo Molnarifdef NO_C99_FORMAT 405*86470930SIngo Molnar BASIC_CFLAGS += -DNO_C99_FORMAT 406*86470930SIngo Molnarendif 407*86470930SIngo Molnarifdef SNPRINTF_RETURNS_BOGUS 408*86470930SIngo Molnar COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS 409*86470930SIngo Molnar COMPAT_OBJS += compat/snprintf.o 410*86470930SIngo Molnarendif 411*86470930SIngo Molnarifdef FREAD_READS_DIRECTORIES 412*86470930SIngo Molnar COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES 413*86470930SIngo Molnar COMPAT_OBJS += compat/fopen.o 414*86470930SIngo Molnarendif 415*86470930SIngo Molnarifdef NO_SYMLINK_HEAD 416*86470930SIngo Molnar BASIC_CFLAGS += -DNO_SYMLINK_HEAD 417*86470930SIngo Molnarendif 418*86470930SIngo Molnarifdef NO_STRCASESTR 419*86470930SIngo Molnar COMPAT_CFLAGS += -DNO_STRCASESTR 420*86470930SIngo Molnar COMPAT_OBJS += compat/strcasestr.o 421*86470930SIngo Molnarendif 422*86470930SIngo Molnarifdef NO_STRTOUMAX 423*86470930SIngo Molnar COMPAT_CFLAGS += -DNO_STRTOUMAX 424*86470930SIngo Molnar COMPAT_OBJS += compat/strtoumax.o 425*86470930SIngo Molnarendif 426*86470930SIngo Molnarifdef NO_STRTOULL 427*86470930SIngo Molnar COMPAT_CFLAGS += -DNO_STRTOULL 428*86470930SIngo Molnarendif 429*86470930SIngo Molnarifdef NO_SETENV 430*86470930SIngo Molnar COMPAT_CFLAGS += -DNO_SETENV 431*86470930SIngo Molnar COMPAT_OBJS += compat/setenv.o 432*86470930SIngo Molnarendif 433*86470930SIngo Molnarifdef NO_MKDTEMP 434*86470930SIngo Molnar COMPAT_CFLAGS += -DNO_MKDTEMP 435*86470930SIngo Molnar COMPAT_OBJS += compat/mkdtemp.o 436*86470930SIngo Molnarendif 437*86470930SIngo Molnarifdef NO_UNSETENV 438*86470930SIngo Molnar COMPAT_CFLAGS += -DNO_UNSETENV 439*86470930SIngo Molnar COMPAT_OBJS += compat/unsetenv.o 440*86470930SIngo Molnarendif 441*86470930SIngo Molnarifdef NO_SYS_SELECT_H 442*86470930SIngo Molnar BASIC_CFLAGS += -DNO_SYS_SELECT_H 443*86470930SIngo Molnarendif 444*86470930SIngo Molnarifdef NO_MMAP 445*86470930SIngo Molnar COMPAT_CFLAGS += -DNO_MMAP 446*86470930SIngo Molnar COMPAT_OBJS += compat/mmap.o 447*86470930SIngo Molnarelse 448*86470930SIngo Molnar ifdef USE_WIN32_MMAP 449*86470930SIngo Molnar COMPAT_CFLAGS += -DUSE_WIN32_MMAP 450*86470930SIngo Molnar COMPAT_OBJS += compat/win32mmap.o 451*86470930SIngo Molnar endif 452*86470930SIngo Molnarendif 453*86470930SIngo Molnarifdef NO_PREAD 454*86470930SIngo Molnar COMPAT_CFLAGS += -DNO_PREAD 455*86470930SIngo Molnar COMPAT_OBJS += compat/pread.o 456*86470930SIngo Molnarendif 457*86470930SIngo Molnarifdef NO_FAST_WORKING_DIRECTORY 458*86470930SIngo Molnar BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY 459*86470930SIngo Molnarendif 460*86470930SIngo Molnarifdef NO_TRUSTABLE_FILEMODE 461*86470930SIngo Molnar BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE 462*86470930SIngo Molnarendif 463*86470930SIngo Molnarifdef NO_IPV6 464*86470930SIngo Molnar BASIC_CFLAGS += -DNO_IPV6 465*86470930SIngo Molnarendif 466*86470930SIngo Molnarifdef NO_UINTMAX_T 467*86470930SIngo Molnar BASIC_CFLAGS += -Duintmax_t=uint32_t 468*86470930SIngo Molnarendif 469*86470930SIngo Molnarifdef NO_SOCKADDR_STORAGE 470*86470930SIngo Molnarifdef NO_IPV6 471*86470930SIngo Molnar BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in 472*86470930SIngo Molnarelse 473*86470930SIngo Molnar BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6 474*86470930SIngo Molnarendif 475*86470930SIngo Molnarendif 476*86470930SIngo Molnarifdef NO_INET_NTOP 477*86470930SIngo Molnar LIB_OBJS += compat/inet_ntop.o 478*86470930SIngo Molnarendif 479*86470930SIngo Molnarifdef NO_INET_PTON 480*86470930SIngo Molnar LIB_OBJS += compat/inet_pton.o 481*86470930SIngo Molnarendif 482*86470930SIngo Molnar 483*86470930SIngo Molnarifdef NO_ICONV 484*86470930SIngo Molnar BASIC_CFLAGS += -DNO_ICONV 485*86470930SIngo Molnarendif 486*86470930SIngo Molnar 487*86470930SIngo Molnarifdef OLD_ICONV 488*86470930SIngo Molnar BASIC_CFLAGS += -DOLD_ICONV 489*86470930SIngo Molnarendif 490*86470930SIngo Molnar 491*86470930SIngo Molnarifdef NO_DEFLATE_BOUND 492*86470930SIngo Molnar BASIC_CFLAGS += -DNO_DEFLATE_BOUND 493*86470930SIngo Molnarendif 494*86470930SIngo Molnar 495*86470930SIngo Molnarifdef PPC_SHA1 496*86470930SIngo Molnar SHA1_HEADER = "ppc/sha1.h" 497*86470930SIngo Molnar LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o 498*86470930SIngo Molnarelse 499*86470930SIngo Molnarifdef ARM_SHA1 500*86470930SIngo Molnar SHA1_HEADER = "arm/sha1.h" 501*86470930SIngo Molnar LIB_OBJS += arm/sha1.o arm/sha1_arm.o 502*86470930SIngo Molnarelse 503*86470930SIngo Molnarifdef MOZILLA_SHA1 504*86470930SIngo Molnar SHA1_HEADER = "mozilla-sha1/sha1.h" 505*86470930SIngo Molnar LIB_OBJS += mozilla-sha1/sha1.o 506*86470930SIngo Molnarelse 507*86470930SIngo Molnar SHA1_HEADER = <openssl/sha.h> 508*86470930SIngo Molnar EXTLIBS += $(LIB_4_CRYPTO) 509*86470930SIngo Molnarendif 510*86470930SIngo Molnarendif 511*86470930SIngo Molnarendif 512*86470930SIngo Molnarifdef NO_PERL_MAKEMAKER 513*86470930SIngo Molnar export NO_PERL_MAKEMAKER 514*86470930SIngo Molnarendif 515*86470930SIngo Molnarifdef NO_HSTRERROR 516*86470930SIngo Molnar COMPAT_CFLAGS += -DNO_HSTRERROR 517*86470930SIngo Molnar COMPAT_OBJS += compat/hstrerror.o 518*86470930SIngo Molnarendif 519*86470930SIngo Molnarifdef NO_MEMMEM 520*86470930SIngo Molnar COMPAT_CFLAGS += -DNO_MEMMEM 521*86470930SIngo Molnar COMPAT_OBJS += compat/memmem.o 522*86470930SIngo Molnarendif 523*86470930SIngo Molnarifdef INTERNAL_QSORT 524*86470930SIngo Molnar COMPAT_CFLAGS += -DINTERNAL_QSORT 525*86470930SIngo Molnar COMPAT_OBJS += compat/qsort.o 526*86470930SIngo Molnarendif 527*86470930SIngo Molnarifdef RUNTIME_PREFIX 528*86470930SIngo Molnar COMPAT_CFLAGS += -DRUNTIME_PREFIX 529*86470930SIngo Molnarendif 530*86470930SIngo Molnar 531*86470930SIngo Molnarifdef DIR_HAS_BSD_GROUP_SEMANTICS 532*86470930SIngo Molnar COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS 533*86470930SIngo Molnarendif 534*86470930SIngo Molnarifdef NO_EXTERNAL_GREP 535*86470930SIngo Molnar BASIC_CFLAGS += -DNO_EXTERNAL_GREP 536*86470930SIngo Molnarendif 537*86470930SIngo Molnar 538*86470930SIngo Molnarifeq ($(PERL_PATH),) 539*86470930SIngo MolnarNO_PERL=NoThanks 540*86470930SIngo Molnarendif 541*86470930SIngo Molnar 542*86470930SIngo MolnarQUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir 543*86470930SIngo MolnarQUIET_SUBDIR1 = 544*86470930SIngo Molnar 545*86470930SIngo Molnarifneq ($(findstring $(MAKEFLAGS),w),w) 546*86470930SIngo MolnarPRINT_DIR = --no-print-directory 547*86470930SIngo Molnarelse # "make -w" 548*86470930SIngo MolnarNO_SUBDIR = : 549*86470930SIngo Molnarendif 550*86470930SIngo Molnar 551*86470930SIngo Molnarifneq ($(findstring $(MAKEFLAGS),s),s) 552*86470930SIngo Molnarifndef V 553*86470930SIngo Molnar QUIET_CC = @echo ' ' CC $@; 554*86470930SIngo Molnar QUIET_AR = @echo ' ' AR $@; 555*86470930SIngo Molnar QUIET_LINK = @echo ' ' LINK $@; 556*86470930SIngo Molnar QUIET_BUILT_IN = @echo ' ' BUILTIN $@; 557*86470930SIngo Molnar QUIET_GEN = @echo ' ' GEN $@; 558*86470930SIngo Molnar QUIET_SUBDIR0 = +@subdir= 559*86470930SIngo Molnar QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ 560*86470930SIngo Molnar $(MAKE) $(PRINT_DIR) -C $$subdir 561*86470930SIngo Molnar export V 562*86470930SIngo Molnar export QUIET_GEN 563*86470930SIngo Molnar export QUIET_BUILT_IN 564*86470930SIngo Molnarendif 565*86470930SIngo Molnarendif 566*86470930SIngo Molnar 567*86470930SIngo Molnarifdef ASCIIDOC8 568*86470930SIngo Molnar export ASCIIDOC8 569*86470930SIngo Molnarendif 570*86470930SIngo Molnar 571*86470930SIngo Molnar# Shell quote (do not use $(call) to accommodate ancient setups); 572*86470930SIngo Molnar 573*86470930SIngo MolnarSHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER)) 574*86470930SIngo MolnarETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) 575*86470930SIngo Molnar 576*86470930SIngo MolnarDESTDIR_SQ = $(subst ','\'',$(DESTDIR)) 577*86470930SIngo Molnarbindir_SQ = $(subst ','\'',$(bindir)) 578*86470930SIngo Molnarbindir_relative_SQ = $(subst ','\'',$(bindir_relative)) 579*86470930SIngo Molnarmandir_SQ = $(subst ','\'',$(mandir)) 580*86470930SIngo Molnarinfodir_SQ = $(subst ','\'',$(infodir)) 581*86470930SIngo Molnarperfexecdir_SQ = $(subst ','\'',$(perfexecdir)) 582*86470930SIngo Molnartemplate_dir_SQ = $(subst ','\'',$(template_dir)) 583*86470930SIngo Molnarhtmldir_SQ = $(subst ','\'',$(htmldir)) 584*86470930SIngo Molnarprefix_SQ = $(subst ','\'',$(prefix)) 585*86470930SIngo Molnar 586*86470930SIngo MolnarSHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) 587*86470930SIngo MolnarPERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) 588*86470930SIngo Molnar 589*86470930SIngo MolnarLIBS = $(PERFLIBS) $(EXTLIBS) 590*86470930SIngo Molnar 591*86470930SIngo MolnarBASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \ 592*86470930SIngo Molnar $(COMPAT_CFLAGS) 593*86470930SIngo MolnarLIB_OBJS += $(COMPAT_OBJS) 594*86470930SIngo Molnar 595*86470930SIngo MolnarALL_CFLAGS += $(BASIC_CFLAGS) 596*86470930SIngo MolnarALL_LDFLAGS += $(BASIC_LDFLAGS) 597*86470930SIngo Molnar 598*86470930SIngo Molnarexport TAR INSTALL DESTDIR SHELL_PATH 599*86470930SIngo Molnar 600*86470930SIngo Molnar 601*86470930SIngo Molnar### Build rules 602*86470930SIngo Molnar 603*86470930SIngo MolnarSHELL = $(SHELL_PATH) 604*86470930SIngo Molnar 605*86470930SIngo Molnarall:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS 606*86470930SIngo Molnarifneq (,$X) 607*86470930SIngo Molnar $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';) 608*86470930SIngo Molnarendif 609*86470930SIngo Molnar 610*86470930SIngo Molnarall:: 611*86470930SIngo Molnar 612*86470930SIngo Molnarplease_set_SHELL_PATH_to_a_more_modern_shell: 613*86470930SIngo Molnar @$$(:) 614*86470930SIngo Molnar 615*86470930SIngo Molnarshell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell 616*86470930SIngo Molnar 617*86470930SIngo Molnarstrip: $(PROGRAMS) perf$X 618*86470930SIngo Molnar $(STRIP) $(STRIP_OPTS) $(PROGRAMS) perf$X 619*86470930SIngo Molnar 620*86470930SIngo Molnarperf.o: perf.c common-cmds.h PERF-CFLAGS 621*86470930SIngo Molnar $(QUIET_CC)$(CC) -DPERF_VERSION='"$(PERF_VERSION)"' \ 622*86470930SIngo Molnar '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ 623*86470930SIngo Molnar $(ALL_CFLAGS) -c $(filter %.c,$^) 624*86470930SIngo Molnar 625*86470930SIngo Molnarperf$X: perf.o $(BUILTIN_OBJS) $(PERFLIBS) 626*86470930SIngo Molnar $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ perf.o \ 627*86470930SIngo Molnar $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS) 628*86470930SIngo Molnar 629*86470930SIngo Molnarbuiltin-help.o: builtin-help.c common-cmds.h PERF-CFLAGS 630*86470930SIngo Molnar $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \ 631*86470930SIngo Molnar '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ 632*86470930SIngo Molnar '-DPERF_MAN_PATH="$(mandir_SQ)"' \ 633*86470930SIngo Molnar '-DPERF_INFO_PATH="$(infodir_SQ)"' $< 634*86470930SIngo Molnar 635*86470930SIngo Molnar$(BUILT_INS): perf$X 636*86470930SIngo Molnar $(QUIET_BUILT_IN)$(RM) $@ && \ 637*86470930SIngo Molnar ln perf$X $@ 2>/dev/null || \ 638*86470930SIngo Molnar ln -s perf$X $@ 2>/dev/null || \ 639*86470930SIngo Molnar cp perf$X $@ 640*86470930SIngo Molnar 641*86470930SIngo Molnarcommon-cmds.h: util/generate-cmdlist.sh command-list.txt 642*86470930SIngo Molnar 643*86470930SIngo Molnarcommon-cmds.h: $(wildcard Documentation/perf-*.txt) 644*86470930SIngo Molnar $(QUIET_GEN)util/generate-cmdlist.sh > $@+ && mv $@+ $@ 645*86470930SIngo Molnar 646*86470930SIngo Molnar$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh 647*86470930SIngo Molnar $(QUIET_GEN)$(RM) $@ $@+ && \ 648*86470930SIngo Molnar sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ 649*86470930SIngo Molnar -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ 650*86470930SIngo Molnar -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ 651*86470930SIngo Molnar -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \ 652*86470930SIngo Molnar -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ 653*86470930SIngo Molnar $@.sh >$@+ && \ 654*86470930SIngo Molnar chmod +x $@+ && \ 655*86470930SIngo Molnar mv $@+ $@ 656*86470930SIngo Molnar 657*86470930SIngo Molnarconfigure: configure.ac 658*86470930SIngo Molnar $(QUIET_GEN)$(RM) $@ $<+ && \ 659*86470930SIngo Molnar sed -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \ 660*86470930SIngo Molnar $< > $<+ && \ 661*86470930SIngo Molnar autoconf -o $@ $<+ && \ 662*86470930SIngo Molnar $(RM) $<+ 663*86470930SIngo Molnar 664*86470930SIngo Molnar# These can record PERF_VERSION 665*86470930SIngo Molnarperf.o perf.spec \ 666*86470930SIngo Molnar $(patsubst %.sh,%,$(SCRIPT_SH)) \ 667*86470930SIngo Molnar $(patsubst %.perl,%,$(SCRIPT_PERL)) \ 668*86470930SIngo Molnar : PERF-VERSION-FILE 669*86470930SIngo Molnar 670*86470930SIngo Molnar%.o: %.c PERF-CFLAGS 671*86470930SIngo Molnar $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $< 672*86470930SIngo Molnar%.s: %.c PERF-CFLAGS 673*86470930SIngo Molnar $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $< 674*86470930SIngo Molnar%.o: %.S 675*86470930SIngo Molnar $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $< 676*86470930SIngo Molnar 677*86470930SIngo Molnarutil/exec_cmd.o: util/exec_cmd.c PERF-CFLAGS 678*86470930SIngo Molnar $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \ 679*86470930SIngo Molnar '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \ 680*86470930SIngo Molnar '-DBINDIR="$(bindir_relative_SQ)"' \ 681*86470930SIngo Molnar '-DPREFIX="$(prefix_SQ)"' \ 682*86470930SIngo Molnar $< 683*86470930SIngo Molnar 684*86470930SIngo Molnarbuiltin-init-db.o: builtin-init-db.c PERF-CFLAGS 685*86470930SIngo Molnar $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_PERF_TEMPLATE_DIR='"$(template_dir_SQ)"' $< 686*86470930SIngo Molnar 687*86470930SIngo Molnarutil/config.o: util/config.c PERF-CFLAGS 688*86470930SIngo Molnar $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< 689*86470930SIngo Molnar 690*86470930SIngo Molnarperf-%$X: %.o $(PERFLIBS) 691*86470930SIngo Molnar $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) 692*86470930SIngo Molnar 693*86470930SIngo Molnar$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) 694*86470930SIngo Molnar$(patsubst perf-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) 695*86470930SIngo Molnarbuiltin-revert.o wt-status.o: wt-status.h 696*86470930SIngo Molnar 697*86470930SIngo Molnar$(LIB_FILE): $(LIB_OBJS) 698*86470930SIngo Molnar $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) 699*86470930SIngo Molnar 700*86470930SIngo Molnardoc: 701*86470930SIngo Molnar $(MAKE) -C Documentation all 702*86470930SIngo Molnar 703*86470930SIngo Molnarman: 704*86470930SIngo Molnar $(MAKE) -C Documentation man 705*86470930SIngo Molnar 706*86470930SIngo Molnarhtml: 707*86470930SIngo Molnar $(MAKE) -C Documentation html 708*86470930SIngo Molnar 709*86470930SIngo Molnarinfo: 710*86470930SIngo Molnar $(MAKE) -C Documentation info 711*86470930SIngo Molnar 712*86470930SIngo Molnarpdf: 713*86470930SIngo Molnar $(MAKE) -C Documentation pdf 714*86470930SIngo Molnar 715*86470930SIngo MolnarTAGS: 716*86470930SIngo Molnar $(RM) TAGS 717*86470930SIngo Molnar $(FIND) . -name '*.[hcS]' -print | xargs etags -a 718*86470930SIngo Molnar 719*86470930SIngo Molnartags: 720*86470930SIngo Molnar $(RM) tags 721*86470930SIngo Molnar $(FIND) . -name '*.[hcS]' -print | xargs ctags -a 722*86470930SIngo Molnar 723*86470930SIngo Molnarcscope: 724*86470930SIngo Molnar $(RM) cscope* 725*86470930SIngo Molnar $(FIND) . -name '*.[hcS]' -print | xargs cscope -b 726*86470930SIngo Molnar 727*86470930SIngo Molnar### Detect prefix changes 728*86470930SIngo MolnarTRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ 729*86470930SIngo Molnar $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) 730*86470930SIngo Molnar 731*86470930SIngo MolnarPERF-CFLAGS: .FORCE-PERF-CFLAGS 732*86470930SIngo Molnar @FLAGS='$(TRACK_CFLAGS)'; \ 733*86470930SIngo Molnar if test x"$$FLAGS" != x"`cat PERF-CFLAGS 2>/dev/null`" ; then \ 734*86470930SIngo Molnar echo 1>&2 " * new build flags or prefix"; \ 735*86470930SIngo Molnar echo "$$FLAGS" >PERF-CFLAGS; \ 736*86470930SIngo Molnar fi 737*86470930SIngo Molnar 738*86470930SIngo Molnar# We need to apply sq twice, once to protect from the shell 739*86470930SIngo Molnar# that runs PERF-BUILD-OPTIONS, and then again to protect it 740*86470930SIngo Molnar# and the first level quoting from the shell that runs "echo". 741*86470930SIngo MolnarPERF-BUILD-OPTIONS: .FORCE-PERF-BUILD-OPTIONS 742*86470930SIngo Molnar @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@ 743*86470930SIngo Molnar @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@ 744*86470930SIngo Molnar @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@ 745*86470930SIngo Molnar @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@ 746*86470930SIngo Molnar 747*86470930SIngo Molnar### Testing rules 748*86470930SIngo Molnar 749*86470930SIngo Molnar# 750*86470930SIngo Molnar# None right now: 751*86470930SIngo Molnar# 752*86470930SIngo Molnar# TEST_PROGRAMS += test-something$X 753*86470930SIngo Molnar 754*86470930SIngo Molnarall:: $(TEST_PROGRAMS) 755*86470930SIngo Molnar 756*86470930SIngo Molnar# GNU make supports exporting all variables by "export" without parameters. 757*86470930SIngo Molnar# However, the environment gets quite big, and some programs have problems 758*86470930SIngo Molnar# with that. 759*86470930SIngo Molnar 760*86470930SIngo Molnarexport NO_SVN_TESTS 761*86470930SIngo Molnar 762*86470930SIngo Molnarcheck: common-cmds.h 763*86470930SIngo Molnar if sparse; \ 764*86470930SIngo Molnar then \ 765*86470930SIngo Molnar for i in *.c */*.c; \ 766*86470930SIngo Molnar do \ 767*86470930SIngo Molnar sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \ 768*86470930SIngo Molnar done; \ 769*86470930SIngo Molnar else \ 770*86470930SIngo Molnar echo 2>&1 "Did you mean 'make test'?"; \ 771*86470930SIngo Molnar exit 1; \ 772*86470930SIngo Molnar fi 773*86470930SIngo Molnar 774*86470930SIngo Molnarremove-dashes: 775*86470930SIngo Molnar ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS) 776*86470930SIngo Molnar 777*86470930SIngo Molnar### Installation rules 778*86470930SIngo Molnar 779*86470930SIngo Molnarifneq ($(filter /%,$(firstword $(template_dir))),) 780*86470930SIngo Molnartemplate_instdir = $(template_dir) 781*86470930SIngo Molnarelse 782*86470930SIngo Molnartemplate_instdir = $(prefix)/$(template_dir) 783*86470930SIngo Molnarendif 784*86470930SIngo Molnarexport template_instdir 785*86470930SIngo Molnar 786*86470930SIngo Molnarifneq ($(filter /%,$(firstword $(perfexecdir))),) 787*86470930SIngo Molnarperfexec_instdir = $(perfexecdir) 788*86470930SIngo Molnarelse 789*86470930SIngo Molnarperfexec_instdir = $(prefix)/$(perfexecdir) 790*86470930SIngo Molnarendif 791*86470930SIngo Molnarperfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) 792*86470930SIngo Molnarexport perfexec_instdir 793*86470930SIngo Molnar 794*86470930SIngo Molnarinstall: all 795*86470930SIngo Molnar $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' 796*86470930SIngo Molnar $(INSTALL) perf$X '$(DESTDIR_SQ)$(bindir_SQ)' 797*86470930SIngo Molnarifdef BUILT_INS 798*86470930SIngo Molnar $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' 799*86470930SIngo Molnar $(INSTALL) $(BUILT_INS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' 800*86470930SIngo Molnarifneq (,$X) 801*86470930SIngo Molnar $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), $(RM) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$p';) 802*86470930SIngo Molnarendif 803*86470930SIngo Molnarendif 804*86470930SIngo Molnar 805*86470930SIngo Molnarinstall-doc: 806*86470930SIngo Molnar $(MAKE) -C Documentation install 807*86470930SIngo Molnar 808*86470930SIngo Molnarinstall-man: 809*86470930SIngo Molnar $(MAKE) -C Documentation install-man 810*86470930SIngo Molnar 811*86470930SIngo Molnarinstall-html: 812*86470930SIngo Molnar $(MAKE) -C Documentation install-html 813*86470930SIngo Molnar 814*86470930SIngo Molnarinstall-info: 815*86470930SIngo Molnar $(MAKE) -C Documentation install-info 816*86470930SIngo Molnar 817*86470930SIngo Molnarinstall-pdf: 818*86470930SIngo Molnar $(MAKE) -C Documentation install-pdf 819*86470930SIngo Molnar 820*86470930SIngo Molnarquick-install-doc: 821*86470930SIngo Molnar $(MAKE) -C Documentation quick-install 822*86470930SIngo Molnar 823*86470930SIngo Molnarquick-install-man: 824*86470930SIngo Molnar $(MAKE) -C Documentation quick-install-man 825*86470930SIngo Molnar 826*86470930SIngo Molnarquick-install-html: 827*86470930SIngo Molnar $(MAKE) -C Documentation quick-install-html 828*86470930SIngo Molnar 829*86470930SIngo Molnar 830*86470930SIngo Molnar### Maintainer's dist rules 831*86470930SIngo Molnar# 832*86470930SIngo Molnar# None right now 833*86470930SIngo Molnar# 834*86470930SIngo Molnar# 835*86470930SIngo Molnar# perf.spec: perf.spec.in 836*86470930SIngo Molnar# sed -e 's/@@VERSION@@/$(PERF_VERSION)/g' < $< > $@+ 837*86470930SIngo Molnar# mv $@+ $@ 838*86470930SIngo Molnar# 839*86470930SIngo Molnar# PERF_TARNAME=perf-$(PERF_VERSION) 840*86470930SIngo Molnar# dist: perf.spec perf-archive$(X) configure 841*86470930SIngo Molnar# ./perf-archive --format=tar \ 842*86470930SIngo Molnar# --prefix=$(PERF_TARNAME)/ HEAD^{tree} > $(PERF_TARNAME).tar 843*86470930SIngo Molnar# @mkdir -p $(PERF_TARNAME) 844*86470930SIngo Molnar# @cp perf.spec configure $(PERF_TARNAME) 845*86470930SIngo Molnar# @echo $(PERF_VERSION) > $(PERF_TARNAME)/version 846*86470930SIngo Molnar# $(TAR) rf $(PERF_TARNAME).tar \ 847*86470930SIngo Molnar# $(PERF_TARNAME)/perf.spec \ 848*86470930SIngo Molnar# $(PERF_TARNAME)/configure \ 849*86470930SIngo Molnar# $(PERF_TARNAME)/version 850*86470930SIngo Molnar# @$(RM) -r $(PERF_TARNAME) 851*86470930SIngo Molnar# gzip -f -9 $(PERF_TARNAME).tar 852*86470930SIngo Molnar# 853*86470930SIngo Molnar# htmldocs = perf-htmldocs-$(PERF_VERSION) 854*86470930SIngo Molnar# manpages = perf-manpages-$(PERF_VERSION) 855*86470930SIngo Molnar# dist-doc: 856*86470930SIngo Molnar# $(RM) -r .doc-tmp-dir 857*86470930SIngo Molnar# mkdir .doc-tmp-dir 858*86470930SIngo Molnar# $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc 859*86470930SIngo Molnar# cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar . 860*86470930SIngo Molnar# gzip -n -9 -f $(htmldocs).tar 861*86470930SIngo Molnar# : 862*86470930SIngo Molnar# $(RM) -r .doc-tmp-dir 863*86470930SIngo Molnar# mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7 864*86470930SIngo Molnar# $(MAKE) -C Documentation DESTDIR=./ \ 865*86470930SIngo Molnar# man1dir=../.doc-tmp-dir/man1 \ 866*86470930SIngo Molnar# man5dir=../.doc-tmp-dir/man5 \ 867*86470930SIngo Molnar# man7dir=../.doc-tmp-dir/man7 \ 868*86470930SIngo Molnar# install 869*86470930SIngo Molnar# cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar . 870*86470930SIngo Molnar# gzip -n -9 -f $(manpages).tar 871*86470930SIngo Molnar# $(RM) -r .doc-tmp-dir 872*86470930SIngo Molnar# 873*86470930SIngo Molnar# rpm: dist 874*86470930SIngo Molnar# $(RPMBUILD) -ta $(PERF_TARNAME).tar.gz 875*86470930SIngo Molnar 876*86470930SIngo Molnar### Cleaning rules 877*86470930SIngo Molnar 878*86470930SIngo Molnardistclean: clean 879*86470930SIngo Molnar# $(RM) configure 880*86470930SIngo Molnar 881*86470930SIngo Molnarclean: 882*86470930SIngo Molnar $(RM) *.o */*.o $(LIB_FILE) 883*86470930SIngo Molnar $(RM) $(ALL_PROGRAMS) $(BUILT_INS) perf$X 884*86470930SIngo Molnar $(RM) $(TEST_PROGRAMS) 885*86470930SIngo Molnar $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope* 886*86470930SIngo Molnar $(RM) -r autom4te.cache 887*86470930SIngo Molnar $(RM) config.log config.mak.autogen config.mak.append config.status config.cache 888*86470930SIngo Molnar $(RM) -r $(PERF_TARNAME) .doc-tmp-dir 889*86470930SIngo Molnar $(RM) $(PERF_TARNAME).tar.gz perf-core_$(PERF_VERSION)-*.tar.gz 890*86470930SIngo Molnar $(RM) $(htmldocs).tar.gz $(manpages).tar.gz 891*86470930SIngo Molnar $(MAKE) -C Documentation/ clean 892*86470930SIngo Molnar $(RM) PERF-VERSION-FILE PERF-CFLAGS PERF-BUILD-OPTIONS 893*86470930SIngo Molnar 894*86470930SIngo Molnar.PHONY: all install clean strip 895*86470930SIngo Molnar.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell 896*86470930SIngo Molnar.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS 897*86470930SIngo Molnar.PHONY: .FORCE-PERF-BUILD-OPTIONS 898*86470930SIngo Molnar 899*86470930SIngo Molnar### Make sure built-ins do not have dups and listed in perf.c 900*86470930SIngo Molnar# 901*86470930SIngo Molnarcheck-builtins:: 902*86470930SIngo Molnar ./check-builtins.sh 903*86470930SIngo Molnar 904*86470930SIngo Molnar### Test suite coverage testing 905*86470930SIngo Molnar# 906*86470930SIngo Molnar# None right now 907*86470930SIngo Molnar# 908*86470930SIngo Molnar# .PHONY: coverage coverage-clean coverage-build coverage-report 909*86470930SIngo Molnar# 910*86470930SIngo Molnar# coverage: 911*86470930SIngo Molnar# $(MAKE) coverage-build 912*86470930SIngo Molnar# $(MAKE) coverage-report 913*86470930SIngo Molnar# 914*86470930SIngo Molnar# coverage-clean: 915*86470930SIngo Molnar# rm -f *.gcda *.gcno 916*86470930SIngo Molnar# 917*86470930SIngo Molnar# COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs 918*86470930SIngo Molnar# COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov 919*86470930SIngo Molnar# 920*86470930SIngo Molnar# coverage-build: coverage-clean 921*86470930SIngo Molnar# $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all 922*86470930SIngo Molnar# $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \ 923*86470930SIngo Molnar# -j1 test 924*86470930SIngo Molnar# 925*86470930SIngo Molnar# coverage-report: 926*86470930SIngo Molnar# gcov -b *.c */*.c 927*86470930SIngo Molnar# grep '^function.*called 0 ' *.c.gcov */*.c.gcov \ 928*86470930SIngo Molnar# | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \ 929*86470930SIngo Molnar# | tee coverage-untested-functions 930