advent2021

Advent of Code 2021 Solutions
git clone git://bsandro.tech/advent2021
Log | Files | Refs | README | LICENSE

Makefile (466B)


      1 NAME=$(shell basename ${PWD})
      2 SRC=$(wildcard *.c ../common/*.c)
      3 DEPS:=$(wildcard *.h ../common/*.h)
      4 OBJ:=$(SRC:.c=.o)
      5 CFLAGS=-O2 -std=c99 -Werror -Wall -Wextra -I. -I../common
      6 LDFLAGS=-lc -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 test: $(NAME)
     25 	@./$(NAME) test.txt
     26 
     27 brute: $(NAME)
     28 	@./$(NAME) -b input.txt