Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Makefile
  2. #
  3. # Copyright (C) 2008-2013 Daniel Baumann <mail@daniel-baumann.ch>
  4. #
  5. # This program is free software: you can 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. # This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
  17. #
  18. # On Debian systems, the complete text of the GNU General Public License
  19. # can be found in /usr/share/common-licenses/GPL-3 file.
  20. DESTDIR =
  21. PREFIX = /usr/local
  22. SBINDIR = $(PREFIX)/sbin
  23. DOCDIR = $(PREFIX)/share/doc
  24. MANDIR = $(PREFIX)/share/man
  25. #OPTFLAGS = -O2 -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
  26. OPTFLAGS = -O2 -fomit-frame-pointer $(shell getconf LFS_CFLAGS)
  27. #WARNFLAGS = -Wall -pedantic -std=c99
  28. WARNFLAGS = -Wall
  29. DEBUGFLAGS = -g
  30. CFLAGS += $(OPTFLAGS) $(WARNFLAGS) $(DEBUGFLAGS)
  31. VPATH = src
  32. all: build
  33. build: dosfsck dosfslabel mkdosfs
  34. dosfsck: boot.o check.o common.o fat.o file.o io.o lfn.o dosfsck.o ui.o
  35. dosfslabel: boot.o check.o common.o fat.o file.o io.o lfn.o dosfslabel.o ui.o
  36. mkdosfs: mkdosfs.o
  37. rebuild: distclean build
  38. install: install-bin install-doc install-man
  39. install-bin: build
  40. install -d -m 0755 $(DESTDIR)/$(SBINDIR)
  41. install -m 0755 dosfsck dosfslabel mkdosfs $(DESTDIR)/$(SBINDIR)
  42. ln -sf dosfsck $(DESTDIR)/$(SBINDIR)/fsck.msdos
  43. ln -sf dosfsck $(DESTDIR)/$(SBINDIR)/fsck.vfat
  44. ln -sf mkdosfs $(DESTDIR)/$(SBINDIR)/mkfs.msdos
  45. ln -sf mkdosfs $(DESTDIR)/$(SBINDIR)/mkfs.vfat
  46. install-doc:
  47. install -d -m 0755 $(DESTDIR)/$(DOCDIR)/dosfstools
  48. install -p -m 0644 ChangeLog doc/* $(DESTDIR)/$(DOCDIR)/dosfstools
  49. install-man:
  50. install -d -m 0755 $(DESTDIR)/$(MANDIR)/man8
  51. install -p -m 0644 man/*.8 $(DESTDIR)/$(MANDIR)/man8
  52. ln -sf dosfsck.8 $(DESTDIR)/$(MANDIR)/man8/fsck.msdos.8
  53. ln -sf dosfsck.8 $(DESTDIR)/$(MANDIR)/man8/fsck.vfat.8
  54. ln -sf mkdosfs.8 $(DESTDIR)/$(MANDIR)/man8/mkfs.msdos.8
  55. ln -sf mkdosfs.8 $(DESTDIR)/$(MANDIR)/man8/mkfs.vfat.8
  56. uninstall: uninstall-bin uninstall-doc uninstall-man
  57. uninstall-bin:
  58. rm -f $(DESTDIR)/$(SBINDIR)/dosfsck
  59. rm -f $(DESTDIR)/$(SBINDIR)/dosfslabel
  60. rm -f $(DESTDIR)/$(SBINDIR)/mkdosfs
  61. rm -f $(DESTDIR)/$(SBINDIR)/fsck.msdos
  62. rm -f $(DESTDIR)/$(SBINDIR)/fsck.vfat
  63. rm -f $(DESTDIR)/$(SBINDIR)/mkfs.msdos
  64. rm -f $(DESTDIR)/$(SBINDIR)/mkfs.vfat
  65. rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(SBINDIR)
  66. uninstall-doc:
  67. rm -rf $(DESTDIR)/$(DOCDIR)/dosfstools
  68. rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(DOCDIR)
  69. uninstall-man:
  70. rm -f $(DESTDIR)/$(MANDIR)/man8/dosfsck.8
  71. rm -f $(DESTDIR)/$(MANDIR)/man8/dosfslabel.8
  72. rm -f $(DESTDIR)/$(MANDIR)/man8/mkdosfs.8
  73. rm -f $(DESTDIR)/$(MANDIR)/man8/fsck.msdos.8
  74. rm -f $(DESTDIR)/$(MANDIR)/man8/fsck.vfat.8
  75. rm -f $(DESTDIR)/$(MANDIR)/man8/mkfs.msdos.8
  76. rm -f $(DESTDIR)/$(MANDIR)/man8/mkfs.vfat.8
  77. rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(MANDIR)/man8
  78. rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(MANDIR)
  79. reinstall: distclean install
  80. clean:
  81. rm -f *.o
  82. distclean: clean
  83. rm -f dosfsck dosfslabel mkdosfs
  84. .PHONY: build rebuild install install-bin install-doc install-man uninstall uninstall-bin uninstall-doc uninstall-man reinstall clean distclean