-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (54 loc) · 1.3 KB
/
Makefile
File metadata and controls
66 lines (54 loc) · 1.3 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
#################################################
# @file Makefile
# @author Charly Batista (carlbsb@gmail.com)
# @brief
# @version 0.1
# @date 2023-04-25
#
# Copyright © Percona LLC and/or its affiliates
#
# Hackathon Team #3
# - Abdul Sayeed
# - Agustin Gallego
# - Charly Batista
# - Jobin Augustine
# - Muhammad Usama
#
#################################################
# /// Executables
CC := gcc
MKDIR := mkdir -p
# ///
TARGET_EXEC := pg_auto_tune
PROJ_DIR := $(realpath $(CURDIR))
BUILD_DIR := build
BUILD_LIB := $(BUILD_DIR)/lib
SRC_DIRS := src
INC_DIR := include
LIB_DDIR := lib
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
INC_DIRS := $(shell find $(INC_DIR) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS)) -I./$(LIB_DDIR)/iniparser/src
CFLAGS := -fPIC -Wall -ggdb3 $(INC_FLAGS) -MMD -MP
LDFLAGS := -shared
LIBS := -L./$(BUILD_LIB) -lm
$(BUILD_DIR)/$(TARGET_EXEC): mkdir $(OBJS)
$(CC) $(OBJS) -o $@ $(LIBS)
# assembly
$(BUILD_DIR)/%.s.o: %.s
$(MKDIR) $(dir $@)
$(AS) $(ASFLAGS) -c $< -o $@
# c source
$(BUILD_DIR)/%.c.o: %.c
$(MKDIR) $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
# Libraries
mkdir:
$(MKDIR) $(BUILD_LIB)
# Clean
.PHONY: clean
clean:
$(RM) -r $(BUILD_DIR)
-include $(DEPS)