blob: 050b750a504dfa4738aab8491ebdcb2a925dcc22 [file] [log] [blame]
bigbiff bigbiff9c754052013-01-09 09:09:08 -05001# 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
21DESTDIR =
22PREFIX = /usr/local
23SBINDIR = $(PREFIX)/sbin
24DOCDIR = $(PREFIX)/share/doc
25MANDIR = $(PREFIX)/share/man
26
27#OPTFLAGS = -O2 -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
28OPTFLAGS = -O2 -fomit-frame-pointer $(shell getconf LFS_CFLAGS)
29#WARNFLAGS = -Wall -pedantic -std=c99
30WARNFLAGS = -Wall
31DEBUGFLAGS = -g
32CFLAGS += $(OPTFLAGS) $(WARNFLAGS) $(DEBUGFLAGS)
33
34VPATH = src
35
36all: build
37
38build: dosfsck dosfslabel mkdosfs
39
40dosfsck: boot.o check.o common.o fat.o file.o io.o lfn.o dosfsck.o
41
42dosfslabel: boot.o check.o common.o fat.o file.o io.o lfn.o dosfslabel.o
43
44mkdosfs: mkdosfs.o
45
46rebuild: distclean build
47
48install: install-bin install-doc install-man
49
50install-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
59install-doc:
60 install -d -m 0755 $(DESTDIR)/$(DOCDIR)/dosfstools
61 install -p -m 0644 ChangeLog doc/* $(DESTDIR)/$(DOCDIR)/dosfstools
62
63install-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
72uninstall: uninstall-bin uninstall-doc uninstall-man
73
74uninstall-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
86uninstall-doc:
87 rm -rf $(DESTDIR)/$(DOCDIR)/dosfstools
88
89 rmdir --ignore-fail-on-non-empty $(DESTDIR)/$(DOCDIR)
90
91uninstall-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
104reinstall: distclean install
105
106clean:
107 rm -f *.o
108
109distclean: 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