Skip to content

Commit 92ff59a

Browse files
committed
Make build more customizable, add compatibility with BSD make
1 parent bef34ab commit 92ff59a

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

Makefile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
PROJNAME=espada
22
SOURCES=src/main.c src/clips.c
3-
ifndef DESTDIR
4-
DESTDIR=/usr/local/games/$(PROJNAME)
5-
endif
3+
DESTDIR?=/usr/local/games/$(PROJNAME)
64

7-
CC=gcc
8-
CFLAGS+=
9-
LDFLAGS+=-lSDL -lSDL_image -lSDL_ttf -lSDL_mixer -liniparser
5+
CC?=gcc
6+
CFLAGS?=-O2
7+
CFLAGS+=`sdl-config --cflags` -Wall -mms-bitfields -std=c99
8+
LDFLAGS+=`sdl-config --libs` -lSDL_image -lSDL_ttf -lSDL_mixer -liniparser
109
OBJECTS=$(SOURCES:.c=.o)
1110
EXECUTABLE=$(PROJNAME)
1211
RESOURCES=res/music.ogg res/background.png res/enemy_ship.png res/laser.png res/player_ship.png res/VeraBd.ttf res/explosion.wav res/player_fire.wav
1312
all: $(SOURCES) $(EXECUTABLE)
1413

1514
$(EXECUTABLE): $(OBJECTS)
16-
$(CC) $(OBJECTS) $(LDFLAGS) -Wall -O2 -mms-bitfields -std=c99 -o $@
15+
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
1716

1817
.c.o:
19-
$(CC) $< $ $(CFLAGS) -c -Wall -O2 -mms-bitfields -std=c99 -o $@
18+
$(CC) $< $ $(CFLAGS) -c -o $@
2019

2120
install:
2221
mkdir -p $(DESTDIR)/res

0 commit comments

Comments
 (0)