1 |
## Version |
2 |
VERSION = 1 |
3 |
BUILD = 1 |
4 |
|
5 |
## Files |
6 |
PLUGIN = libpadSDL-${VERSION}.${BUILD}.so |
7 |
SRCS = padsdl.c |
8 |
|
9 |
## Config |
10 |
CC = gcc |
11 |
CFLAGS = -O2 -fPIC |
12 |
CPPFLAGS = `sdl-config --cflags` -DVERSION=$(VERSION) -DBUILD=$(BUILD) |
13 |
LDFLAGS = -shared -Wl,-soname,${PLUGIN} |
14 |
LIBS = `sdl-config --libs` |
15 |
SHELL = /bin/sh |
16 |
|
17 |
## Rules |
18 |
all: $(PLUGIN) |
19 |
|
20 |
OBJS = $(addsuffix .o, $(basename $(SRCS))) |
21 |
DEPS = $(addprefix .deps/, $(addsuffix .P, $(basename $(SRCS)))) |
22 |
|
23 |
$(PLUGIN): .deps $(OBJS) |
24 |
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) |
25 |
|
26 |
%.o: %.c |
27 |
$(CC) $(CFLAGS) $(CPPFLAGS) -Wp,-MD,.deps/$(*F).P -o $@ -c $< |
28 |
|
29 |
clean: |
30 |
rm -f $(OBJS) $(PLUGIN) |
31 |
|
32 |
distclean: clean |
33 |
rm -rf .deps |
34 |
|
35 |
.deps: |
36 |
@[ -d .deps ] || mkdir .deps >/dev/null 2>&1 |
37 |
|
38 |
-include $(DEPS) |