OS/2, eCS & ArcaOS - Technical > Programming
Compiling PM Samples with OpenWatcom
Martin Iturbide:
Hello
I want to learn to use a the OpenWatcom compiler as an alternative to gcc for some PM samples, but I need to understand the commands and have some example of the make file.
My desire is to compile some thing simple like: https://github.com/OS2World/UTIL-WPS-Scale
I have installed OpenWatcom C for OS/2 v2.0.x offered from the David Azarewicz website. I'm using make and wlink too.
Please give me hand with the makefile, should I make a makefile.wcc ?
Regards
Dave Yeo:
I just used the IDE to compile Util-WPS-Scale with the defaults plus PM program chosen. Here's the log.
--- Code: ---cd H:\tmp\UTIL-WPS-Scale
wmake -f H:\tmp\UTIL-WPS-Scale\Util-WPS-Scale.mk -h -e
wcc386 SCALE.C -i="G:\WATCOM/h;G:\WATCOM/h/os2" -w4 -e25 -zq -od -d2 -6r -bt=os2 -fo=.obj -mf
wlink name Util-WPS-Scale d all sys os2v2 pm op m op maxe=25 op q op symf @Util-WPS-Scale.lk1
Execution complete
--- End code ---
The IDE also left the makefiles. Works a bit different then GNU make, includes mk files and lnk files etc, directory listing afterwards,
--- Code: ---Directory of H:\tmp\UTIL-WPS-Scale
6-09-24 7:39p <DIR> 124 ---- .
6-09-24 7:38p <DIR> 0 ---- ..
6-09-24 7:26p 169 124 a--- compile.cmd
6-09-24 7:39p 262 0 a--- dir.out
6-09-24 7:26p 114 124 a--- FOO.CMD
6-09-24 7:26p 146 124 a--- IBMC.CMD
6-09-24 7:26p 145 124 a--- LINKUP.CMD
6-09-24 7:26p 298 124 a--- makefile
6-09-24 7:26p 351 124 a--- README.md
6-09-24 7:26p 7,408 124 a--- SCALE.C
6-09-24 7:26p 176 124 a--- SCALE.DEF
6-09-24 7:26p 59,844 124 a--- scale.ico
6-09-24 7:30p 8,111 0 a--- SCALE.obj
6-09-24 7:26p 4,495 124 a--- SCALE.txt
6-09-24 7:30p 7,140 0 a--- Util-WPS-Scale.exe
6-09-24 7:30p 17 0 a--- Util-WPS-Scale.lk1
6-09-24 7:30p 9,648 0 a--- Util-WPS-Scale.map
6-09-24 7:30p 115 0 a--- Util-WPS-Scale.mk
6-09-24 7:30p 737 0 a--- Util-WPS-Scale.mk1
6-09-24 7:30p 7,897 0 a--- Util-WPS-Scale.sym
6-09-24 7:30p 418 0 a--- Util-WPS-Scale.tgt
6-09-24 7:31p 292 0 a--- Util-WPS-Scale.txt
6-09-24 7:30p 254 0 a--- Util-WPS-Scale.wpj
6-09-24 7:26p 236 124 a--- WAT.CMD
6-09-24 7:26p <DIR> 124 ---- wiki
25 file(s) 108,273 bytes used
--- End code ---
Try it using the IDE, File-->New Project, name it, then Sources-->New Source and browse to SCALE.C.
Then Targets-->New Target, and choose PM app etc, then press F5.
This will give you the basic commands to build.
If you want to use GnuMake, you can see the needed commands from the log to adapt the makefile. You could have multiple targets in the makefile, one for GCC and one for OW or two makefiles.
From the IDE you can also adjust the build flags etc, or read the documentation.
Dave Yeo:
Quick adaption of the log to GnuMake,
--- Code: ---# nmake makefile
#
# Tools used:
# Compile::Watcom Resource Compiler
# Compile::GNU C
# Make: GNU make
all : scale.exe
scale.exe : scale.obj
wlink name Util-WPS-Scale d all sys os2v2 pm op m op maxe=25 op q op symf FIL SCALE.obj
scale.obj : scale.c
wcc386 SCALE.C -i="G:\WATCOM\h;G:\WATCOM\h\os2" -w4 -e25 -zq -od -d2 -6r -bt=os2 -fo=.obj -mf
clean :
rm -rf *exe *res *obj
--- End code ---
Martin Iturbide:
Thanks Dave, it compiled (and it runs) with the makefile you posted here.
Just one question, any idea how do you add the "bldlevel information" that is on "SCALE.DEF" to be included on the .exe ?
I will keep testing the OpenWatcom IDE too.
Regards
Dave Yeo:
This is sort of how I did with the screensaver. You need https://88watts.net/download/addtofile-1.03.zip, on your path or use the full pathname. With wmake there is a .before to run shell commands at the beginning of the build, have to look better at Gnu Make for similar. For now I adjusted compile.cmd like so,
--- Code: ---rm -rf description.lnk
call AddToFile.cmd description.lnk,option description,BLDLEVEL,OS2World,1,Util-WPS-Scale
make -f makefile.wcc 2>&1 |tee make.out
--- End code ---
and added @description to the wlink line in the makefile, not sure if it matters where, I added it just before the FIL SCALE.obj directive.
--- Code: ---wlink name Util-WPS-Scale d all sys os2v2 pm op m op maxe=25 op q op symf @description FIL SCALE.obj
--- End code ---
--- Code: ---H:\tmp\UTIL-WPS-Scale>bldlevel Util-WPS-Scale.exe
Build Level Display Facility Version 6.12.675 Sep 25 2001
(C) Copyright IBM Corporation 1993-2001
Signature: @#OS2World:1#@##1## 10 Jun 2024 16:07:17 ARCAOS-444::::::@@Util-WPS-Scale
Vendor: OS2World
Revision: 1.00
Date/Time: 10 Jun 2024 16:07:17
Build Machine: ARCAOS-444
File Version: 1.0
Description: Util-WPS-Scale
--- End code ---
The line in compile.cmd can be adjusted of course, see addtofile.cmd. You could also directly add something like the contents of description.lnk to the makefile too, just that addtofile.cmd gets the date, time and machine dynamically.
Navigation
[0] Message Index
[#] Next page
Go to full version