9d733a0ad734cceadcdf344e7843054a3e871df4
[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"
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       archfam_srcs "x86_64"  = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
60                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
61                                  "arch/x86_64/ldt.c",
62                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
63                                  "vspace/arch/x86_64/layout.c",
64                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
65                                  "arch/x86/perfmon.c", "arch/x86/tls.c"]
66       archfam_srcs "k1om"   = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
67                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
68                                  "arch/x86_64/ldt.c",
69                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
70                                  "vspace/arch/x86_64/layout.c",
71                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
72                                  "arch/x86/perfmon.c", "arch/x86/tls.c"]
73       archfam_srcs "arm"     = [ "arch/arm/debug.c", "arch/arm/dispatch.c",
74                                  "arch/arm/pmap_arch.c", "arch/arm/sys_debug.c",
75                                  "arch/arm/syscalls.c", "vspace/memobj_pinned.c" ,
76                                  "vspace/pinned.c", "vspace/memobj_anon.c",
77                                  "vspace/arch/arm/layout.c" ]
78       archfam_srcs _         = []
79
80       -- sources specific to the architecture
81       arch_srcs "scc" = [ "arch/x86/ipi_notify.c" ]
82       arch_srcs "x86_32" = [ "arch/x86/ipi_notify.c" ]
83       arch_srcs "x86_64" = [ "arch/x86/ipi_notify.c" ]
84       arch_srcs "k1om" = [ "arch/x86/ipi_notify.c" ]
85       arch_srcs _     = []
86
87       arch_assembly "x86_32"  = [ "arch/x86_32/entry.S" ]
88       arch_assembly "x86_64"  = [ "arch/x86_64/entry.S" ]
89       arch_assembly "k1om"    = [ "arch/x86_64/entry.S" ]
90       arch_assembly "arm"     = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
91       arch_assembly "armv7-m" = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
92       arch_assembly _         = []
93
94   in
95     build library { target = "barrelfish",
96                     architectures = [arch],
97                     cFiles = arch_srcs arch ++ archfam_srcs (archFamily arch)
98                              ++ common_srcs ++ idc_srcs,
99                     assemblyFiles = arch_assembly (archFamily arch),
100                     flounderBindings = [ "mem", "octopus", "interdisp", "spawn",
101                                          "terminal", "arrakis", "terminal_config" ],
102                     -- only makes sense to compile monitor binding for lmp
103                     flounderTHCStubs = [ "octopus" ],
104                     flounderExtraBindings = [ ("monitor", ["lmp"]),
105                                               ("monitor_blocking", ["lmp", "rpcclient"]),
106                                               ("mem", ["rpcclient"]),
107                                               ("octopus", ["rpcclient"]),
108                                               ("spawn", ["rpcclient"]),
109                                               ("arrakis", ["rpcclient"])],
110                     addCFlags = [ "-DMORECORE_PAGESIZE="++(morecore_pagesize arch) ],
111                     addIncludes = [ "include", "include" ./. arch_dir ],
112                     addGeneratedDependencies = [ "/include/asmoffsets.h" ]
113                   }
114  ) | arch <- allArchitectures ] ++
115 [(let arch_dir = "arch" ./. archFamily arch
116       common_srcs = [ "capabilities.c", "init.c", "dispatch.c", "threads.c",
117                       "thread_sync.c", "slab.c", "domain.c", "idc.c",
118                       "waitset.c", "event_queue.c", "event_mutex.c",
119                       "idc_export.c", "nameservice_client.c", "msgbuf.c",
120                       "monitor_client.c", "flounder_support.c", "flounder_glue_binding.c",
121                       "morecore.c", "debug.c", "heap.c", "ram_alloc.c",
122                       "terminal.c", "spawn_client.c", "vspace/vspace.c",
123                       "vspace/vregion.c", "vspace/memobj_one_frame.c",
124                       "vspace/memobj_one_frame_lazy.c",
125                       "vspace/utils.c",
126                       "vspace/memobj_one_frame_one_map.c", "vspace/mmu_aware.c",
127                       "slot_alloc/single_slot_alloc.c", "slot_alloc/multi_slot_alloc.c",
128                       "slot_alloc/slot_alloc.c", "slot_alloc/range_slot_alloc.c",
129                       "bulk_transfer.c", "trace.c", "resource_ctrl.c", "coreset.c",
130                       "inthandler.c", "deferred.c"
131                     ]
132
133       idc_srcs = concat $ map getsrcs $ optInterconnectDrivers $ options arch
134           where
135             getsrcs "lmp" = [ "lmp_chan.c", "lmp_endpoints.c" ]
136             getsrcs "ump" = [ "ump_chan.c", "ump_endpoint.c" ]
137             getsrcs "multihop" = [ "multihop_chan.c" ]
138             getsrcs _ = []
139
140       -- configure default morecore pagesize based on Config.hs
141       morecore_pagesize "x86_64" = case Config.morecore_pagesize of
142           "large" -> "LARGE_PAGE_SIZE"
143           "huge"  -> "HUGE_PAGE_SIZE"
144           _       -> "BASE_PAGE_SIZE"
145       morecore_pagesize "x86_32" = case Config.morecore_pagesize of
146           "large" -> "LARGE_PAGE_SIZE"
147           _       -> "BASE_PAGE_SIZE"
148       morecore_pagesize _ = "BASE_PAGE_SIZE"
149
150
151       -- sources specific to the architecture family
152       archfam_srcs "x86_32"  = [ "arch/x86_32/debug.c" ,
153                               "arch/x86_32/dispatch.c" , "arch/x86_32/syscalls.c" ,
154                               "arch/x86_32/sys_debug.c", "target/x86_32/pmap_target.c",
155                               "target/x86/pmap_x86.c",
156                               "vspace/arch/x86_32/layout.c" , "vspace/memobj_pinned.c" ,
157                               "vspace/pinned.c", "vspace/memobj_anon.c",
158                               "arch/x86/perfmon.c", "arch/x86/tls.c"]
159       archfam_srcs "x86_64"  = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
160                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
161                                  "arch/x86_64/ldt.c",
162                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
163                                  "vspace/arch/x86_64/layout.c",
164                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
165                                  "arch/x86/perfmon.c", "arch/x86/tls.c"]
166       archfam_srcs "arm"     = [ "arch/arm/debug.c", "arch/arm/dispatch.c",
167                                  "arch/arm/pmap_arch.c", "arch/arm/sys_debug.c",
168                                  "arch/arm/syscalls.c", "vspace/memobj_pinned.c" ,
169                                  "vspace/pinned.c", "vspace/memobj_anon.c",
170                                  "vspace/arch/arm/layout.c" ]
171       archfam_srcs _         = []
172
173       -- sources specific to the architecture
174       arch_srcs "scc" = [ "arch/x86/ipi_notify.c" ]
175       arch_srcs "x86_32" = [ "arch/x86/ipi_notify.c" ]
176       arch_srcs "x86_64" = [ "arch/x86/ipi_notify.c" ]
177       arch_srcs _     = []
178
179       arch_assembly "x86_32"  = [ "arch/x86_32/entry.S" ]
180       arch_assembly "x86_64"  = [ "arch/x86_64/entry.S" ]
181       arch_assembly "arm"     = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
182       arch_assembly _         = []
183
184   in
185     build library { target = "arrakis",
186                     architectures = [arch],
187                     cFiles = arch_srcs arch ++ archfam_srcs (archFamily arch)
188                              ++ common_srcs ++ idc_srcs,
189                     assemblyFiles = arch_assembly (archFamily arch),
190                     addCFlags = [ "-DARRAKIS", "-DMORECORE_PAGESIZE="++(morecore_pagesize arch) ],
191                     flounderBindings = [ "mem", "octopus", "interdisp", "spawn", "arrakis",
192                                          "terminal" ],
193                     -- only makes sense to compile monitor binding for lmp
194                     flounderTHCStubs = [ "octopus" ],
195                     flounderExtraBindings = [ ("monitor", ["lmp"]),
196                                               ("monitor_blocking", ["lmp", "rpcclient"]),
197                                               ("mem", ["rpcclient"]),
198                                               ("octopus", ["rpcclient"]),
199                                               ("spawn", ["rpcclient"]),
200                                               ("arrakis", ["rpcclient"])],
201                     addIncludes = [ "include", "include" ./. arch_dir ],
202                     addGeneratedDependencies = [ "/include/asmoffsets.h" ]
203                   }
204  ) | arch <- allArchitectures ]