1 Star 3 Fork 3

山茶/iso15765-canbus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 1.99 KB
一键复制 编辑 原始数据 按行查看 历史
Io. D 提交于 2020-07-05 15:11 . initial commit
$(info Starting building process)
# include configurations
include Makefile.conf
$(info - Makefile.conf loaded)
# find project files
H_FILES := $(shell find -L ./$(INC_DIRECTORY) -name '*.h' -exec dirname {} \; | sed 's/ /\\ /g' | uniq)
C_FILES := $(shell find ./$(SRC_DIRECTORY) -name '*.c' -type f | sed 's/ /\\ /g' | uniq)
CXX_FILES := $(shell find ./$(SRC_DIRECTORY) -name '*.cpp' -type f | sed 's/ /\\ /g' | uniq)
O_FILES := $(C_FILES:.c=.o)
O_FILES += $(CXX_FILES:.cpp=.o)
H_FILES := $(notdir $(H_FILES))
C_FILES := $(notdir $(C_FILES))
CXX_FILES := $(notdir $(CXX_FILES))
INCLUDES := $(H_FILES:%=-I%)
$(info - Project Files Loaded)
ifeq ($(DEBUG),yes)
$(info - Debug flag added [makefile.conf DEBUG = yes])
CFLAGS := -g $(CFLAGS)
endif
ifeq ($(IS_LIBRARY),yes)
$(info - Set Parameters for Shared Library build process)
ALL_PARAMETERS = lib$(PROJECT_NAME).so.$(PROJECT_VERSION) clean
ALL_TYPE = lib$(PROJECT_NAME).so.$(PROJECT_VERSION): $(O_FILES)
LIBFLAGS = -shared -Wl,-soname,lib$(PROJECT_NAME).so
CFLAGS := -fPIC $(CFLAGS)
CXXFLAGS := -fPIC $(CXXFLAGS)
else
$(info - Set Parameters for Application build process)
ALL_PARAMETERS = $(PROJECT_NAME) clean
ALL_TYPE = $(PROJECT_NAME): $(O_FILES)
LIBFLAGS =
endif
# Build Process
all: $(ALL_PARAMETERS)
$(ALL_TYPE)
@echo - [OUTPUT][CXX] $@ @[$(BIN_DIRECTORY)]
@$(CXX) $(CFLAGS) $(INCLUDES) $(LDFLAGS) $(LIBFLAGS) -o $(BIN_DIRECTORY)/$@ $^ $(LDLIBS)
%.o: %.c
@echo - [CC] $@
@$(CC) $(CFLAGS) -c $(INCLUDES) -o $@ $< $(LFLAGS)
%.o: %.cpp
@echo - [CXX] $@
@$(CXX) $(CXXFLAGS) -c $(INCLUDES) -o $@ $< $(LFLAGS)
# Clear Objects
clean:
$(info - Remove all .o [object] files)
@find . -name \*.o -type f -delete
# Clear Objects & Executables
cleanall:
$(info - Remove all .o [object] files)
@find . -name \*.o -type f -delete
$(info - Remove all files in $(BIN_DIRECTORY))
@find $(BIN_DIRECTORY) -name \*.* -type f -delete
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/teast_tea/iso15765-canbus.git
[email protected]:teast_tea/iso15765-canbus.git
teast_tea
iso15765-canbus
iso15765-canbus
master

搜索帮助