5.1 NLM Make Utilities

The WATCOM make utility is WMAKE. The makefiles associated with the examples that ship with this NDK are written to be used by WMAKE. To compile an example, you simply move to the directory where the example is located and type:

  WMAKE
  

To assist you in creating WMAKE-style makefiles for your programs, this NDK ships with the QMK386 utility. QMK386 generates makefiles for WMAKE based on user input and entries in the MAKEINIT file generated by the MAKEINIT.EXE file. You can customize the makefiles after QMK386 creates them. QMK386 is located in the TOOLS directory.

5.1.1 QMK386.EXE

Information about this utility consists of the following sections:

Syntax for QMK386.EXE

  [d:][path]QMK386 <progname> [/options]
  

[d:][path] specifies the drive and path containing the QMK386 command file.

<progname> specifies the name of the modules whose makefile is being created. If this parameter is not set, the default name is "NONAME."

[/options] See Options for QMK386.EXE

Options for QMK386.EXE

To display the QMK386 options, type:

  QMK386 ?
  

Option

To

/?

Display help screens.

/c<x>

Specify additional objects, imports, exports and modules:

e<spec> - Export file

i<file> - Import file

l<spec> - Library file

m<spec> - Module dependency

s<file> - Source file

/f<name>

Specify name of output file. Default: MAKEFILE

/h<dir>

Specify additional INC386 directories.

/i<x>

Include import statement for ...

a - AIO symbols

c - CALNLM32 (cross-platform NWCalls symbols)

d - NETNLM32 (cross-platform NDS symbols)

e - DSEvent symbolsf - Floating point support symbols

h - Threads symbolsI - NIT NLM symbols

l - AFP symbolsn - NLM-specific symbols (NLMLIB)

o - SOCKLIB symbolsp - Print symbols

r - Requester symbolss - Streams symbols

t - TLI symbolsu - Unicode symbols

v - 3.x Print Services symbols

w - NWSNUT symbols

x - CLXNLM32 (cross-platform NWClient symbols)

y - AUDNLM32 (cross-platform Auditing symbols)

z - LOCNLM32 (cross-platform NWLocale symbols)

NOTE:The recommended method is to use the ALL.IMP file to load all symbols. The /i option cannot be used with the ALL.IMP file.

/l<dir>

Specify additional LIB386 directories.

/n<x>

NLM option ...

m - Load Multiple

p - PseudoPreemption

r - ReEntrant

s - Synchronize

/o<x>

Other option ...

b<path> - shareliB path

c<api> - Check function

d<path> - xDc data path

h<file> - Help file

m<file> - Message file

s<api> - Start function

u<file> - cUstom file

x<api> - eXit function

/p

Run NLMPack after linking.

/s#

Set stack size to `#ā€™ KBytes.

/x

No default screen for NLM

/z

Generate an NLMLINK-style linker definition file.

Environment Variables for QMK386.EXE

The following environment variables may be used with QMK386:

SWITCHAR sets the character that QMK386 uses as the delimiter for parameters. By default, the forward slash `/ā€™ is used.

QMK386 can be used to set options that are commonly used. For example, if you commonly use /Z and /IDT, set the environment variables as follows to avoid entering these options at the command line:

  SET QMK386=/z /idt
  

SILENT places the SILENT directive in the makefile when set.

QMKVER allows you to specify the default way to build an application. If QMKVER is not specified, it will default to `dā€™, which uses DEBUG compile switches, and includes debug information in the output file.

CCF386 specifies the command line switches to be used when rebuilding an application.

Examples for Using QMK386.EXE

This section contains some examples of common build options used with QMK386. The parameters can appear in any order, and no spaces are required between options unless the options require a directory path or function name.

To create a WLINK style makefile for a program called HELLO, with an 8K stack, importing from CLIB.IMP, THREADS.IMP and NLMLIB.IMP:

  F:\> qmk386 hello /ih /in
  

HINT:Import files can be included individually with the /i option (for example, /oh includes the THREADS.IMP file). To inlcude the ALL.IMP file (which includes all the import files), do not use the /i option (ALL.IMP is the default setting).

Using the ALL.IMP file might require more memory than is available in your environment.

To create a WLINK style makefile for a program called TEST1, with a 12K stack, importing from CLIB.IMP and TLI.IMP:

  F:\> qmk386 /s12 /it test1
  

To create an NLMLINK style makefile for the example above:

  F:\> qmk386 /s12 /it test1 /z
  

To create an NLMLINK style makefile, and run the NLMPACK utility:

  F:\> qmk386 /s12 /it test1 /z /p
  

The /CS option allows you to specify source files. You can specify multiple /C<x> options, as well as use wildcards. This allows you to specify multiple dependencies for the first target. For example, to create a MAKEFILE for an NLM called MYNLM, made up of all the .C files in the current directory, importing a file called EXLIB.IMP and specifying a NetWare Loader module dependency on EXLIB.NLM:

  F:\SRC> qmk386 mynlm /CS*.c /CIexlib /Cmexlib
  

Notes for Using QMK386.EXE

QMK386 MAKEFILEs define the following macros for your .C programs:

  • t vMAJ - Major version number

  • t vMIN - Minor version number

  • t vREV - Revision number

The WMAKE macros which define the values of these are pvmaj, pvmin and pvrev. They are defined at the top of your MAKEFILE, and if you change the values, they are reflected in both the C macros as well as the version number passed to the linker. One way to create a version string in your NLM might be:

  #define VERSION "Widget Monitor NLM v"vMAJ"."vMIN
  

This would expand to:

  #define VERSION "Widget Monitor NLM v1.00"
  

if the default values were used.