forked from nragland37/cpp-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (25 loc) · 626 Bytes
/
Copy pathMakefile
File metadata and controls
31 lines (25 loc) · 626 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
31
#****************************************************************************
#
# Makefile for c++ projects with multiple source files and headers
#
# Commands:
# - make
# - make run
# - make clean
#
#****************************************************************************
CXX = g++
CXXFLAGS = -Wall -std=c++17
TARGET = main.exe
SOURCES = $(wildcard *.cpp)
HEADERS = $(wildcard *.h)
OBJECTS = $(SOURCES:.cpp=.o)
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) $(OBJECTS) -o $(TARGET)
%.o: %.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) -c $< -o $@
run: $(TARGET)
./$(TARGET)
clean:
rm -f $(TARGET) $(OBJECTS)