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

View previous topic View next topic Go down

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

Post  timonator on Mon Jul 26, 2010 5: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

View user profile

Back to top Go down

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

Post  Aelesis on Tue Jul 27, 2010 12:58 pm

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
Admin

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

View user profile http://effit.deviantart.com

Back to top Go down

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

Post  shogun1234 on Sat Aug 07, 2010 4:13 pm

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

View user profile

Back to top Go down

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

Post  timonator on Sun Aug 08, 2010 12:20 am

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

View user profile

Back to top Go down

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

Post  shogun1234 on Mon Aug 09, 2010 5:55 pm

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

View user profile

Back to top Go down

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

Post  donky on Tue Aug 17, 2010 8: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

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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