Makefile (1880B)
1 CC = cc #already uses the correct flags 2 CXX = g++ -static -O3 -flto -march=native 3 4 STUDENTS =\ 5 anazarova \ 6 babushkin \ 7 balyaev \ 8 bersekov \ 9 buskin \ 10 gavrilov \ 11 gorobzov \ 12 gukkaev \ 13 zhumiga \ 14 zhuchenko \ 15 zubarev \ 16 krukov \ 17 kuzenkova \ 18 kulev \ 19 larin \ 20 melehov \ 21 minin \ 22 moshkov \ 23 ovchar \ 24 polanskiy \ 25 rahimov \ 26 rijov \ 27 smirnov \ 28 soshnikova \ 29 suhareva \ 30 tairova \ 31 taramova \ 32 chryachkova \ 33 czibenko \ 34 chegodaeva \ 35 usupov \ 36 yarin 37 38 BIN1 =\ 39 bell \ 40 greed \ 41 full 42 43 BIN2 =\ 44 bubble \ 45 choice \ 46 insert \ 47 shell 48 49 all: ${STUDENTS} 50 51 ${STUDENTS}: 52 @echo "=== Processing student: $@ ===" 53 @test -d "$@" || \ 54 exit 0; \ 55 test -f "$@"/Makefile && \ 56 echo Found Makefile && (\ 57 ${MAKE} -C "$@" || true) || \ 58 (ls $@/*.c >/dev/null && COMP="${CC}" || COMP="${CXX}"; \ 59 echo "No Makefile, compiling with $$COMP"; \ 60 for BIN in ${BIN1} ${BIN2}; do \ 61 echo "Compiling $$BIN"; \ 62 $$COMP "$@"/$${BIN}* -o "$@/$$BIN" || true; \ 63 test -x "$@/$$BIN" && strip "$@/$$BIN" || true; \ 64 done;) 65 66 test: enough ${BIN1} ${BIN2} 67 68 enough: 69 ./make_tests.sh 30 70 71 ${BIN1}: 72 @echo "=== Testing $@ ===" 73 @echo "=== Testing $@ ===" >> test1_results 74 @for s in ${STUDENTS}; do \ 75 echo -n "$$s: "; \ 76 echo -n "$$s: " >> test1_results; \ 77 program="$$(ls -l $$s | grep x | grep " $@" | cut -d\ -f 9)"; \ 78 ./test1.sh "./$$s/$$program" >> test1_results || true; \ 79 done; 80 81 ${BIN2}: 82 @echo "=== Testing $@ ===" 83 @echo "=== Testing $@ ===" >> test2_results 84 @for s in ${STUDENTS}; do \ 85 echo -n "$$s: "; \ 86 echo -n "$$s: " >> test2_results; \ 87 program="$$(ls -l $$s | grep x | grep " $@" | cut -d\ -f 9)"; \ 88 ./test2.sh "./$$s/$$program" >> test2_results || true; \ 89 done; 90 91 clean: 92 rm -rf test enough test1_results test2_results 93 cd test1 && ./clean.sh 94 cd test2 && ./clean.sh 95 #you should totally add restoring students' dirs here too 96 97 .PHONY: all ${STUDENTS} test ${BIN1} ${BIN2} clean