@@ -33,6 +33,10 @@ RUNNER_SRC=test/runner-unix.c
33
33
RUNNER_CFLAGS =$(CFLAGS ) -I$(SRCDIR ) /test
34
34
RUNNER_LDFLAGS =-L"$(CURDIR ) " -luv -Xlinker -rpath -Xlinker "$(CURDIR ) "
35
35
36
+ HAVE_DTRACE =
37
+ DTRACE_OBJS =
38
+ DTRACE_HEADER =
39
+
36
40
OBJS += src/unix/async.o
37
41
OBJS += src/unix/core.o
38
42
OBJS += src/unix/dl.o
@@ -58,11 +62,14 @@ OBJS += src/inet.o
58
62
OBJS += src/version.o
59
63
60
64
ifeq (sunos,$(PLATFORM ) )
65
+ HAVE_DTRACE =1
61
66
CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
62
67
LDFLAGS+ =-lkstat -lnsl -lsendfile -lsocket
63
68
# Library dependencies are not transitive.
64
69
RUNNER_LDFLAGS += $(LDFLAGS )
65
70
OBJS += src/unix/sunos.o
71
+ OBJS += src/unix/dtrace.o
72
+ DTRACE_OBJS += src/unix/core.o
66
73
endif
67
74
68
75
ifeq (aix,$(PLATFORM ) )
@@ -72,6 +79,9 @@ OBJS += src/unix/aix.o
72
79
endif
73
80
74
81
ifeq (darwin,$(PLATFORM ) )
82
+ HAVE_DTRACE =1
83
+ # dtrace(1) probes contain dollar signs.
84
+ CFLAGS += -Wno-dollar-in-identifier-extension
75
85
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
76
86
LDFLAGS += -framework Foundation \
77
87
-framework CoreServices \
@@ -96,6 +106,7 @@ OBJS += src/unix/linux-core.o \
96
106
endif
97
107
98
108
ifeq (freebsd,$(PLATFORM ) )
109
+ HAVE_DTRACE =1
99
110
LDFLAGS+ =-lkvm
100
111
OBJS += src/unix/freebsd.o
101
112
OBJS += src/unix/kqueue.o
@@ -132,6 +143,12 @@ else
132
143
RUNNER_LDFLAGS += -pthread
133
144
endif
134
145
146
+ ifeq ($(HAVE_DTRACE ) , 1)
147
+ DTRACE_HEADER = src/unix/uv-dtrace.h
148
+ CPPFLAGS += -Isrc/unix
149
+ CFLAGS += -DHAVE_DTRACE
150
+ endif
151
+
135
152
libuv.a : $(OBJS )
136
153
$(AR ) rcs $@ $^
137
154
@@ -152,7 +169,7 @@ src/.buildstamp src/unix/.buildstamp test/.buildstamp:
152
169
mkdir -p $(@D )
153
170
touch $@
154
171
155
- src/unix/% .o src/unix/% .pic.o : src/unix/% .c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h src/unix/.buildstamp
172
+ src/unix/% .o src/unix/% .pic.o : src/unix/% .c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h src/unix/.buildstamp $( DTRACE_HEADER )
156
173
$(CC ) $(CSTDFLAG ) $(CPPFLAGS ) $(CFLAGS ) -c $< -o $@
157
174
158
175
src/% .o src/% .pic.o : src/% .c include/uv.h include/uv-private/uv-unix.h src/.buildstamp
@@ -162,7 +179,16 @@ test/%.o: test/%.c include/uv.h test/.buildstamp
162
179
$(CC ) $(CSTDFLAG ) $(CPPFLAGS ) $(CFLAGS ) -c $< -o $@
163
180
164
181
clean-platform :
165
- $(RM ) test/run-{tests,benchmarks}.dSYM $(OBJS ) $(OBJS:%.o=%.pic.o )
182
+ $(RM ) test/run-{tests,benchmarks}.dSYM $(OBJS ) $(OBJS:%.o=%.pic.o ) src/unix/uv-dtrace.h
166
183
167
184
% .pic.o % .o : % .m
168
185
$(OBJC ) $(CPPFLAGS ) $(CFLAGS ) -c $^ -o $@
186
+
187
+ src/unix/uv-dtrace.h : src/unix/uv-dtrace.d
188
+ dtrace -h -xnolibs -s $< -o $@
189
+
190
+ src/unix/dtrace.o : src/unix/uv-dtrace.d $(DTRACE_OBJS )
191
+ dtrace -G -s $^ -o $@
192
+
193
+ src/unix/dtrace.pic.o : src/unix/uv-dtrace.d $(DTRACE_OBJS:%.o=%.pic.o )
194
+ dtrace -G -s $^ -o $@
0 commit comments