# $Id: make_lib.dos,v 6.9 2000/02/25 16:46:00 vakatov Exp $
########################################################################
#  This file describes rules to build NCBI-toolkit-based library.
#  Below is an example of using this file(along with another template
#  "make_gen.dos").
#
########################################################################
#NCBI_DLL = 1 -- use this if the target library can be built as a DLL
#!include "$(LIBPATH)\make_gen.dos"
#LIB_NAME = ncbiobj
#LIB_LIB  = $(LIB1)
#LIB_OBJ  = $(OBJ2)
#LIB_PREOPT  =
#LIB_OPT  =
#LIB_STDLIB  =
#RES =
#RES_DEP =
#!include "$(LIBPATH)\make_lib.dos"
########################################################################
# For more detail explanations see in the file "make/_howto_.dos"
########################################################################

# remove '+' before the object module filenames(for non-Borland tools)
LIB_OBJ1 = $(LIB_OBJ:+=)

#############################################################################
# Compose default input/output file names
!ifdef NCBI_DLL
LIBRARY = $(LIB_NAME).dll
!else
LIBRARY = $(LIB_NAME).lib
!endif


########################################################################
XCFLAGS = $(LIB_PREOPT) $(CFLAGS) $(LIB_OPT)

.c.obj:
	$(CC) $(XCFLAGS) $*.c

.cxx.obj:
	$(CC) $(XCFLAGS) $*.cxx

!ifdef NCBI_DLL
!ifdef RES
LIB_RC  = $(LIB_NAME).rc
LIB_RES = $(LIB_NAME).res
$(LIB_RES): $(TEST_RC) $(RES_DEP)
	$(RC) -r -I$(INCPATH) -I$(LIBPATH) $(LIB_RC)
!endif
!endif


#####  special rules to build some of the NCBI toolkit object files
ncbithrs.c:  ncbithr.c
	copy ncbithr.c ncbithrs.c
ncbithrs.obj:  ncbithrs.c
	$(CC) @<<
-DNCBI_NOTHREADS_AVAIL $(XCFLAGS) $*.c
<<
###
regex.obj:  regex.c
	$(CC) @<<
-DREGEX_NCBI -DREGEX_MALLOC $(XCFLAGS) $*.c
<<
###
ncbi_socket_.obj:  ncbi_socket_.c ncbi_socket.c
	$(CC) @<<
$(XCFLAGS) ncbi_socket_.c
<<
###
ncbidrwg.c:  ncbidraw.c
	copy ncbidraw.c ncbidrwg.c
###
naccentr.c:  accentr.c
	copy accentr.c naccentr.c
naccentr.obj: naccentr.c
	$(CC) @<<
$(XCFLAGS) -D_NETENT_ $*.c
<<
###
caccentr.c:  accentr.c
	copy accentr.c caccentr.c
caccentr.obj: caccentr.c
	$(CC) @<<
$(XCFLAGS) -D_NET_AND_CD_ $*.c
<<
###
objmla.obj: objmla.c
	$(CC) @<<
$(XCFLAGS) -DNLM_OBJ_INCL="mampla.h" $*.c
<<
###
txcdproc.obj: txcdproc.c
	$(CC) @<<
$(XCFLAGS) -DTAXSERVICE $*.c
<<

tc2proc.obj: tc2proc.c
	$(CC) @<<
$(XCFLAGS) -DTAXSERVICE $*.c
<<


########################################################################


copy:   $(LIBRARY)
nocopy: $(LIBRARY)

!ifdef NCBI_DLL
XLIB_LIB = $(LIB_LIB)
!endif

$(LIBRARY) : $(LIB_OBJ1) $(LIB_RES) $(XLIB_LIB)
	$(DEL) $@
!ifdef BOR
	tlib $@ $(LIBFLAGS) @<<
$(LIB_OBJ)
<<
!else
!ifdef NCBI_DLL
	link /DLL /NODEFAULTLIB:LIBC $(DBUG_FLG) /OUT:$@ /MAP:$*.map /IMPLIB:$*.lib $(LIB_OBJ1) $(LIB_RES) $(XLIB_LIB) $(LIB_STDLIB) $(STDLIB)
!else
	lib /OUT:$@ $(LIB_OBJ1)
!endif
!endif
