Bonsoir,
Voici mon souci j'ai un premier makefile comme celui-ci (pour compiler MyGeneralAlgorithm.cpp):
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 # Update the line below according to the tulip installation directory you choosed TULIP_DIR=/home/docky/Bureau/tulip-3.2.1 TULIP_CONFIG=$(TULIP_DIR)/tulip-config TULIP_VERSION=$(shell ${TULIP_CONFIG} --version) LIB_EXTENSION=$(shell ${TULIP_CONFIG} --pluginextension) # To limit, crash problems when loading a plugin library # Tulip only load those whose names end with a compatible version number TARGET= libTest-$(TULIP_VERSION).$(LIB_EXTENSION) # a plugin library may contain more than one algorithm # so you can have several source files on the line below SRCS = MyGeneralAlgorithm.cpp CXX=g++ CXXFLAGS = -O3 -Wall -DNDEBUG `${TULIP_CONFIG} --cxxflags --plugincxxflags` LDFLAGS= `${TULIP_CONFIG} --pluginldflags` `${TULIP_CONFIG} --libs` OBJS=$(SRCS:.cpp=.o) DEPS=$(SRCS:.cpp=.d) all: $(TARGET) $(TARGET): $(OBJS) $(CXX) $(OBJS) -o $@ $(LDFLAGS) $(LIBS) clean : -rm -f $(TARGET) *.o *.d install: all install $(TARGET) `${TULIP_CONFIG} --pluginpath` %.d: %.cpp $(CXX) -M $(CXXFLAGS) $< \ | sed 's!\($*\)\.o[ :]*!\1.o $@ : !g' > $@; \ [ -s $@ ] 2>/dev/null || rm $@ -include $(DEPS)
puis un deuxième comme celui-ci (pour compiler BayesianNetwork.cpp):
Mon souhait c'est d'intégrer le code contenu dans BayesianNetwork.cpp dans MyGeneralAlgorithm.cpp. Ainsi les dépendances pour BayesianNetwork doivent être maintenant paramétrées dans MyGeneralAlgorithm et ainsi dans son makefile. Malheureusement, je n'arrive pas à faire un mix des deux et notamment au niveau de la ligne $(TARGET):
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 # Sample Makefile to compile ProBT examples. # Probayes, 2007 # # Targets: PROBT_INCLUDE=include PROBT_LIB=lib CXX=g++ -Wall # Environment variable containing the path to the dynamically loaded libraries ifeq ($(shell uname -s),Darwin) # libraries for Mac OS X DLL_PATH_VAR := DYLD_LIBRARY_PATH else # libraries for Linux DLL_PATH_VAR := LD_LIBRARY_PATH endif all: show # Compiling a C++ source file: add the path to the ProBT includes, the path to the ProBT libraries, # and link with the ProBT libraries. bayesian_network: BayesianNetwork.cpp $(DLL_PATH_VAR)=$(PROBT_LIB):${$(DLL_PATH_VAR)} $(CXX) -I$(PROBT_INCLUDE) BayesianNetwork.cpp -L$(PROBT_LIB) -lspl -o bayesian_network # Running an example: adjust the LD_LIBRARY_PATH environment variable to point to the directory # containing the ProBT libraries. run: bayesian_network @echo ">>> Running the example. It will output bayesian_network.fig (figure in in xfig format)." $(DLL_PATH_VAR)=$(PROBT_LIB):${$(DLL_PATH_VAR)} ./bayesian_network show: run xfig bayesian_network.fig .PHONY: run show
j'ai pour l'instant mis cela mais cela ne marche pas:
Je suis loin d'être un expert en makefile c'est pour cela que je vous sollicite.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 $(TARGET): $(OBJS) $(DLL_PATH_VAR)=$(PROBT_LIB):${$(DLL_PATH_VAR)} $(CXX) -I$(PROBT_INCLUDE) $(OBJS) -L$(PROBT_LIB) -lspl -o $@ $(LDFLAGS) $(LIBS)
Merci d'avance
Partager