# Makefile - mbfip_gateway

PWRFIP_INC_DIR ?= /usr/local/include/powerfip
MODBUS_INC_DIR ?= /usr/local/include/modbus

CFLAGS = -g -Wall -I. -I$(PWRFIP_INC_DIR) -I$(MODBUS_INC_DIR)

LDLIBS += -lpowerfip
LDLIBS += -lmodbus
LDLIBS += -ljson-c
LDLIBS += -Wl,-Bdynamic -lpthread -lm

EXEC := mbfip_gateway
LOBJS := common.o
LOBJS += dev.o
LOBJS += mbus.o
LOBJS += fip.o
LOBJS += gw.o
LOBJS += parser.o
LOBJS += main.o

all: $(EXEC)

$(EXEC): $(LOBJS)
	$(CC) $(CFLAGS) $(LOBJS) $(LDLIBS) -o $@

clean:
	rm -f *.[o,so,a] $(EXEC)
