VirtualBox

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

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

extpack build fix.

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