924b21461bc17568d045a2c937e03d8b4d829ca5
[ipfire-2.x.git] / lfs / util-linux
1 ###############################################################################
2 # This file is part of the IPCop Firewall.                                    #
3 #                                                                             #
4 # IPCop 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 2 of the License, or           #
7 # (at your option) any later version.                                         #
8 #                                                                             #
9 # IPCop 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 IPCop; if not, write to the Free Software                        #
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA    #
17 #                                                                             #
18 # Makefiles are based on LFSMake, which is                                    #
19 # Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com>                        #
20 #                                                                             #
21 # Modifications by:                                                           #
22 # ??-12-2003 Mark Wormgoor < mark@wormgoor.com>                               #
23 #          - Modified Makefile for IPCop build                                #
24 #                                                                             #
25 # $Id: util-linux,v 1.8.2.7 2006/01/20 14:31:47 franck78 Exp $
26 #                                                                             #
27 ###############################################################################
28
29 ###############################################################################
30 # Definitions
31 ###############################################################################
32
33 include Config
34
35 VER        = 2.12r
36
37 THISAPP    = util-linux-$(VER)
38 DL_FILE    = $(THISAPP).tar.bz2
39 DL_FROM    = $(URL_KERNEL)/linux/utils/util-linux
40 DIR_APP    = $(DIR_SRC)/$(THISAPP)
41
42 # Normal build or /tools build.
43 #
44 ifeq "$(ROOT)" ""
45 ifeq "$(LFS_PASS)" "install"
46   TARGET     = $(DIR_INFO)/$(THISAPP)-install
47 else
48   TARGET = $(DIR_INFO)/$(THISAPP)
49 endif
50 else
51   TARGET = $(DIR_INFO)/$(THISAPP)-tools
52 endif
53
54 ###############################################################################
55 # Top-level Rules
56 ###############################################################################
57
58 objects = $(DL_FILE)
59
60 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
61
62 $(DL_FILE)_MD5 = af9d9e03038481fbf79ea3ac33f116f9
63 install : $(TARGET)
64
65 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
66
67 download :$(patsubst %,$(DIR_DL)/%,$(objects))
68
69 md5 : $(subst %,%_MD5,$(objects))
70
71 ###############################################################################
72 # Downloading, checking, md5sum
73 ###############################################################################
74
75 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
76         @$(CHECK)
77
78 $(patsubst %,$(DIR_DL)/%,$(objects)) :
79         @$(LOAD)
80
81 $(subst %,%_MD5,$(objects)) :
82         @$(MD5)
83
84 ###############################################################################
85 # Installation Details
86 ###############################################################################
87
88 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
89         @$(PREBUILD)
90         @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
91 ifeq "$(ROOT)" ""
92 ifeq "$(LFS_PASS)" "install"
93         -mkdir -p /install/misc/bin
94         cd $(DIR_APP) && CFLAGS="-Os -fomit-frame-pointer" ./configure
95         cd $(DIR_APP)/fdisk && sed -i 's+setlocale+// setlocale+' sfdisk.c
96         cd $(DIR_APP)/fdisk && make sfdisk
97         cd $(DIR_APP)/fdisk && install -m 0755 sfdisk /install/misc/bin
98         if [ "$(MACHINE)" = "alpha" ]; then \
99                 cd $(DIR_APP)/fdisk && make fdisk; \
100                 cd $(DIR_APP)/fdisk && install -m 0755 fdisk /install/misc/bin; \
101         fi
102 else
103         cd $(DIR_APP) && cp hwclock/hwclock.c{,.backup}
104         cd $(DIR_APP) && sed 's%etc/adjtime%var/lib/hwclock/adjtime%' \
105             hwclock/hwclock.c.backup > hwclock/hwclock.c
106         -mkdir -p /var/lib/hwclock
107         cd $(DIR_APP) && ./configure
108         cd $(DIR_APP) && make HAVE_SLN=yes
109         cd $(DIR_APP) && make HAVE_SLN=yes install
110         chmod u-s /bin/mount /bin/umount
111         touch /var/lib/hwclock/adjtime
112 endif
113 else
114         cd $(DIR_APP) && cp configure configure.backup
115         cd $(DIR_APP) && sed "s@/usr/include@/tools/include@g" configure.backup > configure 
116         cd $(DIR_APP) && chmod 755 configure
117         cd $(DIR_APP) && ./configure
118         cd $(DIR_APP) && make -C lib
119         cd $(DIR_APP) && make -C mount mount umount
120         cd $(DIR_APP) && make -C text-utils more
121         cd $(DIR_APP) && cp mount/{,u}mount text-utils/more /tools/bin
122 endif
123         @rm -rf $(DIR_APP)
124         @$(POSTBUILD)