MAKEFILE(2)

Table of Contents

Name

makefile specifies additional make file information

Synopsis

%makefile
make macro definitions and file dependencies

Description

The makefile section of a source description file contains code that is inserted into the generated make file, Makefile. This file is used by the make program to build the SDTool from the generated source code.

Most of Makefile is automatically generated. However, the makefile section may be used to specify additional file dependencies or build rules, or to define or redefine make macro values. For example, this section would be used to specify additional object libraries to search in the final link edit of the SDTool.

The make macros that may be defined or redefined in this section are, and their default values, if any, are:

UFILES
list of user-defined object files
ULIBS
list of user-defined libraries
SLIB
path name to ivy*meta SDTB
SHEADER
path name to ivy*meta SDTB header file sglobal.h
SFILES
list of ivy*meta SDTB object files
BINDIR
installation directory
LFLAGS=
list of flags passed to lex
LEX= lex
name of lex tool YFLAGS= -d -v list of flags passed to yacc
YACC= yacc
name of yacc tool
CFLAGS= -g
list of flags passed to cc
CC= cc
name of C compiler

The main purpose of the makefile section is to provide an automatic way of incorporating subroutines into an SDTool. These subroutines would be referred to from sections in source description and product description files. There are two major ways of accomplishing this objective. One is to place all such subroutines in a library. Let sdt be the name of an SDTool, and let X be the path name to the library Y.a. By adding the following section to the source description file, sdt.sd, the library will automatically be included in the final link edit step of the SDTool:

%makefile
ULIBS= X/Y.a

The ULIBS macro is used to list all user-defined libraries. The path name, X, may be either an absolute path name, or a relative path name with respect to the sdt.cc directory.

The alternative approach is to have the source code explicitly added to the sdt.cc directory. The files section is used to list all C source code and header files to be added. The makefile section is used to provide dependency information. For example, let sub.c be a C file that includes global.h, and let sub.c be in the same directory as sdt.sd. Then the following sections cause the generated make file to both link the additional source code into the sdt.cc directory and to maintain it (by recompiling sub.c whenever it is out of date with respect to global.h).

%files sub.c
%makefile
sub.o: global.h

The generated makefile automatically includes the following make commands:

build:
Builds the SDTool.
install:
Builds and installs the SDTool in $BINDIR.
clean:
Removes *.o and intermediate files.
clobber:
Removes *.o, intermediate files and the SDTool.

Example

%files
sub1.c sub2.c my.h

%makefile
# specify the header file dependencies sub1.o: my.h global.h
sub2.o: my.h

# specify a library to include in the build ULIBS=/usr/jcc/lib/stlib.a

# specify options to cc
CFLAGS= -p

See Also

FILES(2)

Documentation

Make A Program for Maintaining Computer Programs, S. I. Feldman


© 1990 Lucent Technologies, Inc
© 1998 Harmony Software, Inc