-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
32 lines (27 loc) · 797 Bytes
/
Makefile
File metadata and controls
32 lines (27 loc) · 797 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
32
# Lesson 03: Variables
#
# Instead of hardcoding g++, flags, and file lists everywhere,
# we use variables. Change the compiler or flags in one place.
#
# Convention:
# CXX — C++ compiler
# CXXFLAGS — compile flags (warnings, standard, optimization)
# LDFLAGS — linker flags (library paths, etc.)
# TARGET — the executable name
# SRCS — source files
# OBJS — object files (derived from SRCS)
CXX = g++
CXXFLAGS = -std=c++20 -Wall -Wextra
LDFLAGS =
TARGET = main
SRCS = main.cpp greet.cpp
OBJS = main.o greet.o
$(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(LDFLAGS)
main.o: main.cpp greet.hpp
$(CXX) $(CXXFLAGS) -c main.cpp
greet.o: greet.cpp greet.hpp
$(CXX) $(CXXFLAGS) -c greet.cpp
.PHONY: clean
clean:
rm -f $(TARGET) $(OBJS)