summaryrefslogtreecommitdiff
path: root/Makefile
blob: c458a474a5d76e4634b7ca1154fc8c100951438b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
NAME            = $(notdir $(CURDIR))
SRC             = $(addprefix src/,main.c init.c move.c flip.c flag.c xSDL.c)

CPPFLAGS        = -I./include $(shell sdl-config --cflags)
CPPFLAGS	   += -I../lib/sdl-digit/include
LDFLAGS         = -L../lib/sdl-digit -L./lib $(shell sdl-config --libs) -lsdl-digit
CFLAGS          = -W -Wall -Wextra -std=gnu99 $(shell sdl-config --cflags)

CC              = gcc

OBJ             = $(SRC:.c=.o)
DEP             = $(SRC:.c=.d)

all: $(NAME)

$(NAME): $(OBJ)
	$(CC) -o "$@" $^ $(LDFLAGS)

-include $(DEP)

%.d: %.c
	$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< -MF $@ -MT "$*.o $@"

clean:
	$(RM) $(OBJ)
	$(RM) $(NAME)

mrproper: clean
	$(RM) $(DEP)

distclean: mrproper
	$(RM) $(addsuffix ~,$(SRC))
	$(RM) $(wildcard $(addsuffix .sw*,$(addprefix .,$(SRC))))

.PHONY: all clean mrproper distclean