Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #
  2. # Makefile for nvmutils
  3. #
  4. # Copyright (C) 2022 Leah Rowe <info@minifree.org>
  5. #
  6. # Permission is hereby granted, free of charge, to any person obtaining a
  7. # copy of this software and associated documentation files (the
  8. # "Software"), to deal in the Software without restriction, including
  9. # without limitation the rights to use, copy, modify, merge, publish,
  10. # distribute, sublicense, and/or sell copies of the Software, and to
  11. # permit persons to whom the Software is furnished to do so, subject to
  12. # the following conditions:
  13. #
  14. # The above copyright notice and this permission notice shall be included
  15. # in all copies or substantial portions of the Software.
  16. #
  17. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  18. # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  21. # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  22. # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  23. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. #
  25. # config:
  26. # ----------
  27. CC=cc
  28. FORCEC99=-std=c99
  29. CFLAGS=-I. -Wall -Wextra -g $(FORCEC99)
  30. NOLINKER=-c
  31. # commands:
  32. # ----------
  33. all: clean nvmmac nvmcheck nvmfix nvmbrick nvmcp nvmswap
  34. nvmmac: obj/lib/checksum.o obj/lib/version.o obj/lib/file.o obj/lib/mac.o \
  35. obj/lib/word.o obj/nvmmac.o
  36. $(CC) $(CFLAGS) obj/lib/checksum.o obj/lib/version.o obj/lib/file.o \
  37. obj/lib/mac.o obj/lib/word.o obj/nvmmac.o -o nvmmac
  38. nvmcheck: obj/lib/checksum.o obj/lib/version.o obj/lib/file.o \
  39. obj/lib/word.o obj/nvmcheck.o
  40. $(CC) $(CFLAGS) obj/lib/checksum.o obj/lib/version.o obj/lib/file.o \
  41. obj/lib/word.o obj/nvmcheck.o -o nvmcheck
  42. nvmfix: obj/lib/checksum.o obj/lib/version.o obj/lib/file.o obj/lib/word.o \
  43. obj/nvmfix.o
  44. $(CC) $(CFLAGS) obj/lib/checksum.o obj/lib/version.o obj/lib/file.o \
  45. obj/lib/word.o obj/nvmfix.o -o nvmfix
  46. nvmbrick: obj/lib/checksum.o obj/lib/version.o obj/lib/file.o \
  47. obj/lib/word.o obj/nvmbrick.o
  48. $(CC) $(CFLAGS) obj/lib/checksum.o obj/lib/version.o obj/lib/file.o \
  49. obj/lib/word.o obj/nvmbrick.o -o nvmbrick
  50. nvmcp: obj/lib/checksum.o obj/lib/version.o obj/lib/file.o obj/lib/word.o \
  51. obj/nvmcp.o
  52. $(CC) $(CFLAGS) obj/lib/checksum.o obj/lib/version.o obj/lib/file.o \
  53. obj/lib/word.o obj/nvmcp.o -o nvmcp
  54. nvmswap: obj/lib/checksum.o obj/lib/version.o obj/lib/file.o obj/lib/word.o \
  55. obj/nvmswap.o
  56. $(CC) $(CFLAGS) obj/lib/checksum.o obj/lib/version.o obj/lib/file.o \
  57. obj/lib/word.o obj/nvmswap.o -o nvmswap
  58. clean:
  59. rm -f nvmmac nvmcheck nvmfix nvmbrick nvmcp nvmswap obj/*.o obj/lib/*.o
  60. # utils:
  61. # ----------
  62. obj/nvmmac.o:
  63. $(CC) $(CFLAGS) $(NOLINKER) src/nvmmac.c -o obj/nvmmac.o
  64. obj/nvmcheck.o:
  65. $(CC) $(CFLAGS) $(NOLINKER) src/nvmcheck.c -o obj/nvmcheck.o
  66. obj/nvmfix.o:
  67. $(CC) $(CFLAGS) $(NOLINKER) src/nvmfix.c -o obj/nvmfix.o
  68. obj/nvmbrick.o:
  69. $(CC) $(CFLAGS) $(NOLINKER) src/nvmbrick.c -o obj/nvmbrick.o
  70. obj/nvmcp.o:
  71. $(CC) $(CFLAGS) $(NOLINKER) src/nvmcp.c -o obj/nvmcp.o
  72. obj/nvmswap.o:
  73. $(CC) $(CFLAGS) $(NOLINKER) src/nvmswap.c -o obj/nvmswap.o
  74. # libs:
  75. # ----------
  76. obj/lib/checksum.o:
  77. $(CC) $(CFLAGS) $(NOLINKER) src/lib/checksum.c -o obj/lib/checksum.o
  78. obj/lib/version.o:
  79. $(CC) $(CFLAGS) $(NOLINKER) src/lib/version.c -o obj/lib/version.o
  80. obj/lib/file.o:
  81. $(CC) $(CFLAGS) $(NOLINKER) src/lib/file.c -o obj/lib/file.o
  82. obj/lib/mac.o:
  83. $(CC) $(CFLAGS) $(NOLINKER) src/lib/mac.c -o obj/lib/mac.o
  84. obj/lib/word.o:
  85. $(CC) $(CFLAGS) $(NOLINKER) src/lib/word.c -o obj/lib/word.o