Original Post

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

4 Replies

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?

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
*/

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.

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

 

Write a reply

You must be logged in to reply to this topic.