1/*
2 * NAME
3 *      as - assembler cookbook
4 *
5 * DESCRIPTION
6 *      This cookbook defines how to use the assembler
7 *
8 * RECIPES
9 *      %.o: %.s        construct object friles from assembler source files
10 *
11 * VARIABLES
12 *      as              The assembler command.
13 *                      Not altered if already defined.
14 *      as_flags        Options to pass the assembler command.
15 *                      Not altered if already defined.
16 *                      The default is empty.
17 *      as_src          Assembler source files in the current directory.
18 *      dot_src         Source files constructable in the current directory
19 *                      (unioned with existing setting, if necessary).
20 *      dot_obj         Object files constructable in the current directory
21 *                      (unioned with existing setting, if necessary).
22 *      dot_clean       Files which may be removed from the current directory
23 *                      in a clean target.
24 * Copyright (C) 1997-2007 Peter Miller
25 */
26
27#pragma once
28
29if [not [defined as]] then
30        as = as;
31if [not [defined as_flags]] then
32        as_flags = ;
33if [not [defined dot_src]] then
34        dot_src = ;
35if [not [defined dot_obj]] then
36        dot_obj = ;
37/* Assembler files have many names... *.asm, *.as, *.S are also
38   possibilities.  use this file for ideas.  */
39as_src = [glob *.s];
40dot_src = [stringset [dot_src] [as_src]];
41dot_obj = [stringset [dot_obj] [fromto %.s %.o [as_src]]];
42dot_clean = [stringset [dot_clean] [dot_obj]];
43
44%.o: %.s
45{
46        [as] [as_flags] -o %.o [resolve %.s];
47}
48
49%.s.d: %.s
50{
51        [c_incl] --language\=optimistic
52                -ns -nc -nrec
53                [add_prefix "-I" [search_list]]
54                [resolve %.s]
55                --prefix "'cascade %.s ='"
56                --suffix "';'"
57                -o [target];
58}
59
60#include-cooked-nowarn [addsuffix ".d" [as_src]]
61
62/* It would be nice to scan the include files, too, but they tend to
63   have even more suffix variety than assembler sources.  */
64