MPDM(1)

NAME
mpdm - MPD makefile generator

SYNOPSIS
mpdm [ options ] file.mpd ... [ other files and libraries ]

DESCRIPTION

Mpdm generates a makefile (for use with make(1)) that builds an MPD program from the given mpd source files (.mpd files), other files (.c, .o files), libraries (-llib), and archives (.a files).

Mpdm produces a makefile that uses mpd(1) and mpdl(1) to compile, link, and execute the program described by the files and libraries listed on the command line. The generated makefile provides the following services:

make compile
    compiles without linking

make link
    links after a ``make compile'' (really the same thing as just ``make'')

make run
    executes the program (runtime arguments may be specified with the -R option)

make ls
    produces a list of the source files (e.g., ``pr `make ls`'')

make clean
    removes all artifacts of compilation except for the executable

make cleanx
    removes all artifacts of compilation including the executable (additional files may be specified for removal with the -Z option)

make make
    re-makes the makefile as per the original instructions (useful if the resource import graph changes and the makefile needs to reflect the new dependencies)

The default makefile name is Makefile, and thus the command ``make'' executes it. The makefile name can be changed using the -f option. As a safety feature, mpdm refuses to overwrite an existing file that it did not create.

The default executable name is a.out. This can be changed using the -o option.

Mpdm attempts to determine the main resource (for linking purposes) by analyzing the source files and selecting the first resource it finds that is imported by the least number of resources. If some other resource is to be the main resource, it should be specified with the -m option.

Mpdm takes a number of option flags, which are specified in arguments beginning with a hyphen. The following options are recognized:

-f mfile
    Name the makefile mfile instead of Makefile. A file name of ``-'' directs the makefile to standard output.

-I dir
    Use dir/MPDinter as the MPDinter directory instead of ./MPDinter.

-o ofile
    Use ofile for executable output instead of a.out.

-c compiler
    Use compiler instead of the default compiler.

-m res
    Use the specified resource as the main resource. The default is the first resource found that is imported by the fewest number of resources.

-v  Display interesting information while building the makefile.

-w  Output wide makefile lines instead of limiting to 78 columns.

-C opts
    Include opts in the list of options passed to the compiler mpd(1).

-L opts
    Include opts in the list of options passed to the linker mpdl(1).

-R args
    Include args in the list of arguments passed to the executable by ``make run''.

-Z files
    Include files in the list of files removed by ``make cleanx''.

EXAMPLES

mpdm *.mpd
    no options, all .mpd files in current directory

mpdm -m main -o x a.mpd b.mpd
    the main resource and executable name are specified

mpdm -C "-q -O" a.mpd b.mpd
    flags are passed to mpd(1)

mpdm a.mpd b.mpd c.o -ll r.c -lm
    objects, libraries and C sources listed are passed on to mpdl(1) to be linked in with the MPD program.

ENVIRONMENT

MPDMOPTS
    The environment variable MPDMOPTS may contain mpdm options to be processed ahead of explicit options.

MPD_PATH
    Mpdm searches for resources and object files by looking first in the current directory, then in the MPDinter directory, and finally in the MPD library. (Items found somewhere other than the current directory are included in the makefile as mpdl arguments but not as dependencies.) If MPD_PATH is set, any directories named there are checked ahead of the standard search sequence. Directories in MPD_PATH are separated by colons (:).

FILES
Makefile    generated makefile
file.mpd    MPD source file
a.out    executable program
MPDinter/component.o    object file
MPDinter/resource.spec    export information

SEE ALSO
mpd(1), mpdl(1), make(1)

DIAGNOSTICS
Mpdm uses the mpd compiler to obtain dependency information. In addition to the syntax errors detected by the compiler, mpdm detects missing resource/global specifications and duplicate spec/body definitions. Warnings are issued if a resource or global has no body or a resource that is not the main resource is not imported by any other resource.

CAVEATS

Omitting mpdm's initial s can have disastrous results.

Mpdm doesn't escape shell meta-characters in the makefile.

If the main resource is imported by others, the -m option will probably be required to produce a correct makefile.