# Makefile for remSerial
# 20 Sep 2012
#

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

# Compiler Flags
CFLAGS = -Wall -c -I. -I./libmodbus-3.0.3/src

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

ifdef IS_UNIX
  TARGET	= remSerial
else
  TARGET	= remSerial.exe
endif

SOURCE	= remSerial.c

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


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

# Compiling source files
%.o :: %.c remSerial.h
	$(CC) $(CFLAGS) -o $*.o $< 

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