source: branches/1.5/Makefile.in @ 556

Last change on this file since 556 was 556, checked in by dennis, 7 years ago

Added a new script to make sure all the needed firmwares for the
kernel modules are available in the /lib/firmware directory

  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1#
2#       "SALI" 
3#
4#   Copyright (C) 2010 SARA Computing and Networking Services
5#   
6#   $Id: Makefile.in 556 2013-03-06 14:10:42Z dennis $
7#        vi: set filetype=make:
8#
9
10## BEGIN General options
11#
12VERSION=$(shell cat VERSION)
13
14ARCH=@ARCH@
15ARCH_BIT=@ARCH_BIT@
16OS=@OS@
17OS_RELEASE=@OS_RELEASE@
18
19ifeq ($(ARCH_BIT),64)
20        LIBDIR=lib64
21else
22        LIBDIR=lib
23endif
24
25RELEASE_DOCS = CHANGELOG LICENSE CREDITS README VERSION AUTHORS
26NCPUS=$(shell egrep -c '^processor' /proc/cpuinfo )
27#
28## END General options
29
30## BEGIN location options
31#
32ROOT_DIR=$(CURDIR)
33
34# TAR directory
35TAR_DIR=$(ROOT_DIR)/tar
36
37# EXAMPLE directory
38EXAMPLE_DIR=example
39
40# contrib directory
41CONTRIB_DIR=contrib
42
43# The basic
44SRC_DIR=$(ROOT_DIR)/src
45STAMP_DIR=$(SRC_DIR)
46
47# The kernel locations
48KERNEL_DIR=$(ROOT_DIR)/kernel
49KERNEL_MAKED_DIR=$(KERNEL_DIR)/make.d
50KERNEL_PATCH_DIR=$(KERNEL_DIR)/patches
51KERNEL_BUILD_DIR=$(KERNEL_DIR)/build_dir
52
53# The initrd locations
54INITRD_DIR=$(ROOT_DIR)/initrd
55INITRD_MAKED_DIR=$(INITRD_DIR)/make.d
56INITRD_PATCH_DIR=$(INITRD_DIR)/patches
57INITRD_BUILD_DIR=$(INITRD_DIR)/build_dir
58
59INITRD_BUILD_MAN_DIR=$(INITRD_BUILD_DIR)/usr/share/man
60INITRD_BUILD_BIN_DIR=$(INITRD_BUILD_DIR)/bin
61INITRD_BUILD_SBIN_DIR=$(INITRD_BUILD_DIR)/sbin
62#
63## END location options
64
65## BEGIN utilities
66#
67GETSOURCE=$(ROOT_DIR)/tools/getsource
68COPYLIBS=$(ROOT_DIR)/tools/copy_libs
69COPYFIRMWARES=$(ROOT_DIR)/tools/copy_firmwares
70#
71## END utilities
72
73include $(KERNEL_MAKED_DIR)/kernel.rul
74include $(KERNEL_MAKED_DIR)/zlib.rul
75include $(INITRD_DIR)/initrd.rul
76
77# build everything, install nothing
78build:  tar_clean initrd_install kernel $(ROOT_DIR)/build
79
80tar_clean:
81        ( rm -rf $(TAR_DIR)/* )
82
83$(ROOT_DIR)/build:
84
85        ( mkdir -p -m 0755 $(TAR_DIR)/sali-$(VERSION)/$(ARCH) )
86
87        ( make INSTALL_MOD_PATH=$(INITRD_BUILD_DIR) -C $(LINUX_DIR) modules_install )
88        $(COPYFIRMWARES) $(SRC_DIR) $(INITRD_BUILD_DIR)
89
90        ## make the binaries smaller
91        #
92        strip $(INITRD_BINARIES)
93
94        ( cd "$(INITRD_BUILD_DIR)" && find . | cpio --quiet -o -H newc > "$(TAR_DIR)/sali-$(VERSION)/$(ARCH)/initrd" )
95        ( cd "$(TAR_DIR)/sali-$(VERSION)/$(ARCH)" && bzip2 --best --force initrd && mv initrd.bz2 initrd.img )
96        ( cp "$(LINUX_IMAGE)" "$(TAR_DIR)/sali-$(VERSION)/$(ARCH)/kernel" )
97
98
99ifeq ($(OS),suse)
100        ( cp "$(LINUX_DIR)/vmlinux" "$(TAR_DIR)/sali-$(VERSION)/$(ARCH)/vmlinux" )
101        mkzimage --vmlinux "$(TAR_DIR)/sali-$(VERSION)/$(ARCH)/vmlinux" --initrd "$(TAR_DIR)/sali-$(VERSION)/$(ARCH)/initrd.img" --output "$(TAR_DIR)/sali-$(VERSION)/$(ARCH)/vmlinuz"
102endif
103
104        $(foreach doc, $(RELEASE_DOCS), cp $(ROOT_DIR)/$(doc) $(TAR_DIR)/sali-$(VERSION)/$(doc);)
105
106        cp -a $(ROOT_DIR)/$(EXAMPLE_DIR) $(TAR_DIR)/sali-$(VERSION)
107        rm -rf $(TAR_DIR)/sali-$(VERSION)/$(EXAMPLE_DIR)/.svn
108        rm -rf $(TAR_DIR)/sali-$(VERSION)/$(EXAMPLE_DIR)/post-install/.svn
109
110        cp -a $(ROOT_DIR)/$(CONTRIB_DIR) $(TAR_DIR)/sali-$(VERSION)
111        rm -rf $(TAR_DIR)/sali-$(VERSION)/$(CONTRIB_DIR)/.svn
112
113        mkdir -p $(TAR_DIR)/sali-$(VERSION)/bootdisk
114        mkdir -p $(TAR_DIR)/sali-$(VERSION)/bootdisk/kernel
115        mkdir -p $(TAR_DIR)/sali-$(VERSION)/bootdisk/images
116        cp -a $(ROOT_DIR)/bootdisk/isolinux $(TAR_DIR)/sali-$(VERSION)/bootdisk/isolinux
117        cp -a $(ROOT_DIR)/bootdisk/sali_create_bootdisk $(TAR_DIR)/sali-$(VERSION)/bootdisk
118        chmod +x $(TAR_DIR)/sali-$(VERSION)/bootdisk/sali_create_bootdisk
119
120        cp -a $(ROOT_DIR)/server $(TAR_DIR)/sali-$(VERSION)
121        find $(TAR_DIR) -type d -name .svn | xargs rm -r
122
123        touch $@
124
125tarball: build
126        cd $(TAR_DIR) && tar -pczf $(ROOT_DIR)/sali-$(ARCH)-$(VERSION).tar.gz *
127
128.PHONY: help
129help:  show_targets
130
131.PHONY: clean
132clean:
133        @echo "Removing file for tar distribution"
134        rm -f $(ROOT_DIR)/build
135        rm -rf $(TAR_DIR)
136   
137
138.PHONY: distclean
139distclean: initrd_clean clean
140
141        @echo "Removing all generated and downloaded files"
142        rm -rf $(ROOT_DIR)/src
143        rm -f Makefile config.log config.status initrd/sali/bin/sali_functions initrd/functions/functions.mbm bootdisk/sali_create_bootdisk server/setup.py
144
145.PHONY: show_targets
146show_targets:
147        @echo
148        @echo "General commands:"
149        @echo " build"
150        @echo "    Build everything."
151        @echo " kernel"
152        @echo "    Only build the kernel."
153        @echo " initrd"
154        @echo "    Builds the software for the initrd, skips kernel build!"
155        @echo " tarball"
156        @echo "    Make a tarball with the contents from ROOT_DIR/build."
157        @echo
158        @echo "Dynamic commands (available when imported in initrd.rul):"
159        @echo " <name>"
160        @echo "    Retrieve and build the .rul package in the directory $(SRC_DIR)"
161        @echo " <name>_install"
162        @echo "    Installs the .rul package to $(INITRD_BUILD_DIR)"
163        @echo " <name>_clean"
164        @echo "    Cleans the files of a .rul package in $(SRC_DIR)"
165
166all: show_targets
Note: See TracBrowser for help on using the repository browser.