proc_mgmt: fixed several dependency issues
[barrelfish] / lib / barrelfish / Hakefile
1 --------------------------------------------------------------------------
2 -- Copyright (c) 2007-2012, 2016, ETH Zurich.
3 -- Copyright (c) 2014, HP Labs.
4 -- Copyright (c) 2015, Hewlett Packard Enterprise Development LP.
5 -- All rights reserved.
6 --
7 -- This file is distributed under the terms in the attached LICENSE file.
8 -- If you do not find this file, copies can be found by writing to:
9 -- ETH Zurich D-INFK, CAB F.78, Universitaetstr. 6, CH-8092 Zurich,
10 -- Attn: Systems Group.
11 --
12 -- Hakefile for lib/barrelfish
13 --
14 --------------------------------------------------------------------------
15
16 let common_srcs = [ "capabilities.c", "init.c", "dispatch.c", "threads.c",
17                     "thread_once.c", "thread_sync.c", "slab.c", "domain.c", "idc.c",
18                     "waitset.c", "event_queue.c", "event_mutex.c",
19                     "idc_export.c", "nameservice_client.c", "msgbuf.c", "proc_mgmt_client.c",
20                     "monitor_client.c", "flounder_support.c", "flounder_glue_binding.c",
21                     "flounder_txqueue.c","morecore.c", "debug.c", "heap.c",
22                     "ram_alloc.c", "terminal.c", "spawn_client.c", "vspace/vspace.c",
23                     "vspace/vregion.c", "vspace/memobj_one_frame.c",
24                     "vspace/memobj_one_frame_lazy.c",
25                     "vspace/utils.c", "vspace/memobj_fixed.c", "vspace/memobj_numa.c",
26                     "vspace/memobj_one_frame_one_map.c", "vspace/mmu_aware.c",
27                     "slot_alloc/single_slot_alloc.c", "slot_alloc/slot_alloc.c",
28                     "slot_alloc/range_slot_alloc.c", "slot_alloc/twolevel_slot_alloc.c",
29                     "bulk_transfer.c", "trace.c", "resource_ctrl.c", "coreset.c",
30                     "inthandler.c", "deferred.c", "syscalls.c", "sys_debug.c", "systime.c",
31                     "notificator.c"
32                   ]
33 in
34 [(let arch_dir = "arch" </> archFamily arch
35       idc_srcs = concat $ map getsrcs $ optInterconnectDrivers $ options arch
36           where
37             getsrcs "lmp" = [ "lmp_chan.c", "lmp_endpoints.c" ]
38             getsrcs "ump" = [ "ump_chan.c", "ump_endpoint.c" ]
39             getsrcs "multihop" = [ "multihop_chan.c" ]
40             getsrcs _ = []
41
42       -- configure default morecore pagesize based on Config.hs
43       morecore_pagesize "x86_64" = case Config.morecore_pagesize of
44           "large" -> "LARGE_PAGE_SIZE"
45           "huge"  -> "HUGE_PAGE_SIZE"
46           _       -> "BASE_PAGE_SIZE"
47       morecore_pagesize "x86_32" = case Config.morecore_pagesize of
48           "large" -> "LARGE_PAGE_SIZE"
49           _       -> "BASE_PAGE_SIZE"
50       morecore_pagesize _ = "BASE_PAGE_SIZE"
51
52
53       -- sources specific to the architecture family
54       archfam_srcs "x86_32"  = [ "arch/x86_32/debug.c" ,
55                               "arch/x86_32/dispatch.c" , "arch/x86_32/syscalls.c" ,
56                               "arch/x86_32/sys_debug.c", "target/x86_32/pmap_target.c",
57                               "target/x86/pmap_x86.c",
58                               "vspace/arch/x86_32/layout.c" , "vspace/memobj_pinned.c" ,
59                               "vspace/pinned.c", "vspace/memobj_anon.c",
60                               "arch/x86/perfmon.c", "arch/x86/tls.c",
61                               "arch/x86/sys_debug.c"]
62       archfam_srcs "x86_64"  = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
63                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
64                                  "arch/x86_64/ldt.c",
65                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
66                                  "vspace/arch/x86_64/layout.c",
67                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
68                                  "arch/x86/perfmon.c", "arch/x86/tls.c",
69                                  "arch/x86/sys_debug.c"]
70       archfam_srcs "k1om"   = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
71                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
72                                  "arch/x86_64/ldt.c",
73                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
74                                  "vspace/arch/x86_64/layout.c",
75                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
76                                  "arch/x86/perfmon.c", "arch/x86/tls.c",
77                                  "arch/x86/sys_debug.c"]
78       archfam_srcs "arm"     = [ "arch/arm/debug.c", "arch/arm/dispatch.c",
79                                  "arch/arm/pmap_arch.c",
80                                  "arch/arm/syscalls.c", "vspace/memobj_pinned.c" ,
81                                  "vspace/pinned.c", "vspace/memobj_anon.c",
82                                  "vspace/arch/arm/layout.c",
83                                  "arch/arm/sys_debug.c"]
84       archfam_srcs "aarch64"   = [ "arch/aarch64/debug.c", "arch/aarch64/dispatch.c",
85                                    "arch/aarch64/context.S",
86                                    "arch/aarch64/pmap_arch.c", "arch/aarch64/sys_debug.c",
87                                    "arch/aarch64/syscalls.c", "vspace/memobj_pinned.c" ,
88                                    "vspace/pinned.c", "vspace/memobj_anon.c",
89                                    "vspace/arch/aarch64/layout.c" ]
90
91       archfam_srcs _         = []
92
93       -- sources specific to the architecture
94       arch_srcs "x86_32" = [ "arch/x86/ipi_notify.c" ]
95       arch_srcs "x86_64" = [ "arch/x86/ipi_notify.c" ]
96       arch_srcs "k1om" = [ "arch/x86/ipi_notify.c" ]
97       arch_srcs _     = []
98
99       arch_assembly "x86_32"  = [ "arch/x86_32/entry.S" ]
100       arch_assembly "x86_64"  = [ "arch/x86_64/entry.S" ]
101       arch_assembly "k1om"    = [ "arch/x86_64/entry.S" ]
102       arch_assembly "arm"     = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
103       arch_assembly "aarch64" = [ "arch/aarch64/entry.S" ]
104       arch_assembly _         = []
105
106       arch_include "k1om"     = "include/arch/x86_64"
107       arch_include _          = ""
108
109   in
110     build library { target = "barrelfish",
111                     architectures = [arch],
112                     cFiles = arch_srcs arch ++ archfam_srcs (archFamily arch)
113                              ++ common_srcs ++ idc_srcs,
114                     assemblyFiles = arch_assembly (archFamily arch),
115                     flounderDefs = [ "proc_mgmt" ],
116                     flounderBindings = [ "mem", "octopus", "interdisp", "spawn",
117                                          "proc_mgmt", "terminal", "arrakis",
118                                          "terminal_config" ],
119                     -- only makes sense to compile monitor binding for lmp
120                     flounderTHCStubs = [ "octopus" ],
121                     flounderExtraBindings = [ ("monitor", ["lmp"]),
122                                               ("monitor_blocking", ["lmp", "rpcclient"]),
123                                               ("mem", ["rpcclient"]),
124                                               ("octopus", ["rpcclient"]),
125                                               ("spawn", ["rpcclient"]),
126                                               ("proc_mgmt", ["rpcclient"]),
127                                               ("arrakis", ["rpcclient"])],
128                     addCFlags = [ "-DMORECORE_PAGESIZE="++(morecore_pagesize arch) ],
129                     addIncludes = [ "include", "include" </> arch_dir, (arch_include arch) ],
130                     addGeneratedDependencies = [ "/include/asmoffsets.h" ]
131                   }
132  ) | arch <- allArchitectures ] ++
133 [(let arch_dir = "arch" </> archFamily arch
134       idc_srcs = concat $ map getsrcs $ optInterconnectDrivers $ options arch
135           where
136             getsrcs "lmp" = [ "lmp_chan.c", "lmp_endpoints.c" ]
137             getsrcs "ump" = [ "ump_chan.c", "ump_endpoint.c" ]
138             getsrcs "multihop" = [ "multihop_chan.c" ]
139             getsrcs _ = []
140
141       -- configure default morecore pagesize based on Config.hs
142       morecore_pagesize "x86_64" = case Config.morecore_pagesize of
143           "large" -> "LARGE_PAGE_SIZE"
144           "huge"  -> "HUGE_PAGE_SIZE"
145           _       -> "BASE_PAGE_SIZE"
146       morecore_pagesize "x86_32" = case Config.morecore_pagesize of
147           "large" -> "LARGE_PAGE_SIZE"
148           _       -> "BASE_PAGE_SIZE"
149       morecore_pagesize _ = "BASE_PAGE_SIZE"
150
151
152       -- sources specific to the architecture family
153       archfam_srcs "x86_32"  = [ "arch/x86_32/debug.c" ,
154                               "arch/x86_32/dispatch.c" , "arch/x86_32/syscalls.c" ,
155                               "arch/x86_32/sys_debug.c", "target/x86_32/pmap_target.c",
156                               "target/x86/pmap_x86.c",
157                               "vspace/arch/x86_32/layout.c" , "vspace/memobj_pinned.c" ,
158                               "vspace/pinned.c", "vspace/memobj_anon.c",
159                               "arch/x86/perfmon.c", "arch/x86/tls.c",
160                               "arch/x86/sys_debug.c"]
161       archfam_srcs "x86_64"  = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
162                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
163                                  "arch/x86_64/ldt.c",
164                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
165                                  "vspace/arch/x86_64/layout.c",
166                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
167                                  "arch/x86/perfmon.c", "arch/x86/tls.c",
168                                  "arch/x86/sys_debug.c"]
169       archfam_srcs "arm"     = [ "arch/arm/debug.c", "arch/arm/dispatch.c",
170                                  "arch/arm/pmap_arch.c",
171                                  "arch/arm/syscalls.c", "vspace/memobj_pinned.c" ,
172                                  "vspace/pinned.c", "vspace/memobj_anon.c",
173                                  "vspace/arch/arm/layout.c",
174                                  "arch/arm/sys_debug.c"]
175       archfam_srcs "aarch64"   = [ "arch/aarch64/debug.c", "arch/aarch64/dispatch.c",
176                                    "arch/aarch64/pmap_arch.c", "arch/aarch64/sys_debug.c",
177                                    "arch/aarch64/syscalls.c", "vspace/memobj_pinned.c" ,
178                                    "vspace/pinned.c", "vspace/memobj_anon.c",
179                                    "vspace/arch/aarch64/layout.c" ]
180
181       archfam_srcs _         = []
182
183       -- sources specific to the architecture
184       arch_srcs "x86_32" = [ "arch/x86/ipi_notify.c" ]
185       arch_srcs "x86_64" = [ "arch/x86/ipi_notify.c" ]
186       arch_srcs _     = []
187
188       arch_assembly "x86_32"  = [ "arch/x86_32/entry.S" ]
189       arch_assembly "x86_64"  = [ "arch/x86_64/entry.S" ]
190       arch_assembly "arm"     = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
191       arch_assembly "aarch64" = [ "arch/aarch64/entry.S" ]
192       arch_assembly _         = []
193
194       arch_include "k1om"     = "include/arch/x86_64"
195       arch_include _          =  ""
196
197   in
198     build library { target = "arrakis",
199                     architectures = [arch],
200                     cFiles = arch_srcs arch ++ archfam_srcs (archFamily arch)
201                              ++ common_srcs ++ idc_srcs,
202                     assemblyFiles = arch_assembly (archFamily arch),
203                     addCFlags = [ "-DARRAKIS", "-DMORECORE_PAGESIZE="++(morecore_pagesize arch) ],
204                     flounderBindings = [ "mem", "octopus", "interdisp", "spawn", "arrakis",
205                                          "proc_mgmt", "terminal", "terminal_config",
206                                          "terminal_session" ],
207                     -- only makes sense to compile monitor binding for lmp
208                     flounderTHCStubs = [ "octopus" ],
209                     flounderExtraBindings = [ ("monitor", ["lmp"]),
210                                               ("monitor_blocking", ["lmp", "rpcclient"]),
211                                               ("mem", ["rpcclient"]),
212                                               ("octopus", ["rpcclient"]),
213                                               ("spawn", ["rpcclient"]),
214                                               ("proc_mgmt", ["rpcclient"]),
215                                               ("arrakis", ["rpcclient"])],
216                     addIncludes = [ "include", "include" </> arch_dir, (arch_include arch) ],
217                     addGeneratedDependencies = [ "/include/asmoffsets.h" ]
218                   }
219  ) | arch <- allArchitectures ]