@echo off
echo --------------------------------------------------------------------
echo (C) Copyright 1994 by Autodesk, Inc.
echo Permission to use, copy, modify, and distribute this software and its
echo documentation for any purpose and without fee is hereby granted.   
echo THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. 
echo ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF 
echo MERCHANTABILITY ARE HEREBY DISCLAIMED.                                 
echo --------------------------------------------------------------------
Rem Notice what goes into an ADS application:  the application's own code
Rem (e.g., GRAVITY.OBJ), the library (WCADS100.LIB), and the WATCOM C/C++
Rem Version 10.0 libraries.  Each ADS application requires a special version
Rem of the startup module that is contained in the WATCOM C/C++ run-time
Rem library CLIB3S.LIB.  This special version, ADSSTART.OBJ, is located in
Rem the \WATCOM\LIB386\DOS directory.  The following link directives will
Rem properly link your application with the new startup module: 
Rem
Rem     wlink system ads file your_obj library wcads100 name your_app 
Rem
@echo MSDOS batch file to build WATCOM C/C++ 10.0 ADS sample programs

set savwat=%watcom%
set savpth=%path%
set savinc=%include%

set WATCOM=C:\WATCOM
set path=%WATCOM%\bin;%WATCOM%\binb;%path%;
set include=%WATCOM%\h;..

if exist %WATCOM%\lib386\dos\clib3s.lib goto L1
echo You must edit w100samp.bat and change the variable WATCOM
goto done 
:L1

if .%1 == . goto L2
@echo Compiling %1.c 
  wcc386 %1 -fpi87 -4s -s -oailt -zq
  wlink system ads file %1 library wcads100 option quiet
goto done

:L2
@echo Compiling ads_perr.c
  wcc386 ads_perr -fpi87 -4s -s -oailt -zq
  wlink system ads file ads_perr library wcads100 option quiet

@echo Compiling appmngr.c
  wcc386 appmngr -fpi87 -4s -s -oailt -zq
  wlink system ads file appmngr library wcads100 option quiet

@echo Compiling arbmat.c
  wcc386 arbmat -fpi87 -4s -s -oailt -zq
  wlink system ads file arbmat library wcads100 option quiet

@echo Compiling colext.c
  wcc386 colext -fpi87 -4s -s -oailt -zq
  wlink system ads file colext library wcads100 option quiet

@echo Compiling dlgtest.c
  wcc386 dlgtest -fpi87 -4s -s -oailt -zq
  wlink system ads file dlgtest library wcads100 option quiet

@echo Compiling dragger.c
  wcc386 dragger -fpi87 -4s -s -oailt -zq
  wlink system ads file dragger library wcads100 option quiet

@echo Compiling fact.c
  wcc386 fact -fpi87 -4s -s -oailt -zq
  wlink system ads file fact library wcads100 option quiet

@echo Compiling gpalsym.c
  wcc386 gpalsym -fpi87 -4s -s -oailt -zq
  wlink system ads file gpalsym library wcads100 option quiet

@echo Compiling gravity.c
  wcc386 gravity -fpi87 -4s -s -oailt -zq
  wlink system ads file gravity library wcads100 option quiet

@echo Compiling grvecs.c
  wcc386 grvecs -fpi87 -4s -s -oailt -zq
  wlink system ads file grvecs library wcads100 option quiet

@echo Compiling magnets.c
  wcc386 magnets -fpi87 -4s -s -oailt -zq
  wlink system ads file magnets library wcads100 option quiet

@echo Compiling mountain.c
  wcc386 mountain -fpi87 -4s -s -oailt -zq
  wlink system ads file mountain library wcads100 option quiet

@echo Compiling sld2ps.c
  wcc386 sld2ps -fpi87 -4s -s -oailt -zq
  wlink system ads file sld2ps library wcads100 option quiet

@echo Compiling sqr.c
  wcc386 sqr -fpi87 -4s -s -oailt -zq
  wlink system ads file sqr library wcads100 option quiet

@echo Compiling tadc.c
  wcc386 tadc -fpi87 -4s -s -oailt -zq
  wlink system ads file tadc library wcads100 option quiet

@echo Compiling tower.c
  wcc386 tower -fpi87 -4s -s -oailt -zq
  wlink system ads file tower library wcads100 option quiet

@echo Building geomcal
  wcc386 cal     -fpi87 -4s -s -oailt -zq
  wcc386 calerr  -fpi87 -4s -s -oailt -zq
  wcc386 calexpr -fpi87 -4s -s -oailt -zq
  wcc386 callex  -fpi87 -4s -s -oailt -zq
  wcc386 calmngf -fpi87 -4s -s -oailt -zq
  wcc386 calstdf -fpi87 -4s -s -oailt -zq
  wcc386 calusrf -fpi87 -4s -s -oailt -zq
  wcc386 util    -fpi87 -4s -s -oailt -zq
  echo system ads file cal file calerr file calexpr file callex > geomcal.lnk
  echo file calmngf file calstdf file calusrf file util >> geomcal.lnk
  echo library wcads100 name geomcal option quiet >> geomcal.lnk
  wlink @geomcal.lnk
  del geomcal.lnk

:done

set include=%savinc%
set path=%savpth%
set WATCOM=%savwat%
set savinc=
set savpth=
set savwat=

@echo
@echo W100SAMP completed
@echo on
