VirtualBox

source: vbox/trunk/src/VBox/ExtPacks/VBoxDTrace/Makefile.kmk@ 55628

Last change on this file since 55628 was 54037, checked in by vboxsync, 10 years ago

nit

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.0 KB
Line 
1# $Id: Makefile.kmk 54037 2015-01-29 18:14:59Z vboxsync $
2## @file
3# Sub-makefile for VBoxDTrace.
4#
5# Contributed by: bird
6#
7
8#
9# Copyright (C) 2012-2015 Oracle Corporation
10#
11# This file is part of VirtualBox Open Source Edition (OSE), as
12# available from http://www.virtualbox.org. This file is free software;
13# you can redistribute it and/or modify it under the terms of the Common
14# Development and Distribution License Version 1.0 (CDDL) only, as it
15# comes in the "COPYING.CDDL" file of the VirtualBox OSE distribution.
16# VirtualBox OSE is distributed in the hope that it will be useful, but
17# WITHOUT ANY WARRANTY of any kind.
18#
19
20SUB_DEPTH = ../../../../
21include $(KBUILD_PATH)/subheader.kmk
22
23
24#
25# Globals.
26#
27VBOX_EXTPACK_VBOXDTRACE_NAME := Oracle VBoxDTrace Extension Pack
28VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME := Oracle_VBoxDTrace_Extension_Pack
29VBOX_PATH_EXTPACK_VBOXDTRACE = $(PATH_STAGE)/$(INST_EXTPACK)$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)
30INST_EXTPACK_VBOXDTRACE = $(INST_EXTPACK)$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/
31
32VBOXDT_PATH := $(PATH_ROOT)/src/VBox/ExtPacks/VBoxDTrace
33VBOXDT_PATH_ONNV := $(VBOXDT_PATH)/onnv
34VBOXDT_PATH_UTS := $(VBOXDT_PATH_ONNV)/uts
35VBOXDT_PATH_CMD := $(VBOXDT_PATH_ONNV)/cmd
36VBOXDT_PATH_LIBCTF := $(VBOXDT_PATH_ONNV)/lib/libctf
37VBOXDT_PATH_CMN_CTF := $(VBOXDT_PATH_ONNV)/common/ctf
38VBOXDT_PATH_LIBDTRACE := $(VBOXDT_PATH_ONNV)/lib/libdtrace
39VBOXDT_PATH_CMN_DTRACE := $(VBOXDT_PATH_ONNV)/common/dtrace
40
41
42ifndef VBOX_ONLY_EXTPACKS
43 #
44 # The generic wrapper that selects native or extpack dtrace cmd and adds our
45 # library path to the command line.
46 #
47 # Note! This is not installed as part of the extension pack, but always shipped
48 # with the base VBox installation.
49 #
50 PROGRAMS += VBoxDTrace
51 VBoxDTrace_TEMPLATE := VBOXR3EXE
52 VBoxDTrace_SOURCES := VBoxDTraceWrapper.cpp
53 VBoxDTrace_LIBS = $(LIB_RUNTIME)
54endif
55
56
57if defined(VBOX_WITH_EXTPACK_VBOXDTRACE) && defined(VBOX_WITH_EXTPACK)
58
59 #
60 # Extend the extension pack templates.
61 #
62 TEMPLATE_VBoxR3ExtPackDTrace = For the ring-3 context modules in the VBoxDTrace extension pack.
63 TEMPLATE_VBoxR3ExtPackDTrace_EXTENDS = VBoxR3ExtPack
64 TEMPLATE_VBoxR3ExtPackDTrace_INST = $(INST_EXTPACK_VBOXDTRACE)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
65
66 TEMPLATE_VBoxR0ExtPackDTrace = For the ring-0 context modules in the VBoxDTrace extension pack.
67 TEMPLATE_VBoxR0ExtPackDTrace_EXTENDS = VBoxR0ExtPack
68 TEMPLATE_VBoxR0ExtPackDTrace_INST = $(INST_EXTPACK_VBOXDTRACE)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
69
70 TEMPLATE_VBoxInsExtPackDTrace = For the install targets for the VBoxDTrace extension pack.
71 TEMPLATE_VBoxInsExtPackDTrace_EXTENDS = VBoxR0ExtPack
72 TEMPLATE_VBoxInsExtPackDTrace_INST = $(INST_EXTPACK_VBOXDTRACE)
73
74
75 #
76 # Install the description.
77 #
78 INSTALLS += VBoxDTraceIns
79 VBoxDTraceIns_TEMPLATE = VBoxInsExtPackDTrace
80 VBoxDTraceIns_SOURCES = \
81 $(VBoxDTraceIns_0_OUTDIR)/ExtPack.xml \
82 COPYING=>ExtPack-SourceCodeLicense.txt
83 $(call VBOX_EDIT_VERSION_RULE_FN,VBoxDTraceIns,ExtPack.xml)
84
85
86 #
87 # VBoxDTraceMain - The module which the VirtualBox Main API talks to.
88 #
89 DLLS += VBoxDTraceMain
90 VBoxDTraceMain_TEMPLATE = VBoxR3ExtPackDTrace
91 VBoxDTraceMain_SOURCES = VBoxDTraceMain.cpp
92
93
94 #
95 # The ring-3 VBoxDTrace command implementation (library).
96 #
97 ifneq ($(KBUILD_TARGET),solaris) # Temporarily disabled on Solaris (not really needed)...
98 DLLS += VBoxDTraceCmd
99 VBoxDTraceCmd_TEMPLATE = VBoxR3ExtPackDTrace
100 VBoxDTraceCmd_DEFS = RTMEM_WRAP_TO_EF_APIS
101 #VBoxDTraceCmd_DEFS += YYDEBUG
102 VBoxDTraceCmd_DEFS.linux = _XOPEN_SOURCE=700
103 VBoxDTraceCmd_SDKS = VBOX_ZLIB
104 ifn1of ($(KBUILD_TARGET), win)
105 VBoxDTraceCmd_CFLAGS = -Wno-format $(VBOX_GCC_Wno-overlength-strings) -Wno-sign-compare -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-shadow
106 endif
107 VBoxDTraceCmd_INCS = \
108 include \
109 $(VBOXDT_PATH_UTS)/common \
110 $(VBOXDT_PATH_LIBCTF)/common \
111 $(VBOXDT_PATH_LIBDTRACE)/common \
112 $(VBOXDT_PATH_CMN_CTF)
113 VBoxDTraceCmd_SOURCES = \
114 $(VBOXDT_PATH_CMD)/dtrace/dtrace.c \
115 \
116 $(VBOXDT_PATH_LIBDTRACE)/common/dt_as.c \
117 $(VBOXDT_PATH_LIBDTRACE)/common/dt_aggregate.c \
118 $(VBOXDT_PATH_LIBDTRACE)/common/dt_buf.c \
119 $(VBOXDT_PATH_LIBDTRACE)/common/dt_cc.c \
120 $(VBOXDT_PATH_LIBDTRACE)/common/dt_cg.c \
121 $(VBOXDT_PATH_LIBDTRACE)/common/dt_consume.c \
122 $(VBOXDT_PATH_LIBDTRACE)/common/dt_decl.c \
123 $(VBOXDT_PATH_LIBDTRACE)/common/dt_dis.c \
124 $(VBOXDT_PATH_LIBDTRACE)/common/dt_dof.c \
125 $(VBOXDT_PATH_LIBDTRACE)/common/dt_error.c \
126 $(VBOXDT_PATH_LIBDTRACE)/common/dt_handle.c \
127 $(VBOXDT_PATH_LIBDTRACE)/common/dt_ident.c \
128 $(VBOXDT_PATH_LIBDTRACE)/common/dt_inttab.c \
129 $(VBOXDT_PATH_LIBDTRACE)/common/dt_list.c \
130 $(VBOXDT_PATH_LIBDTRACE)/common/dt_map.c \
131 $(VBOXDT_PATH_LIBDTRACE)/common/dt_module.c \
132 $(VBOXDT_PATH_LIBDTRACE)/common/dt_program.c \
133 $(VBOXDT_PATH_LIBDTRACE)/common/dt_open.c \
134 $(VBOXDT_PATH_LIBDTRACE)/common/dt_options.c \
135 $(VBOXDT_PATH_LIBDTRACE)/common/dt_parser.c \
136 $(VBOXDT_PATH_LIBDTRACE)/common/dt_pcb.c \
137 $(VBOXDT_PATH_LIBDTRACE)/common/dt_pragma.c \
138 $(VBOXDT_PATH_LIBDTRACE)/common/dt_printf.c \
139 $(VBOXDT_PATH_LIBDTRACE)/common/dt_proc.c \
140 $(VBOXDT_PATH_LIBDTRACE)/common/dt_provider.c \
141 $(VBOXDT_PATH_LIBDTRACE)/common/dt_regset.c \
142 $(VBOXDT_PATH_LIBDTRACE)/common/dt_string.c \
143 $(VBOXDT_PATH_LIBDTRACE)/common/dt_strtab.c \
144 $(VBOXDT_PATH_LIBDTRACE)/common/dt_subr.c \
145 $(VBOXDT_PATH_LIBDTRACE)/common/dt_work.c \
146 $(VBOXDT_PATH_LIBDTRACE)/common/dt_xlator.c \
147 \
148 $(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c \
149 $(VBoxDTraceCmd_0_OUTDIR)/dt_names.c \
150 \
151 $(VBOXDT_PATH_CMN_CTF)/ctf_create.c \
152 $(VBOXDT_PATH_CMN_CTF)/ctf_error.c \
153 $(VBOXDT_PATH_CMN_CTF)/ctf_decl.c \
154 $(VBOXDT_PATH_CMN_CTF)/ctf_hash.c \
155 $(VBOXDT_PATH_CMN_CTF)/ctf_labels.c \
156 $(VBOXDT_PATH_CMN_CTF)/ctf_lookup.c \
157 $(VBOXDT_PATH_CMN_CTF)/ctf_open.c \
158 $(VBOXDT_PATH_CMN_CTF)/ctf_types.c \
159 $(VBOXDT_PATH_CMN_CTF)/ctf_util.c \
160 \
161 $(VBOXDT_PATH_LIBCTF)/common/ctf_subr.c \
162 $(VBOXDT_PATH_LIBCTF)/common/ctf_lib.c
163
164 # Source not used or wanted:
165 # $(VBOXDT_PATH_LIBDTRACE)/common/dt_link.c
166 # $(VBOXDT_PATH_LIBDTRACE)/common/dt_pid.c
167
168 # Generate sources
169 $$(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c: \
170 $(VBOXDT_PATH_LIBDTRACE)/common/dt_errtags.h \
171 $(VBOXDT_PATH_LIBDTRACE)/common/mkerrtags.sed \
172 | $$(dir $$@)
173 $(MSG_GENERATE,VBoxDTraceCmd,$@,$<)
174 $(SED) -n -f $(VBOXDT_PATH_LIBDTRACE)/common/mkerrtags.sed --output $@ $<
175
176 $$(VBoxDTraceCmd_0_OUTDIR)/dt_names.c: \
177 $(VBOXDT_PATH_UTS)/common/sys/dtrace.h \
178 $(VBOXDT_PATH_LIBDTRACE)/common/mknames.sed \
179 | $$(dir $$@)
180 $(MSG_GENERATE,VBoxDTraceCmd,$@,$<)
181 $(SED) -n -f $(VBOXDT_PATH_LIBDTRACE)/common/mknames.sed --output $@ $<
182
183 ifdef VBOX_HAVE_BISON
184 USES += yacc
185 VBoxDTraceCmd_USES += yacc
186 VBoxDTraceCmd_YACCTOOL = BISON
187 VBoxDTraceCmd_YACCFLAGS = -d -y
188 VBoxDTraceCmd_SOURCES += \
189 $(VBOXDT_PATH_LIBDTRACE)/common/dt_grammar.y
190 VBoxDTraceCmd_INCS += $(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common
191 else
192 VBoxDTraceCmd_SOURCES += \
193 $(VBOXDT_PATH)/generated/dt_grammar.c
194 VBoxDTraceCmd_INCS += \
195 $(VBOXDT_PATH)/generated/
196 endif
197
198 ifdef VBOX_HAVE_FLEX
199 USES += lex
200 VBoxDTraceCmd_USES += lex
201 VBoxDTraceCmd_LEXTOOL = FLEX
202 VBoxDTraceCmd_LEXFLAGS = -l -B #-d -T
203 VBoxDTraceCmd_SOURCES += \
204 $(VBOXDT_PATH_LIBDTRACE)/common/dt_lex.l
205 else
206 VBoxDTraceCmd_SOURCES += \
207 $(VBOXDT_PATH)/generated/dt_lex.c
208 endif
209 VBoxDTraceCmd_DEFS += USING_FLEX
210
211 #
212 # Updates the sources generated by flex and biosn.
213 # The SED processing removes the paths the from #line statements.
214 #
215 vboxdtrace-update-generated-sources: \
216 $$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_grammar.c \
217 $$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_grammar.h \
218 $$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_lex.c
219 $(foreach file,dt_grammar.c dt_grammar.h dt_lex.c \
220 ,$(NLTAB)$(SED) -e 's,$(VBOXDT_PATH_LIBDTRACE)/common/,,g'\
221 -e 's,$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/,,g' \
222 --output $(VBOXDT_PATH)/generated/$(file) \
223 $(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/$(file))
224 endif # Temporarily disabled on Solaris.
225
226 #
227 # The ring-0 part of VBoxDTrace.
228 #
229 ifneq ($(KBUILD_TARGET),solaris) # disabled on solaris - neiter needed nor currently able to build it here.
230 SYSMODS += VBoxDTraceR0
231 endif
232 VBoxDTraceR0_TEMPLATE = VBoxR0ExtPackDTrace
233 VBoxDTraceR0_DEFS = IN_VBOXDTRACE_R0 IN_RT_R0
234 ifeq ($(VBOX_LDR_FMT),elf)
235 VBoxDTraceR0_LDFLAGS = -e ModuleInit
236 endif
237 VBoxDTraceR0_INCS = \
238 include \
239 $(VBOXDT_PATH_UTS)/common
240 VBoxDTraceR0_SOURCES = \
241 VBoxDTraceR0.cpp \
242 VBoxDTraceR0A.asm \
243 $(VBOXDT_PATH_UTS)/common/dtrace/dtrace.c
244 VBoxDTraceR0_LIBS = \
245 $(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB)
246 ifneq ($(filter pe lx,$(VBOX_LDR_FMT)),)
247 VBoxDTraceR0_LIBS += \
248 $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
249 endif
250
251
252 #
253 # Packing.
254 #
255 ifndef VBOX_WITHOUT_EXTPACK_VBOXDTRACE_PACKING
256 PACKING += $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack
257 endif
258
259 ifndef VBOX_WITH_EXTPACK_OS_ARCHS
260 ifeq ($(USER),bird) # for now
261 VBOX_WITH_EXTPACK_OS_ARCHS = $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
262 endif
263 endif
264
265 # Build the file list. The macro takes 1=darwin.x86, 2=dist/VirtualBox.app/Contents/MacOS, 3=dylib
266 VBOX_VBOXDTRACE_FILES_MACRO = \
267 $(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceMain.$(3)=>$(1)/VBoxDTraceMain.$(3) \
268 $(if $(intersects $1, solaris.x86 solaris.amd64),, \
269 $(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceCmd.$(3)=>$(1)/VBoxDTraceCmd.$(3) \
270 $(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceR0.r0=>$(1)/VBoxDTraceR0.r0 \
271 )
272
273 VBOX_VBOXDTRACE_FILES := \
274 $(VBOX_PATH_EXTPACK_VBOXDTRACE)/ExtPack.xml=>ExtPack.xml \
275 $(VBOX_PATH_EXTPACK_VBOXDTRACE)/ExtPack-SourceCodeLicense.txt=>ExtPack-SourceCodeLicense.txt
276
277 if1of (darwin.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
278 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,darwin.amd64,dist/VirtualBox.app/Contents/MacOS,dylib)
279 endif
280 if1of (darwin.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
281 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,darwin.x86,dist/VirtualBox.app/Contents/MacOS,dylib)
282 endif
283 if1of (freebsd.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
284 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,freebsd.amd64,bin,so)
285 endif
286 if1of (freebsd.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
287 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,freebsd.x86,bin,so)
288 endif
289 if1of (linux.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
290 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,linux.amd64,bin,so)
291 endif
292 if1of (linux.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
293 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,linux.x86,bin,so)
294 endif
295 if1of (os2.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
296 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,os2.x86,bin,so)
297 endif
298 if1of (solaris.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
299 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,solaris.amd64,bin,so)
300 endif
301 if1of (solaris.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
302 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,solaris.x86,bin,so)
303 endif
304 if1of (win.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
305 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,win.amd64,bin,dll)
306 endif
307 if1of (win.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
308 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,win.x86,bin,dll)
309 endif
310
311 # Pack it all up using a temporary staging directory.
312 $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack: \
313 $$(foreach file, $$(VBOX_VBOXDTRACE_FILES), $$(firstword $$(subst =>,$$(SP),$$(file)))) \
314 | $(VBOX_PATH_PACKAGES)/
315 $(RM) -f $(wildcard $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-*.vbox-extpack) \
316 $(VBoxDTraceIns_0_OUTDIR)/ExtPack.manifest \
317 $(VBoxDTraceIns_0_OUTDIR)/ExtPack.signature
318 # Stage all the files
319 $(RM) -Rf $(VBoxDTraceIns_0_OUTDIR)/Stage/
320 $(foreach file, $(VBOX_VBOXDTRACE_FILES),\
321 $(NLTAB)$(MKDIR) -p $(dir $(lastword $(subst =>,$(SP)$(VBoxDTraceIns_0_OUTDIR)/Stage/,$(file)))) \
322 $(NLTAB)$(CP) $(subst =>,$(SP)$(VBoxDTraceIns_0_OUTDIR)/Stage/,$(file)) )
323 # Create the manifest
324 $(VBOX_RTMANIFEST) \
325 --manifest $(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.manifest \
326 --chdir $(VBoxDTraceIns_0_OUTDIR)/Stage/ \
327 $(foreach file, $(VBOX_VBOXDTRACE_FILES), $(lastword $(subst =>,$(SP),$(file))))
328 $(APPEND) $(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.signature "todo"
329 $(CHMOD) a+r \
330 $(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.manifest \
331 $(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.signature
332 # Tar it up.
333 tar -cvf - -C $(VBoxDTraceIns_0_OUTDIR)/Stage/ . | gzip -9c > $@
334 # Clean up
335 $(RM) -Rf $(VBoxDTraceIns_0_OUTDIR)/Stage/
336
337 BLDDIRS += $(VBOX_PATH_PACKAGES)/
338
339endif # VBOX_WITH_EXTPACK_VBOXDTRACE
340
341
342include $(FILE_KBUILD_SUB_FOOTER)
343
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette