3 # Copyright (C) 2008-2013 Daniel Baumann <mail@daniel-baumann.ch>
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.
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.
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/>.
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.
24 SBINDIR = $(PREFIX)/sbin
25 DOCDIR = $(PREFIX)/share/doc
26 MANDIR = $(PREFIX)/share/man
28 #OPTFLAGS = -O2 -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
29 OPTFLAGS = -O2 -fomit-frame-pointer $(shell getconf LFS_CFLAGS)
30 #WARNFLAGS = -Wall -pedantic -std=c99
33 CFLAGS += $(OPTFLAGS) $(WARNFLAGS) $(DEBUGFLAGS)
39 build: dosfsck dosfslabel mkdosfs
41 dosfsck: boot.o check.o common.o fat.o file.o io.o lfn.o charconv.o dosfsck.o
43 dosfslabel: boot.o check.o common.o fat.o file.o io.o lfn.o charconv.o dosfslabel.o
47 rebuild: distclean build
49 install: install-bin install-doc install-man
52 install -d -m 0755 $(DESTDIR)/$(SBINDIR)
53 install -m 0755 dosfsck dosfslabel mkdosfs $(DESTDIR)/$(SBINDIR)
55 ln -sf dosfsck $(DESTDIR)/$(SBINDIR)/fsck.msdos
56 ln -sf dosfsck $(DESTDIR)/$(SBINDIR)/fsck.vfat
57 ln -sf mkdosfs $(DESTDIR)/$(SBINDIR)/mkfs.msdos
58 ln -sf mkdosfs $(DESTDIR)/$(SBINDIR)/mkfs.vfat
61 install -d -m 0755 $(DESTDIR)/$(DOCDIR)/dosfstools
62 install -p -m 0644 ChangeLog doc/* $(DESTDIR)/$(DOCDIR)/dosfstools
65 install -d -m 0755 $(DESTDIR)/$(MANDIR)/man8
66 install -p -m 0644 man/*.8 $(DESTDIR)/$(MANDIR)/man8
68 ln -sf dosfsck.8 $(DESTDIR)/$(MANDIR)/man8/fsck.msdos.8
69 ln -sf dosfsck.8 $(DESTDIR)/$(MANDIR)/man8/fsck.vfat.8
70 ln -sf mkdosfs.8 $(DESTDIR)/$(MANDIR)/man8/mkfs.msdos.8
71 ln -sf mkdosfs.8 $(DESTDIR)/$(MANDIR)/man8/mkfs.vfat.8
73 uninstall: uninstall-bin uninstall-doc uninstall-man
76 rm -f $(DESTDIR)/$(SBINDIR)/dosfsck
77 rm -f $(DESTDIR)/$(SBINDIR)/dosfslabel
78 rm -f $(DESTDIR)/$(SBINDIR)/mkdosfs
80 rm -f $(DESTDIR)/$(SBINDIR)/fsck.msdos
81 rm -f $(DESTDIR)/$(SBINDIR)/fsck.vfat
82 rm -f $(DESTDIR)/$(SBINDIR)/mkfs.msdos
83 rm -f $(DESTDIR)/$(SBINDIR)/mkfs.vfat
85 rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(SBINDIR)
88 rm -rf $(DESTDIR)/$(DOCDIR)/dosfstools
90 rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(DOCDIR)
93 rm -f $(DESTDIR)/$(MANDIR)/man8/dosfsck.8
94 rm -f $(DESTDIR)/$(MANDIR)/man8/dosfslabel.8
95 rm -f $(DESTDIR)/$(MANDIR)/man8/mkdosfs.8
97 rm -f $(DESTDIR)/$(MANDIR)/man8/fsck.msdos.8
98 rm -f $(DESTDIR)/$(MANDIR)/man8/fsck.vfat.8
99 rm -f $(DESTDIR)/$(MANDIR)/man8/mkfs.msdos.8
100 rm -f $(DESTDIR)/$(MANDIR)/man8/mkfs.vfat.8
102 rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(MANDIR)/man8
103 rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(MANDIR)
105 reinstall: distclean install
111 rm -f dosfsck dosfslabel mkdosfs
113 .PHONY: build rebuild install install-bin install-doc install-man uninstall uninstall-bin uninstall-doc uninstall-man reinstall clean distclean