advent2021

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

Makefile (569B)


      1 NAME=$(shell basename ${PWD})
      2 SRC=$(wildcard *.c ../common/*.c)
      3 DEPS:=$(wildcard *.h ../common/*.h)
      4 OBJ:=$(SRC:.c=.o)
      5 #CFLAGS=-O0 -g -fsanitize=address -fno-omit-frame-pointer -std=c99 -Werror -Wall -Wextra -I. -I../common
      6 #LDFLAGS=-g -lc -lm -fsanitize=address
      7 CFLAGS=-O2 -std=c99 -Werror -Wall -Wextra -I. -I../common
      8 LDFLAGS=-lc -lm
      9 
     10 all: $(NAME)
     11 
     12 .PHONY: clean run
     13 
     14 clean:
     15 	rm -f $(OBJ) $(NAME)
     16 
     17 %.o : %.c $(DEPS)
     18 	@$(CC) $(CFLAGS) -c $< -o $@
     19 
     20 $(NAME): $(OBJ)
     21 	@$(CC) $(OBJ) -o $@ $(LDFLAGS)
     22 
     23 run: $(NAME)
     24 	@./$(NAME) input.txt
     25 
     26 test: $(NAME)
     27 	@./$(NAME) test.txt