First outline of a process management service server.
[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                   ]
32 in
33 [(let arch_dir = "arch" </> archFamily arch
34       idc_srcs = concat $ map getsrcs $ optInterconnectDrivers $ options arch
35           where
36             getsrcs "lmp" = [ "lmp_chan.c", "lmp_endpoints.c" ]
37             getsrcs "ump" = [ "ump_chan.c", "ump_endpoint.c" ]
38             getsrcs "multihop" = [ "multihop_chan.c" ]
39             getsrcs _ = []
40
41       -- configure default morecore pagesize based on Config.hs
42       morecore_pagesize "x86_64" = case Config.morecore_pagesize of
43           "large" -> "LARGE_PAGE_SIZE"
44           "huge"  -> "HUGE_PAGE_SIZE"
45           _       -> "BASE_PAGE_SIZE"
46       morecore_pagesize "x86_32" = case Config.morecore_pagesize of
47           "large" -> "LARGE_PAGE_SIZE"
48           _       -> "BASE_PAGE_SIZE"
49       morecore_pagesize _ = "BASE_PAGE_SIZE"
50
51
52       -- sources specific to the architecture family
53       archfam_srcs "x86_32"  = [ "arch/x86_32/debug.c" ,
54                               "arch/x86_32/dispatch.c" , "arch/x86_32/syscalls.c" ,
55                               "arch/x86_32/sys_debug.c", "target/x86_32/pmap_target.c",
56                               "target/x86/pmap_x86.c",
57                               "vspace/arch/x86_32/layout.c" , "vspace/memobj_pinned.c" ,
58                               "vspace/pinned.c", "vspace/memobj_anon.c",
59                               "arch/x86/perfmon.c", "arch/x86/tls.c",
60                               "arch/x86/sys_debug.c"]
61       archfam_srcs "x86_64"  = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
62                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
63                                  "arch/x86_64/ldt.c",
64                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
65                                  "vspace/arch/x86_64/layout.c",
66                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
67                                  "arch/x86/perfmon.c", "arch/x86/tls.c",
68                                  "arch/x86/sys_debug.c"]
69       archfam_srcs "k1om"   = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
70                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
71                                  "arch/x86_64/ldt.c",
72                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
73                                  "vspace/arch/x86_64/layout.c",
74                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
75                                  "arch/x86/perfmon.c", "arch/x86/tls.c",
76                                  "arch/x86/sys_debug.c"]
77       archfam_srcs "arm"     = [ "arch/arm/debug.c", "arch/arm/dispatch.c",
78                                  "arch/arm/pmap_arch.c",
79                                  "arch/arm/syscalls.c", "vspace/memobj_pinned.c" ,
80                                  "vspace/pinned.c", "vspace/memobj_anon.c",
81                                  "vspace/arch/arm/layout.c",
82                                  "arch/arm/sys_debug.c"]
83       archfam_srcs "aarch64"   = [ "arch/aarch64/debug.c", "arch/aarch64/dispatch.c",
84                                    "arch/aarch64/context.S",
85                                    "arch/aarch64/pmap_arch.c", "arch/aarch64/sys_debug.c",
86                                    "arch/aarch64/syscalls.c", "vspace/memobj_pinned.c" ,
87                                    "vspace/pinned.c", "vspace/memobj_anon.c",
88                                    "vspace/arch/aarch64/layout.c" ]
89
90       archfam_srcs _         = []
91
92       -- sources specific to the architecture
93       arch_srcs "x86_32" = [ "arch/x86/ipi_notify.c" ]
94       arch_srcs "x86_64" = [ "arch/x86/ipi_notify.c" ]
95       arch_srcs "k1om" = [ "arch/x86/ipi_notify.c" ]
96       arch_srcs _     = []
97
98       arch_assembly "x86_32"  = [ "arch/x86_32/entry.S" ]
99       arch_assembly "x86_64"  = [ "arch/x86_64/entry.S" ]
100       arch_assembly "k1om"    = [ "arch/x86_64/entry.S" ]
101       arch_assembly "arm"     = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
102       arch_assembly "aarch64" = [ "arch/aarch64/entry.S" ]
103       arch_assembly _         = []
104
105       arch_include "k1om"     = "include/arch/x86_64"
106       arch_include _          = ""
107
108   in
109     build library { target = "barrelfish",
110                     architectures = [arch],
111                     cFiles = arch_srcs arch ++ archfam_srcs (archFamily arch)
112                              ++ common_srcs ++ idc_srcs,
113                     assemblyFiles = arch_assembly (archFamily arch),
114                     flounderBindings = [ "mem", "octopus", "interdisp", "spawn",
115                                          "terminal", "arrakis", "terminal_config" ],
116                     -- only makes sense to compile monitor binding for lmp
117                     flounderTHCStubs = [ "octopus" ],
118                     flounderExtraBindings = [ ("monitor", ["lmp"]),
119                                               ("monitor_blocking", ["lmp", "rpcclient"]),
120                                               ("mem", ["rpcclient"]),
121                                               ("octopus", ["rpcclient"]),
122                                               ("spawn", ["rpcclient"]),
123                                               ("arrakis", ["rpcclient"])],
124                     addCFlags = [ "-DMORECORE_PAGESIZE="++(morecore_pagesize arch) ],
125                     addIncludes = [ "include", "include" </> arch_dir, (arch_include arch) ],
126                     addGeneratedDependencies = [ "/include/asmoffsets.h" ]
127                   }
128  ) | arch <- allArchitectures ] ++
129 [(let arch_dir = "arch" </> archFamily arch
130       idc_srcs = concat $ map getsrcs $ optInterconnectDrivers $ options arch
131           where
132             getsrcs "lmp" = [ "lmp_chan.c", "lmp_endpoints.c" ]
133             getsrcs "ump" = [ "ump_chan.c", "ump_endpoint.c" ]
134             getsrcs "multihop" = [ "multihop_chan.c" ]
135             getsrcs _ = []
136
137       -- configure default morecore pagesize based on Config.hs
138       morecore_pagesize "x86_64" = case Config.morecore_pagesize of
139           "large" -> "LARGE_PAGE_SIZE"
140           "huge"  -> "HUGE_PAGE_SIZE"
141           _       -> "BASE_PAGE_SIZE"
142       morecore_pagesize "x86_32" = case Config.morecore_pagesize of
143           "large" -> "LARGE_PAGE_SIZE"
144           _       -> "BASE_PAGE_SIZE"
145       morecore_pagesize _ = "BASE_PAGE_SIZE"
146
147
148       -- sources specific to the architecture family
149       archfam_srcs "x86_32"  = [ "arch/x86_32/debug.c" ,
150                               "arch/x86_32/dispatch.c" , "arch/x86_32/syscalls.c" ,
151                               "arch/x86_32/sys_debug.c", "target/x86_32/pmap_target.c",
152                               "target/x86/pmap_x86.c",
153                               "vspace/arch/x86_32/layout.c" , "vspace/memobj_pinned.c" ,
154                               "vspace/pinned.c", "vspace/memobj_anon.c",
155                               "arch/x86/perfmon.c", "arch/x86/tls.c",
156                               "arch/x86/sys_debug.c"]
157       archfam_srcs "x86_64"  = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
158                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
159                                  "arch/x86_64/ldt.c",
160                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
161                                  "vspace/arch/x86_64/layout.c",
162                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
163                                  "arch/x86/perfmon.c", "arch/x86/tls.c",
164                                  "arch/x86/sys_debug.c"]
165       archfam_srcs "arm"     = [ "arch/arm/debug.c", "arch/arm/dispatch.c",
166                                  "arch/arm/pmap_arch.c",
167                                  "arch/arm/syscalls.c", "vspace/memobj_pinned.c" ,
168                                  "vspace/pinned.c", "vspace/memobj_anon.c",
169                                  "vspace/arch/arm/layout.c",
170                                  "arch/arm/sys_debug.c"]
171       archfam_srcs "aarch64"   = [ "arch/aarch64/debug.c", "arch/aarch64/dispatch.c",
172                                    "arch/aarch64/pmap_arch.c", "arch/aarch64/sys_debug.c",
173                                    "arch/aarch64/syscalls.c", "vspace/memobj_pinned.c" ,
174                                    "vspace/pinned.c", "vspace/memobj_anon.c",
175                                    "vspace/arch/aarch64/layout.c" ]
176
177       archfam_srcs _         = []
178
179       -- sources specific to the architecture
180       arch_srcs "x86_32" = [ "arch/x86/ipi_notify.c" ]
181       arch_srcs "x86_64" = [ "arch/x86/ipi_notify.c" ]
182       arch_srcs _     = []
183
184       arch_assembly "x86_32"  = [ "arch/x86_32/entry.S" ]
185       arch_assembly "x86_64"  = [ "arch/x86_64/entry.S" ]
186       arch_assembly "arm"     = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
187       arch_assembly "aarch64" = [ "arch/aarch64/entry.S" ]
188       arch_assembly _         = []
189
190       arch_include "k1om"     = "include/arch/x86_64"
191       arch_include _          =  ""
192
193   in
194     build library { target = "arrakis",
195                     architectures = [arch],
196                     cFiles = arch_srcs arch ++ archfam_srcs (archFamily arch)
197                              ++ common_srcs ++ idc_srcs,
198                     assemblyFiles = arch_assembly (archFamily arch),
199                     addCFlags = [ "-DARRAKIS", "-DMORECORE_PAGESIZE="++(morecore_pagesize arch) ],
200                     flounderBindings = [ "mem", "octopus", "interdisp", "spawn", "arrakis",
201                                          "terminal", "terminal_config", "terminal_session" ],
202                     -- only makes sense to compile monitor binding for lmp
203                     flounderTHCStubs = [ "octopus" ],
204                     flounderExtraBindings = [ ("monitor", ["lmp"]),
205                                               ("monitor_blocking", ["lmp", "rpcclient"]),
206                                               ("mem", ["rpcclient"]),
207                                               ("octopus", ["rpcclient"]),
208                                               ("spawn", ["rpcclient"]),
209                                               ("arrakis", ["rpcclient"])],
210                     addIncludes = [ "include", "include" </> arch_dir, (arch_include arch) ],
211                     addGeneratedDependencies = [ "/include/asmoffsets.h" ]
212                   }
213  ) | arch <- allArchitectures ]