-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (50 loc) · 1.22 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
all: usage
usage:
@echo 'Usage: make [target] PROBLEM=<problem-name>'
@echo ''
@echo 'Targets:'
@echo 'cpp Builds C++ template'
@echo 'go Builds Go template'
@echo 'python Builds Python template'
@echo 'rust Builds Rust template'
cpp:
ifndef PROBLEM
$(error PROBLEM is not set)
endif
$(eval DIR = ./problems/$(PROBLEM)/cpp)
$(eval TARGET = $(DIR)/main.cpp)
@echo 'creating template at $(TARGET)'
mkdir -p $(DIR)
touch $(TARGET)
@echo 'done'
go:
ifndef PROBLEM
$(error PROBLEM is not set)
endif
$(eval DIR = ./problems/$(PROBLEM)/go)
$(eval TARGET = $(DIR)/main.go)
@echo 'creating template at $(TARGET)'
mkdir -p $(DIR)
cd $(DIR) && test -f go.mod || go mod init $(PROBLEM)
touch $(TARGET)
@echo 'done'
python:
ifndef PROBLEM
$(error PROBLEM is not set)
endif
$(eval DIR = ./problems/$(PROBLEM)/python)
$(eval TARGET = $(DIR)/main.py)
@echo 'creating template at $(TARGET)'
mkdir -p $(DIR)
touch $(TARGET)
@echo 'done'
rust:
ifndef PROBLEM
$(error PROBLEM is not set)
endif
$(eval DIR = ./problems/$(PROBLEM))
$(eval TARGET = $(DIR)/rust/src/lib.rs)
@echo 'creating template at $(TARGET)'
mkdir -p $(DIR)
cd $(DIR) && test -d rust || cargo new rust --lib --vcs none
@echo 'done'