前言
做项目需要在linux下编译文件,所以临时学习一下Makefile文件的编写,只了解了一些皮毛
代码
编译自己的代码所编写的Makefile文件如下:
INCLUDE_DIRS := ./ /usr/local/include /usr/include
LIBRARY_DIRS := /usr/local/lib /usr/lib
LIBRARIES := opencv_core opencv_imgproc opencv_highgui
WARNINGS := -Wall
CXX:= /usr/bin/g++
COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
CXXFLAGS := -fPIC $(COMMON_FLAGS)
LDFLAGS += $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(foreach library,$(LIBRARIES),-1$(library))
all : cnn_decode.bin
cnn_decode.bin : main.o net.o layer.o blob