1----------------------------------------------------------------------
2-- Copyright (c) 2016, ETH Zurich.
3-- All rights reserved.
4--
5-- This file is distributed under the terms in the attached LICENSE file.
6-- If you do not find this file, copies can be found by writing to:
7-- ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
8--
9-- Hakefile for mkmb
10--
11----------------------------------------------------------------------
12
13let arch = "armv8"
14    opts = (options arch) {
15             optFlags = [ Str s | s <- [ "-fno-builtin",
16                                         "-std=gnu99",
17
18                                         "-mstrict-align",
19                                         "-march=armv8-a+nofp",
20
21                                         "-fPIE",
22                                         "-fno-stack-protector",
23                                         "-U__linux__",
24                                         "-Wall",
25                                         "-Wshadow",
26                                         "-Wold-style-definition",
27                                         "-Wmissing-field-initializers",
28                                         "-Wredundant-decls",
29                                         "-Werror" ] ],
30             optIncludes = [ NoDep SrcTree "src" "/kernel/include" ],
31             optDefines = [],
32             optLibs = [],
33             optLdFlags = [ Str s | s <- [
34                                        "-fno-builtin",
35                                        "-pie",
36                                        "-nostdlib",
37                                        "-Wl,--fatal-warnings",
38                                        "-Wl,-N",
39                                        "-Wl,--build-id=none" ]] ++
40                          [ Str "-T", In SrcTree "src" "shim.lds" ],
41             optSuffix = ""
42           }
43in
44[
45    compileNativeC "mkmb_fvp"
46        [ "build_multiboot.c", "config.c", "main.c", "util.c", "efi.c" ]
47        [ "-std=gnu99", "-g", "-I/usr/include/freebsd", "-Wall" ]
48        [ "-lelf-freebsd" ]
49        [ "/kernel/include" ],
50    compileNativeC "test_mkmb"
51        [ "test_mkmb.c", "util.c", "efi.c" ]
52        [ "-std=gnu99", "-g", "-I/usr/include/freebsd", "-Wall" ]
53        [ "-lelf-freebsd" ]
54        [ "/kernel/include" ],
55    assembleSFiles opts [ "shim.S" ],
56    compileCFiles opts [ "cache.c" ],
57    link opts [ "shim.o", "cache.o" ] [] [] "fvp_shim",
58    copyFile SrcTree "tools" "/tools/fastmodels/bootdebug.py"
59                     "tools" "/fastmodels/bootdebug.py"
60]
61