SoulFu Forums II
Would you like to react to this message? Create an account in a few clicks or log in to continue.

linux makefiles and such (also discussion on a build system)

4 posters

Go down

linux makefiles and such (also discussion on a build system) Empty linux makefiles and such (also discussion on a build system)

Post  timonator Mon Jul 26, 2010 6:33 pm

Someone made this Makefile some time ago, which works quite well
Code:



# Makefile to build SoulFu on *nix systems.
# Hacked for distribution pending a soulfu-compiler fix.
#
# XXX: This is currently somewhat mangled, to match the SoulFu
#      build system; Because of the bloat of the tools, we don't
#      install them alongside the game.

CC=gcc
BIN=soulfu
SDF=../../sdf/datafile.sdf
CFLAGS=`sdl-config --cflags` -m32
LIBDIRS=
LIBS=`sdl-config --libs` -lSDL_net -lGL -ljpeg -lvorbis -lm
SOURCES=soulfu.c
OBJECTS=$(SOURCES:.c=.o)
INSTALL=install
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
DATADIR=$(PREFIX)/share/soulfu
DEFINES=-DDATADIR='"$(DATADIR)"'
.PHONY=clean install dist

all: $(BIN) $(SDF)

install: $(BIN) $(SDF)
   $(INSTALL) -d $(BINDIR)
   $(INSTALL) $(BIN) $(BINDIR)/$(BIN)
   $(INSTALL) -d $(DATADIR)
   $(INSTALL) $(SDF) $(DATADIR)/datafile.sdf

clean:
   rm $(OBJECTS) $(BIN)

$(BIN): $(OBJECTS)
   $(CC) $^ -o $@ $(LIBS)

%.o: ../../source/%.c
   $(CC) $(CFLAGS) -c $< -o $@ $(DEFINES)

this works pretty good.
put a folder "build" next to the "source" folder and inside that you put a "unix" folder. put the makefile there and run make and - quite magically - a binary will pop up. if you get the sdf file, too, it will run just fine - at least with the code i have here Wink


build system

it would be really great, if we could get a common build system for windows, linux and mac up. i heard good things about cmake, does anyone else have any experience at all? i have almost none Smile (cmake would be especially neat because it can create microsoft visual studio build system whatevers (or so i hear))

timonator

Posts : 6
Join date : 2010-07-25

Back to top Go down

linux makefiles and such (also discussion on a build system) Empty Re: linux makefiles and such (also discussion on a build system)

Post  Aelesis Tue Jul 27, 2010 5:58 am

Aha, thanks for adding that.
Of course, the old Linux and Mac links were in old forum threads, so we can't snag them anymore, which is inconvenient.
Aelesis
Aelesis
Admin

Posts : 27
Join date : 2010-07-25
Age : 26
Location : Victoria, Australia

http://effit.deviantart.com

Back to top Go down

linux makefiles and such (also discussion on a build system) Empty Re: linux makefiles and such (also discussion on a build system)

Post  shogun1234 Sat Aug 07, 2010 9:13 am

After putting Makefile inside the build/unix folder, doing `make` or `make all` shows
Code:

make: *** No rule to make target `soulfu.o', needed by `soulfu'.  Stop

Looks like the object doesn't get built. What step I may miss so that I can build bin successfully?

Thanks

shogun1234

Posts : 2
Join date : 2010-08-07

Back to top Go down

linux makefiles and such (also discussion on a build system) Empty Re: linux makefiles and such (also discussion on a build system)

Post  timonator Sat Aug 07, 2010 5:20 pm

it's likely that you put the makefile in the wrong folder. that's no problem, though. the folder structure must look like this in order for this makefile to work

+ someplace
+ + sources
+ + + soulfu.c
+ + sdf
+ + + datafile.sdf
+ + build
+ + + unix
+ + + + Makefile

then it oughta work.
If it still won't work, try fiddling with the paths in the Makefile (especially "../../sources" and such). I'm not a proficient Makefilemaker myself, so that's all I know Sad

timonator

Posts : 6
Join date : 2010-07-25

Back to top Go down

linux makefiles and such (also discussion on a build system) Empty Re: linux makefiles and such (also discussion on a build system)

Post  shogun1234 Mon Aug 09, 2010 10:55 am

I notice that only

./Branches/Coz/rev4/sdf/datafile.sdf
./Branches/Coz/Trunk/sdf/datafile.sdf

contain datafile.sdf (searched by command `find . -name datafile.sdf`)

There is no datafile.sdf existing within Trunk, Tags folders.

In addition, whilst building using Makefile resided under Branches/Coz/Trunk

it throws message

Code:

../../sourcecode/gameseed.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘game_seed’
../../sourcecode/gameseed.c: In function ‘generate_game_seed’:
../../sourcecode/gameseed.c:8: error: ‘game_seed’ undeclared (first use in this function)
../../sourcecode/gameseed.c:8: error: (Each undeclared identifier is reported only once
../../sourcecode/gameseed.c:8: error: for each function it appears in.)
make: *** [gameseed.o] Error 1


Is Branches/Coz/Trunk the right place to build the project? Or what (step) I may miss? The revision no. is 141

Thanks.

shogun1234

Posts : 2
Join date : 2010-08-07

Back to top Go down

linux makefiles and such (also discussion on a build system) Empty Re: linux makefiles and such (also discussion on a build system)

Post  donky Tue Aug 17, 2010 1:19 pm

No, the goal is not to find a SVN branch that has an SDF file and then try to compile it Very Happy It is to find a working version of the source code, and to use the Makefile with it. And to grab the SDF file from somewhere else. Perhaps the source code that comes with the Windows binary installer, and the SDF file that comes with it as well.

Unfortunately, timonator has not specified exactly which source code. Your best bet is to look at forum threads for references to other sources of the source code. There aren't that many here.

donky

Posts : 9
Join date : 2010-08-05

Back to top Go down

linux makefiles and such (also discussion on a build system) Empty Re: linux makefiles and such (also discussion on a build system)

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum