cons-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: building files with nasm (#2)


From: Johan Holmberg
Subject: Re: building files with nasm (#2)
Date: Sat, 3 Nov 2001 01:31:10 +0100 (MET)

On Fri, 2 Nov 2001, Timothee Besset wrote:
>
> I am still trying to get some .nasm assembly files to compile using cons.
> In the long run I'd like to do that without having to modify cons itself.
>
> I have several .nasm files that I want to turn into an asmstuff.a with the
> Library command. It is not very much different from a regular Library
> instruction, except that I need to use nasm to process the files into .o
> objects.
>

The handling of different file-extension/languages has as far as I
remember always been bad in Cons.

Since this situation irritated me, I added functionality to deal
with this to my "add-on" to Cons called "Cons::Plus".
Using Cons::Plus you can write:

    ----Construct------------------------------------------

    use Cons::Plus;

    Language("Nasm",
             SRC_SUFFIX => ".nasm",
             OBJ_SUFFIX => ".o",
             PREFIX     => "NASM",
             ENV        => {
                  NASMCOM => "%NASM %_IFLAGS %< -o %>",
                  NASM  => "nasm",
             },
            );

    $e = Cons::Plus->new();
    $e->Program("prog", "prog.c", "mod1.nasm");

    ---------------------------------------------------------


When you run "cons" you get:

    $cons . -pa
    mod1.o:
    ... nasm mod1.nasm -o mod1.o
    prog:
    ... gcc -o prog prog.o mod1.o
    prog.o:
    ... gcc -c prog.c -o prog.o


For more information about Cons::Plus look at

    ftp://mercury.iar.se/jhftp/cons/Cons-Plus-0.05.tar.gz
    ftp://mercury.iar.se/jhftp/cons/cons-plus.pdf

The latest version is 0.05. ( earlier versions had a bug when
used on UNIX-platforms (I do most development on NT so I don't
test on UNIX very often).

( As Steven mentioned in an his reply, the example above doesn't
work on UNIX unless you apply the patch provided in his mail )

I hope this helps,

/johan holmberg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]