代码拉取完成,页面将自动刷新
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。