forked from glouw/littlewolf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (49 loc) · 975 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
50
51
52
53
54
55
56
57
58
CC = gcc
NAME = littlewolf
SRCS = main.c
# CompSpec defined in windows environment.
ifdef ComSpec
BIN = $(NAME).exe
else
BIN = $(NAME)
endif
CFLAGS =
ifdef ComSpec
CFLAGS += -I ../SDL2-2.0.7/i686-w64-mingw32/include
CFLAGS += -I ../SDL2-2.0.7/i686-w64-mingw32/include/SDL2
endif
CFLAGS += -std=c99
CFLAGS += -Wshadow -Wall -Wpedantic -Wextra -Wdouble-promotion
CFLAGS += -g
CFLAGS += -O3 -march=native
LDFLAGS =
ifdef ComSpec
LDFLAGS += -L..\SDL2-2.0.7\i686-w64-mingw32\lib
LDFLAGS += -lmingw32
LDFLAGS += -lSDL2main
endif
LDFLAGS += -lSDL2 -lm
ifdef ComSpec
RM = del /F /Q
MV = ren
else
RM = rm -f
MV = mv -f
endif
# Link.
$(BIN): $(SRCS:.c=.o)
$(CC) $(CFLAGS) $(SRCS:.c=.o) $(LDFLAGS) -o $(BIN)
# Compile.
%.o : %.c Makefile
$(CC) $(CFLAGS) -MMD -MP -MT $@ -MF $*.td -c $<
@$(RM) $*.d
@$(MV) $*.td $*.d
%.d: ;
-include *.d
clean:
$(RM) vgcore.*
$(RM) cachegrind.out.*
$(RM) callgrind.out.*
$(RM) $(BIN)
$(RM) $(SRCS:.c=.o)
$(RM) $(SRCS:.c=.d)