#
# File:		makeprog.b32
# Author:	Julian Smart
# Created:	1999
# Updated:	
# Copyright:
#
# Include file for samples and utilities. Set TARGET, OBJECTS and 
# TARGETDEF (if you want to include a DEF file in the build) before
# including this file.

# WXWIN  set by parent make
# BCCDIR set in makeb32.env

WXDIR = $(WXWIN)

!ifndef EXEDIR
EXEDIR = BORL
!endif

!include $(WXDIR)\src\makeb32.env

!if "$(wxUSE_GUI)" == "0"
IMGLIBS=
!else
IMGLIBS= png_bc$(DEBUG_SUFFIX) jpeg_bc$(DEBUG_SUFFIX) tiff_bc$(DEBUG_SUFFIX)
!endif

!if "$(FINAL)" == "0"
EX_LIBS=$(EXTRALIBS:.lib=_bcd.lib)
!else
EX_LIBS=$(EXTRALIBS:.lib=_bc.lib)
!endif

!if "$(WXUSINGDLL)" == "1"
LIBS=$(WXLIB) $(EX_LIBS) cw32mti import32 ole2w32 regex_bc$(DEBUG_SUFFIX) zlib_bc$(DEBUG_SUFFIX) $(IMGLIBS) 
!else
LIBS=$(WXLIB) $(EX_LIBS) cw32mt import32 ole2w32 regex_bc$(DEBUG_SUFFIX) zlib_bc$(DEBUG_SUFFIX) $(IMGLIBS)
!endif

!if "$(wxUSE_ODBC)" == "1"
LIBS=$(LIBS) odbc32
!endif


!if "$(wxUSE_GUI)" == "0"
LINKOUT = /ap
!else
LINKOUT = /aa
!endif

!if "$(FINAL)" == "0"
#LINKFLAGS=/v /c /Tpe $(LNKCFG) $(EXTRALINKFLAGS)
LINKFLAGS=/v /c $(LINKOUT) -L"$(WXLIBDIR);$(BCCDIR)\lib;$(BCCDIR)\lib\psdk" $(EXTRALINKFLAGS)
OPT = -Od
DEBUG_FLAGS= -v
!else
#LINKFLAGS=/Tpe +$(LNKCFG) $(EXTRALINKFLAGS)
LINKFLAGS=$(LINKOUT) -L"$(WXLIBDIR);$(BCCDIR)\lib;$(BCCDIR)\lib\psdk" $(EXTRALINKFLAGS)
OPT = -Od
DEBUG_FLAGS =
!endif

CPPFLAGS=$(CPPFLAGS) $(DEBUG_FLAGS) $(OPT)

!if "$(wxUSE_GUI)" == "0"
TARGETRES = 
STARTUP = c0x32.obj	
!else
TARGETRES = $(EXEDIR)\$(TARGET).res
STARTUP = c0w32.obj
!endif

EXE_TARGET=$(EXEDIR)\$(TARGET)

default : all

maked: 
    -if not exist $(EXEDIR)\nul mkdir $(EXEDIR)

wx: $(EXE_TARGET).exe $(EXTRATARGETS)

all: maked wx 


$(EXE_TARGET).exe: $(OBJECTS) $(TARGETDEF) $(TARGETRES) 
  $(LINK) $(LINKFLAGS) -j$(EXEDIR) @&&!
$(STARTUP) $(OBJECTS)
$(EXE_TARGET)
nul
$(LIBS)
$(TARGETDEF)
$(TARGETRES)
!

.path.obj=$(EXEDIR)

.$(SRCSUFF).obj:
	bcc32 $(CPPFLAGS) -c  -n$(EXEDIR) {$< }

.c.obj:
	bcc32 $(CPPFLAGS) -P- -c -n$(EXEDIR) {$< }

!if "$(wxUSE_GUI)" != "0"
#make resources only with GUI apps
$(TARGETRES) :      $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include /i$(WXDIR)\contrib\include -fo$(EXEDIR)\$(<B).res $(TARGET)
!endif

clean:
        -$(RM) $(EXEDIR)\*.obj
        -$(RM) $(EXEDIR)\*.exe
        -$(RM) $(EXEDIR)\*.res
        -$(RM) $(EXEDIR)\*.map
        -$(RM) $(EXEDIR)\*.rws
        -$(RM) $(EXEDIR)\*.tds
        -$(RM) $(EXEDIR)\*.il?