-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
56 lines (41 loc) · 1.29 KB
/
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
50
51
52
53
54
55
56
CXX := g++
CXXFLAGS := -std=c++17 -O3 -Wall -Wextra -pedantic -g
SRC_DIR := kiwi/src
INCLUDE_DIR := kiwi/include
BUILD_DIR := build
BIN_DIR := bin
SRC_FILES := $(wildcard $(SRC_DIR)/*.cpp)
INCLUDE_FILES := $(wildcard $(INCLUDE_DIR)/*.h)
OBJ_FILES := $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SRC_FILES))
EXECUTABLE := $(BIN_DIR)/kiwi
# Define linker flags and libraries
LDFLAGS :=
LDLIBS := -lffi -ldl
.PHONY: all clean test play install profile rpm
all: clean $(EXECUTABLE)
$(EXECUTABLE): $(OBJ_FILES)
@mkdir -p $(BIN_DIR)
$(CXX) $(LDFLAGS) $^ -o $@ $(LDLIBS)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp $(INCLUDE_FILES)
@mkdir -p $(BUILD_DIR)
$(CXX) $(CXXFLAGS) -I$(INCLUDE_DIR) -c $< -o $@
format:
find . -iname "*.cpp" -o -iname "*.h" | xargs clang-format -i --style=file
test: $(EXECUTABLE)
@echo "================================"
$(EXECUTABLE) ./test
play: $(EXECUTABLE)
@echo "================================"
$(EXECUTABLE) play
install: $(EXECUTABLE)
@echo "================================"
./$(EXECUTABLE) configure install
profile: CXXFLAGS += -pg
profile: clean $(EXECUTABLE)
clean:
rm -rf $(BUILD_DIR) $(BIN_DIR)
rpm: all
# Create source tarball
tar czf kiwi-2.0.12.tar.gz --transform 's,^,kiwi-2.0.12/,' bin/ lib/ kiwi.spec
# Build the RPM package
rpmbuild -ta kiwi-2.0.12.tar.gz