home *** CD-ROM | disk | FTP | other *** search
-
-
-
- SETLINK
- Ted H. Emigh, emigh@ncsugn.ncsu.edu
- 4 August 1989
-
- One of the limitations of DOS that I encounter in developing
- software using Turbo C is the length of the command line
- available. I often have over a dozen program source files which
- need to be linked. In order to link these files together I would
- need a command line whose length is well over the DOS limit of
- 128 characters. Borland has a partial solution to the problem by
- allowing the linker to take its commands from a file. The
- command becomes:
- tlink @makefile.lnk
- where makefile.lnk (or whatever name you choose) contains the
- linker commands. While this helps, it is not a complete
- solution.
- A problem arises in using make with a makefile. The list of
- files to be linked needs to be listed in both makefile and
- makefile.lnk. This opens the possibility of a mistake when
- source files are added and deleted or when changing the memory
- model. I prefer to have the files listed in makefile along with
- the memory model and any other information needed, and have make
- create makefile.lnk. Unfortunately, make does not allow for
- output redirection, so I cannot use echo ... >makefile.lnk.
- To solve this problem, I have developed a short program,
- setlink (see setlink.c), to make up for make's lack of output
- redirection. setlink merely takes the rest of the command line
- and adds it to the specified file. It is useful to identify
- which setlink call in the makefile will be the first and so
- identify when to create the file and when to append to the file.
- In addition, I have added an option to use a user supplied name.
- I have written setlink to minimize program size, so have used
- some atypical program fragments.
- The command setlink has the following usage:
- setlink -n[filename]|-a[filename] [optional command line]
- One of the options -n (for new file) or -a (for append to file)
- is required. If a file name is given following -n or -a (without
- a space between the file name and the option), then that file is
- used, otherwise makefile.lnk is used. The remainder of the
- command line, containing linker commands and options, is written
- to the file makefile.lnk.
- As an example of the usage, the MAKEFILE is the makefile for
- setlink.
-