GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 31-Mar-2009, 14:03
New_Programmer New_Programmer is offline
New Member
 
Join Date: Mar 2009
Posts: 2
New_Programmer is on a distinguished road

Need help with makefile


Hello! I'm just starting to learn c++. I also like to play chess against other people and against computer programs. There is a very famous chess program called Fruit 2.1 that I have been trying to compile the windows version before I edit the source code to change its playing style. You can find the source at:

arctrix.com

I'm using code::blocks IDE and have tried the watcom, borland 5.5, and the gnu gcc compilers to compile the makefile. gnu gcc gives me the least amount of errors, only one error to be exact.

***************
the makefile build log says:

pv.cpp random.cpp recog.cpp search.cpp search_full.cpp see.cpp sort.cpp square.cpp trans.cpp util.cpp value.cpp vector.cpp > .depend
mingw32-make.exe: *** No rule to make target `Release'. Stop.
Process terminated with status 2 (0 minutes, 2 seconds)
1 errors, 0 warnings

***************
the makefile build messages says:

Makefile|47|.depend: No such file or directory|
||=== Build finished: 1 errors, 0 warnings ===|
***************

the makefile looks like this:

==========================================

# files

EXE = fruit

OBJS = attack.o board.o book.o eval.o fen.o hash.o list.o main.o material.o \
move.o move_check.o move_do.o move_evasion.o move_gen.o move_legal.o \
option.o pawn.o piece.o posix.o protocol.o pst.o pv.o random.o recog.o \
search.o search_full.o see.o sort.o square.o trans.o util.o value.o \
vector.o

# rules

all: $(EXE) .depend

clean:
$(RM) *.o .depend gmon.out

# general

CXX = g++
CXXFLAGS = -pipe
LDFLAGS = -lm

# C++

CXXFLAGS += -fno-exceptions -fno-rtti

# optimisation

CXXFLAGS += -O3 -fstrict-aliasing
CXXFLAGS += -fomit-frame-pointer
# CXXFLAGS += -march=athlon-xp # SELECT ME

# strip

LDFLAGS += -s

# dependencies

$(EXE): $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $(OBJS)

.depend:
$(CXX) -MM $(OBJS:.o=.cpp) > $@

include .depend
==========================================

could somebody explain to me in the greatest of layman's terms what i have to do to fix this....................................
  #2  
Old 31-Mar-2009, 14:11
New_Programmer New_Programmer is offline
New Member
 
Join Date: Mar 2009
Posts: 2
New_Programmer is on a distinguished road

Re: Need help with makefile


I finally compiled the Fruit 2.1 chess engine source without the makefile using the code::blocks IDE and the GNU GCC compiler. The executable runs fine, but I have some new questions that I hope others can answer.

A: The downloaded Fruit 2.1 chess engine source comes with an executable that runs much faster than the one I created with the GNU GCC compiler. Why is the executable I created so much slower? I have not modified the source files yet and I tried checking some of the speed optimizations in the GNU GCC compiler settings. The two programs
do exactly the same thing, but the one I created is much slower.

B: The downloaded Fruit 2.1 chess engine executable displays information on the "Arena GUI" (i.e. knodes/second, total nodes evaluated) that my executable does not. Why?

C: Do all commercial IDEs come with some special tools to get the most out of certain compilers? In other words are they able to fully optimize source code to create a better performing executable while those of us who use a free IDE like code::blocks cannot. If so, that is a major bummer because then I'll have to buy me an expensive IDE that can better optimize code and better utilize certain c++ compilers.


Please remember that some of us don't know the answers to these questions because we are just learning to program.
  #3  
Old 31-Mar-2009, 23:49
ocicat ocicat is offline
Regular Member
 
Join Date: May 2008
Posts: 580
ocicat is a jewel in the roughocicat is a jewel in the rough

Re: Need help with makefile


Quote:
Originally Posted by New_Programmer
The downloaded Fruit 2.1 chess engine source comes with an executable that runs much faster than the one I created with the GNU GCC compiler. Why is the executable I created so much slower?
Perhaps different compiler switches were used to compile the executable found.
Quote:
The downloaded Fruit 2.1 chess engine executable displays information on the "Arena GUI" (i.e. knodes/second, total nodes evaluated) that my executable does not. Why?
This tends to support the idea that the code & makefile you found is not the same as the executable, however, this is simply conjecture on my part.
Quote:
Do all commercial IDEs come with some special tools to get the most out of certain compilers? In other words are they able to fully optimize source code to create a better performing executable while those of us who use a free IDE like code::blocks cannot.
Different compilers have different switches, & yes, some compilers do a better job of optimizing for speed than others. Note that optimizing for speed may cause the size of the executable to go up.
Quote:
If so, that is a major bummer because then I'll have to buy me an expensive IDE that can better optimize code and better utilize certain c++ compilers.
Two comments:
  • I don't use Code Blocks, but as I understand, it is merely an IDE interface which is loosely coupled to a backend compiler. Perhaps it only is compatible with GNU or maybe not. The question you are really asking is what flags/switches is it setting for the compiler? Most likely, these are configurable, so you have some control over what optimizations are used. I will leave it to you do dig through the documentation to see what control you may have.
  • I don't have the two executables you are comparing, but is optimization really that important? Most commercial software is not compiled with every optimization switch turned on because optimization is a two-edged sword. You might be able to reduce the filesize or increase execution speed (but rarely both...), but optimization algorithms are frequently designed for specific cases & can be quite buggy (Most compilers ship with only minimally testing optimization switches. The number of cases to be tested are astronomical, & time can be better utilized testing more commonly used features.). If stability is important, optimizations are frequently avoided.
Now algorithm efficiency implemented in user code is a different issue...
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mixing C and assembly in x86 - Makefile nuances aijazbaig1 Assembly Language 3 23-Apr-2008 09:29
I need some help with my makefile program takachi C Programming Language 2 14-Jan-2008 06:43
Makefile command pmzq C++ Forum 2 24-Jan-2006 17:04
Makefile Problems Tommmmm C++ Forum 2 06-May-2005 21:59
makefile ap6118 C++ Forum 8 21-Mar-2005 14:02

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:33.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.