##########################################################################
#_Title Makec -    Linux  x86_64 OS make KRC C routine library
#_Args  NONE
#_Descr Defines dependancies for GNU compilers using  make
#_Hist  Feb 08 2005 Kris Becker, USGS, Flagstaff Original Version
# 2009may17 Hugh Kieffer Modify for the C routines needed by KRC
# 2011oct24 HK Modify for distribution
#_End
###########################################################################

# Set up some shell-level specific variables
SHELL=/bin/csh
RM=/bin/rm -f
HHK_DBG=-g -C

#  GNU C compiler and flags.
CC=gcc -pipe -O2  -Wall -fPIC -Dunix -DLinux_x86_64

# where to put output library
LIBDIRS=-L/work1/build/src

#  Special load flags.  These flags are utilized in all builds, whether
#  they are FORTRAN or C
# 2007aug10 Put in the order concatonated below
# LD=ld
LDFLAGS=-shared

# Special library MACROS
AR=ar           # handles archives
ARFLAGS=-rvs    # r=replace v=verbose s=include index

# set LIBRARY to be name of library
LIBRARY        ?= krc_c
LIBNAME        = $(LIBRARY).a

SYSLIBS=-lncurse -ltermcap  -lg2c -lc -lm

OBJS = b2b.o b_alloc.o b_c2fstr.o b_f2cstr.o b_free.o binf5_bind.o pio_bind_c.o primio.o r2r.o u_actinf.o u_bind_c.o u_move1.o u_move4.o u_swapn.o

$(LIBNAME): $(OBJS)
	$(AR) $(ARFLAGS) $(LIBNAME) $(OBJS)

# match for all routines
%.o : %.c
	$(CC)  -c $<

# those that have additional dependencies or both .f and .c versions
primio.o: primio.c primio.h 
b2b.o: b2b.c
r2r.o: r2r.c

