eedf8d826a
- add problem 3518 implementation - add build configuration with debug and release modes - add test cases and examples - add makefile for problem-specific build workflow
46 lines
864 B
Makefile
46 lines
864 B
Makefile
export ROOT_DIR := $(CURDIR)
|
|
|
|
export BUILD_ROOT := $(ROOT_DIR)/build
|
|
|
|
export CC = gcc
|
|
export LDFLAGS = -lstdc++
|
|
|
|
BUILD_TYPE ?= Release
|
|
|
|
ifeq ($(BUILD_TYPE),Debug)
|
|
export CFLAGS = -std=c++23 -Wall -Wextra -Werror -Wpedantic -g -O0
|
|
else ifeq ($(BUILD_TYPE),Release)
|
|
export CFLAGS = -std=c++23 -Wall -Wextra -Werror -Wpedantic -O2
|
|
else
|
|
$(error Unknown BUILD_TYPE: $(BUILD_TYPE))
|
|
endif
|
|
|
|
|
|
.PHONY: all clean build run test rebuild
|
|
|
|
all:
|
|
ifndef PROBLEM_ID
|
|
$(error PROBLEM_ID is not set)
|
|
endif
|
|
$(MAKE) -C $(PROBLEM_ID)
|
|
|
|
clean:
|
|
rm -rf $(BUILD_ROOT)
|
|
|
|
# NOTE: Examples
|
|
# make build PROBLEM_ID=3518 BUILD_TYPE=Debug
|
|
# make build PROBLEM_ID=3518
|
|
build:
|
|
mkdir -p $(BUILD_ROOT)/$(PROBLEM_ID)
|
|
$(MAKE) -C $(PROBLEM_ID) build
|
|
|
|
run:
|
|
$(MAKE) -C $(PROBLEM_ID) run
|
|
|
|
test:
|
|
$(MAKE) -C $(PROBLEM_ID) test
|
|
|
|
rebuild:
|
|
$(MAKE) -C $(PROBLEM_ID) clean
|
|
$(MAKE) -C $(PROBLEM_ID) build
|