makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. ## Copyright (C) 2016 Jeremiah Orians
  2. ## Copyright (C) 2020 fosslinux
  3. ## This file is part of mescc-tools.
  4. ##
  5. ## mescc-tools is free software: you an redistribute it and/or modify
  6. ## it under the terms of the GNU General Public License as published by
  7. ## the Free Software Foundation, either version 3 of the License, or
  8. ## (at your option) any later version.
  9. ##
  10. ## mescc-tools is distributed in the hope that it will be useful,
  11. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ## GNU General Public License for more details.
  14. ##
  15. ## You should have received a copy of the GNU General Public License
  16. ## along with mescc-tools. If not, see <http://www.gnu.org/licenses/>.
  17. # Prevent rebuilding
  18. all: kaem
  19. CC=gcc
  20. CFLAGS:=$(CFLAGS) -D_GNU_SOURCE -std=c99 -ggdb
  21. kaem: ../bin/kaem
  22. ../bin/kaem: kaem.c kaem_globals.c variable.c | bin
  23. $(CC) $(CFLAGS) kaem.c \
  24. kaem_globals.c \
  25. variable.c \
  26. ../M2libc/bootstrappable.c \
  27. -o $@
  28. # Always run the tests
  29. .PHONY: test
  30. test: kaem | results
  31. ./test.sh
  32. # Generate test answers
  33. .PHONY: Generate-test-answers
  34. Generate-test-answers:
  35. sha256sum test/results/* >| test/test.answers
  36. # Clean up after ourselves
  37. .PHONY: clean kaem
  38. clean:
  39. rm -rf ../bin/
  40. rm -rf test/results/
  41. results:
  42. mkdir -p test/results
  43. bin:
  44. mkdir -p ../bin
  45. DESTDIR:=
  46. PREFIX:=/usr/local
  47. bindir:=$(DESTDIR)$(PREFIX)/bin
  48. .PHONY: install
  49. install: ../bin/kaem
  50. mkdir -p $(bindir)
  51. cp $^ $(bindir)