day1
This commit is contained in:
		
							
								
								
									
										25
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
			
		||||
DAY = 1
 | 
			
		||||
 | 
			
		||||
DIR = day$(DAY)
 | 
			
		||||
 | 
			
		||||
INPUT = $(DIR)/input.txt
 | 
			
		||||
 | 
			
		||||
SRC = $(shell find $(DIR) -name "main.hs" -or -name "main.zig")
 | 
			
		||||
 | 
			
		||||
ifeq ($(patsubst %hs,,$(SRC)),)
 | 
			
		||||
	RUNNER = runhaskell
 | 
			
		||||
else
 | 
			
		||||
	RUNNER = zig run
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.PHONY: run
 | 
			
		||||
run: $(SRC) $(INPUT)
 | 
			
		||||
	$(RUNNER) $(SRC) < $(INPUT)
 | 
			
		||||
 | 
			
		||||
$(DIR):
 | 
			
		||||
	mkdir -p $(DIR)
 | 
			
		||||
 | 
			
		||||
$(INPUT): | $(DIR)
 | 
			
		||||
	@echo on
 | 
			
		||||
	curl -H @${HOME}/creds/aoc-cookie https://adventofcode.com/2022/day/$(DAY)/input > $@
 | 
			
		||||
		Reference in New Issue
	
	Block a user