-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·49 lines (40 loc) · 991 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
40
41
42
43
44
45
46
47
48
49
# ------------------------------------------
# Red-black tree implementation
# Henrik Peters
# ------------------------------------------
# Binary target name
TARGET ?= rbtree
# Compiler configuration
CC = g++
CPPFLAGS = -c -std=c++14 -Wall -Wextra
LDFLAGS =
# Source code
SOURCE=$(wildcard *.cpp)
HEADER=$(wildcard *.h)
OBJECTS=$(SOURCE:.cpp=.o)
# Targets
.PHONY: all clean help rebuild
default: all
all: $(TARGET)
# Compiling source code files
%.o : %.cpp $(HEADER)
@echo "Compiling $@"
$(CC) $(CPPFLAGS) -o $@ $<
@echo "Compiling done"
# Linking to executable
$(TARGET): $(OBJECTS)
@echo "Linking $@"
$(CC) $(LDFLAGS) $(OBJECTS) -o $(TARGET)
@echo "Linking done"
# Remove created objects
clean:
rm -f $(OBJECTS) $(TARGET)
@echo "cleanup done"
rebuild: clean all
# Show help
help:
@echo "Options:"
@echo "make all - create program"
@echo "make rebuild - clean up and create program"
@echo "make clean - clean up"
@echo "make help - show this help text"