A Fresh New Toolchain+libs - Compiled On Demand!


err.. are you SURE you really need all of those libs? thats a lot of libs.. esepcially static...
 
YakumoFuji posted on Oct 6 2006 at 12:25 PM said:
err.. are you SURE you really need all of those libs? thats a lot of libs.. esepcially static...

Not in that program. Static linking does not glue a library onto an executable just because you show it to the linker. Only adds to it if an object file references a symbol in a library, and only then. I'll cut out half of that and illustrate. The only thing it would do is slow your link time with isn't real noticable on this 4600+ x2. First I'll take last nights build and name it with a dot all extension and check the size. then make clean and make again with the bobbed makefile below and then list them for size and we'll see the effect. Does seem huge, dynamic version was only 170k, but that's static for you.

#
# $Id: Makefile,v 0.1 2006/10/09 16:35:00 Linus Sphinx $
#

VER = 0.1
PROG = frogs.gpe
PREFIX = tmp
CFLAGS += -g -O2 -Wall -Werror $(shell ../bin/sdl-config --cflags)
LDFLAGS = -static \
-lSDLmain \
-lSDL_mixer \
-lSDL_svg \
-lSDL_ttf \
-lSDL_image \
-lmikmod \
-lreadline \
-lsmpeg \
-logg \
-lvorbis \
-lvorbisidec \
-lvorbisenc \
-lvorbisfile \
-lxml2 \
$(shell ../bin/sdl-config --libs) \
-lz

OBJET = chardisp.o frogs.o helm.o player.o racket.o room.o sprite.o tank.o util.o magi.o ceo.o
CCODE = $(shell ls *.c)
HEAD = $(shell ls *.h)

all: $(PROG)

$(PROG): $(OBJET)
../bin/gp2x-g++ -o $@ $^ $(LDFLAGS)
../bin/gp2x-strip $@

%.o: %.c $(HEAD)
../bin/gp2x-gcc $(CFLAGS) -c -o $@ $<

clean:
rm -f *.o *~ $(PROG)

cleanzip: cleantmp
rm -f $(shell basename $(PROG) .gpe)-$(VER).zip

cleantmp:
rm -rf tmp

zip: all cleanzip cleantmp
mkdir -p $(PREFIX)/$(shell basename $(PROG) .gpe)/wav
mkdir -p $(PREFIX)/$(shell basename $(PROG) .gpe)/bmp
mkdir -p $(PREFIX)/$(shell basename $(PROG) .gpe)/doc
rm -rf bmp/.xvpics
cp -a bmp/*.bmp $(PREFIX)/$(shell basename $(PROG) .gpe)/bmp
cp -a bmp/*.ico $(PREFIX)/$(shell basename $(PROG) .gpe)/bmp
cp -a bmp/*.elf $(PREFIX)/$(shell basename $(PROG) .gpe)/bmp
cp -a wav/*.wav $(PREFIX)/$(shell basename $(PROG) .gpe)/wav
cp -a wav/*.elf $(PREFIX)/$(shell basename $(PROG) .gpe)/wav
cp -a doc $(PREFIX)/$(shell basename $(PROG) .gpe)
cp -a $(PROG) $(PREFIX)/$(shell basename $(PROG) .gpe)
mkdir -p $(PREFIX)/$(shell basename $(PROG) .gpe)/src
cp -a $(CCODE) $(HEAD) Makefile $(PREFIX)/$(shell basename $(PROG) .gpe)/src
cd $(PREFIX); zip -r ../$(shell basename $(PROG) .gpe)-$(VER).zip $(shell basename $(PROG) .gpe)

linus@beavis /usr/local/gp2xdev/frogs $ ls -l frogs.gpe*
-rwxr-xr-x 1 linus users 1470848 Oct 5 18:18 frogs.gpe.all
linus@beavis /usr/local/gp2xdev/frogs $
linus@beavis /usr/local/gp2xdev/frogs $ make clean
rm -f *.o *~ frogs.gpe
linus@beavis /usr/local/gp2xdev/frogs $ make
../bin/gp2x-gcc -g -O2 -Wall -Werror -I/usr/local/gp2xdev/include/SDL -D_REENTRANT -c -o chardisp.o chardisp.c
../bin/gp2x-gcc -g -O2 -Wall -Werror -I/usr/local/gp2xdev/include/SDL -D_REENTRANT -c -o frogs.o frogs.c
../bin/gp2x-gcc -g -O2 -Wall -Werror -I/usr/local/gp2xdev/include/SDL -D_REENTRANT -c -o helm.o helm.c
../bin/gp2x-gcc -g -O2 -Wall -Werror -I/usr/local/gp2xdev/include/SDL -D_REENTRANT -c -o player.o player.c
../bin/gp2x-gcc -g -O2 -Wall -Werror -I/usr/local/gp2xdev/include/SDL -D_REENTRANT -c -o racket.o racket.c
../bin/gp2x-gcc -g -O2 -Wall -Werror -I/usr/local/gp2xdev/include/SDL -D_REENTRANT -c -o room.o room.c
../bin/gp2x-gcc -g -O2 -Wall -Werror -I/usr/local/gp2xdev/include/SDL -D_REENTRANT -c -o sprite.o sprite.c
../bin/gp2x-gcc -g -O2 -Wall -Werror -I/usr/local/gp2xdev/include/SDL -D_REENTRANT -c -o tank.o tank.c
../bin/gp2x-gcc -g -O2 -Wall -Werror -I/usr/local/gp2xdev/include/SDL -D_REENTRANT -c -o util.o util.c
../bin/gp2x-gcc -g -O2 -Wall -Werror -I/usr/local/gp2xdev/include/SDL -D_REENTRANT -c -o magi.o magi.c
../bin/gp2x-gcc -g -O2 -Wall -Werror -I/usr/local/gp2xdev/include/SDL -D_REENTRANT -c -o ceo.o ceo.c
../bin/gp2x-g++ -o frogs.gpe chardisp.o frogs.o helm.o player.o racket.o room.o sprite.o tank.o util.o magi.o ceo.o -static -lSDLmain -lSDL_mixer -lSDL_svg -lSDL_ttf -lSDL_image -lmikmod -lreadline -lsmpeg -logg -lvorbis -lvorbisidec -lvorbisenc -lvorbisfile -lxml2 -L/usr/local/gp2xdev/lib -Wl,-rpath,/usr/local/gp2xdev/lib -lSDL -lpthread -lz
../bin/gp2x-strip frogs.gpe
linus@beavis /usr/local/gp2xdev/frogs $ ls -l frogs.gpe*
-rwxr-xr-x 1 linus users 1470848 Oct 6 17:32 frogs.gpe
-rwxr-xr-x 1 linus users 1470848 Oct 5 18:18 frogs.gpe.all
linus@beavis /usr/local/gp2xdev/frogs $
 
Last edited by a moderator:
i was more looking at linking in sdl and ncurses since it seems disharmonious to have both but I guess it doesnt hurt.
 
YakumoFuji posted on Oct 7 2006 at 11:25 PM said:
i was more looking at linking in sdl and ncurses since it seems disharmonious to have both but I guess it doesnt hurt.

That does seem wrong. I saw imlib2 built, have you checked all the other graphic libs for the functionality you need? Toughest part of a video game has always been the text, menus, lists, high score, config windows etc, well after the idea anyway.
 
Last edited by a moderator:
no, your example has ncurses + sdl linking in, which was what I was looking at that looked wrong. I dont know what imlimb2 is so I doubt I need it :)
 
Is this dead? I cant access the website.

Any better toolchain to be using?
 
Back
Top