-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (28 loc) · 935 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
39
OUT_DIR = obj
OBJS = $(OUT_DIR)/TheGeneral.o $(OUT_DIR)/ColonelA.o $(OUT_DIR)/ColonelB.o
INCS = -I"."
BIN = general
CC = g++
CXXFLAGS = $(INCS) -Wall -std=c++11
LFLAGS = -Wall
MKDIRS = mkdir -p
RM_ALL = rm -rf
.PHONY: directories run
build: directories $(BIN)
all: clean build run
run:
@echo=off; echo "\nRunning Example:\n"
./$(BIN)
$(BIN): $(OBJS)
$(CC) $(LFLAGS) $(OBJS) -o $(BIN)
directories: $(OUT_DIR)
$(OUT_DIR):
$(MKDIRS) $(OUT_DIR)
clean:
$(RM_ALL) $(OBJS) $(OUT_DIR) $(BIN)
$(OUT_DIR)/ColonelA.o: directories ColonelA.h ColonelA.cpp libFoo_v1/libFoo.h
$(CC) -I"./libfoo_v1/" $(CXXFLAGS) -c ColonelA.cpp -o $@
$(OUT_DIR)/ColonelB.o: directories ColonelB.h ColonelB.cpp libFoo_v2/libFoo.h $(OUT_DIR)/
$(CC) -I"./libfoo_v2/" $(CXXFLAGS) -c ColonelB.cpp -o $@
$(OUT_DIR)/TheGeneral.o: directories TheGeneral.cpp $(OUT_DIR)/ColonelA.o $(OUT_DIR)/ColonelB.o $(OUT_DIR)/
$(CC) $(CXXFLAGS) -c TheGeneral.cpp -o $@