# ******************************************************************************
# * Makefile.Linux : This is the platform specific Makefile for Linux.
# *
# * Externals        : This Makefile relies on the developer defining the 
# *                    following external definitions...
# *
# *                   CDEV      : The base directory of the CDEV distribution
# ******************************************************************************
TARGET          = Linux

include $(CDEV)/include/makeinclude/Makefile.common
include $(CDEV)/include/makeinclude/Makefile.archive

# ******************************************************************************
# * Platform specific compile and link options.
# ******************************************************************************

# ******************************************************************************
# * Only define the DEBUGFLAG if DEBUG has been specified by the caller.
# ******************************************************************************
ifdef DEBUG
DEBUGFLAG     = -g
else
DEBUGFLAG  = -O2
endif

CXX           = g++
CC            = gcc
CXXFLAGS      = -DLinux -DCDEV_HAS_UNDERSCORE_FDBITS -DCDEV_HAS_64BIT_LONGS -fno-for-scope $(DEBUGFLAG) $(CXXEXTRA) $(CXXINCLUDES) \
		$(CDEVINCLUDES) 
CFLAGS        = -DLinux -DCDEV_HAS_UNDERSCORE_FDBITS -DCDEV_HAS_64BIT_LONGS $(DEBUGFLAG) $(CEXTRA) $(CXXINCLUDES) $(CDEVINCLUDES)
PIC           = -fpic
OSLIBS        = -lm -ldl


# ******************************************************************************
# * These definitions define the names and locations of libraries that are
# * required by CDEV for a shared and archive applications.  The developer
# * is required to add the list of service specific libraries.
# ******************************************************************************
ifeq ($(SHOBJ), NO)
  CDEVLIBS    = $(CDEVLIB)/libcdev.a $(ARCHIVELIBS)
else
  CDEVLIBS    = -Xlinker -rpath -Xlinker $(CDEVLIB) -L$(CDEVLIB) -lcdev
endif


# ******************************************************************************
# * Platform specific compile and link macros.
# ******************************************************************************
COMPILE.cc    = $(CXX) -c $(CXXFLAGS) $^ -o $@
COMPILE.cc.so = $(CXX) $(CXXFLAGS) $(PIC) -c -o $@ $^
COMPILE.c     = $(CC) -c $(CFLAGS) $^ -o $@
COMPILE.c.so  = $(CC) -c $(CFLAGS) $(PIC) $^ -o $@
LINK.cc       = rm -f $@; $(CXX) $(CXXFLAGS) $(CXXEXTRA) $^ -o $@ $(CDEVLIBS) $(OSLIBS)
