# Linux makefiles help

**URL:** <https://discourse.libsdl.org/t/linux-makefiles-help/2079>\
**Category:** SDL Development\
**Created:** [March 22, 2000, 12:13pm UTC](https://discourse.libsdl.org/t/linux-makefiles-help/2079 "2000-03-22T12:13:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexei\_M\_Nikitin](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/a/b5e925/32.png) [@Alexei\_M\_Nikitin](https://discourse.libsdl.org/u/Alexei_M_Nikitin)\
**Post date:** [March 22, 2000, 12:13pm UTC](https://discourse.libsdl.org/t/linux-makefiles-help/2079/1 "2000-03-22T12:13:34Z")

</div>

Hello.

I am newcomer in Unix. I try to use SDL under Debian Linux.  
Library have been compiled without any problem.  
But config. file for examples does not work.  
Could you give me some simple makefile for examples  
compilation?

Best wishes.  
Alexei Nikitin.

---

<div class="post-metadata">

**Author:** ![Sylvain\_Hellegouarch](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ecae2f/32.png) [@Sylvain\_Hellegouarch](https://discourse.libsdl.org/u/Sylvain_Hellegouarch)\
**Post date:** [March 22, 2000, 3:19pm UTC](https://discourse.libsdl.org/t/linux-makefiles-help/2079/2 "2000-03-22T15:19:55Z")

</div>

Alexey M. Nikitin wrote:

> Hello.
> 
> I am newcomer in Unix. I try to use SDL under Debian Linux.  
> Library have been compiled without any problem.  
> But config. file for examples does not work.  
> Could you give me some simple makefile for examples  
> compilation?
> 
> Best wishes.  
> Alexei Nikitin.

You can download some examples of SDL program on the SDL page, so you  
will get some Makefile too !

Sylvain  
lawouach at [caramail.com](http://caramail.com)

---

<div class="post-metadata">

**Author:** ![Robert\_Linden](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/r/48db29/32.png) [@Robert\_Linden](https://discourse.libsdl.org/u/Robert_Linden)\
**Post date:** [March 22, 2000, 2:48pm UTC](https://discourse.libsdl.org/t/linux-makefiles-help/2079/3 "2000-03-22T14:48:31Z")

</div>

Here’s a (not “the” 😉 makefile which compiles two of the test-programs  
when called as “make all”:

--------  
CC = gcc  
CFLAGS = -O2 -Wall $(shell sdl-config --cflags)  
LIBS = $(shell sdl-config --libs) -lm

testalpha: testalpha.c  
${CC} ${CFLAGS} -o testalpha testalpha.c ${LIBS}  
testsprite: testsprite.c  
${CC} ${CFLAGS} -o testsprite testsprite.c ${LIBS}

all: testalpha testsprite  
----—

Other programs can be added the same way.

All the best,  
robOn Wed, Mar 22, 2000 at 03:13:34PM +0000, Alexey M. Nikitin wrote:

> Hello.
> 
> I am newcomer in Unix. I try to use SDL under Debian Linux.  
> Library have been compiled without any problem.  
> But config. file for examples does not work.  
> Could you give me some simple makefile for examples  
> compilation?

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [March 22, 2000, 3:43pm UTC](https://discourse.libsdl.org/t/linux-makefiles-help/2079/4 "2000-03-22T15:43:23Z")

</div>

Here’s an alternative version:

CFLAGS := -O2 -Wall $(shell sdl-config --cflags)  
LIBS := $(shell sdl-config --libs) -lm

all: testalpha testsprite

testalpha: testalpha.o  
$(CC) -o $@ $^ $(LIBS)

testsprite: testsprite.o  
$(CC) -o $@ $^ $(LIBS)

This version is specific to the GNU Makefiles

```
-Sam Lantinga (slouken at devolution.com)

```

Lead Programmer, Loki Entertainment Software–  
“Any sufficiently advanced bug is indistinguishable from a feature”  
– Rich Kulawiec

---

<div class="post-metadata">

**Author:** ![Steve\_Madsen](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/85e7bf/32.png) [@Steve\_Madsen](https://discourse.libsdl.org/u/Steve_Madsen)\
**Post date:** [March 22, 2000, 5:32pm UTC](https://discourse.libsdl.org/t/linux-makefiles-help/2079/5 "2000-03-22T17:32:48Z")

</div>

Hi everyone,

I have been able to use an MP3 for the background track of the  
aliens demo by simply changing the Mix\_OpenAudio line to read

```
 Mix_OpenAudio( 22050, AUDIO_S16, 2, 4096 );

```

and symlinking my mp3 file as [music.it](http://music.it). Simple as that.

The problem comes after the background music mp3 has stopped playing.  
When that happens, the audio goes completely dead–shot.wav and  
explode.wav then cease playing as well, even though they are fine  
initially (while the MP3 is still playing). But, the video part of  
the game continues with no apparent problems…until the ESC key  
is pressed, whereupon the game sprites stop moving, but the game  
window and xterm from which it was launched hang permanently.

Anyone else encountered this end-of-MP3 problem?

I also tried a plain .WAV file as the background music, and notice  
that it loops perfectly. So, what I hope to do is be able to use  
a background MP3 in place of a background WAV, without any strange  
problems.

My platform is an x86 box running Redhat 6.0, and  
I’m using the latest versions of the relevant packages:  
SDL-1.1.1  
SDL\_mixer-1.0.5  
smpeg-0.3.4

Thanks for any pointers,

Steve Madsen  
H2Eye Ltd.  
24-28 Hatton Wall  
London EC1N 8JH  
UNITED KINGDOM (UK)  
Tel: +44 (0) 207 404 9600  
Fax: +44 (0) 207 404 9490  
Email: @Steve_Madsen

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [March 22, 2000, 6:19pm UTC](https://discourse.libsdl.org/t/linux-makefiles-help/2079/6 "2000-03-22T18:19:51Z")

</div>

> Hi everyone,

> I have been able to use an MP3 for the background track of the  
> aliens demo by simply changing the Mix\_OpenAudio line to read

> ```
> Mix_OpenAudio( 22050, AUDIO_S16, 2, 4096 );
> 
> ```

> and symlinking my mp3 file as music.it. Simple as that.

> The problem comes after the background music mp3 has stopped playing.  
> When that happens, the audio goes completely dead

Again, this is a bug in smpeg. You can get the latest CVS code which  
has this fixed from [http://cvs.lokigames.com/](http://cvs.lokigames.com/).

```
-Sam Lantinga (slouken at devolution.com)

```

Lead Programmer, Loki Entertainment Software–  
“Any sufficiently advanced bug is indistinguishable from a feature”  
– Rich Kulawiec
