MAKEFLAGS += -r -R

TARGET=cloud_conn_dayun

MYCFLAGS := $(CFLAGS) -DNDEBUG -ggdb -fno-omit-frame-pointer -fPIC -Werror

ifeq ($(SUPPORT_LED),1)
  MYCFLAGS += -DSUPPORT_LED=1
else
  MYCFLAGS += -DSUPPORT_LED=0
endif

SOURCES=$(wildcard *.c)
OBJECTS=$(subst .c,.o, $(SOURCES))
MYLDFLAGS := -ldyutils -luci -lubox -lpthread -lipc_helper -lmqtt_session

PCLNT :=
ifneq ($(wildcard $(COLNT_DIR)),)
PCLNT += pclnt_wrapper
$(info PCLNT-TING PACKAGE cloud_conn_dayun)
endif

.PHONY: all clean
all: $(TARGET)

%.o: %.c
	$(PCLNT) $(CC) -c $(MYCFLAGS) -o $@ $<
%.o: %.cpp
	$(PCLNT) $(CC) -c $(MYCFLAGS) -o $@ $<
$(TARGET):$(OBJECTS)
	$(PCLNT) $(CC) $(MYCFLAGS) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(MYLDFLAGS)

clean:
	rm -rf *.o $(TARGET)
