#
# These coded instructions, statements, and computer programs are the
# copyrighted works and confidential proprietary information of
# UNISOC Technology (Shanghai), Inc. They may not be modified, copied, reproduced,
# distributed, or disclosed to third parties in any manner, medium, or form,
# in whole or in part, without the prior written consent of UNISOC Technology (Shanghai), Inc.

CFLAGS += -Wall -g -O -fPIC
CFLAGS += $(FLAG_GPIO_LED_CONFIG)
CFLAGS += -Werror -fstack-protector-strong -D_FORTIFY_SOURCE=2
CFLAGS += -Wformat -Wformat-security -O2
TARGET = libled-util.so

TARGET_INC = led_util.h

DIR_ROOT = ${SYS_ROOT}/recipe-sysroot

LIBS = -lpthread -lrt

SRCS := $(wildcard ./*.c)

FILES := $(notdir $(SRCS))

OBJS = $(patsubst %c,%o,$(FILES))

INCLUDES = -I$(DIR_ROOT)/usr/include

$(TARGET): $(OBJS)
	$(CC) -shared -o $(TARGET) $(OBJS) $(LIBS)

$(OBJS):$(SRCS)
	$(CC) -c $^ $(CFLAGS) $(INCLUDES)

install:
	cp $(TARGET) /usr/lib
	cp $(TARGET_INC) /usr/include

uninstall:
	rm -f /usr/lib/$(notdir $(TARGET))

clean:
	rm -f *.so
	rm -f $(TARGET)
