The instructions to be used are placed into a makefile. The new make facility NMAKE, provided with the IBM Developer's Toolkit for OS/2 2.0 is extremely flexible and rich in function. It is recommended that programmers read the NMAKE section of the IBM OS/2 Version 2.0 Programming Tools Reference if unfamiliar with makefiles.
The SOM Precompiler environment variables are set as follows:
!if [set SMINCLUDE=.;$(SCPATH);] || \ [set SMTMP=$(SOMTEMP)] || \ [set SMEMIT=ih;h;ph;psc;sc;c;def] !endif
The use of the !if directive is somewhat confusing, as the statement has nothing to do with a conditional command. In fact, the OS/2 SET command is being executed to initialize the environment variables. The NMAKE utility executes any OS/2 command placed within square brackets in a !if directive.
The SMEMIT environment variable tells the SOM Precompiler which C source files are to be generated; the suffixes correspond to the file types described earlier in this chapter.
The SMINCLUDE and SMTMP environment variables are set from two NMAKE macros, which are defined at the top of the makefile:
SCPATH = D:\toolkt20\sc SOMTEMP = .\somtemp
The SMINCLUDE variable tells the SOM Precompiler where to find the class definition (.SC) include files.
The SMTMP variable locates the SOM Precompiler temporary workspace directory.
This brings us to the next part of the makefile that is responsible for ensuring the existence of the temporary directory.
!if [cd $(SOMTEMP)] ! if [md $(SOMTEMP)] ! error Error creating $(SOMTEMP) directory ! endif !else ! if [cd ..] ! error Error could not cd .. from $(SOMTEMP) directory ! endif !endif
This code checks for the existence of the directory and if it cannot be found, attempts to create it.