aoc

Advent of Code Solutions
git clone git://git.alexkarle.com.com/aoc
Log | Files | Refs | README | LICENSE

Makefile (612B) [raw]


      1 # Makefile
      2 #
      3 # Targets:
      4 #
      5 # 	build: builds all C executables
      6 #
      7 # 	run:   runs all found solutions for $DAY
      8 # 	       (default all, example: make DAY=1 run)
      9 #
     10 # 	clean: removes all C executables
     11 CFLAGS = -g -O2 -Wall -Wpedantic -Wextra
     12 DAY = *
     13 
     14 TARGETS = 01/a 01/b \
     15 	  02/a 02/b \
     16 	  03/a \
     17 	  05/a 05/b \
     18 	  06/a 06/b
     19 
     20 .PHONY: build
     21 build: $(TARGETS)
     22 
     23 .PHONY: run
     24 run: build
     25 	@for d in $(DAY)/; do \
     26 		for sol in a.py a b.py b; do \
     27 			[ -e $$d/$$sol ] && printf "%-9s" "$${d}$$sol: " && $$d/$$sol < $$d/input || true; \
     28 		done; \
     29 	done
     30 
     31 .PHONY: clean
     32 clean:
     33 	rm -f $(TARGETS)
     34 
     35 %: %.c
     36 	$(CC) $(CFLAGS) -o $@ $<