forked from glouw/tinn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (45 loc) · 869 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
# Makefile with support for Windows (mingw32) and NIX (clang / gcc)
CC = gcc
NAME = tinn
SRCS =
SRCS += test.c
SRCS += Tinn.c
# CompSpec defined in windows environment.
ifdef ComSpec
BIN = $(NAME).exe
else
BIN = $(NAME)
endif
CFLAGS =
CFLAGS += -std=c99
CFLAGS += -Wshadow -Wall -Wpedantic -Wextra -Wdouble-promotion -Wunused-result
CFLAGS += -g
CFLAGS += -Ofast -march=native -pipe
CFLAGS += -flto
LDFLAGS =
LDFLAGS += -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) saved.tinn
$(RM) $(BIN)
$(RM) $(SRCS:.c=.o)
$(RM) $(SRCS:.c=.d)