-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
38 lines (30 loc) · 979 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
# compiler to use
CC=gcc
# Flags to create object files with
CFLAGS=-g -Wall -Werror -Wextra -pedantic
# Flags to link the SDL2 library
SDL_FLAGS=-I/usr/local/include/SDL2 -L/usr/lib/x86_64-linux-gnu -lSDL2 -lm
# All C program files
SRC=./src/create_maze.c ./src/create_world.c ./src/dist_checks.c ./src/draw.c ./src/event_handlers.c ./src/free_stuff.c ./src/init_instance.c ./src/main_maze.c ./src/movement.c ./src/win.c
# The names of all object files
OBJ=$(SRC:.c=.o)
# Executable name
NAME=maze
# Removal command
RM=rm
# Compile all files into the executable
# CFLAGS will only be used when creating object files
# SDL_FLAGS includes necessary libraries to link
all: $(OBJ)
$(CC) $(OBJ) -o $(NAME) $(SDL_FLAGS)
# Remove all Emacs temp files (~)
clean:
$(RM) -f *~
# Remove all object files (.o)
oclean:
$(RM) -f $(OBJ)
# Remove temp files, object files, and executable
fclean: clean oclean
$(RM) -f $(NAME)
# Run full clean and recompile all files
re: fclean all