SubDir OBOS_TOP src tools gensyscalls ; # build gensyscallinfos BuildPlatformMain gensyscallinfos : gensyscallinfos.cpp ; LinkSharedOSLibs gensyscallinfos : $(BUILD_LIBSTDC++) ; # generate the syscall infos source file SetupObjectsDir ; local syscallsHeader = [ FGristFiles syscalls.h ] ; SEARCH on $(syscallsHeader) = [ FDirName $(OBOS_TOP) headers private kernel ] ; local syscallsHeaderPP = [ FGristFiles syscalls.h.pp ] ; LOCATE on $(syscallsHeaderPP) = $(LOCATE_SOURCE) ; local syscallInfos = [ FGristFiles gensyscalls_infos.c ] ; LOCATE on $(syscallInfos) = $(LOCATE_SOURCE) ; 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)) ; LinkSharedOSLibs gensyscalls : $(BUILD_LIBSTDC++) ; UsePrivateObjectHeaders gensyscalls.cpp : kernel ; UseArchObjectHeaders gensyscalls.cpp : $(OBOS_ARCH) ; # generate the output files # place them where there are needed MakeLocate syscalls.S.inc : [ FObjectsDir src kernel libroot os ] ; MakeLocate syscall_dispatcher.h : [ FObjectsDir src kernel core ] ; Depends objects/x86.R1/kernel/core : objects/x86.R1/kernel ; 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) } GenSyscallsFile syscalls.S.inc ; GenSyscallsDispatcher syscall_dispatcher.h ; # preprocess the syscalls header SetupIncludes ; UsePrivateHeaders kernel ; UseArchHeaders $(OBOS_ARCH) ; rule Preprocess { Depends $(<) : $(>) ; HDRS on $(<) = $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ; HDRRULE on $(>) = HdrRule ; HDRSCAN on $(>) = $(HDRPATTERN) ; HDRSEARCH on $(>) = $(SEARCH_SOURCE:E) $(SUBDIRHDRS) $(HDRS) $(STDHDRS) ; HDRGRIST on $(>) = $(HDRGRIST) ; DEFINES on $(<) += $(DEFINES) ; CCFLAGS on $(<) += $(CCFLAGS) $(SUBDIRCCFLAGS) $(OPTIM) [ FDefines GEN_SYSCALL_INFOS_PROCESSING ] ; CCHDRS on $(<) = [ on $(<) FIncludes $(HDRS) ] ; CCDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ; } actions Preprocess { $(CC) -E "$(2)" $(CCFLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)" ; } Preprocess $(syscallsHeaderPP) : $(syscallsHeader) ; # compile the syscall infos source file Object $(syscallInfos:S=$(SUFOBJ)) : $(syscallInfos) ;