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