Bonjour à tous,

Voilà bientôt 4h que je m'arrache les cheveux à essayer de transformer un makefile que j'utilise en général en un makefile utilisable pour mes programmes utilisant OpenCV.

J'ai lu plusieurs tutoriaux, mais je n'ai pas très bien compris. Par exemple, certains mettent des " " autour des noms de librairie et autres choses du genre
=> J'ai essayé de nombreuses combinaisons et je ne suis pas arrivé à modifier le makefile.



Voici le makefile initial:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
CXX = g++
CXXFLAGS = -O3 -g -Wall -Wextra
LDFLAGS =
 
# name of the executable that will be created
TARGET = Main
# directory of the source files .cpp and .h
SRCDIR = .
# directory of the binary files .o
BINDIR = ./bin
# directory of the dependency files .d
DEPDIR = ./dep
# directory used by 'tarball' target to store archives .tar.gz
ARCHIVESDIR = .
# name of the makefile
MAKEFILE = Makefile
 
 
 
SRC = $(wildcard $(SRCDIR)/*.cc)
OBJ = $(patsubst $(SRCDIR)/%.cc,$(BINDIR)/%.o,$(SRC))
DEP = $(patsubst $(SRCDIR)/%.cc,$(DEPDIR)/%.d,$(SRC))
 
 
all: $(TARGET)
 
# link
$(TARGET): $(OBJ)
	$(CXX) -o $@ $^ $(LDFLAGS)
 
# pull in dependency info for existing .o files
-include $(DEP)
 
# compile and generate dependency info
$(BINDIR)/%.o: $(SRCDIR)/%.cc $(MAKEFILE)
	@mkdir -p $(BINDIR) $(DEPDIR)
	$(CXX) -c $< $(CXXFLAGS) -o $@
	@$(CXX) -MM $(CXXFLAGS) -MT $(BINDIR)/$*.o $< > $(DEPDIR)/$*.d
 
 
.PHONY: tarball temprm clean mrproper
 
tarball: $(MAKEFILE) $(SRCDIR) README
	@mkdir -p $(ARCHIVESDIR)
	tar zcf $(ARCHIVESDIR)/$(shell basename $(shell pwd))-$(shell date +%Y%m%d-%Hh%Mm).tar.gz $^
 
# cleaners
temprm:
	@rm -f $(SRCDIR)/*~ *~
 
clean: temprm
	@rm -f $(OBJ) $(DEP)
 
mrproper: clean
	@rm -f $(TARGET)
	@rm -rf $(BINDIR) $(DEPDIR)
Et j'aimerais bien réussir à introduire les différents éléments nécessaires à l'utilisation d'OpenCV.

Voici la commande que j'utilise pour compiler:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
g++ -O3 -g -Wall -Wextra main.cc -o main -I /usr/include/opencv -L /usr/lib -lm -lcv -lhighgui -lcvaux
Je programme donc en C++ sur Ubuntu 8.10.
Mon but final est d'utiliser ce makefile dans Eclipse


Merci d'avance pour votre aide.