#*************************************************************************
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
#     National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
#     Operator of Los Alamos National Laboratory.
# EPICS BASE Versions 3.13.7
# and higher are distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution. 
#*************************************************************************
#	Makefile.Host  for  base/src/libCom
#
#

TOP = ../../..
include $(TOP)/config/CONFIG_BASE

USR_CFLAGS = -D_NO_PROTO 

#	includes to install from this sub-project
#
INC += cvtFast.h
INC += ellLib.h
INC += envDefs.h
INC += epicsAssert.h
INC += errlog.h
INC += epicsPrint.h
INC += errMdef.h
INC += error.h
INC += fdmgr.h
INC += freeList.h
INC += gpHash.h
INC += memDebugLib.h
INC += tsDefs.h
INC += bucketLib.h
INC += pal.h
INC += fdManager.h
INC += osiTime.h
INC += osiTimer.h
INC += macLib.h
INC += sigPipeIgnore.h
INC += dbmf.h
INC += epicsString.h
INC += truncateFile.h
INC += adjustment.h
INC += postfix.h
INC += sCalcPostfix.h
INC += osiSleep.h
INC += bsdSocketResource.h
INC_WIN32 += getopt.h

#       general contents of library on all platforms
#
#       system specific lines in RULES.Host figure out
#       1) what object names (.o, .obj,...) to build
#	2) where to find the sources: ., ./os/<ARCH_CLASS>, ./os/generic, ...
#
LIBSRCS += bucketLib.c
LIBSRCS += cvtFast.c
LIBSRCS += ellLib.c
LIBSRCS += envSubr.c
LIBSRCS += envData.c
LIBSRCS += errlogUNIX.c
LIBSRCS += errSymLib.c
LIBSRCS += errSymTbl.c
LIBSRCS += fdmgr.c
LIBSRCS += freeListLib.c
LIBSRCS += gpHashLib.c
LIBSRCS += memDebugLib.c
LIBSRCS += postfix.c
LIBSRCS += calcPerform.c
LIBSRCS += sCalcPostfix.c
LIBSRCS += sCalcPerform.c
LIBSRCS += realpath.c
LIBSRCS += tsSubr.c
LIBSRCS += assertUNIX.c
LIBSRCS += macCore.c
LIBSRCS += macUtil.c
LIBSRCS += sigPipeIgnore.c
LIBSRCS += dbmf.c
LIBSRCS += epicsString.c
LIBSRCS += truncateFile.c
LIBSRCS += aToIPAddr.c
LIBSRCS += adjustment.c
LIBSRCS += bsdSockResource.c
LIBSRCS += osiSleep.c

#
# if CPLUSPLUS isnt empty then include C++ src codes
#	Note: After including/excluding files here,
#	e.g. the C++ stuff,
#	please check Com.def!
#
LIBSRCS += $(patsubst %,fdManager.cc,$(strip $(CPLUSPLUS)))
LIBSRCS += $(patsubst %,osiTimer.cc,$(strip $(CPLUSPLUS)))
LIBSRCS += $(patsubst %,osdTime.cc,$(strip $(CPLUSPLUS)))

#	WIN32 has no getopt, we add it to the Com lib,
#	special initialisation is done in winmain.c
LIBSRCS_WIN32 := getopt.c getLastWSAErrorAsString.c
LIBSRCS_WIN32 += $(patsubst %,dllmain.cc,$(strip $(CPLUSPLUS))) 

#       Library to build:
#       lib$(LIBRARY).a  or   ..dll/..exp/..lib
#
LIBRARY:=Com

Com_RCS_WIN32 = Com.rc

#	only for WIN32:
#	build LIBRARY as a DLL, use the specified def file
LIBTYPE := SHARED

#	libs needed for PROD and TESTPRODUCT
PROD_LIBS := Com 
SYS_PROD_LIBS_WIN32 := ws2_32 advapi32

#USR_CFLAGS += -DTS_TEST
#TESTPROD_SRCS=tsSubr.c
#TESTPROD=testtsLib
#TESTPROD=envtest
#TESTPROD=osiTimeTest fdManagerTest

MAN3 = gpHash.3 freeList.3

#	for bldErrSymTbl:
#
ERR_S_FILES += $(TOP)/src/include/asLib.h
ERR_S_FILES += $(TOP)/src/db/dbAccess.h
ERR_S_FILES += $(TOP)/src/db/devLib.h
ERR_S_FILES += $(TOP)/src/include/devSup.h
ERR_S_FILES += $(TOP)/src/include/drvSup.h
ERR_S_FILES += $(TOP)/src/db/recSup.h
ERR_S_FILES += $(TOP)/src/dbStatic/dbStaticLib.h
ERR_S_FILES += $(TOP)/src/drv/ansi/drvEpvxi.h
ERR_S_FILES += $(TOP)/src/drv/old/drvBitBusErr.h
ERR_S_FILES += $(TOP)/src/drv/old/drvGpibErr.h
ERR_S_FILES += ../tsDefs.h
ERR_S_FILES += ../errMdef.h
ERR_S_FILES += $(TOP)/src/cas/generic/casdef.h
ERR_S_FILES += $(TOP)/src/gdd/gddAppFuncTable.h

include $(TOP)/config/RULES.Host

#	The real dependecies seem to confuse GNUmake:
#	envData.c is rebuild every time...
#envData.c: ../envDefs.h $(TOP)/config/CONFIG_ENV $(TOP)/config/CONFIG_SITE_ENV
envData.c: ../envDefs.h ../bldEnvData.pl
	$(PERL) ../bldEnvData.pl $(TOP)/config

errSymTbl.c: $(ERR_S_FILES)
	$(PERL) ../makeStatTbl.pl  $(ERR_S_FILES)

clean::
	@$(RM) errSymTbl.c envData.c

#	EOF Makefile.Host  for  base/src/libCom
