SubDir HAIKU_TOP src tools gensyscalls ; # build gensyscallinfos BuildPlatformMain gensyscallinfos : gensyscallinfos.cpp ; LinkAgainst gensyscallinfos : $(HOST_LIBSTDC++) ; # generate the syscall infos source file local syscallsHeader = [ FGristFiles syscalls.h ] ; SEARCH on $(syscallsHeader) = [ FDirName $(HAIKU_TOP) headers private kernel ] ; local syscallsHeaderPP = [ FGristFiles syscalls.h.pp ] ; MakeLocateArch $(syscallsHeaderPP) ; local syscallInfos = [ FGristFiles gensyscalls_infos.c ] ; MakeLocateArch $(syscallInfos) ; rule GenSyscallInfos { Depends $(1) : gensyscallinfos $(2) ; GenSyscallInfos1 $(1) : gensyscallinfos $(2) ; } actions GenSyscallInfos1 { $(2[1]) $(2[2]) $(1) } GenSyscallInfos $(syscallInfos) : $(syscallsHeaderPP) ; # build gensyscalls BuildPlatformMain gensyscalls : gensyscalls.cpp $(syscallInfos:S=$(SUFOBJ)) ; LinkAgainst gensyscalls : $(HOST_LIBSTDC++) ; UsePrivateObjectHeaders gensyscalls.cpp : kernel ; UseArchObjectHeaders gensyscalls.cpp : $(TARGET_ARCH) ; # generate the output files # place them where there are needed local dir = $(HAIKU_COMMON_DEBUG_OBJECT_DIR) ; MakeLocate syscalls.S.inc : [ FDirName $(dir) system libroot os ] ; MakeLocate syscall_dispatcher.h : [ FDirName $(dir) system kernel ] ; MakeLocate syscall_numbers.h : [ FDirName $(dir) system kernel ] ; MakeLocate syscall_table.h : [ FDirName $(dir) system kernel ] ; MakeLocate strace_syscalls.h : [ FDirName $(dir) bin strace ] ; rule GenSyscallsFile { Depends $(1) : gensyscalls ; GenSyscallsFile1 $(1) : gensyscalls ; } actions GenSyscallsFile1 { $(2[1]) -c $(1) } rule GenSyscallsDispatcher { Depends $(1) : gensyscalls ; GenSyscallsDispatcher1 $(1) : gensyscalls ; } actions GenSyscallsDispatcher1 { $(2[1]) -d $(1) } rule GenSyscallsNumbers { Depends $(1) : gensyscalls ; GenSyscallsNumbers1 $(1) : gensyscalls ; } actions GenSyscallsNumbers1 { $(2[1]) -n $(1) } rule GenSyscallsTable { Depends $(1) : gensyscalls ; GenSyscallsTable1 $(1) : gensyscalls ; } actions GenSyscallsTable1 { $(2[1]) -t $(1) } rule GenSyscallsSTrace { Depends $(1) : gensyscalls ; GenSyscallsSTrace1 $(1) : gensyscalls ; } actions GenSyscallsSTrace1 { $(2[1]) -s $(1) } GenSyscallsFile syscalls.S.inc ; GenSyscallsDispatcher syscall_dispatcher.h ; GenSyscallsNumbers syscall_numbers.h ; GenSyscallsTable syscall_table.h ; GenSyscallsSTrace strace_syscalls.h ; # preprocess the syscalls header UsePrivateHeaders kernel ; UseArchHeaders $(TARGET_ARCH) ; rule PreprocessSyscalls { Depends $(<) : $(>) ; local headers = [ on $(1) return $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ] ; local sysHeaders = [ on $(1) return $(SUBDIRSYSHDRS) $(SYSHDRS) ] $(HAIKU_HDRS) ; HDRS on $(<) = $(headers) ; SYSHDRS on $(<) = $(sysHeaders) ; HDRRULE on $(>) = HdrRule ; HDRSCAN on $(>) = $(HDRPATTERN) ; HDRSEARCH on $(>) = $(headers) $(sysHeaders) $(STDHDRS) ; HDRGRIST on $(>) = $(HDRGRIST) ; DEFINES on $(<) += $(HAIKU_DEFINES) GEN_SYSCALL_INFOS_PROCESSING ; CCFLAGS on $(<) += $(HAIKU_CCFLAGS) $(SUBDIRCCFLAGS) $(OPTIM) ; CCHDRS on $(<) = [ FIncludes $(headers) : $(HOST_LOCAL_INCLUDES_OPTION) ] $(HOST_INCLUDES_SEPARATOR) [ FSysIncludes $(sysHeaders) : $(HOST_SYSTEM_INCLUDES_OPTION) ] ; CCDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ; } actions PreprocessSyscalls { $(HAIKU_C++) -xc++ -E "$(2)" $(CCFLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)" ; } PreprocessSyscalls $(syscallsHeaderPP) : $(syscallsHeader) ; # compile the syscall infos source file # TODO: Clean this mess up! SYSHDRS on $(syscallInfos:S=$(SUFOBJ)) = $(HAIKU_HDRS) ; Object $(syscallInfos:S=$(SUFOBJ)) : $(syscallInfos) ; CCFLAGS on $(syscallInfos:S=$(SUFOBJ)) += -nostdinc ;