Makefile example for compiling opencv
Adapt from Dr. mdailey version
ref: newhall, bujiwu
Adapt from Dr. mdailey version
#What needs to be built (TARG) from what source code (SRC)
SRC = calibration.cpp
TARG = dsin-opencv
#Tell make what compiler we use
CC = g++
#Tell gcc about non-standard places to find include (.h) files
#For a system wide installation use -I /usr/include/opencv
INC = -I $(HOME)/opencv2/include/
#Also tell gcc to include debug symbols (-g), give all possible warnings
#(-Wall), but don't generate the annoying "unused function" warning
CFLAGS = -g -Wall -Wno-unused-function $(INC)
#Tell the linker where to look for libraries and what's needed for OpenCV
#For a system wide installation -L isn't necessary
LIB = -L $(HOME)/opencv2/lib -lcxcore -lcv -lhighgui -lcvaux -lml
LDFLAGS = $(LIB)
#The object files we want are just the source files with .cpp -> .o
OBJS = $(SRC:.cpp=.o)
#What make should try to build by default
all: $(TARG)
#What object files the target executable depends on
$(TARG): $(OBJS)
%.o:%.cpp
$(CC) $(INC) $(LDFLAGS) -o $@ $<
#Clean up executables, object files, and temp files
clean:
rm -f *~ *.o $(TARG)
ref: newhall, bujiwu
ความคิดเห็น