-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (37 loc) · 1005 Bytes
/
Makefile
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
37
38
39
40
41
42
43
44
45
46
47
48
49
# set the compiler
CC := gcc
# general compiler flags
CFLAGS := --std=c99 -Wall -Wextra -pedantic
ifeq ($(OS),Windows_NT)
CFLAGS += -IC:\libsdl\include -LC:\libsdl\lib -lmingw32 -lSDL2main -lSDL2 -lSDL2_net -lSDL2_image -lSDL2_ttf
EXEC := snek.exe
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CFLAGS += `sdl2-config --libs --cflags` -lSDL2_net -lSDL2_image -lSDL2_ttf -lm
EXEC := snek.out
endif
ifeq ($(UNAME_S),Darwin)
CFLAGS += `sdl2-config --libs --cflags` -lSDL2_net -lSDL2_image -lSDL2_ttf -lm
EXEC := snek.out
endif
endif
$(EXEC): main.o game.o app.o snake.o player.o fruit.o menu.o
$(CC) *.o $(CFLAGS) -o $(EXEC)
main.o: main.c
$(CC) main.c -c $(CFLAGS)
game.o: game.c
$(CC) game.c -c $(CFLAGS)
app.o: app.c
$(CC) app.c -c $(CFLAGS)
fruit.o: fruit.c
$(CC) fruit.c -c $(CFLAGS)
snake.o: snake.c
$(CC) snake.c -c $(CFLAGS)
player.o: player.c
$(CC) player.c -c $(CFLAGS)
menu.o: menu.c
$(CC) menu.c -c $(CFLAGS)
clean:
rm -f $(EXEC) *.o
.PHONY: clean