57 lines
1.4 KiB
Makefile
57 lines
1.4 KiB
Makefile
|
# Compiler
|
||
|
CXX = g++
|
||
|
CXXFLAGS = -std=c++17 -Wall -Wextra -pedantic
|
||
|
|
||
|
# Targets
|
||
|
TARGETS = TagRemover Sieve date_test toString_test string_cast_test
|
||
|
|
||
|
# Source files
|
||
|
SRCS_TAGREMOVER = TagRemover.cc
|
||
|
SRCS_SIEVE = Sieve.cc
|
||
|
SRCS_DATE = date.cc
|
||
|
SRCS_DATE_TEST = date_test.cc
|
||
|
SRCS_TOSTRING_TEST = toString_test.cc date.cc
|
||
|
SRCS_STRING_CAST_TEST = string_cast_test.cc date.cc
|
||
|
|
||
|
# Object files
|
||
|
OBJS_TAGREMOVER = $(SRCS_TAGREMOVER:.cc=.o)
|
||
|
OBJS_SIEVE = $(SRCS_SIEVE:.cc=.o)
|
||
|
OBJS_DATE = $(SRCS_DATE:.cc=.o)
|
||
|
OBJS_DATE_TEST = $(SRCS_DATE_TEST:.cc=.o)
|
||
|
OBJS_TOSTRING_TEST = $(SRCS_TOSTRING_TEST:.cc=.o)
|
||
|
OBJS_STRING_CAST_TEST = $(SRCS_STRING_CAST_TEST:.cc=.o)
|
||
|
|
||
|
# Default target
|
||
|
all: $(TARGETS)
|
||
|
|
||
|
# Rule to build TagRemover
|
||
|
TagRemover: $(OBJS_TAGREMOVER)
|
||
|
$(CXX) $(CXXFLAGS) -o $@ $^
|
||
|
|
||
|
# Rule to build Sieve
|
||
|
Sieve: $(OBJS_SIEVE)
|
||
|
$(CXX) $(CXXFLAGS) -o $@ $^
|
||
|
|
||
|
# Rule to build date_test
|
||
|
date_test: $(OBJS_DATE_TEST) $(OBJS_DATE)
|
||
|
$(CXX) $(CXXFLAGS) -o $@ $^
|
||
|
|
||
|
# Rule to build toString_test
|
||
|
toString_test: $(OBJS_TOSTRING_TEST)
|
||
|
$(CXX) $(CXXFLAGS) -o $@ $^
|
||
|
|
||
|
# Rule to build string_cast_test
|
||
|
string_cast_test: $(OBJS_STRING_CAST_TEST)
|
||
|
$(CXX) $(CXXFLAGS) -o $@ $^
|
||
|
|
||
|
# Rule to compile source files into object files
|
||
|
%.o: %.cc
|
||
|
$(CXX) $(CXXFLAGS) -c $<
|
||
|
|
||
|
# Clean up build artifacts
|
||
|
clean:
|
||
|
rm -f $(OBJS_TAGREMOVER) $(OBJS_SIEVE) $(OBJS_DATE) $(OBJS_DATE_TEST) $(OBJS_TOSTRING_TEST) $(OBJS_STRING_CAST_TEST) $(TARGETS)
|
||
|
|
||
|
# Phony targets
|
||
|
.PHONY: all clean
|