#
#   This is an OpenWatcom makefile.
#

.ERASE
.SUFFIXES:
.SUFFIXES: .exe .obj .c .h

DEBUG=1
AZARLIB=1
WATCOM=e:\watcom
USBTK=..

CFLAGS=-q -bt=os2 -6s -bm -wx -s -orli -zp4 -zq -zm
CC=wcc386
!ifdef DEBUG
CFLAGS+= -d2
!endif

!ifdef AZARLIB
CFLAGS+= -DAZARLIB
!endif

LINK=wlink
ASM=wasm

%INCLUDE=$(USBTK);.;$(WATCOM)\H;$(WATCOM)\H\OS2;

all: sample.exe usblist.exe

# Inference rules
.c.obj:
  $(CC) $(CFLAGS) $[@

.obj.exe:
	@%create $^*.lrf
	@%append $^*.lrf system os2v2
	@%append $^*.lrf option quiet
!ifdef DEBUG
	@%append $^*.lrf debug all
	@%append $^*.lrf option map
!endif	
	@%append $^*.lrf name $^.
	@%append $^*.lrf file $[@
  @%append $^&.lrf lib $(USBTK)\usbcalls.lib
!ifdef AZARLIB
  @%append $^&.lrf lib \src\common\azar.lib
!endif
	$(LINK) @$^*.lrf
	@%erase $^*.lrf

clean: .symbolic
  @if exist *.lrf  @del *.lrf
  @if exist *.obj  @del *.obj
  @if exist *.lst  @del *.lst
  @if exist *.exe  @del *.exe
  @if exist *.err  @del *.err
  @if exist *.map  @del *.map

