⛏️ index : haiku.git

SubDir HAIKU_TOP src bin debug strace ;

UsePrivateHeaders device ;
UsePrivateHeaders drivers ;
UsePrivateHeaders libroot ;
UsePrivateHeaders shared ;
UsePrivateHeaders net ;
UsePrivateSystemHeaders ;

SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ;

# find headers generated by gensyscalls
SubDirHdrs $(TARGET_COMMON_DEBUG_LOCATE_TARGET) ;

local straceSources =
	strace.cpp

	Context.cpp
	TypeHandler.cpp
	NetworkTypes.cpp
	MemoryReader.cpp

	area.cpp
	events.cpp
	exec.cpp
	fcntl.cpp
	file.cpp
	ioctl.cpp
	mutex.cpp
	network.cpp
	rlimit.cpp
	signals.cpp
	util.cpp
;

# Our compiler badly chokes when compiling the generated file. So will
# split up the job into 20 pieces.
local straceSyscallsIndices
	= 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ;

local straceSyscallsSource = [ FGristFiles strace_syscalls.cpp ] ;
local straceSyscallsObjects ;

local i ;
for i in $(straceSyscallsIndices) {
	local object = [ FGristFiles strace_syscalls$(i).o ] ;
	straceSyscallsObjects += $(object) ;

	# Whatever our compiler (gcc 2.95.3) thinks it is doing when compiling the
	# generated files, it really takes it time when optimization is enabled.
	# A lot with -O1, even more with -O2. Also the object sizes are amazing.
	# -O0 fares significantly better; at least speed-wise. I would almost think
	# about reverting to compiling all in one object file again. Almost...
	OPTIM on $(object) = -O0 ;

	Object $(object) : $(straceSyscallsSource) ;

	ObjectDefines $(object)
		: GET_SYSCALLS=get_syscalls$(i) SYSCALLS_CHUNK_$(i) ;
}

TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCH)
	on [ FGristFiles util.o ] += -Wno-format ;

Application strace : $(straceSources)
	:
	$(straceSyscallsObjects)
	<bin>debug_utils.a
	[ TargetLibstdc++ ]
;

# We need to specify the dependency on the generated syscalls file explicitly.
Includes $(straceSyscallsSource)
	: <syscalls!$(TARGET_PACKAGING_ARCH)>strace_syscalls.h ;