# Makefile for oeTest
# Menu-driven test program to test oeLib functionality
# 28 May 2013
#

# Which C compiler to use - (cc, gcc xlc, etc.).
CC = gcc

# Compiler Flags
CFLAGS = -Wall -c -I. -I.. -I/usr/local/include -I/usr/local/include/modbus

LIBFLAGS = -L/usr/local/lib -lmodbus

OELIB  = ../o5eLib.a

.c.o :
	$(CC) $(CFLAGS) $< 

ifdef CYGWIN
TARGET	= oeTest.exe
TTARGET = oeTerm.exe
else
TARGET  = oeTest
TTARGET = oeTerm
endif

SOURCE	= oeTest.c

OBJECTS     = $(SOURCE:%.c=%.o)

# Linking object files
$(TARGET): $(OBJECTS) $(OELIB)
	$(CC) -o $(TARGET) $(OBJECTS) $(OELIB) $(LIBFLAGS)

oeTest.o:  oeTest.c
	$(CC) $(CFLAGS) oeTest.c

term:       $(TTARGET)

$(TTARGET): oeTerm.o $(OELIB)
	$(CC) -o $(TTARGET) oeTerm.o $(OELIB) $(LIBFLAGS)

oeTerm.o:  oeTerm.c
	$(CC) $(CFLAGS) oeTerm.c

termMode.exe: termMode.o
	$(CC) -o termMode.exe termMode.o

# Remove executable and object files
clean:
	rm -f $(OBJECTS) $(TARGET)
