Jump to content
  • Advertisement
Sign in to follow this  
Concentrate

makefiles

This topic is 2888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a project with a makefile. I need to run it. I am under windows 7. I do not know how to exactly run it. Can someone help please. I have downloaded cygwin, and tried to use the "make" command but I get an
error saying that "make command not found". I tried installing the make package but I think it didn't work or I installed the wrong package. Please help me.

Share this post


Link to post
Share on other sites
Advertisement
Thanks for the reply, I got the make command to work but I am still not able to run the makefile. This is what the makefile contains :
[source]

CC = g++
GLPK = glpk-4.34
CFLAGS = -O3 -Wall -Iglpk-4.34/include -D LPSOLVER_GLPK
LIBPATH = glpk-4.34/src

#CFLAGS = -O3 -Wall
#LIBPATH =
#LIBPATH = .

ifneq ($(MAKECMDGOALS), CPLEX)
CFLAGS = -O3 -Wall -I$(GLPK)/include -D LPSOLVER_GLPK
LIBPATH = $(GLPK)/src
#LIBPATH = .
else
CFLAGS = -O3 -lpthread -Wall -D LPSOLVER_CPLEX -I/usr/ilog/cplex101/include/ilcplex/
LIBPATH = /usr/ilog/cplex101/lib/x86-64_RHEL3.0_3.2/static_pic
endif

all: GLPK

BioSequenceMatrix.o: BioSequenceMatrix.cpp BioSequenceMatrix.h Utils.h
$(CC) $(CFLAGS) -c BioSequenceMatrix.cpp

BinaryMatrix.o: BinaryMatrix.cpp BinaryMatrix.h Utils.h
$(CC) $(CFLAGS) -c BinaryMatrix.cpp

GenotypeMatrix.o: GenotypeMatrix.cpp GenotypeMatrix.h Utils.h
$(CC) $(CFLAGS) -c GenotypeMatrix.cpp

UnWeightedGraph.o: UnWeightedGraph.cpp UnWeightedGraph.h Utils.h
$(CC) $(CFLAGS) -c UnWeightedGraph.cpp

Utils.o : Utils.cpp Utils.h
$(CC) $(CFLAGS) -c Utils.cpp

Utils2.o : Utils2.cpp Utils2.h Utils.h
$(CC) $(CFLAGS) -c Utils2.cpp

Utils3.o : Utils3.cpp Utils3.h Utils.h
$(CC) $(CFLAGS) -c Utils3.cpp


SNPUtils.o : SNPUtils.cpp SNPUtils.h Utils.h
$(CC) $(CFLAGS) -c SNPUtils.cpp

BlockUtils.o : BlockUtils.cpp BlockUtils.h Utils.h
$(CC) $(CFLAGS) -c BlockUtils.cpp

BlockILP.o : BlockILP.cpp BlockILP.h Utils.h
$(CC) $(CFLAGS) -c BlockILP.cpp

HeuristicBlock.o : HeuristicBlock.cpp BlockUtils.h Utils.h
$(CC) $(CFLAGS) -c HeuristicBlock.cpp

BlockMCMC.o : BlockMCMC.cpp BlockMCMC.h Utils.h
$(CC) $(CFLAGS) -c BlockMCMC.cpp

ExactBlock.o : ExactBlock.cpp ExactBlock.h Utils.h
$(CC) $(CFLAGS) -c ExactBlock.cpp

ILPSolver.o : ILPSolver.cpp ILPSolver.h Utils.h
$(CC) $(CFLAGS) -c ILPSolver.cpp

glpk_wraper.o : glpk_wraper.c
gcc $(CFLAGS) -c glpk_wraper.c

main.o: main.cpp BinaryMatrix.h Utils.h
$(CC) $(CFLAGS) -c main.cpp

GLPK: main.o BioSequenceMatrix.o BinaryMatrix.o UnWeightedGraph.o Utils.o Utils2.o \
SNPUtils.o BlockUtils.o HeuristicBlock.o Utils3.o BlockMCMC.o ExactBlock.o GenotypeMatrix.o \
ILPSolver.o glpk_wraper.o BlockILP.o
$(CC) $(CFLAGS) -o RecBlock main.o BioSequenceMatrix.o BinaryMatrix.o UnWeightedGraph.o SNPUtils.o \
Utils.o Utils2.o BlockUtils.o HeuristicBlock.o Utils3.o BlockMCMC.o \
ExactBlock.o GenotypeMatrix.o ILPSolver.o glpk_wraper.o BlockILP.o \
$(LIBPATH)/libglpk.a

CPLEX: main.o BioSequenceMatrix.o BinaryMatrix.o UnWeightedGraph.o Utils.o Utils2.o \
SNPUtils.o BlockUtils.o HeuristicBlock.o Utils3.o BlockMCMC.o ExactBlock.o GenotypeMatrix.o \
ILPSolver.o glpk_wraper.o BlockILP.o
$(CC) $(CFLAGS) -o RecBlock main.o BioSequenceMatrix.o BinaryMatrix.o UnWeightedGraph.o SNPUtils.o \
Utils.o Utils2.o BlockUtils.o HeuristicBlock.o Utils3.o BlockMCMC.o \
ExactBlock.o GenotypeMatrix.o ILPSolver.o glpk_wraper.o BlockILP.o \
$(LIBPATH)/libilocplex.a $(LIBPATH)/libcplex.a

[/source]

I'm not sure what to do. I have never worked with cygwin. Currently the command I'm doing is "make Makefile" but I get an error saying "nothing to be done for 'Makefile'" where 'Makefile' is the actual Makefile filename that contains the above data. Please help.

Share this post


Link to post
Share on other sites
If you want to specify a particular make file to use you use "make -f [filename]". Just "make [filename]" will try to build the target with the same name as the file in the default make file. If no such target exists you get the message that there's nothing to do.

Share this post


Link to post
Share on other sites
Thanks for the help. I tried this command : "make -f Makefile" and got this :


$ make -f Makefile
g++ -O3 -Wall -Iglpk-4.34/include -D LPSOLVER_GLPK -c main.cpp
make: g++: Command not found
make: *** [main.o] Error 127

I'm not sure what to do?

Share this post


Link to post
Share on other sites
I probably didn't. Because I only installed the base package + make package. I will try to install the gcc/g++. Any instruction on the exact name on the installation package? Thanks.

Share this post


Link to post
Share on other sites
Hey Thanks for the help. I installed the gcc-g++ and I got it to build the program. I used the "make" command to build the file, and I got it to build the file, and looking at the directory, I do see the object files. Now Can you
help me run the program and possibly produce an executable. Thanks

Share this post


Link to post
Share on other sites

Hey Thanks for the help. I installed the gcc-g++ and I got it to build the program. I used the "make" command to build the file, and I got it to build the file, and looking at the directory, I do see the object files. Now Can you
help me run the program and possibly produce an executable. Thanks


From what I see, typing "make" should give you the binary. Without parameters, make will look for the first target in the makefile. Typically, this is "all". "all" depends on "GLPK". So look at the rule to make GLPK, which tells it depends on ...

GLPK: main.o BioSequenceMatrix.o BinaryMatrix.o UnWeightedGraph.o Utils.o Utils2.o \
SNPUtils.o BlockUtils.o HeuristicBlock.o Utils3.o BlockMCMC.o ExactBlock.o GenotypeMatrix.o \
ILPSolver.o glpk_wraper.o BlockILP.o


and in the next line it says ...

$(CC) $(CFLAGS) -o RecBlock main.o BioSequenceMatrix.o BinaryMatrix.o UnWeightedGraph.o SNPUtils.o \
Utils.o Utils2.o BlockUtils.o HeuristicBlock.o Utils3.o BlockMCMC.o \
ExactBlock.o GenotypeMatrix.o ILPSolver.o glpk_wraper.o BlockILP.o \
$(LIBPATH)/libglpk.a


the parameter -o RecBlock says that the name of the output file should be RecBlock.

Share this post


Link to post
Share on other sites
Hey thanks a lot. So I managed to get the executable from your suggestion, I just had to add the appropriate dll from cygwin into the folder. Sorry for nagging, but I have one more problem. When I run the executable, it pops up and exits quickly. I don't think that should happen, because I know the executable expects inputs so I thought it should stay visible. Any advice on how to fix this? Thanks again.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!