##
#  Makefile for the Go2 library
#  
#  The Gocator 2000 API
#  Copyright (C) 2010 by LMI Technologies Inc.
#  
#  Redistributions of files must retain the above copyright notice.
##

cp = cp -f
rm = rm -f
mkdir = mkdir -p
CC = gcc -fPIC -fno-stack-protector -fvisibility=hidden
DEFS = -DGO2_INTERNAL -DZAPI_STATIC
LINK = ld -shared 
LIBNAME = ../lib/libGo2.so
INCLUDES =  -I../include
CFLAGS = -g $(INCLUDES) $(DEFS)
INSTALLPATH = /lib

SRCS = src/Go2Api.c src/Go2Data.c src/Go2DataTypes.c src/Go2Health.c src/Go2Log.c src/Go2Measurement.c src/Go2Object.c src/Go2Output.c src/Go2OutputChannels.c src/Go2Range.c src/Go2RangeMeasurements.c src/Go2Profile.c src/Go2ProfileMeasurements.c src/Go2ProfileTypes.c src/Go2Part.c src/Go2PartMeasurements.c src/Go2Sensor.c src/Go2System.c

OBJS = src/Go2Api.o src/Go2Data.o src/Go2DataTypes.o src/Go2Health.o src/Go2Log.o src/Go2Measurement.o src/Go2Object.o src/Go2Output.o src/Go2OutputChannels.o src/Go2Range.o src/Go2RangeMeasurements.o src/Go2Profile.o src/Go2ProfileMeasurements.o src/Go2ProfileTypes.o src/Go2Part.o src/Go2PartMeasurements.o src/Go2Sensor.o src/Go2System.o

ARCS = ../lib/libzApi.a

.c.o:
	$(rm) -f $@
	$(CC) $(CFLAGS) -c $*.c -o $@

all: $(LIBNAME)

$(LIBNAME) : $(OBJS)
	$(rm) $@
	$(LINK) $(OBJS) $(ARCS) -o $(LIBNAME)

clean:
	$(rm) $(OBJS) $(LIBNAME) core *~
	
install: 
	$(cp) $(LIBNAME) $(INSTALLPATH)
