226 lines
5.3 KiB
Makefile
Executable File
226 lines
5.3 KiB
Makefile
Executable File
# 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.
|
|
|
|
ifeq ($(MAKECMDGOALS), ubuntu)
|
|
include ./config
|
|
endif
|
|
|
|
|
|
CXXFLAGS = -Wall -Werror=uninitialized -g -O1 -std=c++11 -DBUILD_ON_YOCTO
|
|
|
|
# unused function recycling
|
|
CXXFLAGS += -fdata-sections -ffunction-sections -Wl,-gc-sections
|
|
CXXFLAGS += -DUNISOC_MACHINE=\"${UNISOC_MACHINE}\"
|
|
CXXFLAGS += ${DUAL_DATA_SET_FLAG}
|
|
CXXFLAGS += ${NETCON_DEBUG_FLAG}
|
|
CXXFLAGS += ${MXL_NDA_FLAG}
|
|
CXXFLAGS += ${BRIDGE_MODE_SET_FLAG}
|
|
CXXFLAGS += ${MULTI_SIM_FLAGS}
|
|
CXXFLAGS += ${NETCON_SUPPORT_RTL8367}
|
|
|
|
SRC_DIR = core \
|
|
uweb \
|
|
udhcp \
|
|
core/dhcp \
|
|
core/signal \
|
|
core/connectivity
|
|
|
|
ifneq ($(MAKECMDGOALS), ubuntu)
|
|
|
|
SYS_ROOT = $(WORKDIR)/recipe-sysroot
|
|
|
|
endif
|
|
|
|
INCLUDE_DIRS = -I$(SYS_ROOT)/usr/include \
|
|
-I$(SYS_ROOT)/usr/include/dbus-1.0 \
|
|
-I$(SYS_ROOT)/usr/include/libudbus \
|
|
-I$(SYS_ROOT)/usr/include/libnl3 \
|
|
|
|
INCLUDE_DIRS += -I ./include/
|
|
INCLUDE_DIRS += -I ./uweb
|
|
INCLUDE_DIRS += -I ./core/dhcp
|
|
INCLUDE_DIRS += -I ./udhcp
|
|
INCLUDE_DIRS += -I ./core/connectivity
|
|
|
|
ifeq ($(CONFIG_WIFI),y)
|
|
SRC_DIR += core/wifi \
|
|
core/wifi/station \
|
|
core/wifi/station/dbus \
|
|
core/rfkill
|
|
CXXFLAGS += -DHAVE_WIFI
|
|
INCLUDE_DIRS += -I ./core/wifi
|
|
INCLUDE_DIRS += -I ./core/wifi/station
|
|
INCLUDE_DIRS += -I ./core/wifi/station/dbus
|
|
INCLUDE_DIRS += -I ./core/rfkill
|
|
endif
|
|
|
|
|
|
ifeq ($(CONFIG_SOFTAP),y)
|
|
SRC_DIR += core/wifi
|
|
SRC_DIR += core/wifi/softap
|
|
CXXFLAGS += -DHAVE_SOFTAP
|
|
INCLUDE_DIRS += -I ./core/wifi/softap
|
|
INCLUDE_DIRS += -I ./core/wifi
|
|
endif
|
|
|
|
ifeq ($(CONFIG_BLUETOOTH),y)
|
|
SRC_DIR += core/bluetooth core/rfkill
|
|
CXXFLAGS += -DHAVE_BT
|
|
INCLUDE_DIRS += -I ./core/bluetooth
|
|
INCLUDE_DIRS += -I ./core/rfkill
|
|
endif
|
|
|
|
ifeq ($(CONFIG_TELEPHONY),y)
|
|
SRC_DIR += core/telephony \
|
|
core/telephony/ofono
|
|
CXXFLAGS += -DHAVE_TELE
|
|
INCLUDE_DIRS += -I ./core/telephony
|
|
INCLUDE_DIRS += -I ./core/telephony/ofono
|
|
ifeq ($(CONFIG_SLICE),y)
|
|
SRC_DIR += core/telephony/slice
|
|
CXXFLAGS += -DHAVE_SLICE
|
|
INCLUDE_DIRS += -I ./core/telephony/slice
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(CONFIG_DIAL),y)
|
|
SRC_DIR += core/dial
|
|
CXXFLAGS += -DHAVE_DIAL
|
|
INCLUDE_DIRS += -I ./core/dial
|
|
endif
|
|
|
|
ifeq ($(CONFIG_ETHERNET),y)
|
|
SRC_DIR += core/ethernet
|
|
CXXFLAGS += -DHAVE_ETH
|
|
INCLUDE_DIRS += -I ./core/ethernet
|
|
ifeq (RTL8367_SUPPORT, $(findstring RTL8367_SUPPORT,$(CXXFLAGS)))
|
|
SRC_DIR += core/ethernet/rtl8367
|
|
INCLUDE_DIRS += -I ./core/ethernet/rtl8367
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(CONFIG_USB),y)
|
|
SRC_DIR += core/usb
|
|
CXXFLAGS += -DHAVE_USB
|
|
INCLUDE_DIRS += -I ./core/usb
|
|
endif
|
|
|
|
ifeq ($(CONFIG_GPS),y)
|
|
SRC_DIR += core/gps
|
|
CXXFLAGS += -DHAVE_GPS
|
|
INCLUDE_DIRS += -I ./core/gps
|
|
endif
|
|
|
|
ifeq ($(CONFIG_DNS),y)
|
|
SRC_DIR += core/dns
|
|
CXXFLAGS += -DHAVE_DNS
|
|
INCLUDE_DIRS += -I ./core/dns
|
|
endif
|
|
|
|
ifeq ($(CONFIG_TRAFFICSTATS),y)
|
|
SRC_DIR += core/trafficstats
|
|
CXXFLAGS += -DHAVE_TRAFFICSTATS
|
|
INCLUDE_DIRS += -I core/trafficstats
|
|
endif
|
|
|
|
ifeq ($(CONFIG_TSN),y)
|
|
SRC_DIR += core/tsn
|
|
CXXFLAGS += -DHAVE_TSN
|
|
INCLUDE_DIRS += -I core/tsn
|
|
endif
|
|
|
|
ifeq ($(CONFIG_PDP_AUTO_CONNECT),y)
|
|
CXXFLAGS += -DPDP_AUTO_CONNECT
|
|
endif
|
|
|
|
|
|
vpath %.cpp $(SRC_DIR)
|
|
|
|
CXXFLAGS += $(INCLUDE_DIRS)
|
|
|
|
LIBS = -lsrmi -ludbus -lresolv -lnl-genl-3 -lnl-3
|
|
|
|
ifeq ($(QT_SUPPORT_FLAGS), true)
|
|
INCLUDE_DIRS += -I$(SYS_ROOT)/usr/include/QtCore
|
|
LIBS += -lQt5Core
|
|
CXXFLAGS += -DQT_SUPPORT
|
|
endif
|
|
|
|
ifeq ($(MAKECMDGOALS), ubuntu)
|
|
INCLUDE_DIRS += -I$(SYS_ROOT)/usr/include/srmi
|
|
INCLUDE_DIRS += -I /usr/lib/aarch64-linux-gnu/dbus-1.0/include/dbus/
|
|
CXXFLAGS += -DBUILD_ON_UBUNTU
|
|
|
|
INCLUDE_DIRS += -I /usr/include/aarch64-linux-gnu/qt5/
|
|
LIBS += -lQt5Core
|
|
CXXFLAGS += -DQT_SUPPORT
|
|
endif
|
|
|
|
ifneq ($(MAKECMDGOALS), ubuntu)
|
|
|
|
LIBS += -linput-uevent
|
|
|
|
endif
|
|
|
|
CUR_DIR = $(shell pwd)
|
|
SRCS = $(foreach dir,$(SRC_DIR),$(wildcard $(dir)/*.cpp))
|
|
OBJ = $(patsubst %.cpp,%.o,$(SRCS))
|
|
|
|
$(GEN_FILE):$(wildcard $(CUR_DIR)/uidl/ofono/*.xml)
|
|
$(CUR_DIR)/uidl/gen_ofono_client.sh $(CUR_DIR)/uidl $(CUR_DIR)/uidl/ofono $(CUR_DIR)/uidl/ofono/out/client
|
|
|
|
OUT_DIR = $(CUR_DIR)/out
|
|
OBJ_DIR = $(OUT_DIR)/obj
|
|
BIN_DIR = $(OUT_DIR)/bin
|
|
LIB_DIR = $(OUT_DIR)/lib
|
|
|
|
OBJS = $(notdir $(OBJ))
|
|
OBJS_WITH_DIR = $(addprefix $(OBJ_DIR)/,$(OBJS))
|
|
DEP := $(OBJS_WITH_DIR:.o=.d)
|
|
|
|
TARGET = $(BIN_DIR)/netcond
|
|
|
|
all: $(TARGET) DBUS_CONF
|
|
|
|
ubuntu: all
|
|
cp $(TARGET) /usr/bin
|
|
|
|
$(TARGET):$(OBJS_WITH_DIR)
|
|
$(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS)
|
|
|
|
$(OBJ_DIR)/%.o:%.cpp DIRS
|
|
$(CXX) $(CXXFLAGS) -c -fPIC $< -o $@
|
|
|
|
install:
|
|
cp $(BIN_DIR)/$(TARGET) $(INSTALL_MOD_PATH)/bin
|
|
|
|
clean:
|
|
rm -rf $(OBJ_DIR) $(BIN_DIR) $(LIB_DIR) $(GEN_FILE)
|
|
-include $(DEP)
|
|
#################################################################
|
|
DIRS:
|
|
@$(call CREATE_DIR,$(OUT_DIR))
|
|
@$(call CREATE_DIR,$(OBJ_DIR))
|
|
@$(call CREATE_DIR,$(BIN_DIR))
|
|
@$(call CREATE_DIR,$(LIB_DIR))
|
|
|
|
define CREATE_DIR
|
|
if [ ! -d $(1) ];\
|
|
then\
|
|
mkdir -p $(1);\
|
|
fi
|
|
endef
|
|
|
|
DBUS_CONF:
|
|
-cp core/netcon_dbus.conf ${WORKDIR}
|