Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. GCC = gcc
  2. CFLAGS = -g -Wall -Wshadow
  3. OBJS = answer02.o pa02.o
  4. HDRS = pa02.h
  5. VALGRIND = valgrind --tool=memcheck --leak-check=full --verbose
  6. .PHONY : test memcheck help clean
  7. pa02: $(OBJS) $(HDRS)
  8. $(GCC) $(CFLAGS) $(OBJS) -o $@
  9. test:
  10. mkdir -p outputs
  11. rm -f outputs/*output*
  12. ./pa02 inputs/filelist
  13. diff -q -w outputs/intoutput01 expected/intexpected01
  14. diff -q -w outputs/intoutput02 expected/intexpected02
  15. diff -q -w outputs/intoutput03 expected/intexpected03
  16. diff -q -w outputs/intoutput04 expected/intexpected04
  17. diff -q -w outputs/intoutput05 expected/intexpected05
  18. diff -q -w outputs/intoutput06 expected/intexpected06
  19. diff -q -w outputs/stroutput01 expected/strexpected01
  20. diff -q -w outputs/stroutput02 expected/strexpected02
  21. diff -q -w outputs/stroutput03 expected/strexpected03
  22. diff -q -w outputs/stroutput04 expected/strexpected04
  23. diff -q -w outputs/stroutput05 expected/strexpected05
  24. diff -q -w outputs/stroutput06 expected/strexpected06
  25. memcheck:
  26. $(VALGRIND) --log-file=outputs/memoutput ./pa02 inputs/filelist
  27. help:
  28. @echo " Commands Meaning"
  29. @echo " ---------------------------------------------"
  30. @echo " make compile the file"
  31. @echo " make test run tests"
  32. @echo " make memcheck run valgrind to check memory"
  33. @echo " make clean start from scratch"
  34. .c.o:
  35. $(GCC) $(CFLAGS) -c $*.c
  36. clean:
  37. rm -f pa02 $(OBJS) outputs/*output*