-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (52 loc) · 1.11 KB
/
Makefile
File metadata and controls
68 lines (52 loc) · 1.11 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#version 1
#hello : main.cpp printhello.cpp factorial.cpp
# g++ -o hello main.cpp printhello.cpp factorial.cpp
#version 2
# CXX = g++
# TARGET = hello
# OBJ = main.o printhello.o factorial.o
# $(TARGET) : $(OBJ)
# $(CXX) -o $(TARGET) $(OBJ)
# main.o : main.cpp
# $(CXX) -c main.cpp
# printhello.o : printhello.cpp
# $(CXX) -c printhello.cpp
# factorial.o : factorial.cpp
# $(CXX) -c factorial.cpp
#version 3
# CXX = g++
# TARGET = hello
# OBJ = main.o printhello.o factorial.o
# CXXFLAGS = -c -Wall
# $(TARGET) : $(OBJ)
# $(CXX) -o $@ $^
# %.o : %.cpp
# $(CXX) $(CXXFLAGS) $<
# .PHONY : clean
# clean:
# rm -f *.o $(TARGET)
#version 4
# CXX = g++
# TARGET = hello
# SRC = $(wildcard *.cpp)
# OBJ = $(patsubst %.cpp, %.o, $(SRC))
# CXXFLAGS = -c -Wall
# $(TARGET) : $(OBJ)
# $(CXX) -o $@ $^
# %.o : %.cpp
# $(CXX) $(CXXFLAGS) $< -o $@
# .PHONY : clean
# clean:
# rm -f *.o $(TARGET)
CXX = g++
TARGET = hello
SRC = $(wildcard *.cpp)
OBJ = $(patsubst %.cpp, %.o, $(SRC))
CXXFLAGS = -c -Wall
$(TARGET) : $(OBJ)
$(CXX) -o $@ $^
%.o : %.cpp
$(CXX) $(CXXFLAGS) $< -o $@
.PHONY : clean
clean:
rm -f *.o $(TARGET)