|
|||
Building C++ code from IDLnmake release lu3.5 introduced partial support for building IDL code. The base rules include a default scan rule for the IDL language in order to scan for include files. However, there is no rule provided to actually build the IDL code. A build rule is not included because the rule is project dependent and may very depending on the needs of the project and the IDL compiler being used. In general, building IDL code includes the following steps:
1. Scanning IDL code
nmake release lu3.5 includes a default IDL scan rule called
.ATTRIBUTE.%.suffix : .SCAN.idl
Use
.SOURCE.idl : $(VROOT)/src/idl $(VROOT)/include/idl
You may need to consider using the new
quoteinclude feature of
release lu3.5, which allows the integration of tools that do not support
To use the quoteinclude feature set
quoteinclude = 2
2. Setting the IDL flags
Because nmake is scanning the code for include files it can also generate
IDLFLAGS = -A -B
IDLFLAGS &= $$(.INCLUDE. idl -I -I-)
3. Compiling IDL code
The user must define an IDL rule appropriate for their project. The
following metarule template can be used; adjust it as necessary. With
this metarule,
(IDL) (IDLFLAGS) : .PARAMETER
%C.C %S.C %.hh : %.idl (IDL) (IDLFLAGS) .TERMINAL
$(IDL) $(IDLFLAGS) $(>)
Note, the targets on the LHS ( 4. Compiling C++ codeRules for compiling C++ are already included in all versions of nmake. Finally, there should be some assertion that causes your rules to be triggered. For example:
app :: app.C fileC.C
appsvr :: appsvr.C fileS.C
In this example, when ExampleHere is a simple example showing the above elements in action. Contents of global.mk:
CC = CC
IDL = idl
IDLFLAGS = -A -B
IDLFLAGS &= $$(.INCLUDE. idl -I -I-)
.SOURCE.idl : $(VROOT)/idl $(VROOT)/include/idl
(IDL) (IDLFLAGS) : .PARAMETER
%C.C %S.C %.hh : %.idl (IDL) (IDLFLAGS) .TERMINAL
$(IDL) $(IDLFLAGS) $(>)
Contents of Makefile
:ALL:
app :: app.C fileC.C
appsvr :: appsvr.C fileS.C
Output
$ nmake -g global.mk
+ CC -O -I- -c app.C
+ idl -A -B -I../include/idl -I- -I../idl file.idl
+ CC -O -I. -I- -c fileC.C
+ CC -O -I. -I- -I. -o app app.o fileC.o
+ CC -O -I- -c appsvr.C
+ CC -O -I. -I- -c fileS.C
+ CC -O -I. -I- -I. -o appsvr appsvr.o fileS.o
Last Update: Wednesday,20-Dec-06 13:21:58 CST
|
|||