1--------------------------------------------------------------------------
2-- Copyright (c) 2007-2009, 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 tools/asmoffsets
10--
11--------------------------------------------------------------------------
12
13concat [ let
14    kopts = kernelOptions arch
15    opts = kopts { -- Need this to exclude asmoffsets.h!
16                   optDependencies = [d | d <- optDependencies kopts,
17                                      d /= Dep InstallTree arch "/include/asmoffsets.h"]
18                 }
19   in
20     -- asmoffsets.s here is not the output it is the stem of the presumed
21     -- output for the dependency.
22     [ Rule (makecToAssembler opts { extraDependencies =
23                                        extraDependencies opts ++
24                                        [ Dep BuildTree arch
25                                              "/include/errors/errno.h" ] }
26                              "src" "asmoffsets.c" "asmoffsets.s"),
27       makeDependAssembler opts "src" "asmoffsets.c",
28       Rule [ Str "grep -E '^#(if|ifndef|ifdef|define|undef|endif)'",
29           In BuildTree arch (assemblerFilePath opts "asmoffsets.c"),
30           Str "| sed 's/\\$$//'",
31           Str "| sed -e 's_#\\([0-9]\\)_\\1_' >",
32           Out arch "/include/asmoffsets.h" ]
33     ] | arch <- allArchitectures]
34