]> git.ipfire.org Git - thirdparty/mdadm.git/blob - Makefile
When updating uuid, update the bitmap as well - external bitmaps
[thirdparty/mdadm.git] / Makefile
1 #
2 # mdadm - manage Linux "md" devices aka RAID arrays.
3 #
4 # Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au>
5 #
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #
21 # Author: Neil Brown
22 # Email: <neilb@cse.unsw.edu.au>
23 # Paper: Neil Brown
24 # School of Computer Science and Engineering
25 # The University of New South Wales
26 # Sydney, 2052
27 # Australia
28 #
29
30 # define "CXFLAGS" to give extra flags to CC.
31 # e.g. make CXFLAGS=-O to optimise
32 TCC = tcc
33 UCLIBC_GCC = $(shell for nm in i386-uclibc-linux-gcc i386-uclibc-gcc; do which $$nm > /dev/null && { echo $$nm ; exit; } ; done; echo false No uclibc found )
34 DIET_GCC = diet gcc
35
36 KLIBC=/home/src/klibc/klibc-0.77
37
38 KLIBC_GCC = gcc -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32
39
40 CC = $(CROSS_COMPILE)gcc
41 CXFLAGS = -ggdb
42 CWFLAGS = -Wall -Werror -Wstrict-prototypes
43
44 ifdef DEBIAN
45 CPPFLAGS= -DDEBIAN
46 else
47 CPPFLAGS=
48 endif
49
50 SYSCONFDIR = /etc
51 CONFFILE = $(SYSCONFDIR)/mdadm.conf
52 MAILCMD =/usr/sbin/sendmail -t
53 CFLAGS = $(CWFLAGS) $(STATIC) $(CPPFLAGS) -DCONFFILE=\"$(CONFFILE)\" $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\"
54
55 # If you want a static binary, you might uncomment these
56 # LDFLAGS = -static
57 # STRIP = -s
58
59 INSTALL = /usr/bin/install
60 DESTDIR =
61 BINDIR = /sbin
62 MANDIR = /usr/share/man
63 MAN4DIR = $(MANDIR)/man4
64 MAN5DIR = $(MANDIR)/man5
65 MAN8DIR = $(MANDIR)/man8
66
67 OBJS = mdadm.o config.o mdstat.o ReadMe.o util.o Manage.o Assemble.o Build.o \
68 Create.o Detail.o Examine.o Grow.o Monitor.o dlink.o Kill.o Query.o \
69 mdopen.o super0.o super1.o bitmap.o restripe.o sysfs.o
70 SRCS = mdadm.c config.c mdstat.c ReadMe.c util.c Manage.c Assemble.c Build.c \
71 Create.c Detail.c Examine.c Grow.c Monitor.c dlink.c Kill.c Query.c \
72 mdopen.c super0.c super1.c bitmap.c restripe.c sysfs.c
73
74 ASSEMBLE_SRCS := mdassemble.c Assemble.c config.c dlink.c util.c super0.c super1.c
75 ASSEMBLE_FLAGS:= -DMDASSEMBLE
76 ifdef MDASSEMBLE_AUTO
77 ASSEMBLE_SRCS += mdopen.c mdstat.c
78 ASSEMBLE_FLAGS += -DMDASSEMBLE_AUTO
79 endif
80
81 all : mdadm mdadm.man md.man mdadm.conf.man
82
83 everything: all mdadm.static mdadm.uclibc swap_super test_stripe mdassemble mdassemble.uclibc mdassemble.static mdassemble.man
84 # mdadm.tcc doesn't work..
85
86 mdadm : rmconf $(OBJS)
87 $(CC) $(LDFLAGS) -o mdadm $(OBJS)
88
89 mdadm.static : STATIC=-DSTATIC
90 mdadm.static : rmconf $(OBJS)
91 $(CC) $(LDFLAGS) -DSTATIC -static -o mdadm.static $(OBJS)
92 rmconf:
93 rm -f config.o
94
95 mdadm.tcc : $(SRCS) mdadm.h
96 $(TCC) -o mdadm.tcc $(SRCS)
97
98 mdadm.uclibc : $(SRCS) mdadm.h
99 $(UCLIBC_GCC) -DUCLIBC -o mdadm.uclibc $(SRCS)
100
101 mdadm.klibc : $(SRCS) mdadm.h
102 rm -f $(OBJS)
103 gcc -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32 $(CFLAGS) $(SRCS)
104
105 test_stripe : restripe.c mdadm.h
106 $(CC) $(CXFLAGS) $(LDFLAGS) -o test_stripe -DMAIN restripe.c
107
108 mdassemble : $(ASSEMBLE_SRCS) mdadm.h
109 rm -f $(OBJS)
110 $(DIET_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)
111
112 mdassemble.static : $(ASSEMBLE_SRCS) mdadm.h
113 rm -f $(OBJS)
114 $(CC) $(LDFLAGS) $(ASSEMBLE_FLAGS) -static -o mdassemble.static $(ASSEMBLE_SRCS)
115
116 mdassemble.uclibc : $(ASSEMBLE_SRCS) mdadm.h
117 rm -f $(OBJS)
118 $(UCLIBC_GCC) $(ASSEMBLE_FLAGS) -DUCLIBC -static -o mdassemble.uclibc $(ASSEMBLE_SRCS)
119
120 # This doesn't work
121 mdassemble.klibc : $(ASSEMBLE_SRCS) mdadm.h
122 rm -f $(OBJS)
123 $(KLIBC_GCC) $(CFLAGS) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)
124
125 mdadm.man : mdadm.8
126 nroff -man mdadm.8 > mdadm.man
127
128 md.man : md.4
129 nroff -man md.4 > md.man
130
131 mdadm.conf.man : mdadm.conf.5
132 nroff -man mdadm.conf.5 > mdadm.conf.man
133
134 mdassemble.man : mdassemble.8
135 nroff -man mdassemble.8 > mdassemble.man
136
137 $(OBJS) : mdadm.h bitmap.h
138
139 install : mdadm mdadm.8 md.4 mdadm.conf.5
140 $(INSTALL) -D $(STRIP) -m 755 mdadm $(DESTDIR)$(BINDIR)/mdadm
141 $(INSTALL) -D -m 644 mdadm.8 $(DESTDIR)$(MAN8DIR)/mdadm.8
142 $(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
143 $(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
144
145 clean :
146 rm -f mdadm $(OBJS) core *.man mdadm.tcc mdadm.uclibc mdadm.static *.orig *.porig *.rej *.alt \
147 mdassemble mdassemble.static mdassemble.uclibc mdassemble.klibc swap_super \
148 init.cpio.gz mdadm.uclibc.static test_stripe
149
150 dist : clean
151 ./makedist
152
153 testdist : everything clean
154 ./makedist test
155
156 TAGS :
157 etags *.h *.c