include $(TOPDIR)/rules.mk

TARGET=xieneng_car

ifdef WITH_DEBUG
  CFLAGS += -g
else
  CFLAGS += -DNDEBUG -g
endif

CFLAGS += -Werror

SOURCES=xieneng_car_supervisor.c xieneng_car_store_data.c modbus_slave.c

CFLAGS += -I$(STAGING_DIR)/usr/include

LDFLAGS += -ldyutils -luci -lubox -lpthread -lsqlite3 -lipc_helper

ifeq ($(BOARD),x86)
	LDFLAGS += -lcontrolcan
endif

all: $(TARGET)

$(TARGET):
	$(CC) $(CFLAGS) -o $(TARGET) $(SOURCES) $(LDFLAGS)
clean:
	find . -name '*.o' -type f -print -exec rm -rf {} \;
	find . -name '*.a' -type f -print -exec rm -rf {} \;
	rm -f $(TARGET)
