# SPDX-FileCopyrightText: 2023 Unisoc (Shanghai) Technologies Co., Ltd.
#
# SPDX-License-Identifier: LicenseRef-UNISOC

bindir=/usr/bin

CFLAGS = -Wall -g -O -std=c++11
TARGET = slt
INCLUDE_DIRS=-I ./inc/ -I ./module/inc/
LIBS = -lpthread -lrt -ldl -lofono -lglib-2.0 -lnetcon -ldbus-1 -ludbus
SYS_ROOT = $(WORKDIR)/recipe-sysroot
INCLUDE_DIRS += -I$(SYS_ROOT)/usr/include \
	-I$(SYS_ROOT)/usr/include/glib-2.0 \
	-I$(SYS_ROOT)/usr/lib/glib-2.0/include \
	-I$(SYS_ROOT)/usr/lib/dbus-1.0/include/ \
	-I$(SYS_ROOT)/usr/include/dbus-1.0/ \

#remove later
SRCS := $(wildcard ./src/*.cpp ./module/src/*.cpp)
OBJS := $(notdir $(patsubst %.cpp,%.o,$(SRCS)))

all:$(OBJS)
	$(CXX) -o $(TARGET) $(OBJS) $(LIBS)

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

install:
	install -d $(DESTDIR)${bindir}
	install -m 0755 $(TARGET) $(DESTDIR)${bindir}
clean:
	rm -f $(OBJS)
	rm -f $(TARGET)
