Skip to content

Commit 8796cb9

Browse files
mfwittenacmel
authored andcommitted
perf tools: Makefile: Remove platform-specific cruft
While it makes sense that this tool could be used on other platforms at least to parse data, there doesn't appear to be any real support for such usage. This commit squashes several commits that remove: SNPRINTF_RETURNS_BOGUS FREAD_READS_DIRECTORIES NO_D_{INO,TYPE}_IN_DIRENT NO_STRCASESTR NO_MEMMEM NO_STRTOUMAX and NO_STRTOULL NO_SETENV NO_UNSETENV NO_MKDTEMP NEEDS_LIBICONV NEEDS_SOCKET NO_MMAP NO_PTHREADS NO_PREAD NO_TRUSTABLE_FILEMODE NO_IPV6 and NO_SOCKADDR_STORAGE NO_ICONV and OLD_ICONV NO_NSEC, USE_NSEC, and USE_ST_TIMESPEC NO_ST_BLOCKS_IN_STRUCT_STAT NO_FINK and NO_DARWIN_PORTS NO_SYS_SELECT_H NO_HSTRERROR DIR_HAS_BSD_GROUP_SEMANTICS and FORCE_DIR_SET_GID NEEDS_NSL, NO_UINTMAX_T, NO_INET_{N,P}TON COMPAT_{CFLAGS,OBJS} Executable extension `X' Signed-off-by: Michael Witten <[email protected]> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 006cdc3 commit 8796cb9

File tree

2 files changed

+8
-250
lines changed

2 files changed

+8
-250
lines changed

tools/perf/Makefile

Lines changed: 8 additions & 224 deletions
Original file line numberDiff line numberDiff line change
@@ -14,103 +14,23 @@ endif
1414
# Define V=1 to have a more verbose compile.
1515
# Define V=2 to have an even more verbose compile.
1616
#
17-
# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
18-
# or vsnprintf() return -1 instead of number of characters which would
19-
# have been written to the final string if enough space had been available.
20-
#
21-
# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
22-
# when attempting to read from an fopen'ed directory.
23-
#
2417
# Define CURLDIR=/foo/bar if your curl header and library files are in
2518
# /foo/bar/include and /foo/bar/lib directories.
2619
#
2720
# Define EXPATDIR=/foo/bar if your expat header and library files are in
2821
# /foo/bar/include and /foo/bar/lib directories.
2922
#
30-
# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
31-
#
32-
# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
33-
# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
34-
#
3523
# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
3624
# do not support the 'size specifiers' introduced by C99, namely ll, hh,
3725
# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
3826
# some C compilers supported these specifiers prior to C99 as an extension.
3927
#
40-
# Define NO_STRCASESTR if you don't have strcasestr.
41-
#
42-
# Define NO_MEMMEM if you don't have memmem.
43-
#
44-
# Define NO_STRTOUMAX if you don't have strtoumax in the C library.
45-
# If your compiler also does not support long long or does not have
46-
# strtoull, define NO_STRTOULL.
47-
#
48-
# Define NO_SETENV if you don't have setenv in the C library.
49-
#
50-
# Define NO_UNSETENV if you don't have unsetenv in the C library.
51-
#
52-
# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
53-
#
54-
# Define NO_SYS_SELECT_H if you don't have sys/select.h.
55-
#
56-
# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
57-
# installed in /sw, but don't want PERF to link against any libraries
58-
# installed there. If defined you may specify your own (or Fink's)
59-
# include directories and library directories by defining CFLAGS
60-
# and LDFLAGS appropriately.
61-
#
62-
# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
63-
# have DarwinPorts installed in /opt/local, but don't want PERF to
64-
# link against any libraries installed there. If defined you may
65-
# specify your own (or DarwinPort's) include directories and
66-
# library directories by defining CFLAGS and LDFLAGS appropriately.
67-
#
68-
# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
69-
#
70-
# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
71-
# Patrick Mauritz).
72-
#
73-
# Define NO_MMAP if you want to avoid mmap.
74-
#
75-
# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
76-
#
77-
# Define NO_PREAD if you have a problem with pread() system call (e.g.
78-
# cygwin.dll before v1.5.22).
79-
#
80-
# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
81-
# the executable mode bit, but doesn't really do so.
82-
#
83-
# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
84-
#
85-
# Define NO_SOCKADDR_STORAGE if your platform does not have struct
86-
# sockaddr_storage.
87-
#
88-
# Define NO_ICONV if your libc does not properly support iconv.
89-
#
90-
# Define OLD_ICONV if your library has an old iconv(), where the second
91-
# (input buffer pointer) parameter is declared with type (const char **).
92-
#
9328
# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
9429
#
9530
# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
9631
# that tells runtime paths to dynamic libraries;
9732
# "-Wl,-rpath=/path/lib" is used instead.
9833
#
99-
# Define USE_NSEC below if you want perf to care about sub-second file mtimes
100-
# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
101-
# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
102-
# randomly break unless your underlying filesystem supports those sub-second
103-
# times (my ext3 doesn't).
104-
#
105-
# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
106-
# "st_ctim"
107-
#
108-
# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
109-
# available. This automatically turns USE_NSEC off.
110-
#
111-
# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
112-
# field that counts the on-disk footprint in 512-byte blocks.
113-
#
11434
# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
11535
#
11636
# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
@@ -282,8 +202,6 @@ BASIC_LDFLAGS =
282202
# Guard against environment variables
283203
BUILTIN_OBJS =
284204
BUILT_INS =
285-
COMPAT_CFLAGS =
286-
COMPAT_OBJS =
287205
LIB_H =
288206
LIB_OBJS =
289207
PYRF_OBJS =
@@ -329,7 +247,7 @@ LANG_BINDINGS =
329247
ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
330248

331249
# what 'all' will build but not install in perfexecdir
332-
OTHER_PROGRAMS = $(OUTPUT)perf$X
250+
OTHER_PROGRAMS = $(OUTPUT)perf
333251

334252
# Set paths to tools early so that they can be used for version tests.
335253
ifndef SHELL_PATH
@@ -538,22 +456,6 @@ endif # NO_DWARF
538456

539457
-include arch/$(ARCH)/Makefile
540458

541-
ifeq ($(uname_S),Darwin)
542-
ifndef NO_FINK
543-
ifeq ($(shell test -d /sw/lib && echo y),y)
544-
BASIC_CFLAGS += -I/sw/include
545-
BASIC_LDFLAGS += -L/sw/lib
546-
endif
547-
endif
548-
ifndef NO_DARWIN_PORTS
549-
ifeq ($(shell test -d /opt/local/lib && echo y),y)
550-
BASIC_CFLAGS += -I/opt/local/include
551-
BASIC_LDFLAGS += -L/opt/local/lib
552-
endif
553-
endif
554-
PTHREAD_LIBS =
555-
endif
556-
557459
ifneq ($(OUTPUT),)
558460
BASIC_CFLAGS += -I$(OUTPUT)
559461
endif
@@ -707,110 +609,9 @@ ifndef CC_LD_DYNPATH
707609
endif
708610
endif
709611

710-
ifdef NEEDS_SOCKET
711-
EXTLIBS += -lsocket
712-
endif
713-
ifdef NEEDS_NSL
714-
EXTLIBS += -lnsl
715-
endif
716-
ifdef NO_D_TYPE_IN_DIRENT
717-
BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
718-
endif
719-
ifdef NO_D_INO_IN_DIRENT
720-
BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
721-
endif
722-
ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
723-
BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
724-
endif
725-
ifdef USE_NSEC
726-
BASIC_CFLAGS += -DUSE_NSEC
727-
endif
728-
ifdef USE_ST_TIMESPEC
729-
BASIC_CFLAGS += -DUSE_ST_TIMESPEC
730-
endif
731-
ifdef NO_NSEC
732-
BASIC_CFLAGS += -DNO_NSEC
733-
endif
734612
ifdef NO_C99_FORMAT
735613
BASIC_CFLAGS += -DNO_C99_FORMAT
736614
endif
737-
ifdef SNPRINTF_RETURNS_BOGUS
738-
COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
739-
COMPAT_OBJS += $(OUTPUT)compat/snprintf.o
740-
endif
741-
ifdef FREAD_READS_DIRECTORIES
742-
COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
743-
COMPAT_OBJS += $(OUTPUT)compat/fopen.o
744-
endif
745-
ifdef NO_STRCASESTR
746-
COMPAT_CFLAGS += -DNO_STRCASESTR
747-
COMPAT_OBJS += $(OUTPUT)compat/strcasestr.o
748-
endif
749-
ifdef NO_STRTOUMAX
750-
COMPAT_CFLAGS += -DNO_STRTOUMAX
751-
COMPAT_OBJS += $(OUTPUT)compat/strtoumax.o
752-
endif
753-
ifdef NO_STRTOULL
754-
COMPAT_CFLAGS += -DNO_STRTOULL
755-
endif
756-
ifdef NO_SETENV
757-
COMPAT_CFLAGS += -DNO_SETENV
758-
COMPAT_OBJS += $(OUTPUT)compat/setenv.o
759-
endif
760-
ifdef NO_MKDTEMP
761-
COMPAT_CFLAGS += -DNO_MKDTEMP
762-
COMPAT_OBJS += $(OUTPUT)compat/mkdtemp.o
763-
endif
764-
ifdef NO_UNSETENV
765-
COMPAT_CFLAGS += -DNO_UNSETENV
766-
COMPAT_OBJS += $(OUTPUT)compat/unsetenv.o
767-
endif
768-
ifdef NO_SYS_SELECT_H
769-
BASIC_CFLAGS += -DNO_SYS_SELECT_H
770-
endif
771-
ifdef NO_MMAP
772-
COMPAT_CFLAGS += -DNO_MMAP
773-
COMPAT_OBJS += $(OUTPUT)compat/mmap.o
774-
else
775-
ifdef USE_WIN32_MMAP
776-
COMPAT_CFLAGS += -DUSE_WIN32_MMAP
777-
COMPAT_OBJS += $(OUTPUT)compat/win32mmap.o
778-
endif
779-
endif
780-
ifdef NO_PREAD
781-
COMPAT_CFLAGS += -DNO_PREAD
782-
COMPAT_OBJS += $(OUTPUT)compat/pread.o
783-
endif
784-
ifdef NO_TRUSTABLE_FILEMODE
785-
BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
786-
endif
787-
ifdef NO_IPV6
788-
BASIC_CFLAGS += -DNO_IPV6
789-
endif
790-
ifdef NO_UINTMAX_T
791-
BASIC_CFLAGS += -Duintmax_t=uint32_t
792-
endif
793-
ifdef NO_SOCKADDR_STORAGE
794-
ifdef NO_IPV6
795-
BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
796-
else
797-
BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
798-
endif
799-
endif
800-
ifdef NO_INET_NTOP
801-
LIB_OBJS += $(OUTPUT)compat/inet_ntop.o
802-
endif
803-
ifdef NO_INET_PTON
804-
LIB_OBJS += $(OUTPUT)compat/inet_pton.o
805-
endif
806-
807-
ifdef NO_ICONV
808-
BASIC_CFLAGS += -DNO_ICONV
809-
endif
810-
811-
ifdef OLD_ICONV
812-
BASIC_CFLAGS += -DOLD_ICONV
813-
endif
814615

815616
ifdef NO_DEFLATE_BOUND
816617
BASIC_CFLAGS += -DNO_DEFLATE_BOUND
@@ -819,14 +620,6 @@ endif
819620
ifdef NO_PERL_MAKEMAKER
820621
export NO_PERL_MAKEMAKER
821622
endif
822-
ifdef NO_HSTRERROR
823-
COMPAT_CFLAGS += -DNO_HSTRERROR
824-
COMPAT_OBJS += $(OUTPUT)compat/hstrerror.o
825-
endif
826-
ifdef NO_MEMMEM
827-
COMPAT_CFLAGS += -DNO_MEMMEM
828-
COMPAT_OBJS += $(OUTPUT)compat/memmem.o
829-
endif
830623
ifdef INTERNAL_QSORT
831624
COMPAT_CFLAGS += -DINTERNAL_QSORT
832625
COMPAT_OBJS += $(OUTPUT)compat/qsort.o
@@ -835,9 +628,6 @@ ifdef RUNTIME_PREFIX
835628
COMPAT_CFLAGS += -DRUNTIME_PREFIX
836629
endif
837630

838-
ifdef DIR_HAS_BSD_GROUP_SEMANTICS
839-
COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
840-
endif
841631
ifdef NO_EXTERNAL_GREP
842632
BASIC_CFLAGS += -DNO_EXTERNAL_GREP
843633
endif
@@ -895,9 +685,6 @@ PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
895685

896686
LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive $(EXTLIBS)
897687

898-
BASIC_CFLAGS += $(COMPAT_CFLAGS)
899-
LIB_OBJS += $(COMPAT_OBJS)
900-
901688
ALL_CFLAGS += $(BASIC_CFLAGS)
902689
ALL_CFLAGS += $(ARCH_CFLAGS)
903690
ALL_LDFLAGS += $(BASIC_LDFLAGS)
@@ -910,9 +697,6 @@ export TAR INSTALL DESTDIR SHELL_PATH
910697
SHELL = $(SHELL_PATH)
911698

912699
all:: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(BUILT_INS) $(OTHER_PROGRAMS) $(OUTPUT)PERF-BUILD-OPTIONS
913-
ifneq (,$X)
914-
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
915-
endif
916700

917701
all::
918702

@@ -921,15 +705,15 @@ please_set_SHELL_PATH_to_a_more_modern_shell:
921705

922706
shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
923707

924-
strip: $(PROGRAMS) $(OUTPUT)perf$X
925-
$(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf$X
708+
strip: $(PROGRAMS) $(OUTPUT)perf
709+
$(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
926710

927711
$(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
928712
$(QUIET_CC)$(CC) -DPERF_VERSION='"$(PERF_VERSION)"' \
929713
'-DPERF_HTML_PATH="$(htmldir_SQ)"' \
930714
$(ALL_CFLAGS) -c $(filter %.c,$^) -o $@
931715

932-
$(OUTPUT)perf$X: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
716+
$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
933717
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \
934718
$(BUILTIN_OBJS) $(LIBS) -o $@
935719

@@ -1027,11 +811,11 @@ $(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/tra
1027811
$(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
1028812
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
1029813

1030-
$(OUTPUT)perf-%$X: %.o $(PERFLIBS)
814+
$(OUTPUT)perf-%: %.o $(PERFLIBS)
1031815
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
1032816

1033817
$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
1034-
$(patsubst perf-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
818+
$(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
1035819

1036820
# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So
1037821
# we depend the various files onto their directories.
@@ -1168,7 +952,7 @@ export perfexec_instdir
1168952

1169953
install: all
1170954
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
1171-
$(INSTALL) $(OUTPUT)perf$X '$(DESTDIR_SQ)$(bindir_SQ)'
955+
$(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'
1172956
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
1173957
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
1174958
$(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
@@ -1267,7 +1051,7 @@ distclean: clean
12671051

12681052
clean:
12691053
$(RM) $(OUTPUT){*.o,*/*.o,*/*/*.o,*/*/*/*.o,$(LIB_FILE),perf-archive}
1270-
$(RM) $(ALL_PROGRAMS) $(BUILT_INS) perf$X
1054+
$(RM) $(ALL_PROGRAMS) $(BUILT_INS) perf
12711055
$(RM) $(TEST_PROGRAMS)
12721056
$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
12731057
$(RM) -r $(PERF_TARNAME) .doc-tmp-dir

tools/perf/util/util.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@
7070
#include <sys/poll.h>
7171
#include <sys/socket.h>
7272
#include <sys/ioctl.h>
73-
#ifndef NO_SYS_SELECT_H
7473
#include <sys/select.h>
75-
#endif
7674
#include <netinet/in.h>
7775
#include <netinet/tcp.h>
7876
#include <arpa/inet.h>
@@ -83,10 +81,6 @@
8381
#include "types.h"
8482
#include <sys/ttydefaults.h>
8583

86-
#ifndef NO_ICONV
87-
#include <iconv.h>
88-
#endif
89-
9084
extern const char *graph_line;
9185
extern const char *graph_dotted_line;
9286
extern char buildid_dir[];
@@ -236,26 +230,6 @@ static inline int sane_case(int x, int high)
236230
return x;
237231
}
238232

239-
#ifndef DIR_HAS_BSD_GROUP_SEMANTICS
240-
# define FORCE_DIR_SET_GID S_ISGID
241-
#else
242-
# define FORCE_DIR_SET_GID 0
243-
#endif
244-
245-
#ifdef NO_NSEC
246-
#undef USE_NSEC
247-
#define ST_CTIME_NSEC(st) 0
248-
#define ST_MTIME_NSEC(st) 0
249-
#else
250-
#ifdef USE_ST_TIMESPEC
251-
#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctimespec.tv_nsec))
252-
#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtimespec.tv_nsec))
253-
#else
254-
#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctim.tv_nsec))
255-
#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtim.tv_nsec))
256-
#endif
257-
#endif
258-
259233
int mkdir_p(char *path, mode_t mode);
260234
int copyfile(const char *from, const char *to);
261235

0 commit comments

Comments
 (0)