forked from parraro/Assignment1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmymake
57 lines (43 loc) · 1.88 KB
/
mymake
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
CXX=g++
CXXFLAGS=-Wall -ansi -pedantic
BUILD_DIR=build
OBJS= \
$(BUILD_DIR)/main.o \
$(BUILD_DIR)/Weapon.o \
$(BUILD_DIR)/WeaponFactory.o \
$(BUILD_DIR)/CommonSword.o \
$(BUILD_DIR)/CommonSpear.o \
$(BUILD_DIR)/SimpleAxe.o \
$(BUILD_DIR)/CrazyRandomSword.o \
$(BUILD_DIR)/StrongHammer.o
all: main.out
main.out: $(OBJS)
$(CXX) $(CXXFLAGS) -o $(BUILD_DIR)/main.out $(OBJS)
$(BUILD_DIR)/main.o: $(BUILD_DIR) $(BUILD_DIR)/Weapon.o $(BUILD_DIR)/WeaponFactory.o
$(CXX) $(CXXFLAGS) -c -o $@ main.cpp
$(BUILD_DIR)/WeaponFactory.o: $(BUILD_DIR) $(BUILD_DIR)/CommonSword.o $(BUILD_DIR)/CommonSpear.o $(BUILD_DIR)/SimpleAxe.o $(BUILD_DIR)/CrazyRandomSword.o $(BUILD_DIR)/StrongHammer.o WeaponFactory.cpp WeaponFactory.h
$(CXX) $(CXXFLAGS) -c -o $@ WeaponFactory.cpp
$(BUILD_DIR)/CommonSword.o: $(BUILD_DIR) $(BUILD_DIR)/Weapon.o CommonSword.cpp CommonSword.h
$(CXX) $(CXXFLAGS) -c -o $@ CommonSword.cpp
$(BUILD_DIR)/CommonSpear.o: $(BUILD_DIR) $(BUILD_DIR)/Weapon.o CommonSpear.cpp CommonSpear.h
$(CXX) $(CXXFLAGS) -c -o $@ CommonSpear.cpp
$(BUILD_DIR)/SimpleAxe.o: $(BUILD_DIR) $(BUILD_DIR)/Weapon.o SimpleAxe.cpp SimpleAxe.h
$(CXX) $(CXXFLAGS) -c -o $@ SimpleAxe.cpp
$(BUILD_DIR)/CrazyRandomSword.o: $(BUILD_DIR) $(BUILD_DIR)/Weapon.o CrazyRandomSword.cpp CrazyRandomSword.h
$(CXX) $(CXXFLAGS) -c -o $@ CrazyRandomSword.cpp
$(BUILD_DIR)/StrongHammer.o: $(BUILD_DIR) $(BUILD_DIR)/Weapon.o StrongHammer.cpp StrongHammer.h
$(CXX) $(CXXFLAGS) -c -o $@ StrongHammer.cpp
$(BUILD_DIR)/Weapon.o: $(BUILD_DIR) Weapon.cpp Weapon.h
$(CXX) $(CXXFLAGS) -c -o $@ Weapon.cpp
clean:
rm -f $(BUILD_DIR)/Weapon.o
rm -f $(BUILD_DIR)/WeaponFactory.o
rm -f $(BUILD_DIR)/main.o
rm -f $(BUILD_DIR)/CommonSword.o
rm -f $(BUILD_DIR)/CommonSpear.o
rm -f $(BUILD_DIR)/SimpleAxe.o
rm -f $(BUILD_DIR)/CrazyRandomSword.o
rm -f $(BUILD_DIR)/StrongHammer.o
rm -rf $(BUILD_DIR)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)