VirtualBox

source: kStuff/trunk/kProfiler2/Makefile.kmk@ 75

Last change on this file since 75 was 29, checked in by bird, 15 years ago

Finally got around execute the switch to the MIT license.

  • Property svn:keywords set to Id Revision
File size: 8.7 KB
Line 
1# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $
2## @file
3# kProfiler Mark 2, sub-makefile.
4#
5
6#
7# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
8#
9# Permission is hereby granted, free of charge, to any person
10# obtaining a copy of this software and associated documentation
11# files (the "Software"), to deal in the Software without
12# restriction, including without limitation the rights to use,
13# copy, modify, merge, publish, distribute, sublicense, and/or sell
14# copies of the Software, and to permit persons to whom the
15# Software is furnished to do so, subject to the following
16# conditions:
17#
18# The above copyright notice and this permission notice shall be
19# included in all copies or substantial portions of the Software.
20#
21# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28# OTHER DEALINGS IN THE SOFTWARE.
29#
30
31DEPTH ?= ..
32SUB_DEPTH = ..
33include $(PATH_KBUILD)/subheader.kmk
34
35#LIBRARIES += kPrf2GC kPrf2R0
36DLLS += kPrf2
37PROGRAMS += kPrf2Read
38
39
40#
41# Our template.
42#
43TEMPLATE_kPrf2 = kProfiler Template
44if1of ($(BUILD_TARGET), win)
45TEMPLATE_kPrf2_EXTENDS = kStuff
46
47else # Eliminate these
48TEMPLATE_kPrf2_TOOL = GCC3
49TEMPLATE_kPrf2_TOOL.os2 = GCC3OMF
50TEMPLATE_kPrf2_TOOL.win.x86 = VCC70
51TEMPLATE_kPrf2_TOOL.win.amd64 = VCC80AMD64
52TEMPLATE_kPrf2_ASTOOL = YASM
53TEMPLATE_kPrf2_ASTOOL.os2 = NASM
54
55TEMPLATE_kPrf2_SDKS.win = WINPSDK
56
57TEMPLATE_kPrf2_CXXFLAGS.freebsd = -g
58TEMPLATE_kPrf2_CXXFLAGS.linux = -g
59TEMPLATE_kPrf2_CXXFLAGS.os2 = -g
60TEMPLATE_kPrf2_CXXFLAGS.win = -Zi -Zl -W3 -GF -GR-
61TEMPLATE_kPrf2_CXXFLAGS.win.amd64 = -GS- #-FAcs
62ifneq ($(BUILD_TYPE),debug)
63TEMPLATE_kPrf2_CXXFLAGS.freebsd+= -O3
64TEMPLATE_kPrf2_CXXFLAGS.linux += -O3
65TEMPLATE_kPrf2_CXXFLAGS.os2 += -O3
66TEMPLATE_kPrf2_CXXFLAGS.win += -O2b2
67endif
68
69TEMPLATE_kPrf2_ASFLAGS.freebsd = -f elf
70TEMPLATE_kPrf2_ASFLAGS.linux = -f elf
71TEMPLATE_kPrf2_ASFLAGS.os2 = -f omf
72TEMPLATE_kPrf2_ASFLAGS.win.x86 = -f win32 -g cv8
73TEMPLATE_kPrf2_ASFLAGS.win.amd64 = -f win64 -g cv8
74
75TEMPLATE_kPrf2_INCS = \
76 ../include
77
78TEMPLATE_kPrf2_LDFLAGS.freebsd = -g
79TEMPLATE_kPrf2_LDFLAGS.linux = -g
80TEMPLATE_kPrf2_LDFLAGS.os2 = -g
81TEMPLATE_kPrf2_LDFLAGS.win = /DEBUG
82
83TEMPLATE_kPrf2_LIBS.freebsd =
84TEMPLATE_kPrf2_LIBS.linux =
85TEMPLATE_kPrf2_LIBS.os2 =
86TEMPLATE_kPrf2_LIBS.win = \
87 $(PATH_SDK_WINPSDK_LIB)/psapi.Lib
88TEMPLATE_kPrf2_LIBS.win.x86 = \
89 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
90 $(PATH_TOOL_VCC70_LIB)/oldnames.lib
91TEMPLATE_kPrf2_LIBS.win.amd64 = \
92 $(PATH_TOOL_VCC80AMD64_LIB)/oldnames.lib \
93 $(PATH_TOOL_VCC80AMD64_LIB)/libcmt.lib
94endif
95
96
97#
98# kPrf2 - The profiler module.
99#
100kPrf2_TEMPLATE = kPrf2
101kPrf2_DEFS.x86 = KPRF_BITS=32
102kPrf2_DEFS.amd64 = KPRF_BITS=64
103kPrf2_LDFLAGS.win.amd64 = -Entry:DllMain
104
105kPrf2_SOURCES = \
106 kProfileR3.cpp
107# kProfileGC.cpp
108# kProfileR0.cpp
109
110kPrf2_SOURCES.win = \
111 dllmain-win.cpp \
112 kPrf2WinApiWrapperHlp.c \
113 prf$(BUILD_TARGET_ARCH)msc.asm \
114 kPrf2-win-$(BUILD_TARGET_ARCH).def
115prfx86msc.asm_DEFS.win.x86 = \
116 KPRF_ENTER=_KPrfEnter \
117 KPRF_LEAVE=_KPrfLeave
118prfamd64msc.asm_DEFS.win.amd64 = \
119 KPRF_ENTER=KPrfEnter \
120 KPRF_LEAVE=KPrfLeave
121
122#
123# kPrf2Read - The read & producer of statistics.
124#
125kPrf2Read_TEMPLATE = kStuffEXE
126kPrf2Read_SOURCES = \
127 kPrf2Read.cpp
128kPrf2Read_LIBS = \
129 $(PATH_LIB)/kDbgStatic$(SUFF_LIB) \
130 $(PATH_LIB)/kRdrStatic$(SUFF_LIB) \
131 $(PATH_LIB)/kHlpCRTStatic$(SUFF_LIB)
132
133#
134# kPrf2WinApiWrappers
135#
136IMPORT_LIBS.win += kPrf2WinApiWrappersImp
137kPrf2WinApiWrappersImp_TEMPLATE = kStuffEXE
138kPrf2WinApiWrappersImp_SOURCES.x86 = kPrf2WinApiWrappersImp-x86.def
139kPrf2WinApiWrappersImp_SOURCES.amd64 = kPrf2WinApiWrappersImp-amd64.def
140
141DLLS.win += kPrf2WinApiWrappers
142kPrf2WinApiWrappers_TEMPLATE = kPrf2
143kPrf2WinApiWrappers_CFLAGS = -GH -Gh
144kPrf2WinApiWrappers_LDFLAGS.win.x86 = -Entry:DllMain@12
145kPrf2WinApiWrappers_LDFLAGS.win.amd64 = -Entry:DllMain
146kPrf2WinApiWrappers_SOURCES = \
147 kPrf2WinApiWrappers.c \
148 kPrf2WinApiWrappersImp-$(BUILD_TARGET_ARCH).def
149kPrf2WinApiWrappers_LIBS = \
150 $(PATH_kPrf2)/kPrf2.lib
151
152ifeq (0,1)
153kPrf2WinApiWrappers-kernel32.h:
154 $(SED) -f kPrf2WinApi-pre.sed --output $@.tmp \
155 $(PATH_SDK_WINPSDK_INC)/WinBase.h \
156 $(PATH_SDK_WINPSDK_INC)/WinCon.h \
157 $(PATH_SDK_WINPSDK_INC)/WinNLS.h \
158 $(PATH_SDK_WINPSDK_INC)/WinVer.h \
159 $(PATH_SDK_WINPSDK_INC)/WinNT.h \
160 $(PATH_SDK_WINPSDK_INC)/TlHelp32.h
161 $(APPEND) $@.tmp 'BOOL WINAPI ReplaceFile( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved );'
162 $(APPEND) $@.tmp 'BOOL WINAPI SetConsoleCursor( PVOID pvUnknown1, PVOID pvUnknown2 );'
163 $(APPEND) $@.tmp 'LPCH WINAPI GetEnvironmentStringsA( VOID );'
164 $(APPEND) $@.tmp 'BOOL WINAPI GetBinaryType( LPCSTR lpApplicationName, LPDWORD lpBinaryType );'
165 $(APPEND) $@.tmp 'WORD NTAPI RtlCaptureStackBackTrace( DWORD FramesToSkip, DWORD FramesToCapture, PVOID * BackTrace, PDWORD BackTraceHash );'
166 $(APPEND) $@.tmp 'PVOID RtlFillMemory( PVOID pv, int ch, SIZE_T cb );'
167 $(APPEND) $@.tmp 'PVOID RtlZeroMemory( PVOID pv, SIZE_T cb );'
168 $(APPEND) $@.tmp 'PVOID RtlMoveMemory( PVOID pvDst, PVOID pvSrc, SIZE_T cb );'
169 $(APPEND) $@.tmp 'VOID NTAPI RtlUnwind( PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue );'
170 $(APPEND) $@.tmp 'VOID NTAPI RtlUnwindEx( FRAME_POINTERS TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable );'
171 $(APPEND) $@.tmp 'ULONGLONG WINAPI RtlVirtualUnwind( ULONG HandlerType, ULONGLONG ImageBase, ULONGLONG ControlPC, PRUNTIME_FUNCTION FunctionEntry, PCONTEXT ContextRecord, PBOOLEAN InFunction, PFRAME_POINTERS EstablisherFrame, PKNONVOLATILE_CONTEXT_POINTERS ContextPointers );'
172 $(APPEND) $@.tmp 'PVOID WINAPI RtlPcToFileHeader( PVOID PcValue, PVOID * BaseOfImage );'
173 $(APPEND) $@.tmp 'PVOID WINAPI RtlLookupFunctionEntry( ULONGLONG ControlPC, PULONGLONG ImageBase, PULONGLONG TargetGp );'
174 $(APPEND) $@.tmp 'void WINAPI RtlRaiseException(PEXCEPTION_RECORD pXcpRec);'
175 $(APPEND) $@.tmp 'int WINAPI uaw_lstrcmpW( LPCUWSTR lpString1, LPCUWSTR lpString2 );'
176 $(APPEND) $@.tmp 'int WINAPI uaw_lstrcmpiW( LPCUWSTR lpString1, LPCUWSTR lpString2 );'
177 $(APPEND) $@.tmp 'int WINAPI uaw_lstrlenW( LPCUWSTR lpString );'
178 $(APPEND) $@.tmp 'LPUWSTR WINAPI uaw_wcschr( LPCUWSTR lpString, WCHAR wc );'
179 $(APPEND) $@.tmp 'LPUWSTR WINAPI uaw_wcscpy( LPUWSTR lpDst, LPCUWSTR lpSrc );'
180 $(APPEND) $@.tmp 'int WINAPI uaw_wcsicmp( LPCUWSTR lp1, LPCUWSTR lp2 );'
181 $(APPEND) $@.tmp 'SIZE_T WINAPI uaw_wcslen( LPCUWSTR lp1 );'
182 $(APPEND) $@.tmp 'LPUWSTR WINAPI uaw_wcsrchr( LPCUWSTR lpString, WCHAR wc );'
183 $(APPEND) $@.tmp 'LPSTR WINAPI lstrcat( LPSTR lpString1, LPCSTR lpString2 );'
184 $(APPEND) $@.tmp 'int WINAPI lstrcmp( LPCSTR lpString1, LPCSTR lpString2 );'
185 $(APPEND) $@.tmp 'int WINAPI lstrcmpi( LPCSTR lpString1, LPCSTR lpString2 );'
186 $(APPEND) $@.tmp 'LPSTR WINAPI lstrcpy( LPSTR lpString1, LPCSTR lpString2 );'
187 $(APPEND) $@.tmp 'LPSTR WINAPI lstrcpyn( LPSTR lpString1, LPCSTR lpString2, int iMaxLength );'
188 $(APPEND) $@.tmp 'int WINAPI lstrlen( LPCSTR lpString );'
189 $(SED) -f kPrf2WinApi-gencode.sed --output $@ $@.tmp
190 $(RM) -f $@.tmp
191
192kPrf2WinApiWrappersImp-$(KBUILD_TARGET_ARCH).def:
193 $(RM) -f $@
194 $(PATH_TOOL_$(TEMPLATE_kStuff_TOOL.win.$(BUILD_TARGET_ARCH))_BIN)/dumpbin.exe /EXPORTS /OUT:$@.tmp $(PATH_SDK_WINPSDK_LIB)/Kernel32.lib
195 $(SED) -f kPrf2WinApi-dumpbin.sed --output $@.tmp2 $@.tmp
196 $(APPEND) $@ 'LIBRARY kPrf2WinApiWrappers'
197 $(APPEND) $@ 'EXPORTS'
198 $(SED) -f kPrf2WinApi-genimp.sed --append $@ $@.tmp2
199 $(RM) -f $@.tmp $@.tmp2
200endif
201
202#
203# A simple testcase.
204#
205PROGRAMS.win.x86 += tst
206tst_TOOL = VCC70
207tst_SDKS = WINPSDK
208tst_CFLAGS = -GH -Gh -Zi -Zl -GR- -GX- -GF- -W3 -wd4244
209tst_SOURCES = tst.c
210tst.c_CFLAGS = -Od
211tst_LDFLAGS = /DEBUG
212tst_LIBS = \
213 $(PATH_TOOL_VCC70_LIB)/msvcrt.lib \
214 $(PATH_TOOL_VCC70_LIB)/msvcprt.lib \
215 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
216 $(PATH_kPrf2)/kPrf2.lib
217
218PROGRAMS += tstlongjmp
219tstlongjmp_TEMPLATE = kStuffEXE
220tstlongjmp_CFLAGS.win = -GH -Gh -Zi
221tstlongjmp_SOURCES = tstlongjmp.c
222tstlongjmp_LIBS = \
223 $(PATH_kPrf2)/kPrf2.lib
224
225# Generate the rules
226include $(PATH_KBUILD)/subfooter.kmk
227
228
229#
230# Aliases for .cpp.h files so we can more easily do syntax checking from the editor.
231#
232CORE := $(wildcard *core*.cpp.h *core*.h.h)
233$(CORE:.h=.o) $(CORE:.h=.obj) : kProfileR3.o
234
235READ := $(wildcard *read*.cpp.h *read*.h.h)
236$(READ:.h=.o) $(READ:.h=.obj) : kPrf2Read.o
237
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