VirtualBox

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

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

wrong way around...

  • 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 54004 2015-01-28 01:59:01Z 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) # disabled on solaris - neiter needed nor currently able to build it here.
98 DLLS += VBoxDTraceCmd
99 endif
100 VBoxDTraceCmd_TEMPLATE = VBoxR3ExtPackDTrace
101 VBoxDTraceCmd_DEFS = RTMEM_WRAP_TO_EF_APIS
102 #VBoxDTraceCmd_DEFS += YYDEBUG
103 VBoxDTraceCmd_DEFS.linux = _XOPEN_SOURCE=700
104 VBoxDTraceCmd_SDKS = VBOX_ZLIB
105 ifn1of ($(KBUILD_TARGET), win)
106 VBoxDTraceCmd_CFLAGS = -Wno-format $(VBOX_GCC_Wno-overlength-strings) -Wno-sign-compare -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-shadow
107 endif
108 VBoxDTraceCmd_INCS = \
109 include \
110 $(VBOXDT_PATH_UTS)/common \
111 $(VBOXDT_PATH_LIBCTF)/common \
112 $(VBOXDT_PATH_LIBDTRACE)/common \
113 $(VBOXDT_PATH_CMN_CTF)
114 VBoxDTraceCmd_SOURCES = \
115 $(VBOXDT_PATH_CMD)/dtrace/dtrace.c \
116 \
117 $(VBOXDT_PATH_LIBDTRACE)/common/dt_as.c \
118 $(VBOXDT_PATH_LIBDTRACE)/common/dt_aggregate.c \
119 $(VBOXDT_PATH_LIBDTRACE)/common/dt_buf.c \
120 $(VBOXDT_PATH_LIBDTRACE)/common/dt_cc.c \
121 $(VBOXDT_PATH_LIBDTRACE)/common/dt_cg.c \
122 $(VBOXDT_PATH_LIBDTRACE)/common/dt_consume.c \
123 $(VBOXDT_PATH_LIBDTRACE)/common/dt_decl.c \
124 $(VBOXDT_PATH_LIBDTRACE)/common/dt_dis.c \
125 $(VBOXDT_PATH_LIBDTRACE)/common/dt_dof.c \
126 $(VBOXDT_PATH_LIBDTRACE)/common/dt_error.c \
127 $(VBOXDT_PATH_LIBDTRACE)/common/dt_handle.c \
128 $(VBOXDT_PATH_LIBDTRACE)/common/dt_ident.c \
129 $(VBOXDT_PATH_LIBDTRACE)/common/dt_inttab.c \
130 $(VBOXDT_PATH_LIBDTRACE)/common/dt_list.c \
131 $(VBOXDT_PATH_LIBDTRACE)/common/dt_map.c \
132 $(VBOXDT_PATH_LIBDTRACE)/common/dt_module.c \
133 $(VBOXDT_PATH_LIBDTRACE)/common/dt_program.c \
134 $(VBOXDT_PATH_LIBDTRACE)/common/dt_open.c \
135 $(VBOXDT_PATH_LIBDTRACE)/common/dt_options.c \
136 $(VBOXDT_PATH_LIBDTRACE)/common/dt_parser.c \
137 $(VBOXDT_PATH_LIBDTRACE)/common/dt_pcb.c \
138 $(VBOXDT_PATH_LIBDTRACE)/common/dt_pragma.c \
139 $(VBOXDT_PATH_LIBDTRACE)/common/dt_printf.c \
140 $(VBOXDT_PATH_LIBDTRACE)/common/dt_proc.c \
141 $(VBOXDT_PATH_LIBDTRACE)/common/dt_provider.c \
142 $(VBOXDT_PATH_LIBDTRACE)/common/dt_regset.c \
143 $(VBOXDT_PATH_LIBDTRACE)/common/dt_string.c \
144 $(VBOXDT_PATH_LIBDTRACE)/common/dt_strtab.c \
145 $(VBOXDT_PATH_LIBDTRACE)/common/dt_subr.c \
146 $(VBOXDT_PATH_LIBDTRACE)/common/dt_work.c \
147 $(VBOXDT_PATH_LIBDTRACE)/common/dt_xlator.c \
148 \
149 $(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c \
150 $(VBoxDTraceCmd_0_OUTDIR)/dt_names.c \
151 \
152 $(VBOXDT_PATH_CMN_CTF)/ctf_create.c \
153 $(VBOXDT_PATH_CMN_CTF)/ctf_error.c \
154 $(VBOXDT_PATH_CMN_CTF)/ctf_decl.c \
155 $(VBOXDT_PATH_CMN_CTF)/ctf_hash.c \
156 $(VBOXDT_PATH_CMN_CTF)/ctf_labels.c \
157 $(VBOXDT_PATH_CMN_CTF)/ctf_lookup.c \
158 $(VBOXDT_PATH_CMN_CTF)/ctf_open.c \
159 $(VBOXDT_PATH_CMN_CTF)/ctf_types.c \
160 $(VBOXDT_PATH_CMN_CTF)/ctf_util.c \
161 \
162 $(VBOXDT_PATH_LIBCTF)/common/ctf_subr.c \
163 $(VBOXDT_PATH_LIBCTF)/common/ctf_lib.c
164
165 # Source not used or wanted:
166 # $(VBOXDT_PATH_LIBDTRACE)/common/dt_link.c
167 # $(VBOXDT_PATH_LIBDTRACE)/common/dt_pid.c
168
169 # Generate sources
170 $$(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c: \
171 $(VBOXDT_PATH_LIBDTRACE)/common/dt_errtags.h \
172 $(VBOXDT_PATH_LIBDTRACE)/common/mkerrtags.sed \
173 | $$(dir $$@)
174 $(MSG_GENERATE,VBoxDTraceCmd,$@,$<)
175 $(SED) -n -f $(VBOXDT_PATH_LIBDTRACE)/common/mkerrtags.sed --output $@ $<
176
177 $$(VBoxDTraceCmd_0_OUTDIR)/dt_names.c: \
178 $(VBOXDT_PATH_UTS)/common/sys/dtrace.h \
179 $(VBOXDT_PATH_LIBDTRACE)/common/mknames.sed \
180 | $$(dir $$@)
181 $(MSG_GENERATE,VBoxDTraceCmd,$@,$<)
182 $(SED) -n -f $(VBOXDT_PATH_LIBDTRACE)/common/mknames.sed --output $@ $<
183
184 ifdef VBOX_HAVE_BISON
185 USES += yacc
186 VBoxDTraceCmd_USES += yacc
187 VBoxDTraceCmd_YACCTOOL = BISON
188 VBoxDTraceCmd_YACCFLAGS = -d -y
189 VBoxDTraceCmd_SOURCES += \
190 $(VBOXDT_PATH_LIBDTRACE)/common/dt_grammar.y
191 VBoxDTraceCmd_INCS += $(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common
192 else
193 VBoxDTraceCmd_SOURCES += \
194 $(VBOXDT_PATH)/generated/dt_grammar.c
195 VBoxDTraceCmd_INCS += \
196 $(VBOXDT_PATH)/generated/
197 endif
198
199 ifdef VBOX_HAVE_FLEX
200 USES += lex
201 VBoxDTraceCmd_USES += lex
202 VBoxDTraceCmd_LEXTOOL = FLEX
203 VBoxDTraceCmd_LEXFLAGS = -l -B #-d -T
204 VBoxDTraceCmd_SOURCES += \
205 $(VBOXDT_PATH_LIBDTRACE)/common/dt_lex.l
206 else
207 VBoxDTraceCmd_SOURCES += \
208 $(VBOXDT_PATH)/generated/dt_lex.c
209 endif
210 VBoxDTraceCmd_DEFS += USING_FLEX
211
212 #
213 # Updates the sources generated by flex and biosn.
214 # The SED processing removes the paths the from #line statements.
215 #
216 vboxdtrace-update-generated-sources: \
217 $$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_grammar.c \
218 $$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_grammar.h \
219 $$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_lex.c
220 $(foreach file,dt_grammar.c dt_grammar.h dt_lex.c \
221 ,$(NLTAB)$(SED) -e 's,$(VBOXDT_PATH_LIBDTRACE)/common/,,g'\
222 -e 's,$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/,,g' \
223 --output $(VBOXDT_PATH)/generated/$(file) \
224 $(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/$(file))
225
226
227 #
228 # The ring-0 part of VBoxDTrace.
229 #
230 ifneq ($(KBUILD_TARGET),solaris) # disabled on solaris - neiter needed nor currently able to build it here.
231 SYSMODS += VBoxDTraceR0
232 endif
233 VBoxDTraceR0_TEMPLATE = VBoxR0ExtPackDTrace
234 VBoxDTraceR0_DEFS = IN_VBOXDTRACE_R0 IN_RT_R0
235 ifeq ($(VBOX_LDR_FMT),elf)
236 VBoxDTraceR0_LDFLAGS = -e ModuleInit
237 endif
238 VBoxDTraceR0_INCS = \
239 include \
240 $(VBOXDT_PATH_UTS)/common
241 VBoxDTraceR0_SOURCES = \
242 VBoxDTraceR0.cpp \
243 VBoxDTraceR0A.asm \
244 $(VBOXDT_PATH_UTS)/common/dtrace/dtrace.c
245 VBoxDTraceR0_LIBS = \
246 $(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB)
247 ifneq ($(filter pe lx,$(VBOX_LDR_FMT)),)
248 VBoxDTraceR0_LIBS += \
249 $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
250 endif
251
252
253 #
254 # Packing.
255 #
256 ifndef VBOX_WITHOUT_EXTPACK_VBOXDTRACE_PACKING
257 PACKING += $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack
258 endif
259
260 ifndef VBOX_WITH_EXTPACK_OS_ARCHS
261 ifeq ($(USER),bird) # for now
262 VBOX_WITH_EXTPACK_OS_ARCHS = $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
263 endif
264 endif
265
266 # Build the file list. The macro takes 1=darwin.x86, 2=dist/VirtualBox.app/Contents/MacOS, 3=dylib
267 VBOX_VBOXDTRACE_FILES_MACRO = \
268 $(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceMain.$(3)=>$(1)/VBoxDTraceMain.$(3) \
269 $(if $(intersects $1, solaris.x86 solaris.amd64),, \
270 $(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceCmd.$(3)=>$(1)/VBoxDTraceCmd.$(3) \
271 $(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceR0.r0=>$(1)/VBoxDTraceR0.r0 \
272 )
273
274 VBOX_VBOXDTRACE_FILES := \
275 $(VBOX_PATH_EXTPACK_VBOXDTRACE)/ExtPack.xml=>ExtPack.xml \
276 $(VBOX_PATH_EXTPACK_VBOXDTRACE)/ExtPack-SourceCodeLicense.txt=>ExtPack-SourceCodeLicense.txt
277
278 if1of (darwin.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
279 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,darwin.amd64,dist/VirtualBox.app/Contents/MacOS,dylib)
280 endif
281 if1of (darwin.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
282 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,darwin.x86,dist/VirtualBox.app/Contents/MacOS,dylib)
283 endif
284 if1of (freebsd.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
285 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,freebsd.amd64,bin,so)
286 endif
287 if1of (freebsd.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
288 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,freebsd.x86,bin,so)
289 endif
290 if1of (linux.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
291 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,linux.amd64,bin,so)
292 endif
293 if1of (linux.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
294 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,linux.x86,bin,so)
295 endif
296 if1of (os2.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
297 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,os2.x86,bin,so)
298 endif
299 if1of (solaris.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
300 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,solaris.amd64,bin,so)
301 endif
302 if1of (solaris.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
303 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,solaris.x86,bin,so)
304 endif
305 if1of (win.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
306 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,win.amd64,bin,dll)
307 endif
308 if1of (win.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
309 VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,win.x86,bin,dll)
310 endif
311
312 # Pack it all up using a temporary staging directory.
313 $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack: \
314 $$(foreach file, $$(VBOX_VBOXDTRACE_FILES), $$(firstword $$(subst =>,$$(SP),$$(file)))) \
315 | $(VBOX_PATH_PACKAGES)/
316 $(RM) -f $(wildcard $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-*.vbox-extpack) \
317 $(VBoxDTraceIns_0_OUTDIR)/ExtPack.manifest \
318 $(VBoxDTraceIns_0_OUTDIR)/ExtPack.signature
319 # Stage all the files
320 $(RM) -Rf $(VBoxDTraceIns_0_OUTDIR)/Stage/
321 $(foreach file, $(VBOX_VBOXDTRACE_FILES),\
322 $(NLTAB)$(MKDIR) -p $(dir $(lastword $(subst =>,$(SP)$(VBoxDTraceIns_0_OUTDIR)/Stage/,$(file)))) \
323 $(NLTAB)$(CP) $(subst =>,$(SP)$(VBoxDTraceIns_0_OUTDIR)/Stage/,$(file)) )
324 # Create the manifest
325 $(VBOX_RTMANIFEST) \
326 --manifest $(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.manifest \
327 --chdir $(VBoxDTraceIns_0_OUTDIR)/Stage/ \
328 $(foreach file, $(VBOX_VBOXDTRACE_FILES), $(lastword $(subst =>,$(SP),$(file))))
329 $(APPEND) $(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.signature "todo"
330 $(CHMOD) a+r \
331 $(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.manifest \
332 $(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.signature
333 # Tar it up.
334 tar -cvf - -C $(VBoxDTraceIns_0_OUTDIR)/Stage/ . | gzip -9c > $@
335 # Clean up
336 $(RM) -Rf $(VBoxDTraceIns_0_OUTDIR)/Stage/
337
338 BLDDIRS += $(VBOX_PATH_PACKAGES)/
339
340endif # VBOX_WITH_EXTPACK_VBOXDTRACE
341
342
343include $(FILE_KBUILD_SUB_FOOTER)
344
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