1 Star 0 Fork 0

saber110/Raspberry car

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
makefile 1.72 KB
一键复制 编辑 原始数据 按行查看 历史
saber110 提交于 2022-12-25 14:54 . 修复编译问题,添加-latomix
BINFILE = main
CC = g++
CXX = g++
DIR_INC = ./include
DIR_SRC = src
DIR_OBJ = obj
DIR_BIN = ./bin
BINTARGET = ${DIR_BIN}/${BINFILE}
ifdef VERBOSE
Q =
E = @true
else
Q = @
E = @echo
endif
CFILES := $(shell find $(DIR_SRC) -mindepth 1 -maxdepth 4 -name "*.c")
CXXFILES := $(shell find $(DIR_SRC) -mindepth 1 -maxdepth 4 -name "*.cpp")
INFILES := $(CFILES) $(CXXFILES)
OBJFILES := $(CXXFILES:$(DIR_SRC)/%.cpp=%) $(CFILES:$(DIR_SRC)/%.c=%)
DEPFILES := $(CXXFILES:$(DIR_SRC)/%.cpp=%) $(CFILES:$(DIR_SRC)/%.c=%)
OFILES := $(OBJFILES:%=$(DIR_OBJ)/%.o)
COMMONFLAGS := -Wall -Wextra -pedantic -O3
DEFINES := -fpic -Wl,-rpath=.
INCLUDE := -I. -I./include
LDFLAGS := -pthread -lpthread
LIBS := -lhandy -lwiringPi -latomic # -Iusr/include/mysql -lmysqlclient
ifdef DEBUG
COMMONFLAGS := $(COMMONFLAGS) -g
endif
CFLAGS := $(COMMONFLAGS) $(DEFINES) $(INCLUDE)
CXXFLAGS := $(COMMONFLAGS) --std=c++0x $(DEFINES) $(INCLUDE)
DEPDIR := deps
all: $(BINTARGET)
ifeq ($(MAKECMDGOALS),)
-include Makefile.dep
endif
ifneq ($(filter-out clean, $(MAKECMDGOALS)),)
-include Makefile.dep
endif
-include Makefile.local
.PHONY: clean all depend
.SUFFIXES:
obj/%.o: src/%.c
$(E) C-compiling $<
$(Q) if [ ! -d `dirname $@` ]; then mkdir -p `dirname $@`; fi
$(Q)$(CC) -o $@ -c $< $(CFLAGS)
obj/%.o: src/%.cpp
$(E) C++-compiling $<
$(Q) if [ ! -d `dirname $@` ]; then mkdir -p `dirname $@`; fi
$(Q)$(CXX) -o $@ -c $< $(CXXFLAGS)
Makefile.dep: $(CFILES) $(CXXFILES)
$(E) Depend
$(Q) for i in $(^); do $(CXX) $(CXXFLAGS) -MM "$${i}" -MT obj/`basename $${i%.*}`.o; done > $@
$(BINTARGET): $(OFILES)
$(E) Linking $@
$(Q)$(CXX) -o $@ $(OFILES) $(LDFLAGS) $(LIBS)
clean:
$(E) Removing files
$(Q) rm -f $(BINTARGET) obj/* Makefile.dep
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/saber456789/raspberry-car.git
git@gitee.com:saber456789/raspberry-car.git
saber456789
raspberry-car
Raspberry car
master

搜索帮助