My Makefile for SBL

mrkotfw

Mid Boss
hi, its me again... well i tried to make my own kind of makefile because it seems as tough the makefile doesnt seem to work with SBL\SGL

Code:
#

#  SEGA SATURN Graphic library make file for GNU

# macro

CC = gcc

LD = ld

RM = deltree

CONV = objcopy

# directory

SGLIDR = ../saturn/include

SGLLDR = ../saturn/lib

GCC   = $(CC)

SEGASMP = ../saturn/lib

SEGALIB = ../saturn/lib

CMNDIR = ./

OBJECTS = ./objects

LIBS	=	../saturn/lib/sega_sgl.a\

 	../saturn/lib/sega_per.a\

 	../saturn/lib/sega_gfs.a\

 	../saturn/lib/sega_snd.a\

 	../saturn/lib/sega_dbg.a\

 	../saturn/lib/sega_scl.a\

 	../saturn/lib/sega_spr.a\

 	../saturn/lib/sega_mth.a\

 	../saturn/lib/sega_int.a\

 	../saturn/lib/sega_cdc.a\

 	../saturn/lib/sega_dma.a\

 	../saturn/lib/sega_csh.a\

 	../saturn/lib/sega_adp.a

# option

CCFLAGS = -O2 -m2 -g -c -Wall -I$(SGLIDR) -I$(SEGALIB) -I$(SEGALIB) \

	-L$(SGLIDR) -L$(SEGALIB) -L$(SEGALIB)

LDFLAGS = -m2 -I$(SGLIDR) -I$(SEGALIB) -I$(SEGALIB) -L$(SGLIDR) -L$(SEGALIB) -L$(SEGALIB) -Xlinker -T$(LDFILE) -Xlinker -Map \

     -Xlinker $(MPFILE) -Xlinker -e -Xlinker ___Start -nostartfiles

DFLAGS =

# source_program

include $(OBJECTS)

TARGET  = sl.coff

TARGET1 = sl.bin

LDFILE = $(CMNDIR)/$(TARGET:.coff=.lnk)

MPFILE  = $(TARGET:.coff=.map)

MAKEFILE = Makefile

all: $(TARGET) $(TARGET1)

# Use gcc to link so it will automagically find correct libs directory

$(TARGET) : $(SYSOBJS) $(OBJS) $(MAKEFILE) $(OBJECTS) $(LDFILE)

	$(CC) $(LDFLAGS) $(SYSOBJS) $(OBJS) $(LIBS) -o $@

$(TARGET1) : $(SYSOBJS) $(OBJS) $(MAKEFILE) $(LDFILE)

	$(CONV) -O binary $(TARGET) $(TARGET1)

.SUFFIXES: .asm

.c.o:

	$(CC) $< $(DFLAGS) $(CCFLAGS) -o $@

clean:

	$(RM) $(OBJS) $(TARGET:.coff=.*)

this is the error:

Code:
C:\SS\EP>make

gcc -m2 -I../saturn/include -I../saturn/lib -I../saturn/lib -L../saturn/include

-L../saturn/lib -L../saturn/lib -Xlinker -T.//sl.lnk -Xlinker -Map -Xlinker sl.m

ap -Xlinker -e -Xlinker ___Start -nostartfiles .//cinit.o ../saturn/lib/sglarea.

o main.o -lsgl -o sl.coff

main.o: In function `Ep_Main':

main.c:11: undefined reference to `DBG_SetCursol'

main.c(.text+0x48): undefined reference to `DBG_Printf'

make.exe: *** [sl.coff] Error 1

i included i guess the right libraries.... but i still get no luck,

so then i decided to try to compile a already built make file in C:\SS\SATURN\SBL\SEGASMP\SGL\S_2_2

and it just told me:

Code:
C:\SS\SATURN\SBL\SEGASMP\SGL\S_2_2>make

gcc -T ../../../segasmp/lib/saturn.lnk -e START -nostartfiles -o main.cof -Xlin

ker -Map -Xlinker main.map ../../../segasmp/lib/strt1_g.o ../../../segasmp/lib/s

trt2_g.o ../../../segasmp/per/smpclib/per_x1.o ../../../segasmp/per/smpclib/per_

x2.o ../../../segasmp/per/smpclib/per_x3.o ../../../segasmp/v_blank/v_blank2.o .

./../../segasmp/v_blank/set_vb.o polygon.o main.o ../../../segalib/lib/sega_sgl.

a ../../../segalib/lib/sega_per.a ../../../segalib/lib/sega_sat.a ../../../segal

ib/lib/sega_scl.a ../../../segalib/lib/sega_cdc.a ../../../segalib/lib/sega_adp.

a

gcc.exe: ../../../segalib/lib/sega_per.a: file not found

gcc.exe: ../../../segalib/lib/sega_sat.a: file not found

gcc.exe: ../../../segalib/lib/sega_scl.a: file not found

gcc.exe: ../../../segalib/lib/sega_cdc.a: file not found

gcc.exe: ../../../segalib/lib/sega_adp.a: file not found

make.exe: *** [main.cof] Error 1

if you guys can tell me where i should put my dirs, and what kind of makefile i can use so i can try to use SGL and SBL commands... thanks
hehehe.gif
wink.gif
 

vbt

Staff member
You should put full hardcoded path to see the difference :

/saturn/SBL6/SEGALIB/LIB/sega_per.a

etc ...
 

mrkotfw

Mid Boss
I would have to say high-level because VBT'S bootloader is made up of SBL code... BTW, here's my MAKEFILE it still doesnt work :/

Code:
#

# Sega Saturn Makefile Made by El Piratero

#

CC = gcc

LD = ld

RM = deltree

CONV = objcopy

# SGL Directories

SGLDIR = ../saturn/sgl

SGLIDR = $(SGLDIR)/inc

SGLLDR = $(SGLDIR)/lib

# SBL Directories

SBLDIR = ../saturn

GCC  = $(SATURN)/gccsh

SBLIDR = $(SATURN)/lib

SBLLDR = $(SATURN)/include

CMNDIR = ./

OBJECTS = ./objects

# SBL & SGL Libs

.LIB_WILDCARD:

.LIB_WILDCARD: *.a

._0__WILDCARD:

._0__WILDCARD: *.o

LIBS = ../saturn/lib/$(LIB_WILDCARD)

_0  = ../saturn/lib/$(_0__WILDCARD)

# Targets

TARGET  = sl.coff

TARGET1 = sl.bin

LDFILE  = $(CMNDIR)/$(TARGET:.coff=.lnk)

MPFILE  = $(TARGET:.coff=.map)

MAKEFILE = Makefile

all: $(TARGET) $(TARGET1)

$(TARGET) : $(SYSOBJS) $(OBJS_) $(MAKEFILE) $(OBJECTS) $(LDFILE)

	$(CC) $(LDFLAGS) $(SYSOBJS) $(OBJS_) $(LIBS_) -o $@

$(TARGET1) : $(SYSOBJS) $(OBJS_) $(MAKEFILE) $(LDFILE)

	$(CONV) -O binary $(TARGET) $(TARGET1)

my objects:

Code:
SRCS  = main.c

SYSOBJS = $(CMNDIR)/sinit.o ../saturn/lib/$(_0)

OBJS_  = $(SRCS:.c=.o)

LIBS_  = ../saturn/lib/$(LIBS) -lcd -lsgl -lsbl

well, i compiled... but the SL.BIN is 0bytes ... lol forgot to include $(OBJECTS)

ok, now i tried to compile

Code:
C:\SS\EP>make

gcc -m2 -L../saturn/sgl/lib -L/lib -Xlinker -T.//Ep_Comp.sat -Xlinker -Map -Xlin

ker Ep_Comp.map -Xlinker -e -Xlinker ___Start -nostartfiles .//sinit.o ../saturn

/lib/ main.o ../saturn/lib/ -lcd -lsgl -lsbl -o Ep_Comp.coff

c:/ss/saturn/bin/ld.exe: cannot open ../saturn/lib/: No such file or directory

make.exe: *** [Ep_Comp.coff] Error 1

C:\SS\EP>

so maybe i will try /saturn instead of ../saturn
 

mrkotfw

Mid Boss
blink.gif
This is wierd, Now I get errors:

Code:
C:\SS\EP>make

gcc -m2 -L../saturn/sgl/lib -L/lib -Xlinker -T.//Ep_Comp.sat -Xlinker -Map -Xlin

ker Ep_Comp.map -Xlinker -e -Xlinker ___Start -nostartfiles .//sinit.o ../saturn

/lib/sglarea.o main.o -lcd -lsgl -o Ep_Comp.coff

main.o(.text+0x4c):main.c: undefined reference to `DBG_SetCursol'

main.o(.text+0x54):main.c: undefined reference to `DBG_Printf'

make.exe: *** [Ep_Comp.coff] Error 1

C:\SS\EP>

Code:
#include <sgl.h>

#include	"sega_scl.h"

#include	"sega_dbg.h"

int Ep_Main(void){

	slInitSystem(TV_320x224,NULL,1);

 	DBG_SetCursol( 10, 22 );

 	DBG_Printf("PRESS START BUTTON");

}

Code:
SRCS  = main.c

SYSOBJS = $(CMNDIR)/sinit.o ../saturn/lib/sglarea.o

OBJS_  = $(SRCS:.c=.o)

LIBS_  = -lcd -lsgl

I dont know why it does this, why...?
 

mrkotfw

Mid Boss
Code:
#

# Sega Saturn Makefile Made by El Piratero

#

# 1. In Order To Compile Succesfully you Must State main() as Ep_Main()

CC = gcc

LD = ld

RM = deltree /Y

CONV = objcopy

# SGL Directories

SGLDIR = ../saturn/sgl

SGLIDR = $(SGLDIR)/inc

SGLLDR = $(SGLDIR)/lib

# SBL Directories

SEGALIB = ../saturn

SBLDIR = ../saturn

GCC   = $(SATURN)/gccsh

SBLIDR = $(SATURN)/include

SBLLDR = $(SATURN)/lib

CMNDIR = ./

OBJECTS = ./objects

# SBL & SGL Libs

LIBS_ = $(SEGALIB)/lib/sega_sgl.a\

    $(SEGALIB)/lib/sega_per.a\

    $(SEGALIB)/lib/sega_gfs.a\

    $(SEGALIB)/lib/sega_snd.a\

    $(SEGALIB)/lib/sega_dbg.a\

    $(SEGALIB)/lib/sega_scl.a\

    $(SEGALIB)/lib/sega_spr.a\

    $(SEGALIB)/lib/sega_mth.a\

    $(SEGALIB)/lib/sega_int.a\

    $(SEGALIB)/lib/sega_cdc.a\

    $(SEGALIB)/lib/sega_dma.a\

    $(SEGALIB)/lib/sega_csh.a\

    $(SEGALIB)/lib/sega_adp.a

# Include Objects File

include $(OBJECTS)

# LD Options

CCFLAGS = -O2 -m2 -g -c -DMODEL_S -I$(SGLIDR) -I$(SBLIDR)

LDFLAGS = -m2 -L$(SGLLDR) -L$(SBLLDR) -Xlinker -T$(LDFILE) -Xlinker -Map \

     -Xlinker $(MPFILE) -Xlinker -e -Xlinker ___Start -nostartfiles

DFLAGS =

LIBS_  = -lcd -lsgl -lgfs -ldbg -lscl -lmth -lm

CFLAGS = -I../saturn/sbl/segasmp/per/smpclib

SRCS  = main.c

SYSOBJS = $(CMNDIR)/sinit.o ../saturn/lib/sglarea.o

OBJS_  = ../saturn/sbl/segasmp/lib/strt1_g.o\

     ../saturn/sbl/segasmp/lib/strt2_g.o\

# Targets

TARGET  = Ep_Comp.coff

TARGET1 = Ep_Comp.bin

LDFILE  = $(CMNDIR)/$(TARGET:.coff=.sat)

MPFILE  = $(TARGET:.coff=.map)

MAKEFILE = Makefile

all: $(TARGET) $(TARGET1)

$(TARGET) : $(SYSOBJS) $(OBJS_) $(MAKEFILE) $(OBJECTS) $(LDFILE)

	$(CC) $(LDFLAGS) $(SYSOBJS) $(OBJS_) $(LIBS_) -o $@

$(TARGET1) : $(SYSOBJS) $(OBJS_) $(MAKEFILE) $(LDFILE)

	$(CONV) -O binary $(TARGET) $(TARGET1)

%.o: %.c

	$(CC) -c $(CCFLAGS) $(CFLAGS) -o $@ $<

clean:

	$(RM) $(OBJS) $(TARGET:.coff=.*)

more problems:

Code:
C:\SS\EP>make

gcc -m2 -L../saturn/sgl/lib -L/lib -Xlinker -T.//Ep_Comp.sat -Xlinker -Map -Xlin

ker Ep_Comp.map -Xlinker -e -Xlinker ___Start -nostartfiles .//sinit.o ../saturn

/lib/sglarea.o ../saturn/sbl/segasmp/lib/strt1_g.o ../saturn/sbl/segasmp/lib/str

t2_g.o -lcd -lsgl -lgfs -ldbg -lscl -lmth -lm -o Ep_Comp.coff

.//sinit.o: In function `main':

cinit.c:35: undefined reference to `Ep_Main'

../saturn/sbl/segasmp/lib/strt1_g.o(.text+0x20):fake: undefined reference to `ST

ARTOF_R'

../saturn/sbl/segasmp/lib/strt1_g.o(.text+0x24):fake: undefined reference to `EN

DOF_R'

../saturn/sbl/segasmp/lib/strt1_g.o(.text+0x28):fake: undefined reference to `ST

ARTOF_B'

../saturn/sbl/segasmp/lib/strt1_g.o(.text+0x2c):fake: undefined reference to `EN

DOF_B'

make.exe: *** [Ep_Comp.coff] Error 1

C:\SS\EP>

angry.gif
very fustrating <_<
 

vbt

Staff member
Sorry, I'm dead those days, the weather is too hot and I'm not aable to think
sad.gif
 
Top