source: trunk/Makefile.in

Last change on this file was 579, checked in by dennis, 6 years ago

Pushing change from tag/1.6.0 to trunk

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