Initial
This commit is contained in:
parent
2b329b4031
commit
61812932ac
4 changed files with 83 additions and 5 deletions
11
Makefile
11
Makefile
|
|
@ -1,24 +1,25 @@
|
|||
BIN := graphs
|
||||
# Compiler
|
||||
CC := gcc
|
||||
# CC := gcc
|
||||
CC := g++
|
||||
|
||||
GITHASH := $(shell git rev-parse --short HEAD)
|
||||
|
||||
# Compiler flags
|
||||
CFLAGS := -Wall -Wextra -Wpedantic -std=c2x
|
||||
CFLAGS := -Wall -Wextra -Wpedantic -std=c++23
|
||||
|
||||
# Directories
|
||||
SRC_DIR := src
|
||||
BUILD_DIR := build
|
||||
|
||||
# Source files
|
||||
SRCS := $(wildcard $(SRC_DIR)/*.c)
|
||||
SRCS := $(wildcard $(SRC_DIR)/*.cpp)
|
||||
|
||||
# Header files (used for formatting)
|
||||
HEADERS := $(wildcard $(SRC_DIR)/*.h)
|
||||
|
||||
# Object files
|
||||
OBJS := $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SRCS))
|
||||
OBJS := $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SRCS))
|
||||
|
||||
# Target executable
|
||||
TARGET := $(BUILD_DIR)/$(BIN)
|
||||
|
|
@ -31,7 +32,7 @@ $(TARGET): $(OBJS)
|
|||
$(CC) $(CFLAGS) $^ -o $@
|
||||
|
||||
# Rule to build object files
|
||||
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
|
||||
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue