# SPDX-FileCopyrightText: 2022 Unisoc (Shanghai) Technologies Co., Ltd.
#
# SPDX-License-Identifier: LicenseRef-Unisoc-General-1.0
ifdef CROSS_COMPILE
	CC = $(CROSS_COMPILE)gcc
endif

FLAGS = -Wall -g -O
FLAGS += -DPLATFORM_YOCTO

CFLAGS  +=  -fPIC

TARGET := gnss-adapter

# makefile depend workdir
# WORKDIR needs to be assigned in the .bb
SYS_ROOT = $(WORKDIR)/recipe-sysroot

INCULED_FILE = -I$(SYS_ROOT)/usr/include \
               -I$(SYS_ROOT)/usr/include/dbus-1.0 \
               -I$(SYS_ROOT)/usr/lib/dbus-1.0/include

LIBS := -pthread -lutil -lgnssmgt -ldbus-1 -ldbushelper

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

OBJS := $(notdir $(patsubst %.c,%.o,$(SRCS)))

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

$(OBJS):$(SRCS)
	$(CC) $(CFLAGS) $(FLAGS) $(INCULED_FILE) -c $^

install:
	@echo "gnss-adapter install do nothing"
clean:
	-rm *.o *.gcno
	-rm -rf $(TARGET)
