-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (20 loc) · 842 Bytes
/
Makefile
File metadata and controls
30 lines (20 loc) · 842 Bytes
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
# Makefile for the Twixt game (Syntax has been Googled as Makefile has not been taught)
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -g
SRC_DIR = src
BIN_NAME = twixt
SRC_FILES = board.c gamelogic.c input.c main.c render.c
OBJ_FILES = $(patsubst %.c, %.o, $(SRC_FILES))
.PHONY: all clean
all: $(BIN_NAME)
$(BIN_NAME): $(OBJ_FILES)
$(CC) $(CFLAGS) $^ -o $@
%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
board.o: $(SRC_DIR)/board.h $(SRC_DIR)/twixt_types.h
gamelogic.o: $(SRC_DIR)/gamelogic.h $(SRC_DIR)/twixt_types.h $(SRC_DIR)/board.h
input.o: $(SRC_DIR)/input.h $(SRC_DIR)/twixt_types.h
main.o: $(SRC_DIR)/main.c $(SRC_DIR)/gamelogic.h $(SRC_DIR)/board.h $(SRC_DIR)/render.h $(SRC_DIR)/input.h $(SRC_DIR)/twixt_types.h
render.o: $(SRC_DIR)/render.h $(SRC_DIR)/twixt_types.h $(SRC_DIR)/board.h
clean:
rm -f $(BIN_NAME) $(OBJ_FILES)