-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (25 loc) · 875 Bytes
/
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
#TODO: replace ID with your own IDS, for example: 123456789_123456789
SUBMITTERS := 212732101_931202782
COMPILER := g++
COMPILER_FLAGS := --std=c++11 -Wall
SRCS := Commands.cpp signals.cpp smash.cpp
OBJS=$(subst .cpp,.o,$(SRCS))
HDRS := Commands.h signals.h
TESTS_INPUTS := $(wildcard test_input*.txt)
TESTS_OUTPUTS := $(subst input,output,$(TESTS_INPUTS))
SMASH_BIN := smash
test: $(TESTS_OUTPUTS)
$(TESTS_OUTPUTS): $(SMASH_BIN)
$(TESTS_OUTPUTS): test_output%.txt: test_input%.txt test_expected_output%.txt
./$(SMASH_BIN) < $(word 1, $^) > $@
diff $@ $(word 2, $^)
echo $(word 1, $^) ++PASSED++
$(SMASH_BIN): $(OBJS)
$(COMPILER) $(COMPILER_FLAGS) $^ -o $@
$(OBJS): %.o: %.cpp
$(COMPILER) $(COMPILER_FLAGS) -c $^
zip: $(SRCS) $(HDRS)
zip $(SUBMITTERS).zip $^ submitters.txt Makefile
clean:
rm -rf $(SMASH_BIN) $(OBJS) $(TESTS_OUTPUTS)
rm -rf $(SUBMITTERS).zip