cons-discuss
[Top][All Lists]
Advanced

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

Re: Dynamic target


From: Steven Knight
Subject: Re: Dynamic target
Date: Wed, 15 Nov 2000 17:13:00 -0600 (CST)

>   ZD> 1. The first step takes 2 input text files and generates a set
>   ZD> of .c files.  These files will all get the same prefix, but
>   ZD> other than that I do not know the names of these files or the
>   ZD> size of the set in advance.
> 
>   ZD> 2. The second step compiles and links these files into an
>   ZD> executable.
> 
> Hi, Zach.  This is exactly what we do here.  My solution is as
> follows:
> 
> 1. You need my AfterBuild patch, which allows you to execute code
>    after a specified target is built.
> 
> 2. In your first step, also generate a list of the .c files into a
>    text file.  Mention that file as one of the targets of your step 1
>    command.
> 
> 3. Write an AfterBuild action (in my AfterBuild patch) for the above
>    text file, which should just add each filename seen into the link.
>    (You may need to futz with this; I build a DLL, and cons knows how
>    to do that in sections; Command and Program don't.)
> 
> 4. Use your regular Command/Program target to define the main
>    executable.

If the input text files are source files (i.e., aren't generated by
an action), then you could do this more simply by executing step 1 in
straight perl, either coded directly or by calling a utility to do it,
like so:

        @c_files = `generate_list input1.txt input2.txt`;
        Program $env 'output.exe', @c_files;

If the input text files are generated by other Cons actions, then you
need something like Gary's AfterBuild patch.

        --SK




reply via email to

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