Makefile for C++ program

S

Sharp Tool

Hi

I have downloaded a program that is written in C++ that I would like to
compile into a Win XP executable.
The program contains a Makefile written for Unix/linux/cygwin.
I would like to modify it, if neccessary, so that I can compile it using MS
Visual C++ 6.0.
Here is the code for the Makefile:

//START
CC = /bin/g++ -Winline -Wall -Wno-sign-compare

VIENNA = vienna

COPT = -include Alignment_prefix.h -I$(VIENNA)
LDFLAGS = $(COPT) -L$(VIENNA)
LIBS = -lRNA

SOURCES = main.cpp \
AlignmentManager.cpp \
Alphabet.cpp \
DistanceTable.cpp \
Profile.cpp \
ProfileDistanceTable.cpp \
Sequence.cpp \
Region.cpp \
ViennaLib.cpp

#OBJECTS = vienna/fold.o vienna/RNAstruct.o vienna/fold_vars.h

all: viennalib align_with_log

viennalib:
cd vienna; $(MAKE)

align_with_log:
$(CC) $(SOURCES) -o ../rnaprofile $(LDFLAGS) $(LIBS)

clean:
cd vienna; $(MAKE) clean
//END

I suspect that all I need to do is remove the first line that says, "CC =
/bin/g++ -Winline -Wall -Wno-sign-compare", as Visual C++ already has a
compiler, and should know where it is. How do I get get Visual C++ to use
this Makefile to compile into a Win XP executable?

Any help much appreciated.

Cheers
Sharp Tool
 
J

John Ratliff

You will probably not find any help on this newsgroup since it is geared
towards standard C++ language questions only.

I suggest you ask on the microsoft VC++ forum. Maybe this one:
microsoft.public.vstudio.general

--John Ratliff
 
S

Sharp Tool

You will probably not find any help on this newsgroup since it is geared
towards standard C++ language questions only.

I suggest you ask on the microsoft VC++ forum. Maybe this one:
microsoft.public.vstudio.general

--John Ratliff

Thanks John

I will keep an eye out anyway in hope that someone might be able to help me
out.

Cheers
Sharp tool
 
A

Alf P. Steinbach

* Sharp Tool:
I have downloaded a program that is written in C++ that I would like to
compile into a Win XP executable.
The program contains a Makefile written for Unix/linux/cygwin.
I would like to modify it, if neccessary, so that I can compile it using MS
Visual C++ 6.0.

Better use e.g. g++ or Visual C++ 7.1 (which is a free download). Visual
C++ 6.0 is an old compiler that's non-standard in many respects.

Also, instead of struggling with 'make', which isn't one standard but a
number of different but somewhat similar tools, try out e.g. 'jam'.

The Boost library uses a version of 'jam', <url:
http://www.boost.org/tools/build/jam_src/index.html>.

Here is the code for the Makefile:

//START
CC = /bin/g++ -Winline -Wall -Wno-sign-compare

You'll have to change this definition, both the compiler invocation and the
options, corresponding to the compiler you'll be using.

VIENNA = vienna

COPT = -include Alignment_prefix.h -I$(VIENNA)
Ditto.


LDFLAGS = $(COPT) -L$(VIENNA)
Ditto.


LIBS = -lRNA
Ditto.


SOURCES = main.cpp \
AlignmentManager.cpp \
Alphabet.cpp \
DistanceTable.cpp \
Profile.cpp \
ProfileDistanceTable.cpp \
Sequence.cpp \
Region.cpp \
ViennaLib.cpp

OK (and this is probably the _only_ rule you don't have to change).

#OBJECTS = vienna/fold.o vienna/RNAstruct.o vienna/fold_vars.h

May have to be changed or not (some compilers use '.obj' file name suffix
for object files).

all: viennalib align_with_log

OS-specific.

viennalib:
cd vienna; $(MAKE)
OS-specific.


align_with_log:
$(CC) $(SOURCES) -o ../rnaprofile $(LDFLAGS) $(LIBS)

Compiler-specific.

clean:
cd vienna; $(MAKE) clean

OS-specific.
 
S

Sharp Tool

Alf P. Steinbach said:
* Sharp Tool:

Better use e.g. g++ or Visual C++ 7.1 (which is a free download). Visual
C++ 6.0 is an old compiler that's non-standard in many respects.


Where can I download Visual C++ 7.1 compiler?

Also, instead of struggling with 'make', which isn't one standard but a
number of different but somewhat similar tools, try out e.g. 'jam'.

The Boost library uses a version of 'jam', <url:
http://www.boost.org/tools/build/jam_src/index.html>.


I will check this out.

You'll have to change this definition, both the compiler invocation and the
options, corresponding to the compiler you'll be using.


This is going to harder than I thought. I have never been taught to use
Makefile. We would just create header and implementation files, one of which
would be the main method, and we would simply compile it using Visual C++
6.0. Now, I have come across this program that uses a Makefile, and I can't
seem to compile without it. Are there any reference for creating a makefile
for WinXP?

Cheers
Sharp tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,237
Latest member
AvivMNS

Latest Threads

Top