1SubDir HAIKU_TOP src bin debug strace ;
2
3UsePrivateHeaders device ;
4UsePrivateHeaders drivers ;
5UsePrivateHeaders libroot ;
6UsePrivateHeaders shared ;
7UsePrivateHeaders net ;
8UsePrivateSystemHeaders ;
9
10SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ;
11
12# find headers generated by gensyscalls
13SubDirHdrs $(TARGET_COMMON_DEBUG_LOCATE_TARGET) ;
14
15local straceSources =
16	strace.cpp
17
18	Context.cpp
19	TypeHandler.cpp
20	NetworkTypes.cpp
21	MemoryReader.cpp
22
23	area.cpp
24	exec.cpp
25	fcntl.cpp
26	ioctl.cpp
27	mutex.cpp
28	network.cpp
29	signals.cpp
30;
31
32# Our compiler badly chokes when compiling the generated file. So will
33# split up the job into 20 pieces.
34local straceSyscallsIndices
35	= 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ;
36
37local straceSyscallsSource = [ FGristFiles strace_syscalls.cpp ] ;
38local straceSyscallsObjects ;
39
40local i ;
41for i in $(straceSyscallsIndices) {
42	local object = [ FGristFiles strace_syscalls$(i).o ] ;
43	straceSyscallsObjects += $(object) ;
44
45	# Whatever our compiler (gcc 2.95.3) thinks it is doing when compiling the
46	# generated files, it really takes it time when optimization is enabled.
47	# A lot with -O1, even more with -O2. Also the object sizes are amazing.
48	# -O0 fares significantly better; at least speed-wise. I would almost think
49	# about reverting to compiling all in one object file again. Almost...
50	OPTIM on $(object) = -O0 ;
51
52	Object $(object) : $(straceSyscallsSource) ;
53
54	ObjectDefines $(object)
55		: GET_SYSCALLS=get_syscalls$(i) SYSCALLS_CHUNK_$(i) ;
56}
57
58BinCommand strace : $(straceSources)
59	:
60	$(straceSyscallsObjects)
61	<bin>debug_utils.a
62	[ TargetLibstdc++ ]
63;
64
65# We need to specify the dependency on the generated syscalls file explicitly.
66Includes $(straceSyscallsSource)
67	: <syscalls!$(TARGET_PACKAGING_ARCH)>strace_syscalls.h ;
68