-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (29 loc) · 924 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 and compilation flags
CXX = g++
CXXFLAGS = -Wall -std=c++11
# Directory containing the source files
SRC_DIR = src
# List of source files in the SRC_DIR
SRC = $(SRC_DIR)/main.cpp \
$(SRC_DIR)/guessthenumber.cpp \
$(SRC_DIR)/guessthecrontab.cpp \
$(SRC_DIR)/tictactoe.cpp \
$(SRC_DIR)/mentalmath.cpp # Added new source file
# List of object files corresponding to the source files
OBJ = $(SRC:.cpp=.o)
# The name of the final executable
TARGET = games
# The default target that builds the executable
all: $(TARGET)
# Rule to create the executable from the object files
$(TARGET): $(OBJ)
$(CXX) $(CXXFLAGS) -o $@ $^
# Rule to compile .cpp files into .o files
$(SRC_DIR)/%.o: $(SRC_DIR)/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# Rule to run the executable
run: $(TARGET)
./$(TARGET)
# Rule to clean up the build: remove object files and the executable
clean:
rm -f $(OBJ) $(TARGET)