Why does this make file not work?

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Why does this make file not work?

Post by Kojima »

Can anyone spot why this is ignoring the EE_LIBS line? It's definitely ignoring because I entered some made up name and it doesn't flag an error.

I'm trying to add the standard C lib so I can use rand() on the second tutorial.

-----------

#----------------------------------------------------------------------------
# File: Makefile
# Author: Tony Saveski, [email protected]
#----------------------------------------------------------------------------
CC=ee-gcc
AS=ee-as
LD=ee-elf-ld
BMP2C=bmp2c

OBJ_DIR = obj
BMP_DIR = resources
EE_INCS += -I$(PS2SDK)/ee/include -I$(PS2SDK)/ee/dma/include -I$(GCCLIB)/include -I$(PS2GDB)/ee
EE_LIBS += -lgcc -lm -lkernel -lc -lsrrscall -ldebug -lpad


CFLAGS = -Wall -W -EL -G0 -O0 -mips3 -nostdlib -DPS2_EE

BMP_SRC = ff.c
C_SRC = g2.c demo2a.c $(BMP_SRC)
S_SRC = crt0.s ps2_asm.s dma_asm.s gs_asm.s

C_OBJ = $(addprefix $(OBJ_DIR)/, $(C_SRC:.c=.o))
S_OBJ = $(addprefix $(OBJ_DIR)/, $(S_SRC:.s=.o))

demo1.elf: $(C_OBJ) $(S_OBJ)
@echo "-------------------------------------------------"
$(CC) $(CFLAGS) -Tlinkfile -o demo2a.elf $(C_OBJ) $(S_OBJ) -Wl,-Map,demo2a.map

$(OBJ_DIR)/%.o: %.c
@echo "-------------------------------------------------"
$(CC) -c $(CFLAGS) $< -o $@

$(OBJ_DIR)/%.o: %.s
@echo "-------------------------------------------------"
$(CC) -xassembler-with-cpp -c $(CFLAGS) $< -o $@

%.c: $(BMP_DIR)/%.bmp
@echo "-------------------------------------------------"
$(BMP2C) $< $(*F) > $@

clean:
rm -f $(C_OBJ) $(S_OBJ) *.map *.elf $(BMP_SRC)

ff.c: $(BMP_DIR)/ff.bmp
Last edited by Kojima on Mon Jul 03, 2006 8:40 pm, edited 2 times in total.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

EE_LIBS is part of the makefile template files (makefile.eeglobal, etc),and you aren't using them, you are just writing all your own rules... so of course it won't work.
Shoot Pixels Not People!
Makeshift Development
User avatar
evilo
Posts: 230
Joined: Thu Apr 22, 2004 8:40 pm
Contact:

Post by evilo »

furthermore, you should check/use the makefile samples from the SDK, those ones are quite old ;)
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

It won't compile with the sdk makefiles. I don't get it, I've looked through the ps2 sdk samples and not a single line (that I saw) actually invokes EE_LIBS etc.

How much work would it be to add lib support to the above makefile?
User avatar
evilo
Posts: 230
Joined: Thu Apr 22, 2004 8:40 pm
Contact:

Post by evilo »

usr\local\ps2dev\sdk\samples\Makefile.eeglobal

Code: Select all

$&#40;EE_BIN&#41; &#58; $&#40;EE_OBJS&#41; $&#40;PS2SDK&#41;/ee/startup/crt0.o
	$&#40;EE_CC&#41; -mno-crt0 -T$&#40;PS2SDK&#41;/ee/startup/linkfile $&#40;EE_LDFLAGS&#41; \
		-o $&#40;EE_BIN&#41; $&#40;PS2SDK&#41;/ee/startup/crt0.o $&#40;EE_OBJS&#41; $&#40;EE_LIBS&#41;
-o $(EE_BIN) $(PS2SDK)/ee/startup/crt0.o $(EE_OBJS) $(EE_LIBS)

hmm .... did you say something ??

:) :) :) :)
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

You just made a very powerful enemy my friend.


:)

Thanks.
User avatar
evilo
Posts: 230
Joined: Thu Apr 22, 2004 8:40 pm
Contact:

Post by evilo »

perfect :)

anyway, I hope to play your ps2 pong very soon now !
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

You could play it now if I had any ftp space. My isp despite being one of the biggest companies in the uk(BT) are too cheap to give any for free.

I'll try looking for a free provider though.
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

Man, I'm not having any luck with this makefile. If it's not too much trouble, could someone modify the one i posted up above to load libs please? I just don't know what to do.
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

I managed it. I don't know how, perhaps voodoo magic, but its working now.

-Edit- Spoke too soon, although it works fine for C, my attempts to convert to C++ have almost worked but not quite,
it now fails, complaining about a missing strlen def. I've done the Extern "C" thing to all my sources but it's not working.

Here's the error,

Code: Select all

C&#58;\ps2dev\ps2sdk\ports\ps2tut_02a>make
-------------------------------------------------
ee-gcc -xassembler-with-cpp -c -Wall -W -EL -G0 -O0   -DPS2_EE ps2_asm.s -o obj/
ps2_asm.o
-------------------------------------------------
ee-gcc -xassembler-with-cpp -c -Wall -W -EL -G0 -O0   -DPS2_EE dma_asm.s -o obj/
dma_asm.o
-------------------------------------------------
ee-gcc -xassembler-with-cpp -c -Wall -W -EL -G0 -O0   -DPS2_EE gs_asm.s -o obj/g
s_asm.o
-------------------------------------------------
ee-gcc -Wall -W -EL -G0 -O0   -DPS2_EE -Tlinkfile -LC&#58;/ps2dev/ps2sdk/ee/lib  -o
demo2a.elf obj/g2.o obj/demo2a.o obj/ps2_asm.o obj/dma_asm.o obj/gs_asm.o -lc -l
gcc -lm -lstdc++ -lsyscall -lc -lkernel -lc -lc -lc -Wl,-Map,demo2a.map
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/libgcc.a&#40;unwind-dw2.o&#41;&#40;.text+0
x388&#41;&#58; In function `extract_cie_info'&#58;
../../gcc/unwind-dw2.c&#58;226&#58; undefined reference to `strlen'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/libgcc.a&#40;unwind-dw2-fde.o&#41;&#40;.te
xt+0x5d4&#41;&#58; In function `get_cie_encoding'&#58;
../../gcc/unwind-dw2-fde.c&#58;271&#58; undefined reference to `strlen'
collect2&#58; ld returned 1 exit status
make&#58; *** &#91;demo1.elf&#93; Error 1

C&#58;\ps2dev\ps2sdk\ports\ps2tut_02a>
Here's the makefile as is,

Code: Select all

#----------------------------------------------------------------------------
# File&#58;		Makefile
# Author&#58;	Tony Saveski, [email protected]
#----------------------------------------------------------------------------
CC=ee-gcc
AS=ee-as
LD=ee-elf-ld
BMP2C=bmp2c

OBJ_DIR = obj
BMP_DIR = resources
EE_INCS += -I$&#40;PS2SDK&#41;/ee/include -I$&#40;PS2SDK&#41;/ee/dma/include -I$&#40;GCCLIB&#41;/include -I$&#40;PS2GDB&#41;/ee 
EE_LIBS += -lc -lgcc -lm -lstdc++ -lsyscall
EE_LDFLAGS &#58;= -L$&#40;PS2SDK&#41;/ee/lib $&#40;EE_LDFLAGS&#41; 
CFLAGS = -Wall -W -EL -G0 -O0   -DPS2_EE
EE_LIBS += -lc -lkernel -lc -lc -lc


C_SRC = g2.cc demo2a.cc
S_SRC =  ps2_asm.s dma_asm.s gs_asm.s

C_OBJ = $&#40;addprefix $&#40;OBJ_DIR&#41;/, $&#40;C_SRC&#58;.cc=.o&#41;&#41;
S_OBJ = $&#40;addprefix $&#40;OBJ_DIR&#41;/, $&#40;S_SRC&#58;.s=.o&#41;&#41;

demo1.elf&#58; $&#40;C_OBJ&#41; $&#40;S_OBJ&#41; $&#40;PS2SDK&#41;/ee/startup/linkfile
	@echo "-------------------------------------------------"
	$&#40;CC&#41; $&#40;CFLAGS&#41; -Tlinkfile $&#40;EE_LDFLAGS&#41;-o demo2a.elf $&#40;C_OBJ&#41; $&#40;S_OBJ&#41; $&#40;EE_LIBS&#41; -Wl,-Map,demo2a.map

$&#40;OBJ_DIR&#41;/%.o&#58; %.cc
	@echo "-------------------------------------------------"
	$&#40;CC&#41; -c $&#40;CFLAGS&#41; $< -o $@

$&#40;OBJ_DIR&#41;/%.o&#58; %.s
	@echo "-------------------------------------------------"
	$&#40;CC&#41; -xassembler-with-cpp -c $&#40;CFLAGS&#41; $< -o $@

%.c&#58; $&#40;BMP_DIR&#41;/%.bmp
	@echo "-------------------------------------------------"
	$&#40;BMP2C&#41; $< $&#40;*F&#41; > $@

clean&#58;
	rm -f $&#40;C_OBJ&#41; $&#40;S_OBJ&#41; *.map *.elf 


Is it a missing lib?
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

Fixed it, i had to order the libs, moving stdc to the second lib like so,

-lc -lstdc++ -lgcc -lm -lsyscall

in case anyone else runs into this problem.

-edit- well spoke too soon again, it compiles run but ps2link just says 'could not execute file host:demo20a.elf"
I opened up irlink and it seems to transfer about 30% of the file before aborting.
Any ideas why?

here's the current make file,

Code: Select all

#----------------------------------------------------------------------------
# File&#58;		Makefile
# Author&#58;	Tony Saveski, [email protected]
#----------------------------------------------------------------------------
CC=ee-gcc
AS=ee-as
LD=ee-elf-ld
BMP2C=bmp2c

OBJ_DIR = obj
BMP_DIR = resources
EE_INCS += -I$&#40;PS2SDK&#41;/ee/include -I$&#40;PS2SDK&#41;/ee/dma/include -I$&#40;GCCLIB&#41;/include -I$&#40;PS2GDB&#41;/ee 
EE_LIBS += -lc -lstdc++ -lgcc -lm  -lsyscall
EE_LDFLAGS &#58;= -L$&#40;PS2SDK&#41;/ee/lib $&#40;EE_LDFLAGS&#41; 
CFLAGS = -Wall -W -EL -G0 -O0   -DPS2_EE
EE_LIBS += -lc -lkernel -lc -lc -lc


C_SRC = g2.cc demo2a.cc
S_SRC =  ps2_asm.s dma_asm.s gs_asm.s

C_OBJ = $&#40;addprefix $&#40;OBJ_DIR&#41;/, $&#40;C_SRC&#58;.cc=.o&#41;&#41;
S_OBJ = $&#40;addprefix $&#40;OBJ_DIR&#41;/, $&#40;S_SRC&#58;.s=.o&#41;&#41;

demo1.elf&#58; $&#40;C_OBJ&#41; $&#40;S_OBJ&#41; 
	@echo "-------------------------------------------------"
	$&#40;CC&#41; $&#40;CFLAGS&#41; -Tlinkfile $&#40;EE_LDFLAGS&#41;-o demo2a.elf $&#40;C_OBJ&#41; $&#40;S_OBJ&#41; $&#40;EE_LIBS&#41; -Wl,-Map,demo2a.map

$&#40;OBJ_DIR&#41;/%.o&#58; %.cc
	@echo "-------------------------------------------------"
	$&#40;CC&#41; -c $&#40;CFLAGS&#41; $< -o $@

$&#40;OBJ_DIR&#41;/%.o&#58; %.s
	@echo "-------------------------------------------------"
	$&#40;CC&#41; -xassembler-with-cpp -c $&#40;CFLAGS&#41; $< -o $@

%.c&#58; $&#40;BMP_DIR&#41;/%.bmp
	@echo "-------------------------------------------------"
	$&#40;BMP2C&#41; $< $&#40;*F&#41; > $@

clean&#58;
	rm -f $&#40;C_OBJ&#41; $&#40;S_OBJ&#41; *.map *.elf 


-Edit- Tried everything, removed just all compile flags that didn't cause a linker error, and still the same, flat out refuses to run. My pong game still runs fine, BUT once it's failed to load this, I have to do a soft or hard reset for anything else to run.

Any ideas why it's not working?
User avatar
evilo
Posts: 230
Joined: Thu Apr 22, 2004 8:40 pm
Contact:

Post by evilo »

kojima,

please :

1st - don't use irlink, but prefer ps2client

2dn - don't reuse that makefile, and prefer a new one based on the SDK samples

check one of mine (from my smw port)

Code: Select all

#					     Super Mario War / PS2
#------------------------------------------------------------------
# Copyright 2005 - Olivier "evilo" Biot <[email protected]>
# Released under GNU license
# Review SMW README & LICENSE files for further details.
#------------------------------------------------------------------
# GCC 3.2.2 / PS2SDK 1.2 / GSKIT 0.2 / SDL 0.1
#------------------------------------------------------------------
# Compilation Flags
#
#------------------------------------------------------------------

EE_BIN      = smw.elf

EE_LIBS   += -L$&#40;PS2SDK&#41;/ports/lib -lsdlmain -lSDL_image -lsdlmixer -lsdl -ljpg -lmc -ldebug
EE_INCS   += -I../include -I$&#40;PS2SDK&#41;/ports/include -I$&#40;PS2SDK&#41;/ports/include/zlib -I$&#40;PS2SDK&#41;/ports/include/SDL

EE_CXXFLAGS += -mlong32 -DUSE_ROMFS -DSYS_LITTLE_ENDIAN -DSYS_NEED_ALIGNMENT -DUSE_RWOPS

EE_CFLAGS   += -DSYS_LITTLE_ENDIAN -DSYS_NEED_ALIGNMENT 

GENROMFS_PATH = ../tools/genromfs
GENROMFS = $&#40;GENROMFS_PATH&#41;/genromfs
  

EE_OBJS = SFont.o \
	  eyecandy.o \
	  gamemodes.o \
	  gfx.o \
	  main.o \
	  map.o \
	  player.o \
	  music_player.o \
	  romdisk.o romfs.o romfs_io.o 

romdisk.img&#58;
	@echo Creating romdisk..
	@$&#40;GENROMFS&#41; -f $@ -d romdisk

romdisk.o&#58; romdisk.img
	@$&#40;PS2SDK&#41;/bin/bin2o -a 16 -n romdisk.img romdisk.o romdisk
 
  
all&#58;    build_romfs $&#40;EE_BIN&#41; 
	$&#40;EE_STRIP&#41; $&#40;EE_BIN&#41;

build_romfs&#58;
	$&#40;MAKE&#41; -C $&#40;GENROMFS_PATH&#41; all 
clean&#58;
	rm -f -R *.elf $&#40;EE_OBJS&#41;  romdisk.img 
	$&#40;MAKE&#41; -C $&#40;GENROMFS_PATH&#41; clean

run&#58;
	ps2client -h 192.168.0.100 execee host&#58;$&#40;EE_BIN&#41;  
	
reset&#58;
	ps2client -h 192.168.0.100 reset   


include Makefile.pref
include Makefile.eeglobal
good luck !
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

I am using Ps2Client, I just used irlink to monitor how much of the file was transfered before it failed. IrLink doesn't even work anyway, aside from the transfer monitor.

I did try to make a new make file based on the samples, but it wouldn't compile saying there was no rule for the .o files, when there clearly was.

But shouldn't my one above work? It compiles fine, links fine, just doesn't run? All I did was change from C to C++, as I did with my pong game, and pong runs fine in C++.

No ideas at all how i could fix my one up? I'm learning just by tinkering with the sample makefiles and I understand how it works now, mostly(At least as far as getting something to compile and link goes)
but my knowledge isn't great enough to figure out why a perfectly compiled and link app fails to run.

In the words of Lennon. Help!

:)
User avatar
evilo
Posts: 230
Joined: Thu Apr 22, 2004 8:40 pm
Contact:

Post by evilo »

with the new makefile rules, you must rename the .s to .S :)
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

There are rules for that in eeglobal too as far as I can see.

I've just tried again, took my pong makefile, ee global and tried to make a new one based on both for the new app, and still it complains 'no rule to make target '/g2.o'

HEre's the main makefile

Code: Select all

#  ____     ___ |    / _____ _____
# |  __    |    |___/    |     |
# |___| ___|    |    \ __|__   |     gsKit Open Source Project.
# ----------------------------------------------------------------------
# Copyright 2004 - Chris "Neovanglist" Gilbert <[email protected]>
# Licenced under Academic Free License version 2.0
# Review gsKit README & LICENSE files for further details.
#
# examples/basic/Makefile - Makefile for "basic" example.
#

EE_BIN = demo2a.elf


all&#58; $&#40;EE_BIN&#41;

clean&#58;
	rm -f *.erl *.o *.a

include $&#40;PS2SDK&#41;/samples/Makefile.pref
include $&#40;PS2SDK&#41;/samples/Makefile.eeglobal


and the modified eeglobal,

Code: Select all

# _____     ___ ____     ___ ____
#  ____|   |    ____|   |        | |____|
# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http&#58;//www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
# $Id&#58; Makefile.eeglobal_sample 1150 2005-06-12 11&#58;42&#58;08Z pixel $

OBJ_DIR = obj 
BMP_DIR = resources 
EE_INCS += -I$&#40;PS2SDK&#41;/ee/include -I$&#40;PS2SDK&#41;/ee/dma/include -I$&#40;GCCLIB&#41;/include -I$&#40;PS2GDB&#41;/ee 
EE_LIBS += -lc -lstdc++ -lgcc -lm  -lsyscall 
EE_LDFLAGS &#58;= -L$&#40;PS2SDK&#41;/ee/lib $&#40;EE_LDFLAGS&#41; 

EE_LIBS += -lc -lkernel -lc -lc -lc

C_SRC = g2.cc demo2a.cc 
S_SRC =  ps2_asm.s dma_asm.s gs_asm.s 

C_OBJ = $&#40;addprefix $&#40;OBJ_DIR&#41;/, $&#40;C_SRC&#58;.cc=.o&#41;&#41; 
S_OBJ = $&#40;addprefix $&#40;OBJ_DIR&#41;/, $&#40;S_SRC&#58;.s=.o&#41;&#41;

# Include directories
EE_INCS &#58;= -I$&#40;PS2SDK&#41;/ee/include -I$&#40;PS2SDK&#41;/common/include -I. $&#40;EE_INCS&#41;

# C compiler flags
EE_CFLAGS &#58;= -D_EE -O2 -G0 -Wall $&#40;EE_CFLAGS&#41;

# C++ compiler flags
EE_CXXFLAGS &#58;= -D_EE -O2 -G0 -Wall $&#40;EE_CXXFLAGS&#41;

# Linker flags


# Assembler flags
EE_ASFLAGS &#58;= -G0 $&#40;EE_ASFLAGS&#41;

# Link with following libraries.  This is a special case, and instead of
# allowing the user to override the library order, we always make sure
# libkernel is the last library to be linked.


# Externally defined variables&#58; EE_BIN, EE_OBJS, EE_LIB

# These macros can be used to simplify certain build rules.
EE_C_COMPILE = $&#40;EE_CC&#41; $&#40;EE_CFLAGS&#41; $&#40;EE_INCS&#41;
EE_CXX_COMPILE = $&#40;EE_CXX&#41; $&#40;EE_CXXFLAGS&#41; $&#40;EE_INCS&#41;

%.o &#58; %.c
	$&#40;EE_CC&#41; $&#40;EE_CFLAGS&#41; $&#40;EE_INCS&#41; -c $< -o $@

%.o &#58; %.cc
	$&#40;EE_CXX&#41; $&#40;EE_CXXFLAGS&#41; $&#40;EE_INCS&#41; -c $< -o $@

%.o &#58; %.cpp
	$&#40;EE_CXX&#41; $&#40;EE_CXXFLAGS&#41; $&#40;EE_INCS&#41; -c $< -o $@

%.o &#58; %.S
	$&#40;EE_CC&#41; $&#40;EE_CFLAGS&#41; $&#40;EE_INCS&#41; -c $< -o $@

%.o &#58; %.s
	$&#40;EE_AS&#41; $&#40;EE_ASFLAGS&#41; $< -o $@

$&#40;EE_BIN&#41; &#58; $&#40;C_OBJ&#41; $&#40;S_OBJ&#41; $&#40;PS2SDK&#41;/ee/startup/crt0.o
	$&#40;EE_CC&#41; -mno-crt0 -T$&#40;PS2SDK&#41;/ee/startup/linkfile $&#40;EE_LDFLAGS&#41; \
		-o $&#40;EE_BIN&#41; $&#40;PS2SDK&#41;/ee/startup/crt0.o $&#40;C_OBJ&#41; $&#40;S_OBJ&#41; $&#40;EE_LIBS&#41;

$&#40;EE_ERL&#41; &#58; $&#40;EE_OBJS&#41;
	$&#40;EE_CC&#41; -mno-crt0 -o $&#40;EE_ERL&#41; $&#40;EE_OBJS&#41; $&#40;EE_CFLAGS&#41; $&#40;EE_LDFLAGS&#41; -Wl,-r
	$&#40;EE_STRIP&#41; --strip-unneeded -R .mdebug.eabi64 -R .reginfo -R .comment $&#40;EE_ERL&#41;

$&#40;EE_LIB&#41; &#58; $&#40;EE_OBJS&#41;
	$&#40;EE_AR&#41; cru $&#40;EE_LIB&#41; $&#40;EE_OBJS&#41;

Any ideas why this is failing? I don't know what else to try.

I live for the day someone releases a VC like ide for ps2 dev, that generates the makefile for you. :)
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

Well I've managed to get the new makefile compiling and linking just fine. But as before the final elf refuses to run on the ps2.

Code: Select all

# _____     ___ ____     ___ ____
#  ____|   |    ____|   |        | |____|
# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http&#58;//www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
# $Id&#58; Makefile.eeglobal_sample 1150 2005-06-12 11&#58;42&#58;08Z pixel $
CC=ee-gcc


OBJ_DIR = obj 
BMP_DIR = resources 
EE_INCS += -I$&#40;PS2SDK&#41;/ee/include -I$&#40;PS2SDK&#41;/ee/dma/include -I$&#40;GCCLIB&#41;/include -I$&#40;PS2GDB&#41;/ee 
EE_LIBS += -lc -lstdc++ -lgcc -lm  -lsyscall 
EE_LDFLAGS &#58;= -L$&#40;PS2SDK&#41;/ee/lib $&#40;EE_LDFLAGS&#41; 

EE_LIBS += -lc -lkernel -lc -lc -lc

C_SRC = demo2a.cc 
S_SRC =  ps2_asm.s dma_asm.s gs_asm.s 

C_OBJ = g2.o demo2a.o 
S_OBJ = ps2_asm.o dma_asm.o gs_asm.o

# Include directories
EE_INCS &#58;= -I$&#40;PS2SDK&#41;/ee/include -I$&#40;PS2SDK&#41;/common/include -I. $&#40;EE_INCS&#41;

# C compiler flags
EE_CFLAGS &#58;= -D_EE -O2 -G0 -Wall $&#40;EE_CFLAGS&#41;

# C++ compiler flags
EE_CXXFLAGS &#58;= -Wall -W -EL -G0 -O0   -DPS2_EE

# Linker flags


# Assembler flags
EE_ASFLAGS &#58;= -G0 $&#40;EE_ASFLAGS&#41;

# Link with following libraries.  This is a special case, and instead of
# allowing the user to override the library order, we always make sure
# libkernel is the last library to be linked.


# Externally defined variables&#58; EE_BIN, EE_OBJS, EE_LIB

# These macros can be used to simplify certain build rules.
EE_C_COMPILE = $&#40;EE_CC&#41; $&#40;EE_CFLAGS&#41; $&#40;EE_INCS&#41;
EE_CXX_COMPILE = $&#40;EE_CXX&#41; $&#40;EE_CXXFLAGS&#41; $&#40;EE_INCS&#41;

%.o &#58; %.c
	$&#40;CC&#41; $&#40;EE_CFLAGS&#41; $&#40;EE_INCS&#41; -c $< -o $@

%.o &#58; %.cc
	$&#40;EE_CXX&#41; $&#40;EE_CXXFLAGS&#41; $&#40;EE_INCS&#41; -c $< -o $@

CFLAGS = -Wall -W -EL -G0 -O0 -mips3 -nostdlib -DPS2_EE

%.o &#58; %.s
	$&#40;CC&#41; -xassembler-with-cpp -c $&#40;CFLAGS&#41; $< -o $@

$&#40;EE_BIN&#41; &#58; $&#40;C_OBJ&#41; $&#40;S_OBJ&#41;
	$&#40;EE_CC&#41; $&#40;CFLAGS&#41; -mno-crt0 -Tlinkfile $&#40;EE_LDFLAGS&#41; \
		-o $&#40;EE_BIN&#41; $&#40;PS2SDK&#41;/ee/startup/crt0.o $&#40;C_OBJ&#41; $&#40;S_OBJ&#41; $&#40;EE_LIBS&#41;

$&#40;EE_LIB&#41; &#58; $&#40;EE_OBJS&#41;
	$&#40;EE_AR&#41; cru $&#40;EE_LIB&#41; $&#40;EE_OBJS&#41;

Last edited by Kojima on Tue Jul 04, 2006 12:57 am, edited 1 time in total.
User avatar
evilo
Posts: 230
Joined: Thu Apr 22, 2004 8:40 pm
Contact:

Post by evilo »

Seems that uint64 is not recognized..

be sure that g2.c include tamtypes.h
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

I fixed that problem, please check my edited post above, i got the makefile working(The new one) but the resulting elf fails to run still.

Makes. No. Sense.

edit- changed -Tlinkfile to -T$(PS2SDK)/ee/startup/linkfile and now it runs, but immediately after running it throws a EE exception "TLB store exception"

So it appears to be the linkfile is what's causing problems.
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

FIXED! Thanks for all your help e.

turns out the exception was an unrelated mistake in my code, so the linkfile change did fix it afterall. So anyone who uses the tutorials as a base like i have, be sure to change linkfiles if you switch to C++.

Anyway expect LikeAllegro very soon, a old skool 2d library with per pixel fx like lighting etc :)
User avatar
evilo
Posts: 230
Joined: Thu Apr 22, 2004 8:40 pm
Contact:

Post by evilo »

Good that you fixed your issue !

concerning LikeAllegro, does it have something to do with Allegro ??

I hope you'll use gsKit as a base instead of the libdream tutorial .... libdream is great to see how the GS is working, but just lacks good performances :)
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

Yeah, kind of like Allegro, Bitmaps etc, but won't be as fleshed out or based on allegro's code.

I will probably use gsKit for my second lib, I'm still learning so I think I'll use the tutorials mini-lib for now.
Post Reply