You are not logged in.
Lost Password?


Register To Post



 Bottom   Previous Topic   Next Topic

#1
Guide to Compile and use the new gccvb
Posted on: 2008/6/18 23:28
Nintendoid!
Joined 2006/3/15
Ecuador
234 Posts
PVBCC 3rdCoderLong Time User (13 Years)
Ok guys, since I work on Windoze now, I'm obligated to compile gccvb on it, here is what I did to make it work: (make sure you have the latests gccvb's source from David's page)

1) Download Cygwin (complete)
2) Install Cygwin (make a full install of everything to not being struggling with it latter.
3) Uncompress the gccvb source in a folder
4) Open Cygwin command console and go the the gccvb's source folder
5) Execute the next command: sh make_v810.sh

And that is all what I did... and everything is working fine. This process should have created a folder /usr/local/v810.

There you are, now you need some source code and a good makefile...

Hopes this helps the people having problems with it.

If there are still problems for you compiling it, I can upload the source I have if Krisse allows it, maybe I made one or two changes to the code... don't remenber now.

jorgeche
Top

#2
Re: Guide to Compile and use the new gccvb
Posted on: 2008/6/20 18:36
Administrator
Joined 2000/1/8
Germany
2515 Posts
Highscore Top10Highscore Top ScoreCoder#1 PosterHOTY09 1stLong Time User (15 Years) 90+ Game Ratings
Quote:
I can upload the source I have if Krisse allows it, maybe I made one or two changes to the code... don't remenber now.


do you mean changed source or the compiled gccVB?


btw, can the new gccVB still be used the old way, with the batch file runnerpack created, or do we have to use makefiles?
Top

#3
Re: Guide to Compile and use the new gccvb
Posted on: 2008/6/20 22:41
Nintendoid!
Joined 2006/3/15
Ecuador
234 Posts
PVBCC 3rdCoderLong Time User (13 Years)
I mean the source code, because I don't remember if I modified something of it or not.


About the Makefile, if you are in Windows I suppose you could use batch files, personally I use a very powerfull makefile which I found in the wikipediag.org if i recall correctly.

This is exactly what I needed becuase it automatically founds new source, headers, etc, and the only time I must edit is when I add new folders at the root of my projects.

Since it is free here is the code:

#Makefile taken from Wikipedia.org
#
# Specify the main target
TARGET = marioVB
# Default build type
TYPE = devel
#TYPE = release
# Which directories contain source files
DIRS = engine/libgccvb \
engine/vbJaE \
source \
source/game/logic \
source/game/logic/worlds \
source/game/logic/entities \
source/game/objects \
source/game/objects/definitions \
source/game/graphics/ \
source/game/graphics/chars \
source/game/graphics/maps

# Which libraries are linked
LIBS =
ROMHEADER=lib/vb.hdr
# Dynamic libraries
DLIBS =

# Binary output dir
OUTPUT = output

# The next blocks change some variables depending on the build type
ifeq ($(TYPE),devel)
LDPARAM = -Tlib/vb.ld -L/usr/local/v810/lib/
CCPARAM = -Wall
MACROS =
endif
ifeq ($(TYPE),debug)
LDPARAM = -Tlib/vb.ld -L/usr/local/v810/lib/
CCPARAM = -Wall -g
MACROS =
endif

ifeq ($(TYPE),profile)
LDPARAM = -Tlib/vb.ld -L/usr/local/v810/lib/
CCPARAM = -Wall -pg
MACROS = NDEBUG
endif

ifeq ($(TYPE), release)
LDPARAM = -s -Tlib/vb.ld -L/usr/local/v810/lib/ -lm
CCPARAM = -Wall -O3 -Winline
MACROS = NDEBUG
endif


# Add directories to the include and library paths
INCPATH = engine \
source/game \
source/game/logic \
source/game/graphics \
source/game/objects \
source/game/graphics
LIBPATH =

# Which files to add to backups, apart from the source code
EXTRA_FILES = Makefile
# The compiler
GCC = /usr/local/bin/v810-gcc
OBJCOPY = /usr/local/bin/v810-objcopy
OBJDUMP = /usr/local/bin/v810-objdump

# Where to store object and dependancy files.
STORE = .make-$(TYPE)
# Makes a list of the source (.cpp) files.
SOURCE := $(foreach DIR,$(DIRS),$(wildcard $(DIR)/*.c))
# List of header files.
HEADERS := $(foreach DIR,$(DIRS),$(wildcard $(DIR)/*.h))
# Makes a list of the object files that will have to be created.
OBJECTS := $(addprefix $(STORE)/, $(SOURCE:.c=.o))
# Same for the .d (dependancy) files.
DFILES := $(addprefix $(STORE)/,$(SOURCE:.c=.d))

# Specify phony rules. These are rules that are not real files.
.PHONY: clean backup dirs

# Main target. The @ in front of a command prevents make from displaying
# it to the standard output.

$(TARGET).vb: $(OUTPUT)/main.elf
@echo Creating $@
@$(OBJCOPY) -O binary $(OUTPUT)/main.elf $(OUTPUT)/$@
# @$(OBJDUMP) -t $(OUTPUT)/main.elf > $(OUTPUT)/sections.txt
# @$(OBJDUMP) -S $(OUTPUT)/main.elf > $(OUTPUT)/machine.asm
# Pad rom to fit 1 MB
@echo Padding $@
@lib/padder $(OUTPUT)/$@

$(OUTPUT)/main.elf: dirs $(OBJECTS)
@echo Linking $(TARGET).
@$(GCC) -o $@ $(OBJECTS) $(LDPARAM) \
$(foreach LIBRARY, $(LIBS),-l$(LIBRARY)) $(foreach LIB,$(LIBPATH),-L$(LIB))

# Rule for creating object file and .d file, the sed magic is to add
# the object path at the start of the file because the files gcc
# outputs assume it will be in the same dir as the source file.
$(STORE)/%.o: %.c
@echo Creating object file for $*...
@$(GCC) -Wp,-MD,$(STORE)/$*.dd $(CCPARAM) $(foreach INC,$(INCPATH),-I$(INC))\
$(foreach MACRO,$(MACROS),-D$(MACRO)) -c $< -o $@
@sed -e '1s/^\(.*\)$$/$(subst /,\/,$(dir $@))\1/' $(STORE)/$*.dd > $(STORE)/$*.d
@rm -f $(STORE)/$*.dd

# Empty rule to prevent problems when a header is deleted.
%.h: ;

# Cleans up the objects, .d files and executables.
clean:
@echo Making clean.
@-rm -f $(foreach DIR,$(DIRS),$(STORE)/$(DIR)/*.d $(STORE)/$(DIR)/*.o)
# @-rm -f $(TARGET)
@-rm -f $(OUTPUT)/*

# Backup the source files.
backup:
@-if [ ! -e .backup ]; then mkdir .backup; fi;
@zip .backup/backup_`date +%d-%m-%y_%H.%M`.zip $(SOURCE) $(HEADERS) $(EXTRA_FILES)

# Create necessary directories
dirs:
@-if [ ! -e $(STORE) ]; then mkdir $(STORE); fi;
@-$(foreach DIR,$(DIRS), if [ ! -e $(STORE)/$(DIR) ]; \
then mkdir -p $(STORE)/$(DIR); fi; )

# Includes the .d files so it knows the exact dependencies for every
# source.
-include $(DFILES)

Hopes it helps, I didn't have to modify a single line of it to use it in Windows with Cygwin.

jorgeche
*/
Top

#4
Re: Guide to Compile and use the new gccvb
Posted on: 2008/6/22 4:42
PVB Elite
Joined 2003/7/26
USA
1465 Posts
PVBCC EntryCoderContributorSpecial AchievementTop10 PosterHOTY09 EntryLong Time User (15 Years) 20+ Game RatingsPVBCC 2013 Entry
Two things:

1. How hard would it be to run diff on your source and the original to find out what, if anything, you changed? Were the changes only in the linker lib and the crt0, or something else?

I'm curious about the changes, but if it's too much trouble, don't worry about it.

2. That makefile you posted (thanks, BTW!) needs tabs in front of some of the lines. I attached what I think is a correct version.

Attach file:


sample makefile.sample Size: 3.80 KB; Hits: 155
Top

#5
Re: Guide to Compile and use the new gccvb
Posted on: 2008/6/22 16:50
Nintendoid!
Joined 2006/3/15
Ecuador
234 Posts
PVBCC 3rdCoderLong Time User (13 Years)
1) I really do not remember if I made changes to the source code or not, what I remember I did, was to remove a strange character ^M which was in one the of patch files in the first release of the new gccvb which corrupted the source code and made imposible to compile gccvb at least in linux.

But since a lot of people complains about not being able to compile it, maybe it could be helpful to upload a source code which have been tested to compile under different linux vesions (RedHat, CenOS, Debian) and Windows (with a full install of Cygwin).

2) Your are right RunnerPack... I forgot about the tabs, thanks for the fix.

jorgeche
Top

 Top   Previous Topic   Next Topic


Register To Post