include $(TOPDIR)/rules.mk

TARGET=dy_azure

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

CFLAGS += -Werror -fstack-protector-all

SOURCES=$(wildcard *.c)

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

LDFLAGS += -ldyutils -luci -lubox -lpthread -lsqlite3 -liothub_client_amqp_transport -luamqp -liothub_client_mqtt_transport -laziotsharedutil -liothub_client -liothub_client_amqp_transport -liothub_client_mqtt_transport -liothub_client_http_transport -liothub_client_amqp_ws_transport -liothub_client_mqtt_ws_transport -lumqtt -laziotsharedutil -lcurl -lssl -lcrypto -lpthread -lm -lrt -luuid -lparson -lipc_helper -lmosquitto

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)
