Files
CodeRepository/Projects/App_GeneralTracker.GIT/Makefile
2026-02-01 22:23:06 +08:00

87 lines
2.1 KiB
Makefile

ifeq ($(PARAM_FILE),)
ROOT_DIR := $(shell pwd)
PARAM_FILE := $(ROOT_DIR)/config.mk
include $(PARAM_FILE)
endif
# Platform
ifeq ($(strip $(PLATFORM_ROOT)),)
$(error "NO PLATFORM_ROOT")
endif
SUBDIRS := $(PLATFORM_ROOT)
ifneq ($(strip $(PLATFORM_INC)),)
INCLUDE_DIRS += $(PLATFORM_INC)
endif
ifneq ($(strip $(PLATFORM_LDFLAGS)),)
LDFLAGS += $(PLATFORM_LDFLAGS)
endif
# GeneralTracker
INCLUDE_DIRS += -I$(ROOT_DIR)/Global
INCLUDE_DIRS += -I$(ROOT_DIR)/Adaptation
INCLUDE_DIRS += -I$(ROOT_DIR)/BufferPool
INCLUDE_DIRS += -I$(ROOT_DIR)/Universal
INCLUDE_DIRS += -I$(ROOT_DIR)/Universal/Arith
INCLUDE_DIRS += -I$(ROOT_DIR)/Universal/Stream
INCLUDE_DIRS += -I$(ROOT_DIR)/include
INCLUDE_DIRS += -I$(ROOT_DIR)/Adaptation/arith
SRC := $(wildcard $(ROOT_DIR)/Universal/*.cpp)
SRC += $(wildcard $(ROOT_DIR)/BufferPool/*.cpp)
SRC += $(wildcard $(ROOT_DIR)/Global/*.cpp)
SRC += $(wildcard $(ROOT_DIR)/Universal/Arith/*.cpp)
SRC += $(wildcard $(ROOT_DIR)/Universal/Stream/*.cpp)
OBJS := $(SRC:%.cpp=%.o)
INCS := $(SRC:%.cpp=%.h)
APP_DEF = -D_UNICODE -DICE_IGNORE_VERSION
CFLAGS := -Wall -g -fPIC -Wno-unused-variable -Wno-attributes -std=c++11
LDFLAGS += -lpthread -lrt
TARGET:=libGeneralTracker.so
#55kg
INCLUDE_DIRS += -I$(ROOT_DIR)/Communication/msg
INCLUDE_DIRS += -I$(ROOT_DIR)/thirdparty/include
$(SUBDIRS) += $(ROOT_DIR)/Communication/serial_server $(ROOT_DIR)/Communication/msg
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
CLEANSUBDIRS = $(addsuffix .clean, $(SUBDIRS))
INSTALLSUBDIRS = $(addsuffix .install, $(SUBDIRS))
.PHONY: $(SUBDIRS) $(INSTALLSUBDIRS) $(CLEANSUBDIRS)
all : $(SUBDIRS) $(TARGET)
$(SUBDIRS):
@echo Making all in subdirectory $@...
@$(MAKE) -C $@ -j
$(TARGET): $(OBJS)
$(CXX) -shared -fPIC -o $(TARGET) $(OBJS) $(CFLAGS) $(LDFLAGS)
@mkdir -p $(MEDIA_TEST_DIR)/lib
@cp -f $(TARGET) $(MEDIA_TEST_DIR)/lib/.
%.o: %.c
$(CC) -c $(INCLUDE_DIRS) $(APP_DEF) $(LDFLAGS) $<
%.o: %.cpp
$(CXX) $(INCLUDE_DIRS) $(APP_DEF) $(CFLAGS) -c $< -o $@
test: all test_clean
make -C test
test_clean:
make -C test clean
clean: $(CLEANSUBDIRS)
@rm -rf $(OBJS)
@rm -rf $(TARGET)
$(CLEANSUBDIRS):
@cd $(basename $@) ; $(MAKE) clean