/* * build -- Make the makefiles automatically from all the *.C files in * the C directory and invoke the compiler. */ '@echo off' if settings()<>0 then exit 32000 compiler = Value( "vxcompiler", ,"OS2ENVIRONMENT" ) version = Value( "vxversion", , "OS2ENVIRONMENT" ) dllname = Value( "vxdllname", , "OS2ENVIRONMENT" ) som = Value( "vxsom", , "OS2ENVIRONMENT" ) vxodk = value( 'VXODK',, 'OS2ENVIRONMENT' ) if( right( vxodk, 1 ) \= '\' )then do vxodk = vxodk || '\' end say 'Making sure class information is up-to-date...' somlib = 'som.lib' if( som = 'SOM2' )then somlib = 'somtk.lib' exports = 'SOMInitModule SOMUninitModule _VXREXX_CALLER_ _' || dllname || '_VERSION_INFO_' , 'VRXColorDialog VRXColourDialog VRXDropFuncs VRXLoadFuncs VRXGetClipboardText VRXPutClipboardText VRXVersion' libs = somlib 'rexx.lib os2386.lib' say 'Making sure class information is up-to-date...' old = directory() call directory 'som' call make call directory old say 'Building makefile for use with the' compiler 'compiler...' makefile = 'makefile' linkfile = dllname || '.LNK' /* only for CSET */ deffile = dllname || '.DEF' /* only for CSET */ compiler = translate( compiler ) if( left( compiler, 1 ) = 'W' )then compiler = 'WATCOM' else compiler = 'CSET' version = translate( version ) if( left( version, 1 ) = '1' )then version = '101' call rxfuncadd 'sysloadfuncs', 'REXXUTIL', 'SysLoadFuncs' call sysloadfuncs call Erase makefile if( compiler = 'CSET' )then call Erase linkfile call lineout makefile, '#' call lineout makefile, '# This makefile is automatically generated by build.cmd' call lineout makefile, '# Don''t edit it manually!' call lineout makefile, '#' call lineout makefile, '' call lineout makefile, 'ODKDIR =' vxodk || ' ' call lineout makefile, 'SOMDIR =' vxodk || 'SOM.' || version || '\' || ' ' call lineout makefile, 'dllname =' dllname || ' ' call lineout makefile, 'somlevel =' som call lineout makefile, '' if( compiler = 'WATCOM' )then do call lineout makefile, 'objs = &' end; else do call lineout makefile, 'objs = \' end call sysfiletree 'SOM\SC\*.PRP', 'files', 'fo' prplist = '' do i = 1 to files.0 name = filespec( 'name', files.i ) prplist = prplist || ' som\sc\' || name end call sysfiletree 'RC\*.ICO', 'files', 'fo' iconlist = '' do i = 1 to files.0 name = filespec( 'name', files.i ) iconlist = iconlist || ' rc\' || name end call sysfiletree 'C\*.C', 'files', 'fo' do i = 1 to files.0 name = filespec( 'name', files.i ) name = left( name, length( name ) - 2 ) files.i = name if( compiler = 'WATCOM' )then do call lineout makefile, ' ' name || '.obj &' end; else do call lineout makefile, ' $(o)\' || name || '.obj \' str = name || '.obj' if( i < files.0 )then do str = str || ' +' end call lineout linkfile, str end end call lineout makefile, '' if( compiler = 'WATCOM' )then do call lineout makefile, '!include' vxodk'\bin\makewatc.inc' end; else do call lineout makefile, '!include' vxodk'\bin\makecset.inc' end call lineout makefile, '' if( compiler = 'WATCOM' )then do call WatcomOut end; else do call CSetOut end call stream makefile, 'c', 'close' if( compiler = 'WATCOM' )then do say "Invoking wmake on the makefile..." 'wmake' arg(1) end; else do say "Invoking nmake on the makefile..." 'nmake' arg(1) end say '' say 'Done build.' exit 0 /* * CSetOut */ CSetOut: call lineout makefile, '$(o)\$(dllname).dll : $(objs) $(o)\$(dllname).res $(dllname).lnk $(dllname).def' call lineout makefile, ' makedesc -D"VX-REXX Extras API Library" -N"Alex Taylor" -V"^#define=VERSION_STRING,version.h" $(dllname).def' call lineout makefile, ' cd $(o)' call lineout makefile, ' set LIB=$(ODKDIR)lib;$(LIB)' call lineout makefile, ' link386 $(lflags) @..\$(dllname).lnk' call lineout makefile, ' rc $(dllname).res $(dllname).dll' call lineout makefile, ' cd ..' say 'Building LNK file ...' call lineout linkfile, dllname || '.DLL' call lineout linkfile, dllname || '.MAP' call lineout linkfile, 'vxrexxc.lib' libs call lineout linkfile, '..\' || dllname || '.DEF' if( stream( deffile, 'c', 'query exists' ) = '' )then do say 'Building DEF file ...' call lineout deffile, '; DEF file for' dllname call lineout deffile, 'library' dllname 'initinstance terminstance' call lineout deffile, 'data multiple readwrite preload nonshared' call lineout deffile, 'code loadoncall' call lineout deffile, 'protmode' call lineout deffile, 'exports' do i = 1 to words( exports ) call lineout deffile, ' ' word( exports, i ) end end call lineout makefile, '' call lineout makefile, '$(o)\props.obj : c\props.c' prplist call lineout makefile, '' call lineout makefile, '$(o)\$(dllname).res : rc\$(dllname).rc' iconlist call lineout makefile, '' return /* * WatcomOut */ WatcomOut: call lineout makefile, 'exports =' exports call lineout makefile, 'libs =' libs call lineout makefile, '' call lineout makefile, '$(obj_dir)\$(dllname).dll : $(objs) $(obj_dir)\$(dllname).lnk $(obj_dir)\$(dllname).res' call lineout makefile, ' @cd $(obj_dir)' call lineout makefile, ' $(std_link) @$(dllname)' call lineout makefile, ' rc -p -x $(dllname).res $(dllname).dll > nul' call lineout makefile, '!ifdef DEBUG' call lineout makefile, ' @copy /b $(dllname).dll + $(dllname).sym $(dllname).dll 2>&1 >nul' call lineout makefile, '!endif' call lineout makefile, ' @cd $(main_dir)' call lineout makefile, '' call lineout makefile, '$(obj_dir)\$(dllname).res : $(rc_dir)\$(dllname).rc' iconlist call lineout makefile, ' @cd $(rc_dir)' call lineout makefile, ' rc -r $[*.rc $(obj_dir)\$[&.res' call lineout makefile, ' @cd $(main_dir)' call lineout makefile, '' call lineout makefile, '$(obj_dir)\$(dllname).lnk : makefile $(locallibs)' call lineout makefile, ' %create $@' call lineout makefile, " @%append $@ option osname='OS/2 32-bit'" call lineout makefile, ' @%append $@ libpath %WATCOM%\lib386' call lineout makefile, ' @%append $@ libpath %WATCOM%\lib386\os2' call lineout makefile, ' @%append $@ libpath %TOOLKIT%\os2lib' call lineout makefile, ' @%append $@ format os2 lx dll initinstance terminstance' call lineout makefile, ' @%append $@ option Quiet,Map,CaseExact,ManyAutoData' call lineout makefile, ' @%append $@ option symfile=$(dllname).sym' call lineout makefile, ' @%append $@ name $(dllname)' call lineout makefile, ' @%append $@ debug all' call lineout makefile, ' @for %i in ($(objs)) do @%append $^@ file %i' call lineout makefile, ' @for %i in ($(locallibs)) do @%append $^@ library %i' call lineout makefile, ' @for %i in ($(libs)) do @%append $^@ library %i' call lineout makefile, ' @for %i in ($(exports)) do @%append $^@ export %i' call lineout makefile, '' call lineout makefile, 'props.obj : c\props.c' prplist call lineout makefile, '' call lineout makefile, '' return /* * Erase */ Erase: file = arg(1) if( stream( file, 'c', 'query exists' ) \= '' )then do address cmd '@del' file end return