xref: /haiku/src/tools/gensyscalls/Jamfile (revision efd87ab8df79399cac98d888ab3f36d3f33c34ed)
12e463a12SIngo WeinholdSubDir OBOS_TOP src tools gensyscalls ;
22e463a12SIngo Weinhold
3*efd87ab8SIngo Weinhold# build gensyscallinfos
4*efd87ab8SIngo Weinhold
5*efd87ab8SIngo WeinholdBuildPlatformMain gensyscallinfos : gensyscallinfos.cpp ;
6*efd87ab8SIngo WeinholdLinkSharedOSLibs gensyscallinfos : stdc++.r4 ;
7*efd87ab8SIngo Weinhold
8*efd87ab8SIngo Weinhold
9*efd87ab8SIngo Weinhold# generate the syscall infos source file
10*efd87ab8SIngo Weinhold
11*efd87ab8SIngo WeinholdSetupObjectsDir ;
12*efd87ab8SIngo Weinhold
13*efd87ab8SIngo Weinholdlocal syscallsHeader = [ FGristFiles syscalls.h ] ;
14*efd87ab8SIngo WeinholdSEARCH on $(syscallsHeader) = [ FDirName $(OBOS_TOP) headers private kernel ] ;
15*efd87ab8SIngo Weinhold
16*efd87ab8SIngo Weinholdlocal syscallsHeaderPP = [ FGristFiles syscalls.h.pp ] ;
17*efd87ab8SIngo WeinholdLOCATE on $(syscallsHeaderPP) = $(LOCATE_SOURCE) ;
18*efd87ab8SIngo Weinhold
19*efd87ab8SIngo Weinholdlocal syscallInfos = [ FGristFiles gensyscalls_infos.c ] ;
20*efd87ab8SIngo WeinholdLOCATE on $(syscallInfos) = $(LOCATE_SOURCE) ;
21*efd87ab8SIngo Weinhold
22*efd87ab8SIngo Weinholdrule GenSyscallInfos {
23*efd87ab8SIngo Weinhold	Depends $(1) : gensyscallinfos $(2) ;
24*efd87ab8SIngo Weinhold	GenSyscallInfos1 $(1) : gensyscallinfos $(2) ;
25*efd87ab8SIngo Weinhold}
26*efd87ab8SIngo Weinhold
27*efd87ab8SIngo Weinholdactions GenSyscallInfos1 {
28*efd87ab8SIngo Weinhold	$(2[1]) $(2[2]) $(1)
29*efd87ab8SIngo Weinhold}
30*efd87ab8SIngo Weinhold
31*efd87ab8SIngo WeinholdGenSyscallInfos $(syscallInfos) : $(syscallsHeaderPP) ;
32*efd87ab8SIngo Weinhold
33*efd87ab8SIngo Weinhold
34*efd87ab8SIngo Weinhold# build gensyscalls
35*efd87ab8SIngo Weinhold
36*efd87ab8SIngo WeinholdBuildPlatformMain gensyscalls : gensyscalls.cpp $(syscallInfos:S=$(SUFOBJ)) ;
372e463a12SIngo WeinholdLinkSharedOSLibs gensyscalls : stdc++.r4 ;
38*efd87ab8SIngo Weinhold
39*efd87ab8SIngo Weinhold
40*efd87ab8SIngo Weinhold# generate the output files
41*efd87ab8SIngo Weinhold
42*efd87ab8SIngo Weinhold# place them where there are needed
43*efd87ab8SIngo Weinholdlocal syscallFiles = <syscalls>syscalls.S.inc <syscalls>syscall_dispatcher.h ;
44*efd87ab8SIngo WeinholdMakeLocate <syscalls>syscalls.S.inc : [ FObjectsDir src kernel libroot os ] ;
45*efd87ab8SIngo WeinholdMakeLocate <syscalls>syscall_dispatcher.h : [ FObjectsDir src kernel core ] ;
46*efd87ab8SIngo Weinhold#Depends <syscalls>generatedFiles : $(syscallFiles) ;
47*efd87ab8SIngo Weinhold#NotFile <syscalls>generatedFiles ;
48*efd87ab8SIngo Weinhold
49*efd87ab8SIngo WeinholdDepends <dir>objects/x86.R1/kernel/core : <dir>objects/x86.R1/kernel ;
50*efd87ab8SIngo Weinhold
51*efd87ab8SIngo Weinholdrule GenSyscallsFile {
52*efd87ab8SIngo Weinhold	Depends $(1) : gensyscalls ;
53*efd87ab8SIngo Weinhold	GenSyscallsFile1 $(1) : gensyscalls ;
54*efd87ab8SIngo Weinhold}
55*efd87ab8SIngo Weinhold
56*efd87ab8SIngo Weinholdactions GenSyscallsFile1 {
57*efd87ab8SIngo Weinhold	$(2[1]) -c $(1)
58*efd87ab8SIngo Weinhold}
59*efd87ab8SIngo Weinhold
60*efd87ab8SIngo Weinholdrule GenSyscallsDispatcher {
61*efd87ab8SIngo Weinhold	Depends $(1) : gensyscalls ;
62*efd87ab8SIngo Weinhold	GenSyscallsDispatcher1 $(1) : gensyscalls ;
63*efd87ab8SIngo Weinhold}
64*efd87ab8SIngo Weinhold
65*efd87ab8SIngo Weinholdactions GenSyscallsDispatcher1 {
66*efd87ab8SIngo Weinhold	$(2[1]) -d $(1)
67*efd87ab8SIngo Weinhold}
68*efd87ab8SIngo Weinhold
69*efd87ab8SIngo Weinhold#GenSyscalls $(syscallFiles) ;
70*efd87ab8SIngo WeinholdGenSyscallsFile <syscalls>syscalls.S.inc ;
71*efd87ab8SIngo WeinholdGenSyscallsDispatcher <syscalls>syscall_dispatcher.h ;
72*efd87ab8SIngo Weinhold
73*efd87ab8SIngo Weinhold
74*efd87ab8SIngo Weinhold# preprocess the syscalls header
75*efd87ab8SIngo Weinhold
76*efd87ab8SIngo WeinholdSetupIncludes ;
77*efd87ab8SIngo WeinholdUsePrivateHeaders kernel ;
78*efd87ab8SIngo WeinholdUseArchHeaders $(OBOS_ARCH) ;
79*efd87ab8SIngo Weinhold
80*efd87ab8SIngo Weinholdrule Preprocess
81*efd87ab8SIngo Weinhold{
82*efd87ab8SIngo Weinhold	Depends $(<) : $(>) ;
83*efd87ab8SIngo Weinhold
84*efd87ab8SIngo Weinhold	HDRS on $(<) = $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ;
85*efd87ab8SIngo Weinhold	HDRRULE on $(>) = HdrRule ;
86*efd87ab8SIngo Weinhold	HDRSCAN on $(>) = $(HDRPATTERN) ;
87*efd87ab8SIngo Weinhold	HDRSEARCH on $(>) =
88*efd87ab8SIngo Weinhold		$(SEARCH_SOURCE:E) $(SUBDIRHDRS) $(HDRS) $(STDHDRS) ;
89*efd87ab8SIngo Weinhold
90*efd87ab8SIngo Weinhold	HDRGRIST on $(>) = $(HDRGRIST) ;
91*efd87ab8SIngo Weinhold
92*efd87ab8SIngo Weinhold	DEFINES on $(<) += $(DEFINES) ;
93*efd87ab8SIngo Weinhold
94*efd87ab8SIngo Weinhold	CCFLAGS on $(<) += $(CCFLAGS) $(SUBDIRCCFLAGS) $(OPTIM)
95*efd87ab8SIngo Weinhold					   [ FDefines GEN_SYSCALL_INFOS_PROCESSING ] ;
96*efd87ab8SIngo Weinhold
97*efd87ab8SIngo Weinhold	CCHDRS on $(<) = [ on $(<) FIncludes $(HDRS) ] ;
98*efd87ab8SIngo Weinhold	CCDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ;
99*efd87ab8SIngo Weinhold}
100*efd87ab8SIngo Weinhold
101*efd87ab8SIngo Weinholdactions Preprocess
102*efd87ab8SIngo Weinhold{
103*efd87ab8SIngo Weinhold	$(CC) -E "$(2)" $(CCFLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)" ;
104*efd87ab8SIngo Weinhold}
105*efd87ab8SIngo Weinhold
106*efd87ab8SIngo WeinholdPreprocess $(syscallsHeaderPP) : $(syscallsHeader) ;
107*efd87ab8SIngo Weinhold
108*efd87ab8SIngo Weinhold
109*efd87ab8SIngo Weinhold# compile the syscall infos source file
110*efd87ab8SIngo Weinhold
111*efd87ab8SIngo WeinholdObject $(syscallInfos:S=$(SUFOBJ)) : $(syscallInfos) ;
112