root/trunk/Makefile

Revision 4413, 26.0 kB (checked in by arighi, 9 months ago)

- fix: remove README.unstable not present error when building unstable versions

from tar.bz2

The file README.unstable is not present in tar.bz2, it's only in svn
repository, but Makefile always uses it. This fix skips the README replacement
with README.unstable if README.unstable doesn't exist.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #
2 #       "SystemImager" 
3 #
4 #   Copyright (C) 1999-2006 Brian Elliott Finley
5 #   Copyright (C) 2001-2004 Hewlett-Packard Company <dannf@hp.com>
6 #   
7 #   Others who have contributed to this code:
8 #       Sean Dague <sean@dague.net>
9 #
10 #   $Id$
11 #        vi: set filetype=make:
12 #
13 #   This program is free software; you can redistribute it and/or modify
14 #   it under the terms of the GNU General Public License as published by
15 #   the Free Software Foundation; either version 2 of the License, or
16 #   (at your option) any later version.
17 #
18 #   This program is distributed in the hope that it will be useful,
19 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
20 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 #   GNU General Public License for more details.
22 #
23 #   You should have received a copy of the GNU General Public License
24 #   along with this program; if not, write to the Free Software
25 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 #
27 #
28 # ERRORS when running make:
29 #   If you encounter errors when running "make", because make couldn't find
30 #   certain things that it needs, and you are fortunate enough to be building
31 #   on a Debian system, you can issue the following command to ensure that
32 #   all of the proper tools are installed.
33 #
34 #   On Debian, "apt-get build-dep systemimager ; apt-get install wget libssl-dev", will
35 #   install all the right tools.  Note that you need the deb-src entries in
36 #   your /etc/apt/sources.list file.
37 #
38 #
39 # SystemImager file location standards:
40 #   o images will be stored in: /var/lib/systemimager/images/
41 #   o autoinstall scripts:      /var/lib/systemimager/scripts/
42 #   o tarball files for BT:     /var/lib/systemimager/tarballs/
43 #   o torrent files:            /var/lib/systemimager/torrents/
44 #   o override directories:     /var/lib/systemimager/overrides/
45 #
46 #   o web gui pages:            /usr/share/systemimager/web-gui/
47 #
48 #   o kernels:                  /usr/share/systemimager/boot/`arch`/flavor/
49 #   o initrd.img:               /usr/share/systemimager/boot/`arch`/flavor/
50 #   o boel_binaries.tar.gz:     /usr/share/systemimager/boot/`arch`/flavor/
51 #
52 #   o perl libraries:           /usr/lib/systemimager/perl/
53 #
54 #   o docs:                     Use distribution appropriate location.
55 #                               Defaults to /usr/share/doc/systemimager/
56 #                               for installs from tarball or source.
57 #
58 #   o man pages:                /usr/share/man/man8/
59 #
60 #   o log files:                /var/log/systemimager/
61 #
62 #   o configuration files:      /etc/systemimager/
63 #   o rsyncd.conf:              /etc/systemimager/rsyncd.conf
64 #   o rsyncd init script:       /etc/init.d/systemimager
65 #   o netbootmond init script:  /etc/init.d/netbootmond
66 #   
67 #   o tftp files will be copied to the appropriate destination (as determined
68 #     by the local SysAdmin when running "mkbootserver".
69 #
70 #   o user visible binaries:    /usr/bin
71 #     (si_lsimage, si_mkautoinstalldisk, si_mkautoinstallcd)
72 #   o sysadmin binaries:        /usr/sbin
73 #     (all other binaries)
74 #
75 #
76 # Standards for pre-defined rsync modules:
77 #   o boot (directory that holds architecture specific directories with
78 #           boot files for clients)
79 #   o overrides
80 #   o scripts
81 #   o torrents
82 #
83 #
84 # To include the ctcs test suite, and associated files, do a 'make WITH_CTCS=1 all'
85 #
86
87 DESTDIR :=
88 VERSION := $(shell cat VERSION)
89
90 ## is this an unstable release?
91 MINOR = $(shell echo $(VERSION) | cut -d "." -f 2)
92 UNSTABLE = 0
93 ifeq ($(shell echo "$(MINOR) % 2" | bc),1)
94 UNSTABLE = 1
95 endif
96
97 FLAVOR = $(shell cat FLAVOR)
98
99 TOPDIR  := $(CURDIR)
100
101 # RELEASE_DOCS are toplevel files that should be included with all posted
102 # tarballs, but aren't installed onto the destination machine by default
103 RELEASE_DOCS = CHANGE.LOG COPYING CREDITS README VERSION
104
105 ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
106
107 # Follows is a set of arch manipulations to distinguish between ppc types
108 ifeq ($(ARCH),ppc64)
109
110 # Check if machine is Playstation 3
111 IS_PS3 = $(shell grep -q PS3 /proc/cpuinfo && echo 1)
112 ifeq ($(IS_PS3),1)
113         ARCH = ppc64-ps3
114 else
115         IS_PPC64 := 1
116         ifneq ($(shell ls /proc/iSeries 2>/dev/null),)
117                 ARCH = ppc64-iSeries
118         endif
119 endif
120
121 endif
122
123 # is userspace 64bit
124 USERSPACE64 := 0
125 ifeq ($(ARCH),ia64)
126         USERSPACE64 := 1
127 endif
128
129 ifeq ($(ARCH),x86_64)
130         USERSPACE64 := 1
131 endif
132
133 ifneq ($(BUILD_ARCH),)
134         ARCH := $(BUILD_ARCH)
135 endif
136
137 #
138 # To be used by "make" for rules that can take it!
139 NCPUS := $(shell egrep -c '^processor' /proc/cpuinfo )
140
141 MANUAL_DIR = $(TOPDIR)/doc/manual_source
142 MANPAGE_DIR = $(TOPDIR)/doc/man
143 PATCH_DIR = $(TOPDIR)/patches
144 LIB_SRC = $(TOPDIR)/lib
145 SRC_DIR = $(TOPDIR)/src
146 BINARY_SRC = $(TOPDIR)/sbin
147
148 # destination directories
149 PREFIX = /usr
150 ETC  = $(DESTDIR)/etc
151 INITD = $(ETC)/init.d
152 USR = $(DESTDIR)$(PREFIX)
153 DOC  = $(USR)/share/doc/systemimager-doc
154 BIN = $(USR)/bin
155 SBIN = $(USR)/sbin
156 MAN8 = $(USR)/share/man/man8
157 LIB_DEST = $(USR)/lib/systemimager/perl
158 LOG_DIR = $(DESTDIR)/var/log/systemimager
159 LOCK_DIR = $(DESTDIR)/var/lock/systemimager
160
161 INITRD_DIR = $(TOPDIR)/initrd_source
162
163 BOOT_BIN_DEST     = $(USR)/share/systemimager/boot/$(ARCH)/$(FLAVOR)
164
165 PXE_CONF_SRC      = etc/pxelinux.cfg
166 PXE_CONF_DEST     = $(ETC)/systemimager/pxelinux.cfg
167
168 KBOOT_CONF_SRC    = etc/kboot.cfg
169 KBOOT_CONF_DEST   = $(ETC)/systemimager/kboot.cfg
170
171 BINARIES := si_mkautoinstallcd si_mkautoinstalldisk si_psh si_pcp si_pushoverrides si_clusterconfig
172 SBINARIES := si_addclients si_cpimage si_getimage si_mkdhcpserver si_mkdhcpstatic si_mkautoinstallscript si_mkbootserver si_mvimage si_pushupdate si_pushinstall si_rmimage si_mkrsyncd_conf si_mkclientnetboot si_netbootmond si_mkbootpackage si_monitor si_monitortk si_installbtimage
173 CLIENT_SBINARIES  := si_updateclient si_prepareclient
174 COMMON_BINARIES   = si_lsimage
175
176 IMAGESRC    = $(TOPDIR)/var/lib/systemimager/images
177 IMAGEDEST   = $(DESTDIR)/var/lib/systemimager/images
178 WARNING_FILES = $(IMAGESRC)/README $(IMAGESRC)/CUIDADO $(IMAGESRC)/ACHTUNG
179 AUTOINSTALL_SCRIPT_DIR = $(DESTDIR)/var/lib/systemimager/scripts
180 AUTOINSTALL_TORRENT_DIR = $(DESTDIR)/var/lib/systemimager/torrents
181 AUTOINSTALL_TARBALL_DIR = $(DESTDIR)/var/lib/systemimager/tarballs
182 OVERRIDES_DIR = $(DESTDIR)/var/lib/systemimager/overrides
183 OVERRIDES_README = $(TOPDIR)/var/lib/systemimager/overrides/README
184 FLAMETHROWER_STATE_DIR = $(DESTDIR)/var/state/systemimager/flamethrower
185
186 RSYNC_STUB_DIR = $(ETC)/systemimager/rsync_stubs
187
188 CHECK_FLOPPY_SIZE = expr \`du -b $(INITRD_DIR)/initrd.img | cut -f 1\` + \`du -b $(LINUX_IMAGE) | cut -f 1\`
189
190 SI_INSTALL = $(TOPDIR)/tools/si_install --si-prefix=$(PREFIX)
191 GETSOURCE = $(TOPDIR)/tools/getsource
192
193 # Some root tools are probably needed to build SystemImager packages, so
194 # explicitly add the right paths here. -AR-
195 PATH := $(PATH):/sbin:/usr/sbin:/usr/local/sbin
196
197 #
198 # Ok, here's my best idea so far for auto-running configure. -BEF-
199 CONFIG_ME := $(shell test -e config.inc || PATH=$(PATH) ./configure 1>&2)
200 include config.inc
201
202 # build everything, install nothing
203 .PHONY: all
204 all:    kernel $(INITRD_DIR)/initrd.img boel_binaries_tarball manpages dev_tarball
205
206 binaries: $(BOEL_BINARIES_TARBALL) kernel $(INITRD_DIR)/initrd.img
207
208 # All has been modified as docs don't build on non debian platforms
209 #
210 #all:   $(BOEL_BINARIES_TARBALL) kernel $(INITRD_DIR)/initrd.img docs manpages
211
212 #
213 # Now include the other targets.  Some of these may have order dependencies.
214 # Order as appropriate. -BEF-
215 #
216 # Why does ordered dependencies matter? Make will read all these
217 # snippets before it evaluates the rule. If there are dependencies caused
218 # by setting a variable in one and using it in another, then that should be
219 # abstracted out. Its much more robust to include *.rul... -dannf
220 #
221 include $(TOPDIR)/make.d/bc.rul
222 include $(TOPDIR)/make.d/ctcs.rul
223 include $(TOPDIR)/make.d/discover-data.rul
224 include $(TOPDIR)/make.d/discover.rul
225 include $(TOPDIR)/make.d/dosfstools.rul
226 include $(TOPDIR)/make.d/e2fsprogs.rul
227 include $(TOPDIR)/make.d/gzip.rul
228 include $(TOPDIR)/make.d/hfsutils.rul
229 include $(TOPDIR)/make.d/jfsutils.rul
230 include $(TOPDIR)/make.d/kernel.rul
231 include $(TOPDIR)/make.d/kexec.rul
232 include $(TOPDIR)/make.d/lvm.rul
233 include $(TOPDIR)/make.d/mdadm.rul
234 include $(TOPDIR)/make.d/openssh.rul
235 include $(TOPDIR)/make.d/openssl.rul
236 include $(TOPDIR)/make.d/parted.rul
237 include $(TOPDIR)/make.d/pdisk.rul
238 include $(TOPDIR)/make.d/popt.rul
239 include $(TOPDIR)/make.d/reiserfsprogs.rul
240 include $(TOPDIR)/make.d/tar.rul
241 include $(TOPDIR)/make.d/util-linux.rul
242 include $(TOPDIR)/make.d/xfsprogs.rul
243 include $(TOPDIR)/make.d/zlib.rul
244
245 include $(TOPDIR)/initrd_source/initrd.rul
246
247 # a complete server install
248 .PHONY: install_server_all
249 install_server_all:     install_server install_common install_binaries
250
251 # a complete client install
252 .PHONY: install_client_all
253 install_client_all:     install_client install_common install_initrd_template
254
255 # install server-only architecture independent files
256 .PHONY: install_server
257 install_server: install_server_man      \
258                                 install_configs         \
259                                 install_server_libs \
260                                 $(BITTORRENT_DIR).build
261         $(SI_INSTALL) -d $(BIN)
262         $(SI_INSTALL) -d $(SBIN)
263         $(foreach binary, $(BINARIES), \
264                 $(SI_INSTALL) -m 755 $(BINARY_SRC)/$(binary) $(BIN);)
265         $(foreach binary, $(SBINARIES), \
266                 $(SI_INSTALL) -m 755 $(BINARY_SRC)/$(binary) $(SBIN);)
267         $(SI_INSTALL) -d -m 755 $(LOG_DIR)
268         $(SI_INSTALL) -d -m 755 $(LOCK_DIR)
269         $(SI_INSTALL) -d -m 755 $(BOOT_BIN_DEST)
270         $(SI_INSTALL) -d -m 755 $(AUTOINSTALL_SCRIPT_DIR)
271
272         $(SI_INSTALL) -d -m 755 $(AUTOINSTALL_TARBALL_DIR)
273         $(SI_INSTALL) -d -m 755 $(AUTOINSTALL_TORRENT_DIR)
274
275         $(SI_INSTALL) -d -m 755 $(AUTOINSTALL_SCRIPT_DIR)/pre-install
276         $(SI_INSTALL) -m 644 --backup --text \
277                 $(TOPDIR)/var/lib/systemimager/scripts/pre-install/99all.harmless_example_script \
278                 $(AUTOINSTALL_SCRIPT_DIR)/pre-install/
279         $(SI_INSTALL) -m 644 --backup --text \
280                 $(TOPDIR)/var/lib/systemimager/scripts/pre-install/README \
281                 $(AUTOINSTALL_SCRIPT_DIR)/pre-install/
282
283         $(SI_INSTALL) -d -m 755 $(AUTOINSTALL_SCRIPT_DIR)/post-install
284         $(SI_INSTALL) -m 644 --backup --text \
285                 $(TOPDIR)/var/lib/systemimager/scripts/post-install/99all.harmless_example_script \
286                 $(TOPDIR)/var/lib/systemimager/scripts/post-install/95all.monitord_rebooted \
287                 $(TOPDIR)/var/lib/systemimager/scripts/post-install/10all.fix_swap_uuids\
288                 $(AUTOINSTALL_SCRIPT_DIR)/post-install/
289         $(SI_INSTALL) -m 644 --backup --text \
290                 $(TOPDIR)/var/lib/systemimager/scripts/post-install/README \
291                 $(AUTOINSTALL_SCRIPT_DIR)/post-install/
292
293         $(SI_INSTALL) -d -m 755 $(OVERRIDES_DIR)
294         $(SI_INSTALL) -m 644 $(OVERRIDES_README) $(OVERRIDES_DIR)
295
296         $(SI_INSTALL) -d -m 755 $(PXE_CONF_DEST)
297         $(SI_INSTALL) -m 644 --backup --text $(PXE_CONF_SRC)/message.txt \
298                 $(PXE_CONF_DEST)/message.txt
299         $(SI_INSTALL) -m 644 --backup $(PXE_CONF_SRC)/syslinux.cfg \
300                 $(PXE_CONF_DEST)/syslinux.cfg
301         $(SI_INSTALL) -m 644 --backup $(PXE_CONF_SRC)/syslinux.cfg.localboot \
302                 $(PXE_CONF_DEST)/syslinux.cfg.localboot
303         $(SI_INSTALL) -m 644 --backup $(PXE_CONF_SRC)/syslinux.cfg.localboot \
304                 $(PXE_CONF_DEST)/default
305
306         $(SI_INSTALL) -d -m 755 $(KBOOT_CONF_DEST)
307 #       $(SI_INSTALL) -m 644 --backup --text $(KBOOT_CONF_SRC)/message.txt \
308 #               $(KBOOT_CONF_DEST)/message.txt
309         $(SI_INSTALL) -m 644 --backup $(KBOOT_CONF_SRC)/localboot \
310                 $(KBOOT_CONF_DEST)/
311         $(SI_INSTALL) -m 644 --backup $(KBOOT_CONF_SRC)/default \
312                 $(KBOOT_CONF_DEST)/
313
314         $(SI_INSTALL) -d -m 755 $(IMAGEDEST)
315         $(SI_INSTALL) -m 644 $(WARNING_FILES) $(IMAGEDEST)
316         cp -a $(IMAGEDEST)/README $(IMAGEDEST)/DO_NOT_TOUCH_THESE_DIRECTORIES
317
318         $(SI_INSTALL) -d -m 755 $(FLAMETHROWER_STATE_DIR)
319
320 # install client-only files
321 .PHONY: install_client
322 install_client: install_client_man install_client_libs
323         mkdir -p $(ETC)/systemimager
324         $(SI_INSTALL) -b -m 644 etc/updateclient.local.exclude \
325           $(ETC)/systemimager
326         $(SI_INSTALL) -b -m 644 etc/client.conf \
327           $(ETC)/systemimager
328         mkdir -p $(SBIN)
329
330         $(foreach binary, $(CLIENT_SBINARIES), \
331                 $(SI_INSTALL) -m 755 $(BINARY_SRC)/$(binary) $(SBIN);)
332
333 # install files common to both the server and client
334 .PHONY: install_common
335 install_common: install_common_man install_common_libs
336         mkdir -p $(ETC)/systemimager
337         $(SI_INSTALL) -b -m 644 etc/UYOK.modules_to_exclude $(ETC)/systemimager
338         $(SI_INSTALL) -b -m 644 etc/UYOK.modules_to_include $(ETC)/systemimager
339         mkdir -p $(BIN)
340         $(foreach binary, $(COMMON_BINARIES), \
341                 $(SI_INSTALL) -m 755 $(BINARY_SRC)/$(binary) $(BIN);)
342
343 # install server-only libraries
344 .PHONY: install_server_libs
345 install_server_libs:
346         mkdir -p $(LIB_DEST)/SystemImager
347         mkdir -p $(LIB_DEST)/BootMedia
348         $(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/Server.pm  $(LIB_DEST)/SystemImager
349         $(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/HostRange.pm  $(LIB_DEST)/SystemImager
350         $(SI_INSTALL) -m 644 $(LIB_SRC)/BootMedia/BootMedia.pm  $(LIB_DEST)/BootMedia
351         $(SI_INSTALL) -m 644 $(LIB_SRC)/BootMedia/MediaLib.pm   $(LIB_DEST)/BootMedia
352         $(SI_INSTALL) -m 644 $(LIB_SRC)/BootMedia/alpha.pm      $(LIB_DEST)/BootMedia
353         $(SI_INSTALL) -m 644 $(LIB_SRC)/BootMedia/i386.pm       $(LIB_DEST)/BootMedia
354         mkdir -p $(USR)/share/systemimager/icons
355         $(SI_INSTALL) -m 644 $(LIB_SRC)/icons/serverinit.gif    $(USR)/share/systemimager/icons
356         $(SI_INSTALL) -m 644 $(LIB_SRC)/icons/serverinst.gif    $(USR)/share/systemimager/icons
357         $(SI_INSTALL) -m 644 $(LIB_SRC)/icons/serverok.gif      $(USR)/share/systemimager/icons
358         $(SI_INSTALL) -m 644 $(LIB_SRC)/icons/servererror.gif   $(USR)/share/systemimager/icons
359
360 # install client-only libraries
361 .PHONY: install_client_libs
362 install_client_libs:
363         mkdir -p $(LIB_DEST)/SystemImager
364         $(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/Client.pm $(LIB_DEST)/SystemImager
365
366 # install common libraries
367 .PHONY: install_common_libs
368 install_common_libs:
369         mkdir -p $(LIB_DEST)/SystemImager
370         $(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/Common.pm $(LIB_DEST)/SystemImager
371         $(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/Options.pm $(LIB_DEST)/SystemImager
372         $(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/Config.pm $(LIB_DEST)/SystemImager
373         $(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/UseYourOwnKernel.pm $(LIB_DEST)/SystemImager
374         $(SI_INSTALL) -m 755 $(LIB_SRC)/confedit $(LIB_DEST)
375
376 # checks the sized of the i386 kernel and initrd to make sure they'll fit
377 # on an autoinstall diskette
378 .PHONY: check_floppy_size
379 check_floppy_size:      $(LINUX_IMAGE) $(INITRD_DIR)/initrd.img
380 ifeq ($(ARCH), i386)
381         @### see if the kernel and ramdisk are larger than the size of a 1.44MB
382         @### floppy image, minus about 10k for syslinux stuff
383         @echo -n "Ramdisk + Kernel == "
384         @echo "`$(CHECK_FLOPPY_SIZE)`"
385         @echo "                    1454080 is the max that will fit."
386         @[ `$(CHECK_FLOPPY_SIZE)` -lt 1454081 ] || \
387              (echo "" && \
388               echo "************************************************" && \
389               echo "Dammit.  The kernel and ramdisk are too large.  " && \
390               echo "************************************************" && \
391               exit 1)
392         @echo " - ok, that should fit on a floppy"
393 endif
394
395 # install the initscript & config files for the server
396 .PHONY: install_configs
397 install_configs:
398         $(SI_INSTALL) -d $(ETC)/systemimager
399         $(SI_INSTALL) -m 644 etc/systemimager.conf $(ETC)/systemimager/
400         $(SI_INSTALL) -m 644 etc/flamethrower.conf $(ETC)/systemimager/
401         $(SI_INSTALL) -m 644 --backup etc/bittorrent.conf $(ETC)/systemimager/
402         $(SI_INSTALL) -m 644 --backup etc/cluster.xml $(ETC)/systemimager/
403         $(SI_INSTALL) -m 644 etc/autoinstallscript.template $(ETC)/systemimager/
404         $(SI_INSTALL) -m 644 etc/getimage.exclude $(ETC)/systemimager/
405
406         mkdir -p $(RSYNC_STUB_DIR)
407         $(SI_INSTALL) -b -m 644 etc/rsync_stubs/10header $(RSYNC_STUB_DIR)
408         [ -f $(RSYNC_STUB_DIR)/99local ] \
409                 && $(SI_INSTALL) -b -m 644 etc/rsync_stubs/99local $(RSYNC_STUB_DIR)/99local.dist~ \
410                 || $(SI_INSTALL) -b -m 644 etc/rsync_stubs/99local $(RSYNC_STUB_DIR)
411         $(SI_INSTALL) -b -m 644 etc/rsync_stubs/README $(RSYNC_STUB_DIR)
412
413         [ "$(INITD)" != "" ] || exit 1
414         mkdir -p $(INITD)
415         $(SI_INSTALL) -b -m 755 etc/init.d/systemimager-server-rsyncd                   $(INITD)
416         $(SI_INSTALL) -b -m 755 etc/init.d/systemimager-server-netbootmond              $(INITD)
417         $(SI_INSTALL) -b -m 755 etc/init.d/systemimager-server-flamethrowerd    $(INITD)
418         $(SI_INSTALL) -b -m 755 etc/init.d/systemimager-server-bittorrent       $(INITD)
419         $(SI_INSTALL) -b -m 755 etc/init.d/systemimager-server-monitord         $(INITD)
420
421 ########## END initrd ##########
422
423
424 ########## BEGIN dev_tarball ##########
425 .PHONY: dev_tarball install_dev_tarball
426 dev_tarball: $(TOPDIR)/tmp/dev.tar.gz
427
428 $(TOPDIR)/tmp/dev.tar.gz:
429         mkdir -p $(TOPDIR)/tmp
430         rm -rf $(TOPDIR)/tmp/dev
431         $(TOPDIR)/tools/makedevs $(TOPDIR)/tmp/dev
432         cd $(TOPDIR)/tmp && tar -czf $@ dev
433         rm -rf $(TOPDIR)/tmp/dev
434
435 install_dev_tarball: $(TOPDIR)/tmp/dev.tar.gz
436         $(SI_INSTALL) -m 600 tmp/dev.tar.gz $(BOOT_BIN_DEST)/initrd_template/
437
438 ########## END dev_tarball ##########
439
440
441 ########## BEGIN man pages ##########
442 # build all of the manpages
443 .PHONY: manpages install_server_man install_client_man install_common_man install_docs docs
444 ifeq ($(SI_BUILD_DOCS),1)
445 manpages:
446         $(MAKE) -C $(MANPAGE_DIR) TOPDIR=$(TOPDIR)
447
448 # install the manpages for the server
449 install_server_man: manpages
450         cd $(MANPAGE_DIR) && $(MAKE) install_server_man TOPDIR=$(TOPDIR) PREFIX=$(PREFIX) $@
451
452 # install the manpages for the client
453 install_client_man: manpages
454         cd $(MANPAGE_DIR) && $(MAKE) install_client_man TOPDIR=$(TOPDIR) PREFIX=$(PREFIX) $@
455
456 # install manpages common to the server and client
457 install_common_man: manpages
458         cd $(MANPAGE_DIR) && $(MAKE) install_common_man TOPDIR=$(TOPDIR) PREFIX=$(PREFIX) $@
459
460 ########## END man pages ##########
461
462 # installs the manual and some examples
463 install_docs: docs
464         mkdir -p $(DOC)
465         cp -a $(MANUAL_DIR)/html $(DOC)
466         cp $(MANUAL_DIR)/*.ps $(MANUAL_DIR)/*.pdf $(DOC)
467         rsync -av --exclude 'CVS/' --exclude '.svn/' doc/examples/ $(DOC)/examples/
468         #XXX $(SI_INSTALL) -m 644 doc/media-api.txt $(DOC)/
469
470 # builds the manual from SGML source
471 docs:
472         $(MAKE) -C $(MANUAL_DIR) html ps pdf
473 endif
474
475 # pre-download the source to other packages that are needed by
476 # the build system
477 .PHONY: get_source
478 get_source:     $(ALL_SOURCE)
479
480 .PHONY: install
481 install:
482         @echo ''
483         @echo 'Read README for installation details.'
484         @echo ''
485
486 .PHONY: install_binaries
487 install_binaries:       install_kernel \
488                         install_initrd \
489                         install_boel_binaries_tarball \
490                         install_initrd_template \
491                         install_dev_tarball
492
493 include make.d/boel_binaries.inc
494
495 .PHONY: complete_source_tarball
496 complete_source_tarball:        $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source.tar.bz2.sign
497 $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source.tar.bz2.sign:     $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source.tar.bz2
498         cd $(TOPDIR)/tmp && gpg --detach-sign -a --output systemimager-$(VERSION)-complete_source.tar.bz2.sign systemimager-$(VERSION)-complete_source.tar.bz2
499         cd $(TOPDIR)/tmp && gpg --verify systemimager-$(VERSION)-complete_source.tar.bz2.sign
500
501 $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source.tar.bz2: systemimager.spec
502         rm -fr $(TOPDIR)/tmp
503         if [ -d $(TOPDIR)/.svn ]; then \
504                 mkdir -p $(TOPDIR)/tmp; \
505                 svn export . $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source; \
506         else \
507                 make distclean && mkdir -p $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source; \
508                 (cd $(TOPDIR) && tar --exclude=tmp -cvf - .) | (cd $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source && tar -xvf -); \
509         fi
510         cd $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source && ./configure
511         $(MAKE) -C $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source get_source
512         #
513         # Make sure we've got all kernel source.  NOTE:  The egrep -v '-' bit is so that we don't include customized kernels (Ie: -ydl).
514         $(foreach linux_version, $(shell grep 'LINUX_VERSION =' make.d/kernel.rul | egrep -v '(^#|-)' | sort -u | perl -pi -e 's#.*= ##'), \
515                 $(GETSOURCE) $(shell dirname $(LINUX_URL))/linux-$(linux_version).tar.bz2 $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source/src;)
516         $(MAKE) -C $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source clean
517 ifeq ($(UNSTABLE), 1)
518         if [ -f README.unstable ]; then \
519                 cd $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source && cp README README.tmp; \
520                 cd $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source && cp README.unstable README; \
521                 cd $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source && cat README.tmp >> README; \
522                 cd $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source && rm README.tmp; \
523         fi
524 endif
525         rm -f $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source/README.unstable
526         perl -pi -e "s/^%define\s+ver\s+\d+\.\d+\.\d+.*/%define ver $(VERSION)/" \
527                 $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source/systemimager.spec
528         find $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source -type f -exec chmod ug+r  {} \;
529         find $(TOPDIR)/tmp/systemimager-$(VERSION)-complete_source -type d -exec chmod ug+rx {} \;
530         cd $(TOPDIR)/tmp && tar -ch systemimager-$(VERSION)-complete_source | bzip2 > systemimager-$(VERSION)-complete_source.tar.bz2
531         @echo
532         @echo "complete source tarball has been created in $(TOPDIR)/tmp"
533         @echo
534
535 .PHONY: source_tarball
536 source_tarball: $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2.sign
537 $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2.sign:     $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2
538         cd $(TOPDIR)/tmp && gpg --detach-sign -a --output systemimager-$(VERSION).tar.bz2.sign systemimager-$(VERSION).tar.bz2
539         cd $(TOPDIR)/tmp && gpg --verify systemimager-$(VERSION).tar.bz2.sign
540
541 $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2: systemimager.spec
542         rm -fr $(TOPDIR)/tmp
543         if [ -d $(TOPDIR)/.svn ]; then \
544                 mkdir -p $(TOPDIR)/tmp; \
545                 svn export . $(TOPDIR)/tmp/systemimager-$(VERSION); \
546         else \
547                 make distclean && mkdir -p $(TOPDIR)/tmp/systemimager-$(VERSION); \
548                 (cd $(TOPDIR) && tar --exclude=tmp -cvf - .) | (cd $(TOPDIR)/tmp/systemimager-$(VERSION) && tar -xvf -); \
549         fi
550 ifeq ($(UNSTABLE), 1)
551         if [ -f README.unstable ]; then \
552                 cd $(TOPDIR)/tmp/systemimager-$(VERSION) && cp README README.tmp; \
553                 cd $(TOPDIR)/tmp/systemimager-$(VERSION) && cp README.unstable README; \
554                 cd $(TOPDIR)/tmp/systemimager-$(VERSION) && cat README.tmp >> README; \
555                 cd $(TOPDIR)/tmp/systemimager-$(VERSION) && rm README.tmp; \
556         fi
557 endif
558         rm -f $(TOPDIR)/tmp/systemimager-$(VERSION)/README.unstable
559         perl -pi -e "s/^%define\s+ver\s+\d+\.\d+\.\d+.*/%define ver $(VERSION)/" \
560                 $(TOPDIR)/tmp/systemimager-$(VERSION)/systemimager.spec
561         find $(TOPDIR)/tmp/systemimager-$(VERSION) -type f -exec chmod ug+r  {} \;
562         find $(TOPDIR)/tmp/systemimager-$(VERSION) -type d -exec chmod ug+rx {} \;
563         cd $(TOPDIR)/tmp && tar -ch systemimager-$(VERSION) | bzip2 > systemimager-$(VERSION).tar.bz2
564         @echo
565         @echo "source tarball has been created in $(TOPDIR)/tmp"
566         @echo
567
568 # make the srpms for systemimager
569 .PHONY: srpm
570 srpm: $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2
571         rpmbuild -ts $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2
572
573 # make the rpms for systemimager
574 .PHONY: rpm
575 rpm: $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2
576         rpmbuild -tb $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2
577
578 # make the debs for systemimager
579 .PHONY: deb
580 deb: $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2
581         # Check package version.
582         @(if [ ! "`dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2`" = $(VERSION) ]; then \
583                 echo "ERROR: versions in debian/changelog doesn't match with version specified into the file VERSION"; \
584                 echo "Please fix it."; \
585                 exit 1; \
586         else \
587                 exit 0; \
588         fi)
589         @cd $(TOPDIR)/tmp && tar xvjf systemimager-$(VERSION).tar.bz2
590         @cd $(TOPDIR)/tmp/systemimager-$(VERSION) && make -f debian/rules debian/control
591         @cd $(TOPDIR)/tmp/systemimager-$(VERSION) && dpkg-buildpackage -rfakeroot -uc -us
592         @echo "=== deb packages for systemimager ==="
593         @ls -l $(TOPDIR)/tmp/*.deb
594         @echo "====================================="
595
596 # removes object files, docs, editor backup files, etc.
597 .PHONY: clean
598 clean:  $(subst .rul,_clean,$(shell cd $(TOPDIR)/make.d && ls *.rul)) initrd_clean
599         -$(MAKE) -C $(MANPAGE_DIR) clean
600         -$(MAKE) -C $(MANUAL_DIR) clean
601
602         ## where the tarballs are built
603         -rm -rf tmp
604
605         ## editor backups
606         -find . -name "*~" -exec rm -f {} \;
607         -find . -name "#*#" -exec rm -f {} \;
608         -find . -name ".#*" -exec rm -f {} \;
609
610         rm -f config.inc config.log config.status
611
612 # same as clean, but also removes downloaded source, stamp files, etc.
613 .PHONY: distclean
614 distclean:      clean initrd_distclean
615         -rm -rf $(SRC_DIR) $(INITRD_SRC_DIR)
616
617 DEBIAN_STABLE_BUILD_DEPS += flex
618 UBUNTU_DAPPER_BUILD_DEPS += flex
619
620 .PHONY: help
621 help:  show_targets
622
623 #
624 #
625 # Show me a list of all targets in this entire build heirarchy
626 .PHONY: show_targets
627 show_targets:
628         @echo
629         @echo Makefile targets you are probably most interested in:
630         @echo ---------------------------------------------------------------------
631         @echo "all"
632         @echo "    Build everything you need for your machine's architecture."
633         @echo " "
634         @echo "install_client_all"
635         @echo "    Install all files needed by a client."
636         @echo " "
637         @echo "install_server_all"
638         @echo "    Install all files needed by a server."
639         @echo " "
640         @echo "install_boel_binaries_tarball"
641         @echo ""
642         @echo "install_initrd"
643         @echo ""
644         @echo "source_tarball"
645         @echo "    Make a source tarball for distribution."
646         @echo " "
647         @echo "    Includes SystemImager source only.  Source for all"
648         @echo "    the tools SystemImager depends on will be found in /usr/src "
649         @echo "    or will be automatically downloaded at build time."
650         @echo " "
651         @echo "complete_source_tarball"
652         @echo "    Make a source tarball for distribution."
653         @echo "    "
654         @echo "    Includes all necessary source for building SystemImager and"
655         @echo "    all of it's supporting tools."
656         @echo " "
657         @echo "rpm"
658         @echo "    Build all of the RPMs that can be build on your platform."
659         @echo ""
660         @echo "srpm"
661         @echo "    Build yourself a source RPM."
662         @echo ""
663         @echo "deb"
664         @echo "    Build all of the debs that can be build on your platform."
665         @echo ""
666         @echo "show_all_targets"
667         @echo "    Show all available targets."
668         @echo
669         @echo "show_build_deps"
670         @echo "    Shows the list of packages necessary for building on"
671         @echo "    various distributions and releases."
672         @echo
673
674 .PHONY: show_build_deps
675 show_build_deps:
676         @echo "Cut and paste the appropriate command below:"
677         @echo
678         @echo Ubuntu Dapper:
679         @echo "  apt-get install $(UBUNTU_DAPPER_BUILD_DEPS)"
680         @echo
681         @echo Debian Stable:
682         @echo "  apt-get install $(DEBIAN_STABLE_BUILD_DEPS)"
683         @echo
684
685 .PHONY: show_all_targets
686 SHOW_TARGETS_ALL_MAKEFILES = $(shell find . make.d/ initrd_source/ initrd_source/make.d/  -maxdepth 1 -name 'Makefile' -or -name '*.rul' )
687 show_all_targets:
688         @echo All Available Targets Include:
689         @echo ---------------------------------------------------------------------
690         @cat $(SHOW_TARGETS_ALL_MAKEFILES) | egrep '^[a-z_]+:' | sed 's/:.*//' | sort -u
691         @echo
Note: See TracBrowser for help on using the browser.