Hi,
I've written a program for statistic analysis that can be found here
http://staff.pubhealth.ku.dk/~ande/web/software/relate.html

I want to make it portable and the program works on unix with the following compilers
sun, intel and gcc
It also compiles on windows with mingw and the intel compiler.

I've installed ms studio,
but I have yet to find a sort of Makefile way of installing the program.

Can anyone give me an advice on how to make the compilation step easier for the end windows user.

Do I have to install cmake to generate an msproject/workspace or whatever it's called?
It seems like an overkill just for 8 compilations and 2 times linking.

I mostly an unix user, and most of the window stuff just puzzles me.

Just the commandpromt. I cant even change the width of this.
So when I type in commands with long dir names it spans over multiple lines.

but also the object files aren't called .o under windows,
so what I do is to compile manually with something like

cl -c myfile.cpp

Has anyone any experience with this?

thanks in advance

btw this is my makefile

CC=g++
C=gcc



#this is the flags used for dev.
flags=-ggdb -Wall -pedantic -ansi 

#flags= -O2 -pg

#this is the flag used for prod.
#flags=-O3

all : relateHMM.o relateHMMRun HMMtest


bfgs.o : bfgs.c bfgs.h types.h
	$(C) -c -fPIC -std=gnu99 -O2  bfgs.c 

alloc.o : alloc.h alloc.cpp types.h
	$(CC) -c -fPIC   alloc.cpp ${flags}

ld.o : ld.cpp ld.h types.h
	$(CC)  -c -fPIC  ld.cpp ${flags}

asort.o : asort.cpp asort.h types.h alloc.o
	$(CC) -c asort.cpp ${flags}

filereader_and_conversions.o : filereader_and_conversions.cpp filereader_and_conversions.h types.h
	$(CC) -c filereader_and_conversions.cpp ${flags}

extractors.o : extractors.cpp extractors.h types.h
	$(CC) -c extractors.cpp ${flags}

relateHMM.o:  relateHMM.cpp relateHMM.h ld.o alloc.o asort.o types.h filereader_and_conversions.o extractors.o
	$(CC) -c -fPIC  relateHMM.cpp  ${flags}


relateHMMRun : relateHMM.o runRelate.cpp relateHMM.o bfgs.o alloc.o ld.o asort.o filereader_and_conversions.o types.h extractors.o
	$(CC) -o relateHMM runRelate.cpp asort.o relateHMM.o bfgs.o alloc.o ld.o filereader_and_conversions.o extractors.o ${flags}

HMMtest : HMMtest.cpp alloc.o types.h
	$(CC) -o HMMtest HMMtest.cpp alloc.o ${flags} 

makeR: HMMld.cpp relateHMM.o bfgs.o ld.o 
	R CMD SHLIB HMMld.cpp relateHMM.o bfgs.o alloc.o ld.o 

clean:
	rm  -f *.o  relateHMM Relate.so HMMtest

I don't think you will be able to use the same makefile across UNIX and Windows. What you can do is have 2 makefiles with different extensions like makefile.XP and makefile.Sun and have another sort of a base makefile included in all the makefiles that decides at compile time which of the above makefiles to pick based on env variables like OS_REV, which should be set in the env. file.

Something on these lines might help.

Microsoft stopped supporting makefiles beginning with VC++ 2005. Instead they have solution files which you can use to do command-line compiles. But first you will have to use the IDE to create the solution file. It also has its own version of make, but I don't recall its name.

but I don't recall its name.

That would be MSBuild

Always MS-something when it's microsoft, just as it's always mc-something with mc-donalds ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.