advent2024

Advent of Code 2024
git clone git://bsandro.tech/advent2024
Log | Files | Refs

Makefile (453B)


      1 NAME=$(shell basename ${PWD})
      2 SRC=$(wildcard *.cpp)
      3 DEPS:=$(wildcard *.hpp)
      4 OBJ:=$(SRC:.cpp=.o)
      5 CXXFLAGS=-O2 -std=c++23 -Werror -Wall -Wextra -I. -I../include
      6 LDFLAGS=-lstdc++ -lm
      7 
      8 all: $(NAME)
      9 
     10 .PHONY: clean run
     11 
     12 clean:
     13 	rm -f $(OBJ) $(NAME)
     14 
     15 %.o : %.c $(DEPS)
     16 	@$(CC) $(CFLAGS) -c $< -o $@
     17 
     18 $(NAME): $(OBJ)
     19 	@$(CC) $(OBJ) -o $@ $(LDFLAGS)
     20 
     21 run: $(NAME)
     22 	@./$(NAME) input.txt
     23 
     24 test1: $(NAME)
     25 	@./$(NAME) test1.txt
     26 
     27 test2: $(NAME)
     28 	@./$(NAME) test2.txt