bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 1 | # Makefile |
| 2 | # |
| 3 | # Copyright (C) 2008 Daniel Baumann <daniel@debian.org> |
| 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 | |
| 21 | DESTDIR = |
| 22 | PREFIX = /usr/local |
| 23 | SBINDIR = $(PREFIX)/sbin |
| 24 | DOCDIR = $(PREFIX)/share/doc |
| 25 | MANDIR = $(PREFIX)/share/man |
| 26 | |
| 27 | #OPTFLAGS = -O2 -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 |
| 28 | OPTFLAGS = -O2 -fomit-frame-pointer $(shell getconf LFS_CFLAGS) |
| 29 | #WARNFLAGS = -Wall -pedantic -std=c99 |
| 30 | WARNFLAGS = -Wall |
| 31 | DEBUGFLAGS = -g |
| 32 | CFLAGS += $(OPTFLAGS) $(WARNFLAGS) $(DEBUGFLAGS) |
| 33 | |
| 34 | VPATH = src |
| 35 | |
| 36 | all: build |
| 37 | |
| 38 | build: dosfsck dosfslabel mkdosfs |
| 39 | |
| 40 | dosfsck: boot.o check.o common.o fat.o file.o io.o lfn.o dosfsck.o |
| 41 | |
| 42 | dosfslabel: boot.o check.o common.o fat.o file.o io.o lfn.o dosfslabel.o |
| 43 | |
| 44 | mkdosfs: mkdosfs.o |
| 45 | |
| 46 | rebuild: distclean build |
| 47 | |
| 48 | install: install-bin install-doc install-man |
| 49 | |
| 50 | install-bin: build |
| 51 | install -d -m 0755 $(DESTDIR)/$(SBINDIR) |
| 52 | install -m 0755 dosfsck dosfslabel mkdosfs $(DESTDIR)/$(SBINDIR) |
| 53 | |
| 54 | ln -sf dosfsck $(DESTDIR)/$(SBINDIR)/fsck.msdos |
| 55 | ln -sf dosfsck $(DESTDIR)/$(SBINDIR)/fsck.vfat |
| 56 | ln -sf mkdosfs $(DESTDIR)/$(SBINDIR)/mkfs.msdos |
| 57 | ln -sf mkdosfs $(DESTDIR)/$(SBINDIR)/mkfs.vfat |
| 58 | |
| 59 | install-doc: |
| 60 | install -d -m 0755 $(DESTDIR)/$(DOCDIR)/dosfstools |
| 61 | install -p -m 0644 ChangeLog doc/* $(DESTDIR)/$(DOCDIR)/dosfstools |
| 62 | |
| 63 | install-man: |
| 64 | install -d -m 0755 $(DESTDIR)/$(MANDIR)/man8 |
| 65 | install -p -m 0644 man/*.8 $(DESTDIR)/$(MANDIR)/man8 |
| 66 | |
| 67 | ln -sf dosfsck.8 $(DESTDIR)/$(MANDIR)/man8/fsck.msdos.8 |
| 68 | ln -sf dosfsck.8 $(DESTDIR)/$(MANDIR)/man8/fsck.vfat.8 |
| 69 | ln -sf mkdosfs.8 $(DESTDIR)/$(MANDIR)/man8/mkfs.msdos.8 |
| 70 | ln -sf mkdosfs.8 $(DESTDIR)/$(MANDIR)/man8/mkfs.vfat.8 |
| 71 | |
| 72 | uninstall: uninstall-bin uninstall-doc uninstall-man |
| 73 | |
| 74 | uninstall-bin: |
| 75 | rm -f $(DESTDIR)/$(SBINDIR)/dosfsck |
| 76 | rm -f $(DESTDIR)/$(SBINDIR)/dosfslabel |
| 77 | rm -f $(DESTDIR)/$(SBINDIR)/mkdosfs |
| 78 | |
| 79 | rm -f $(DESTDIR)/$(SBINDIR)/fsck.msdos |
| 80 | rm -f $(DESTDIR)/$(SBINDIR)/fsck.vfat |
| 81 | rm -f $(DESTDIR)/$(SBINDIR)/mkfs.msdos |
| 82 | rm -f $(DESTDIR)/$(SBINDIR)/mkfs.vfat |
| 83 | |
| 84 | rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(SBINDIR) |
| 85 | |
| 86 | uninstall-doc: |
| 87 | rm -rf $(DESTDIR)/$(DOCDIR)/dosfstools |
| 88 | |
| 89 | rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(DOCDIR) |
| 90 | |
| 91 | uninstall-man: |
| 92 | rm -f $(DESTDIR)/$(MANDIR)/man8/dosfsck.8 |
| 93 | rm -f $(DESTDIR)/$(MANDIR)/man8/dosfslabel.8 |
| 94 | rm -f $(DESTDIR)/$(MANDIR)/man8/mkdosfs.8 |
| 95 | |
| 96 | rm -f $(DESTDIR)/$(MANDIR)/man8/fsck.msdos.8 |
| 97 | rm -f $(DESTDIR)/$(MANDIR)/man8/fsck.vfat.8 |
| 98 | rm -f $(DESTDIR)/$(MANDIR)/man8/mkfs.msdos.8 |
| 99 | rm -f $(DESTDIR)/$(MANDIR)/man8/mkfs.vfat.8 |
| 100 | |
| 101 | rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(MANDIR)/man8 |
| 102 | rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(MANDIR) |
| 103 | |
| 104 | reinstall: distclean install |
| 105 | |
| 106 | clean: |
| 107 | rm -f *.o |
| 108 | |
| 109 | distclean: clean |
| 110 | rm -f dosfsck dosfslabel mkdosfs |
| 111 | |
| 112 | .PHONY: build rebuild install install-bin install-doc install-man uninstall uninstall-bin uninstall-doc uninstall-man reinstall clean distclean |