#----------------------------
# An almost generic make file
#----------------------------

!if !$d(C_PATH)
!error Execute: SET C_PATH=<compiler base directory>
!endif

proj=wh_wedit
# define name of project

Windows=1
# type: define one of DOS, Windows, or DLL (case sencitive)

RES=1
# define RES if resource file present

model=s
# small: s; compact: c; medium: m; large: l; huge: h;

c_type=c
# c or cpp

cpp=
# force C++: -P; else empty

no_eh=1
# define no_eh to include noeh library (no errorhandling)

#obj = $(proj).obj d:\c\help_b_s.obj
obj = $(proj).obj
# append other pre-compiled objects if applicable

c=bin\bcc
link=bin\tlink
rc=bin\rc

!if !$d(cpu)
cpu=3
!endif

!if !$d(c_type)
c_type=cpp
!endif

!if $d(RES)
resrc=$(proj).res
!else
resrc=
!endif

!if $d(DOS)
# DOS .exe
ext=exe
ti=de
win=
w=
pf=
ds_ss=
!elif $d(Windows)
# Windows .exe
ext=exe
ti=we
win=w
w=-WE
pf=w
ds_ss=
!elif $d(DLL)
# Windows .dll
ext=dll
ti=wd
win=w
w=-WE
pf=d
ds_ss=!
!else
!error Type DOS, Windows, or DLL must be defined.
!endif

!if $d(no_eh)
noeh=noeh$(win)$(model)
!else
noeh=
!endif

$(proj).$(ext) : $(obj) $(resrc) $(proj).def d:\c\help_lib\help_b_s.lib
#     $(C_PATH)\$(link) /A=16 /c /n /T$(ti) /yx /L$(C_PATH)\lib c0$(pf)$(model) $(obj), $(proj).$(ext), NUL, import $(noeh) help_b_$(model) c$(win)$(model), $(proj)
     $(C_PATH)\$(link) /A=16 /c /n /T$(ti) /yx c0$(pf)$(model) $(obj), $(proj).$(ext), NUL, import $(noeh) help_b_$(model) c$(win)$(model), $(proj)
     $(C_PATH)\$(rc) -t $(resrc) $(proj).$(ext)

$(proj).obj : $(proj).$(c_type) $(proj).h
     $(C_PATH)\$(c) -c -m$(model)$(ds_ss) -w-par $(cpp) $(w) -$(cpu) -I$(C_PATH)\include $(proj).$(c_type)

!if $d(RES)
$(proj).res : $(proj).rc $(proj).h
     $(C_PATH)\$(rc) -r -i$(C_PATH)\include $(proj).rc
!endif
