Added command line arg for overriding default heap pagesize.
[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_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                       "morecore.c", "debug.c", "heap.c", "ram_alloc.c",
22                       "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",
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 "arm"     = [ "arch/arm/debug.c", "arch/arm/dispatch.c", 
67                                  "arch/arm/pmap_arch.c", "arch/arm/sys_debug.c",
68                                  "arch/arm/syscalls.c", "vspace/memobj_pinned.c" ,
69                                  "vspace/pinned.c", "vspace/memobj_anon.c",
70                                  "vspace/arch/arm/layout.c" ]
71       archfam_srcs _         = []
72
73       -- sources specific to the architecture
74       arch_srcs "scc" = [ "arch/x86/ipi_notify.c" ]
75       arch_srcs "x86_32" = [ "arch/x86/ipi_notify.c" ]
76       arch_srcs "x86_64" = [ "arch/x86/ipi_notify.c" ]
77       arch_srcs _     = []
78
79       arch_assembly "x86_32"  = [ "arch/x86_32/entry.S" ]
80       arch_assembly "x86_64"  = [ "arch/x86_64/entry.S" ]
81       arch_assembly "arm"     = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
82       arch_assembly "armv7-m" = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
83       arch_assembly _         = []
84
85   in
86     build library { target = "barrelfish",
87                     architectures = [arch],
88                     cFiles = arch_srcs arch ++ archfam_srcs (archFamily arch)
89                              ++ common_srcs ++ idc_srcs,
90                     assemblyFiles = arch_assembly (archFamily arch),
91                     flounderBindings = [ "mem", "octopus", "interdisp", "spawn",
92                                          "terminal" ],
93                     -- only makes sense to compile monitor binding for lmp
94                     flounderTHCStubs = [ "octopus" ],
95                     flounderExtraBindings = [ ("monitor", ["lmp"]),
96                                               ("monitor_blocking", ["lmp", "rpcclient"]),
97                                               ("mem", ["rpcclient"]),
98                                               ("octopus", ["rpcclient"]),
99                                               ("spawn", ["rpcclient"])],
100                     addCFlags = [ "-DMORECORE_PAGESIZE="++(morecore_pagesize arch) ],
101                     addIncludes = [ "include", "include" ./. arch_dir ],
102                     addGeneratedDependencies = [ "/include/asmoffsets.h" ]
103                   }
104  ) | arch <- allArchitectures ]