1--------------------------------------------------------------------------
2-- Copyright (c) 2007-2011, 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, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
8--
9-- Hakefile for lib/crt
10-- 
11--------------------------------------------------------------------------
12
13-- Description of crt*.o files generated:
14-- crt0.o: startup for all C/C++ programs
15-- crtbegin.o .ctors section header (for C++ ABI compatibility)
16-- crtend.o .ctors section footer (for C++ ABI compatibility)
17
18[(
19let 
20    opts = (options arch) { 
21             extraDependencies = [ Dep BuildTree arch "/include/asmoffsets.h" ],
22             extraDefines = [ "-Wno-array-bounds" ]
23           }
24    adir = "arch" </> archFamily arch
25in
26    Rules [assembleSFile opts (adir  </> "crt0.S"),
27           copy opts (adir </> "crt0.o") "/lib/crt0.o",
28           compileCFile opts ("crtbegin.c"),
29           copy opts "crtbegin.o" "/lib/crtbegin.o",
30           compileCFile opts ("crtend.c"),
31	   -- crtend has to be an object file, otherwise it will not be linked properly	
32           -- staticLibrary opts "crtend" ["crtend.o"] [], 
33           copy opts "crtend.o" "/lib/crtend.o" ]
34) | arch <- allArchitectures ]
35