]> git.ipfire.org Git - thirdparty/mdadm.git/blob - Makefile
Make homehost information appear in superblock.
[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 LDLIBS=-lssl
36
37 KLIBC=/home/src/klibc/klibc-0.77
38
39 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
40
41 CC = $(CROSS_COMPILE)gcc
42 CXFLAGS = -ggdb
43 CWFLAGS = -Wall -Werror -Wstrict-prototypes
44
45 ifdef DEBIAN
46 CPPFLAGS= -DDEBIAN
47 else
48 CPPFLAGS=
49 endif
50
51 SYSCONFDIR = /etc
52 CONFFILE = $(SYSCONFDIR)/mdadm.conf
53 MAILCMD =/usr/sbin/sendmail -t
54 CFLAGS = $(CWFLAGS) $(STATIC) $(CPPFLAGS) -DCONFFILE=\"$(CONFFILE)\" $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\"
55
56 # If you want a static binary, you might uncomment these
57 # LDFLAGS = -static
58 # STRIP = -s
59
60 INSTALL = /usr/bin/install
61 DESTDIR =
62 BINDIR = /sbin
63 MANDIR = /usr/share/man
64 MAN4DIR = $(MANDIR)/man4
65 MAN5DIR = $(MANDIR)/man5
66 MAN8DIR = $(MANDIR)/man8
67
68 OBJS = mdadm.o config.o mdstat.o ReadMe.o util.o Manage.o Assemble.o Build.o \
69 Create.o Detail.o Examine.o Grow.o Monitor.o dlink.o Kill.o Query.o \
70 mdopen.o super0.o super1.o bitmap.o restripe.o sysfs.o
71 SRCS = mdadm.c config.c mdstat.c ReadMe.c util.c Manage.c Assemble.c Build.c \
72 Create.c Detail.c Examine.c Grow.c Monitor.c dlink.c Kill.c Query.c \
73 mdopen.c super0.c super1.c bitmap.c restripe.c sysfs.c
74
75 ASSEMBLE_SRCS := mdassemble.c Assemble.c config.c dlink.c util.c super0.c super1.c
76 ASSEMBLE_FLAGS:= -DMDASSEMBLE
77 ifdef MDASSEMBLE_AUTO
78 ASSEMBLE_SRCS += mdopen.c mdstat.c
79 ASSEMBLE_FLAGS += -DMDASSEMBLE_AUTO
80 endif
81
82 all : mdadm mdadm.man md.man mdadm.conf.man
83
84 everything: all mdadm.static mdadm.uclibc swap_super test_stripe mdassemble mdassemble.uclibc mdassemble.static mdassemble.man
85 # mdadm.tcc doesn't work..
86
87 mdadm : rmconf $(OBJS)
88 $(CC) $(LDFLAGS) -o mdadm $(OBJS) $(LDLIBS)
89
90 mdadm.static : STATIC=-DSTATIC
91 mdadm.static : rmconf $(OBJS)
92 $(CC) $(LDFLAGS) -DSTATIC -static -o mdadm.static $(OBJS) SHA1.o sha1.o
93 rmconf:
94 rm -f config.o
95
96 mdadm.tcc : $(SRCS) mdadm.h
97 $(TCC) -o mdadm.tcc $(SRCS)
98
99 mdadm.uclibc : $(SRCS) mdadm.h
100 $(UCLIBC_GCC) -DUCLIBC -o mdadm.uclibc $(SRCS)
101
102 mdadm.klibc : $(SRCS) mdadm.h
103 rm -f $(OBJS)
104 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)
105
106 test_stripe : restripe.c mdadm.h
107 $(CC) $(CXFLAGS) $(LDFLAGS) -o test_stripe -DMAIN restripe.c
108
109 mdassemble : $(ASSEMBLE_SRCS) mdadm.h
110 rm -f $(OBJS)
111 $(DIET_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)
112
113 mdassemble.static : $(ASSEMBLE_SRCS) mdadm.h
114 rm -f $(OBJS)
115 $(CC) $(LDFLAGS) $(ASSEMBLE_FLAGS) -static -o mdassemble.static $(ASSEMBLE_SRCS)
116
117 mdassemble.uclibc : $(ASSEMBLE_SRCS) mdadm.h
118 rm -f $(OBJS)
119 $(UCLIBC_GCC) $(ASSEMBLE_FLAGS) -DUCLIBC -static -o mdassemble.uclibc $(ASSEMBLE_SRCS)
120
121 # This doesn't work
122 mdassemble.klibc : $(ASSEMBLE_SRCS) mdadm.h
123 rm -f $(OBJS)
124 $(KLIBC_GCC) $(CFLAGS) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)
125
126 mdadm.man : mdadm.8
127 nroff -man mdadm.8 > mdadm.man
128
129 md.man : md.4
130 nroff -man md.4 > md.man
131
132 mdadm.conf.man : mdadm.conf.5
133 nroff -man mdadm.conf.5 > mdadm.conf.man
134
135 mdassemble.man : mdassemble.8
136 nroff -man mdassemble.8 > mdassemble.man
137
138 $(OBJS) : mdadm.h bitmap.h
139
140 sha1.o : sha1.c sha1.h md5.h
141 $(CC) $(CFLAGS) -DHAVE_STDINT_H -o sha1.o -c sha1.c
142 SHA1.o : SHA1.c
143 $(CC) $(CFLAGS) -DHAVE_STDINT_H -o SHA1.o -c SHA1.c
144
145 install : mdadm mdadm.8 md.4 mdadm.conf.5
146 $(INSTALL) -D $(STRIP) -m 755 mdadm $(DESTDIR)$(BINDIR)/mdadm
147 $(INSTALL) -D -m 644 mdadm.8 $(DESTDIR)$(MAN8DIR)/mdadm.8
148 $(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
149 $(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
150
151 clean :
152 rm -f mdadm $(OBJS) core *.man mdadm.tcc mdadm.uclibc mdadm.static *.orig *.porig *.rej *.alt \
153 mdassemble mdassemble.static mdassemble.uclibc mdassemble.klibc swap_super \
154 init.cpio.gz mdadm.uclibc.static test_stripe
155
156 dist : clean
157 ./makedist
158
159 testdist : everything clean
160 ./makedist test
161
162 TAGS :
163 etags *.h *.c