#SPDX-License-Identifier: LicenseRef-Unisoc-General-1.0
#
#Copyright 2016-2023 Unisoc (Shanghai) Technologies Co., Ltd
#
#Licensed under the Unisoc General Software License, version 1.0 (the License);
#you may not use this file except in compliance with the License. You may obtain a copy of the License at
#
#https://www.unisoc.com/en_us/license/UNISOC_GENERAL_LICENSE_V1.0-EN_US
#
#Software distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OF ANY KIND, either express or implied.
#See the Unisoc General Software License, version 1.0 for more details.

CFLAGS = -Wall -g -O -fPIC

TARGET = libsensorstub.so

TARGET_INC = sensors.h

DIR_ROOT = ${SYS_ROOT}/recipe-sysroot
INCLUDE_DIRS=-I . \
             -I$(DIR_ROOT)/usr/include \


LIBS = -lrt -lpthread
OBJS = sensors.o
SRCS := $(wildcard ./*.c)

FILES := $(notdir $(SRCS))

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


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

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

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


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

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