]> git.ozlabs.org Git - yaboot.git/blob - Makefile
ofpath: Add support for VSCSI, VFC, and SAS
[yaboot.git] / Makefile
1 ## Setup
2
3 include Config
4
5 VERSION = 1.3.17
6 # Debug mode (spam/verbose)
7 DEBUG = 0
8 # make install vars
9 ROOT =
10 PREFIX = usr/local
11 MANDIR = man
12 # command used to get root (needed for tarball creation)
13 GETROOT = fakeroot
14
15 # We use fixed addresses to avoid overlap when relocating
16 # and other trouble with initrd
17
18 # Load the bootstrap at 1Mb
19 TEXTADDR        = 0x100000
20 # Malloc block of 1MB
21 MALLOCSIZE      = 0x100000
22 # Load kernel and ramdisk at as low as possible
23 KERNELADDR      = 0x00000000
24
25 # Set this to the prefix of your cross-compiler, if you have one.
26 # Else leave it empty.
27 #
28 CROSS =
29
30 CC              := $(CROSS)gcc
31 LD              := $(CROSS)ld
32 AS              := $(CROSS)as
33 OBJCOPY         := $(CROSS)objcopy
34
35 # The flags for the yaboot binary.
36 #
37 YBCFLAGS = -Os -m32 $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -m32 -print-file-name=include` -fsigned-char
38 YBCFLAGS += -DVERSION="\"${VERSION}${VERSIONEXTRA}\""
39 YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG)
40 YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE)
41 YBCFLAGS += -DKERNELADDR=$(KERNELADDR)
42 YBCFLAGS += -Werror -fdiagnostics-show-option
43 YBCFLAGS += -I ./include
44 YBCFLAGS += -fno-strict-aliasing
45
46 ifeq ($(CONFIG_COLOR_TEXT),y)
47 YBCFLAGS += -DCONFIG_COLOR_TEXT
48 endif
49
50 ifeq ($(CONFIG_SET_COLORMAP),y)
51 YBCFLAGS += -DCONFIG_SET_COLORMAP
52 endif
53
54 ifeq ($(USE_MD5_PASSWORDS),y)
55 YBCFLAGS += -DUSE_MD5_PASSWORDS
56 endif
57
58 ifeq ($(CONFIG_FS_XFS),y)
59 YBCFLAGS += -DCONFIG_FS_XFS
60 endif
61
62 ifeq ($(CONFIG_FS_REISERFS),y)
63 YBCFLAGS += -DCONFIG_FS_REISERFS
64 endif
65
66 # Link flags
67 #
68 LFLAGS = -Ttext $(TEXTADDR) -Bstatic -melf32ppclinux
69
70 # Libraries
71 #
72 LLIBS = -lext2fs
73
74 # For compiling userland utils
75 #
76 UCFLAGS = -Os $(CFLAGS) -Wall -I/usr/include
77 UCFLAGS += -Werror -fdiagnostics-show-option
78
79 # For compiling build-tools that run on the host.
80 #
81 HOSTCC = gcc
82 HOSTCFLAGS = -O2 $(CFLAGS) -Wall -I/usr/include
83
84 ## End of configuration section
85
86 OBJS = second/crt0.o second/yaboot.o second/cache.o second/prom.o second/file.o \
87         second/partition.o second/fs.o second/cfg.o second/setjmp.o second/cmdline.o \
88         second/fs_of.o second/fs_ext2.o second/fs_iso.o second/fs_swap.o \
89         second/iso_util.o \
90         lib/nonstd.o \
91         lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/strstr.o
92
93 ifeq ($(USE_MD5_PASSWORDS),y)
94 OBJS += second/md5.o
95 endif
96
97 ifeq ($(CONFIG_FS_XFS),y)
98 OBJS += second/fs_xfs.o
99 endif
100
101 ifeq ($(CONFIG_FS_REISERFS),y)
102 OBJS += second/fs_reiserfs.o
103 endif
104
105 # compilation
106 lgcc = `$(CC) -m32 -print-libgcc-file-name`
107
108 all: yaboot addnote mkofboot
109
110 yaboot: $(OBJS)
111         $(LD) $(LFLAGS) $(OBJS) $(LLIBS) $(lgcc) -o second/$@
112         chmod -x second/yaboot
113
114 addnote:
115         $(CC) $(UCFLAGS) -o util/addnote util/addnote.c
116
117 elfextract:
118         $(CC) $(UCFLAGS) -o util/elfextract util/elfextract.c
119
120 mkofboot:
121         ln -sf ybin ybin/mkofboot
122         @if [ $$(grep '^VERSION=' ybin/ybin | cut -f2 -d=) != ${VERSION} ] ; then       \
123                 echo "ybin/ybin: warning: VERSION  mismatch";                           \
124                 false;                                                                  \
125         fi
126
127 %.o: %.c
128         $(CC) $(YBCFLAGS) -c -o $@ $<
129
130 %.o: %.S
131         $(CC) $(YBCFLAGS) -D__ASSEMBLY__  -c -o $@ $<
132
133 dep:
134         makedepend -Iinclude *.c lib/*.c util/*.c gui/*.c
135
136 docs:
137         make -C doc all
138
139 bindist: all
140         mkdir ../yaboot-binary-${VERSION}
141         $(GETROOT) make ROOT=../yaboot-binary-${VERSION} install
142         mkdir -p -m 755 ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot
143         cp -a COPYING ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/COPYING
144         cp -a README ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/README
145         cp -a doc/README.rs6000 ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/README.rs6000
146         cp -a doc/yaboot-howto.html ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/yaboot-howto.html
147         cp -a doc/yaboot-howto.sgml ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/yaboot-howto.sgml
148         mv ../yaboot-binary-${VERSION}/etc/yaboot.conf ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/
149         rmdir ../yaboot-binary-${VERSION}/etc
150         $(GETROOT) tar -C ../yaboot-binary-${VERSION} -zcvpf ../yaboot-binary-${VERSION}.tar.gz .
151         rm -rf ../yaboot-binary-${VERSION}
152
153 clean:
154         rm -f second/yaboot util/addnote util/elfextract $(OBJS)
155         find . -not -path './\{arch\}*' -name '#*' | xargs rm -f
156         find . -not -path './\{arch\}*' -name '.#*' | xargs rm -f
157         find . -not -path './\{arch\}*' -name '*~' | xargs rm -f
158         find . -not -path './\{arch\}*' -name '*.swp' | xargs rm -f
159         find . -not -path './\{arch\}*' -name ',,*' | xargs rm -rf
160         -gunzip man/*.gz
161         rm -rf man.deb
162
163 cleandocs:
164         make -C doc clean
165
166 ## removes arch revision control crap, only to be called for making
167 ## release tarballs.  arch should have a export command like cvs...
168
169 archclean:
170         rm -rf '{arch}'
171         find . -type d -name .arch-ids | xargs rm -rf
172         rm -f 0arch-timestamps0
173
174 maintclean: clean cleandocs
175
176 release: docs bindist clean
177
178 strip: all
179         strip second/yaboot
180         strip --remove-section=.comment second/yaboot
181         strip util/addnote
182         strip --remove-section=.comment --remove-section=.note util/addnote
183
184 install: all strip
185         install -d -o root -g root -m 0755 ${ROOT}/etc/
186         install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/sbin/
187         install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/lib
188         install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/lib/yaboot
189         install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man5/
190         install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man8/
191         install -o root -g root -m 0644 second/yaboot ${ROOT}/$(PREFIX)/lib/yaboot
192         install -o root -g root -m 0755 util/addnote ${ROOT}/${PREFIX}/lib/yaboot/addnote
193         install -o root -g root -m 0644 first/ofboot ${ROOT}/${PREFIX}/lib/yaboot/ofboot
194         install -o root -g root -m 0755 ybin/ofpath ${ROOT}/${PREFIX}/sbin/ofpath
195         install -o root -g root -m 0755 ybin/ybin ${ROOT}/${PREFIX}/sbin/ybin
196         install -o root -g root -m 0755 ybin/yabootconfig ${ROOT}/${PREFIX}/sbin/yabootconfig
197         rm -f ${ROOT}/${PREFIX}/sbin/mkofboot
198         ln -s ybin ${ROOT}/${PREFIX}/sbin/mkofboot
199         @gzip -9 man/*.[58]
200         install -o root -g root -m 0644 man/bootstrap.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/bootstrap.8.gz
201         install -o root -g root -m 0644 man/mkofboot.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/mkofboot.8.gz
202         install -o root -g root -m 0644 man/ofpath.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/ofpath.8.gz
203         install -o root -g root -m 0644 man/yaboot.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/yaboot.8.gz
204         install -o root -g root -m 0644 man/yabootconfig.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/yabootconfig.8.gz
205         install -o root -g root -m 0644 man/ybin.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/ybin.8.gz
206         install -o root -g root -m 0644 man/yaboot.conf.5.gz ${ROOT}/${PREFIX}/${MANDIR}/man5/yaboot.conf.5.gz
207         @gunzip man/*.gz
208         @if [ ! -e ${ROOT}/etc/yaboot.conf ] ; then                                             \
209                 echo "install -o root -g root -m 0644 etc/yaboot.conf ${ROOT}/etc/yaboot.conf"; \
210                 install -o root -g root -m 0644 etc/yaboot.conf ${ROOT}/etc/yaboot.conf;        \
211          else                                                                                   \
212                 echo "/etc/yaboot.conf already exists, leaving it alone";                       \
213          fi
214         @echo
215         @echo "Installation successful."
216         @echo
217         @echo "An example /etc/yaboot.conf has been installed (unless /etc/yaboot.conf already existed)"
218         @echo "You may either alter that file to match your system, or alternatively run yabootconfig"
219         @echo "yabootconfig will generate a simple and valid /etc/yaboot.conf for your system"
220         @echo
221
222 deinstall:
223         rm -f ${ROOT}/${PREFIX}/sbin/ofpath
224         rm -f ${ROOT}/${PREFIX}/sbin/ybin
225         rm -f ${ROOT}/${PREFIX}/sbin/yabootconfig
226         rm -f ${ROOT}/${PREFIX}/sbin/mkofboot
227         rm -f ${ROOT}/${PREFIX}/lib/yaboot/yaboot
228         rm -f ${ROOT}/${PREFIX}/lib/yaboot/ofboot
229         rm -f ${ROOT}/${PREFIX}/lib/yaboot/addnote
230         @rmdir ${ROOT}/${PREFIX}/lib/yaboot || true
231         rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/bootstrap.8.gz
232         rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/mkofboot.8.gz
233         rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/ofpath.8.gz
234         rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/yaboot.8.gz
235         rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/yabootconfig.8.gz
236         rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/ybin.8.gz
237         rm -f ${ROOT}/${PREFIX}/${MANDIR}/man5/yaboot.conf.5.gz
238         @if [ -L ${ROOT}/boot/yaboot -a ! -e ${ROOT}/boot/yaboot ] ; then rm -f ${ROOT}/boot/yaboot ; fi
239         @if [ -L ${ROOT}/boot/ofboot.b -a ! -e ${ROOT}/boot/ofboot.b ] ; then rm -f ${ROOT}/boot/ofboot.b ; fi
240         @echo
241         @echo "Deinstall successful."
242         @echo "${ROOT}/etc/yaboot.conf has not been removed, you may remove it yourself if you wish."
243
244 uninstall: deinstall