-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (31 loc) · 804 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
# Compiler and flags
CC = clang
# CFLAGS = -Wall -Wextra -Werror -g3 -fno-omit-frame-pointer -fsanitize=address -fsanitize=null -fsanitize=undefined
CFLAGS = -Wall -Wextra -Werror -O3
# Source files
SRCS = main.c mlx.c mlx_int.c
# Header files
HEADERS = raylib.h raygui.h raymath.h rlgl.h mlx.h mlx_int.h
# Output executable
NAME = game
# Libraries
LIBS = libraylib.a -lGL -lm -lpthread -ldl -lrt -lX11
# Objects
OBJS = $(SRCS:.c=.o)
# Default rule
all: $(NAME)
# Linking
$(NAME): $(OBJS) libraylib.a
$(CC) $(CFLAGS) $(OBJS) -o $(NAME) $(LIBS)
# Compiling
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
# Clean object files
clean:
rm -f $(OBJS)
# Clean object files and executable, but keep libraylib.a
fclean: clean
rm -f $(NAME)
# Recompile
re: fclean all
.PHONY: all clean fclean re