summaryrefslogtreecommitdiffstats
path: root/disk-utils/Makefile
blob: d21cedb9ed30f8d205c693f4a2bc76938aaa3c3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Makefile -- Makefile for util-linux Linux utilities
# Created: Sat Dec 26 20:09:40 1992
# Revised: Fri Oct  6 21:02:21 1995 by r.faith@ieee.org
# Copyright 1992, 1993, 1994, 1995 Rickard E. Faith (faith@cs.unc.edu)
#

include ../MCONFIG

# Where to put man pages?

MAN8= 		fdformat.8 mkswap.8 setfdprm.8

# Where to put binaries?
# See the "install" rule for the links. . .

SBIN= 		mkfs mkswap

USRBIN=		fdformat setfdprm

ETC=		fdprm

ifneq "$(CPU)" "sparc"
# fsck and mkfs will compile, but there is no kernel support on sparc
MAN8:=$(MAN8) fsck.minix.8 mkfs.8 mkfs.minix.8
SBIN:=$(SBIN) fsck.minix mkfs.minix
ifneq "$(CPU)" "m68k"
MAN8:=$(MAN8) fdisk.8 cfdisk.8 sfdisk.8
SBIN:=$(SBIN) fdisk cfdisk sfdisk
endif
else
MAN8:=$(MAN8) fdisk.8
SBIN:=$(SBIN) fdisk
endif

# Where to put datebase files?

all: $(SBIN) $(USRBIN)

cfdisk.o: cfdisk.c
ifeq "$(HAVE_SLANG)" "yes"
	$(CC) -c $(CFLAGS) -DSLCURSES=1 $< -o $@
else
ifeq "$(HAVE_NCURSES)" "yes"
	$(CC) -c $(CFLAGS) $< -o $@
else
	:
endif
endif

cfdisk: cfdisk.o llseek.o
ifeq "$(HAVE_SLANG)" "yes"
	$(CC) $(LDFLAGS) $^ -o $@ $(LIBSLANG)
else
ifeq "$(HAVE_NCURSES)" "yes"
	$(CC) $(LDFLAGS) $^ -o $@ $(LIBCURSES) -lm
else
	@echo $@ not made since it requires ncurses or slang
endif
endif

# not installed by default
activate: sfdisk
	rm -f activate
	ln -s sfdisk activate

# Rules for everything else

fdformat: fdformat.o
fsck.minix: fsck.minix.o
fsck.minix.o: fsck.minix.c bitops.h
mkfs: mkfs.o
mkfs.minix: mkfs.minix.o
mkfs.minix.o: mkfs.minix.c bitops.h
mkswap: mkswap.o
setfdprm: setfdprm.o
sfdisk: sfdisk.o

ifeq "$(CPU)" "sparc"
fdisk: fdisk.o fdisklabel.o fdisksunlabel.o llseek.o
fdisksunlabel.o: fdisksunlabel.c fdisksunlabel.h fdisk.h
else
fdisk: fdisk.o fdisklabel.o llseek.o
endif

fdisk.o: fdisk.c fdisk.h
fdisklabel.o: fdisklabel.c fdisk.h fdisklabel.h

install: all
	$(INSTALLDIR) $(SBINDIR) $(USRBINDIR) $(ETCDIR)
	$(INSTALLBIN) $(SBIN) $(SBINDIR)
	$(INSTALLBIN) $(USRBIN) $(USRBINDIR)
	$(INSTALLDAT) $(ETC) $(ETCDIR)
	$(INSTALLDIR) $(MAN8DIR)
	$(INSTALLMAN) $(MAN8) $(MAN8DIR)

.PHONY:	clean
clean:
	-rm -f *.o *~ core $(SBIN) $(USRBIN)