Announce

PukiWiki contents have been moved into SONOTS Plugin (20070703)

make

makeのメモ

普通の

CC = g++
LINK = g++
INSTALL = install
CFLAGS = `pkg-config --cflags opencv` -I../include -I.
LFLAGS = `pkg-config --libs opencv`

# Compile
all: createsamples haartraining performance mergevec vec2img facedetect convert_cascade

cvboost.o: cvboost.cpp
	$(CC) $(CFLAGS) -o $@ -c $^
cvhaarclassifier.o: cvhaarclassifier.cpp
	$(CC) $(CFLAGS) -o $@ -c $^
cvhaartraining.o: cvhaartraining.cpp
	$(CC) $(CFLAGS) -o $@ -c $^
cvcommon.o: cvcommon.cpp
	$(CC) $(CFLAGS) -o $@ -c $^
cvsamples.o: cvsamples.cpp
	$(CC) $(CFLAGS) -o $@ -c $^

createsamples.o: createsamples.cpp
	$(CC) $(CFLAGS) -o $@ -c $^
haartraining.o: haartraining.cpp
	$(CC) $(CFLAGS) -o $@ -c $^
performance.o: performance.cpp
	$(CC) $(CFLAGS) -o $@ -c $^
mergevec.o: mergevec.cpp
	$(CC) $(CFLAGS) -o $@ -c $^
vec2img.o: vec2img.cpp
	$(CC) $(CFLAGS) -o $@ -c $^
facedetect.o: facedetect.c
	$(CC) $(CFLAGS) -o $@ -c $^
convert_cascade.o: convert_cascade.c
	$(CC) $(CFLAGS) -o $@ -c $^

libcvhaartraining.a: cvboost.o cvhaarclassifier.o cvhaartraining.o cvcommon.o cvsamples.o
	ar cru $@ $^
	ranlib $@

createsamples: createsamples.o libcvhaartraining.a
	$(LINK) -o $@ $^ $(LFLAGS)
haartraining: haartraining.o libcvhaartraining.a
	$(LINK) -o $@ $^ $(LFLAGS)
performance: performance.o libcvhaartraining.a
	$(LINK) -o $@ $^ $(LFLAGS)
mergevec: mergevec.o libcvhaartraining.a
	$(LINK) -o $@ $^ $(LFLAGS)
vec2img: vec2img.o libcvhaartraining.a
	$(LINK) -o $@ $^ $(LFLAGS)
facedetect: facedetect.o
	$(LINK) -o $@ $^ $(LFLAGS)
convert_cascade: convert_cascade.o
	$(LINK) -o $@ $^ $(LFLAGS)

clean:
	rm -f createsamples haartraining performance mergevec vec2img facedetect convert_cascade *.o *.a

install: all
	$(INSTALL) --strip createsamples haartraining performance mergevec vec2img facedetect convert_cascade ../bin

カレントディレクトリ以下の 1 cpp -> 1 exe を短く

GNU make

SRCS = $(wildcard *.cpp)
EXES = $(SRCS:.cpp=.exe)

all: $(EXES)

%.obj: %.cpp
	gcc -c $^ -o $@

%.exe: %.obj
	gcc $^ -o $@

clean:
	rm *.exe *.obj
References