| [16] | 1 | #================================================== | 
|---|
 | 2 | # Copyright IBM 2000 | 
|---|
 | 3 | #================================================== | 
|---|
 | 4 |  | 
|---|
 | 5 | # makefile for stand-alone build of Linux interface for GPFS. | 
|---|
 | 6 | # $Id: makefile.toship,v 1.27 2006/02/28 17:25:21 yuri Exp $ | 
|---|
 | 7 |  | 
|---|
 | 8 | # Build instructions | 
|---|
 | 9 | #  0) export SHARKCLONEROOT=/usr/lpp/mmfs/src | 
|---|
 | 10 | #  1) Create the build configuration file. This may be done manually or | 
|---|
 | 11 | #     by autoconfig. | 
|---|
 | 12 | #     - Manual Method: | 
|---|
 | 13 | #        cd config | 
|---|
 | 14 | #        cp site.mcr.proto site.mcr | 
|---|
 | 15 | #        (edit site.mcr file as desired, eg, architecture and compiler flags) | 
|---|
 | 16 | #        cd .. | 
|---|
 | 17 | #     - Autoconfig Method: | 
|---|
 | 18 | #        make Autoconfig | 
|---|
 | 19 | #  2) make World | 
|---|
 | 20 | # | 
|---|
 | 21 | # If you want to recreate the site.mcr configuration file (e.g. build for new | 
|---|
 | 22 | # kernel), you may either edit manually or remove it prior to invoking auto- | 
|---|
 | 23 | # configuration via the 'make Autoconfig' rule. The site.mcr file may be | 
|---|
 | 24 | # manually removed from $SHARKCLONEROOT/shark/config or by invoking the | 
|---|
 | 25 | # 'make CleanConfig' rule. | 
|---|
 | 26 | # | 
|---|
 | 27 |  | 
|---|
 | 28 |  | 
|---|
 | 29 | LPPBIN  = /usr/lpp/mmfs/bin | 
|---|
 | 30 | DESTDIR = /usr/lpp/mmfs/src | 
|---|
 | 31 | TOOLDIR = /usr/X11R6/bin | 
|---|
 | 32 |  | 
|---|
 | 33 | IMAKE = $(TOOLDIR)/imake | 
|---|
 | 34 | IRULESRC = $(DESTDIR)/shark/config | 
|---|
 | 35 |  | 
|---|
 | 36 | MAKE = /usr/bin/make | 
|---|
 | 37 | MAKEDASH = - | 
|---|
 | 38 |  | 
|---|
 | 39 | DOTDOTIMAKE_CMD = $(IMAKE) -Timake.tmpl -I. -I$(IRULESRC) -s makefile | 
|---|
 | 40 |  | 
|---|
 | 41 | all: World | 
|---|
 | 42 |  | 
|---|
 | 43 | World:: | 
|---|
 | 44 |   @if [ "$(SHARKCLONEROOT)" = "" ]; then \ | 
|---|
 | 45 |   echo "Error: SHARKCLONEROOT is not set!"; exit 1; fi | 
|---|
 | 46 | World:: VerifyBuildTools | 
|---|
 | 47 | World:: config1 | 
|---|
 | 48 | World:: Makefiles | 
|---|
 | 49 | World:: Clean | 
|---|
 | 50 | World:: config2 | 
|---|
 | 51 | World:: Headers | 
|---|
 | 52 | World:: Depend | 
|---|
 | 53 | World:: Modules | 
|---|
 | 54 | World:: InstallLibs | 
|---|
 | 55 | World:: Install | 
|---|
 | 56 | World:: finish | 
|---|
 | 57 |  | 
|---|
 | 58 | InstLibs:: InstallLibs | 
|---|
 | 59 |  | 
|---|
 | 60 | ################################################### | 
|---|
 | 61 |  | 
|---|
 | 62 | SUBDIRS = ibm-kxi ibm-linux gpl-linux misc | 
|---|
 | 63 | # old directories from previous releases (used for clean up) | 
|---|
 | 64 | OLDSUBDIRS = patches | 
|---|
 | 65 |  | 
|---|
 | 66 | Clean:: | 
|---|
 | 67 |   @if [ "$(SHARKCLONEROOT)" = "" ]; then \ | 
|---|
 | 68 |   echo "Error: SHARKCLONEROOT is not set!"; exit 1; fi | 
|---|
 | 69 | Clean:: clean | 
|---|
 | 70 | UninstallClean:: clean | 
|---|
 | 71 | clean:: | 
|---|
 | 72 |   rm -rf $(DESTDIR)/include $(DESTDIR)/bin $(DESTDIR)/lib | 
|---|
 | 73 |   mkdir $(DESTDIR)/include $(DESTDIR)/bin $(DESTDIR)/lib | 
|---|
 | 74 |   rm -f config/install.ti | 
|---|
 | 75 |  | 
|---|
 | 76 | VerifyBuildTools:: | 
|---|
 | 77 |   @echo "Verifying that tools to build the portability layer exist...."; | 
|---|
 | 78 |   @which $(TOOLDIR)/imake > /dev/null 2>&1; if [ $$? -eq 0 ]; then \ | 
|---|
 | 79 |   echo "imake present"; \ | 
|---|
 | 80 |   else \ | 
|---|
 | 81 |   echo "imake missing! Verify that it is installed."; \ | 
|---|
 | 82 |         echo "imake is normally installed with X11 development packages."; \ | 
|---|
 | 83 |         exit 1; \ | 
|---|
 | 84 |   fi; | 
|---|
 | 85 |   @which cpp > /dev/null 2>&1; if [ $$? -eq 0 ]; then \ | 
|---|
 | 86 |   echo "cpp present"; \ | 
|---|
 | 87 |   else \ | 
|---|
 | 88 |   echo "cpp missing! Verify that it is installed."; exit 1; \ | 
|---|
 | 89 |   fi | 
|---|
 | 90 |   @which gcc > /dev/null 2>&1; if [ $$? -eq 0 ]; then \ | 
|---|
 | 91 |   echo "gcc present"; \ | 
|---|
 | 92 |   else \ | 
|---|
 | 93 |   echo "gcc missing! Verify that it is installed."; exit 1; \ | 
|---|
 | 94 |   fi | 
|---|
 | 95 |   @which g++ > /dev/null 2>&1; if [ $$? -eq 0 ]; then \ | 
|---|
 | 96 |   echo "g++ present"; \ | 
|---|
 | 97 |   else \ | 
|---|
 | 98 |   echo "g++ missing! Verify that it is installed."; exit 1; \ | 
|---|
 | 99 |   fi | 
|---|
 | 100 |   @which ld > /dev/null 2>&1; if [ $$? -eq 0 ]; then \ | 
|---|
 | 101 |   echo "ld present"; \ | 
|---|
 | 102 |   else \ | 
|---|
 | 103 |   echo "ld missing! Verify that it is installed."; exit 1; \ | 
|---|
 | 104 |   fi | 
|---|
 | 105 |  | 
|---|
 | 106 | Autoconfig: config/site.mcr | 
|---|
 | 107 |  | 
|---|
 | 108 | config/site.mcr: config/site.mcr.proto | 
|---|
 | 109 |   cd config; ./configure; exit $$? || exit 1; | 
|---|
 | 110 |  | 
|---|
 | 111 | config1:: | 
|---|
 | 112 |   cd config; ./bootstrap; $(MAKE) clean; $(MAKE) install | 
|---|
 | 113 |  | 
|---|
 | 114 | config2:: | 
|---|
 | 115 |   cd config; $(MAKE) config2; | 
|---|
 | 116 |   cd misc; $(DOTDOTIMAKE_CMD) | 
|---|
 | 117 |   cd misc; $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) stubs | 
|---|
 | 118 |   cd misc; $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) install | 
|---|
 | 119 |  | 
|---|
 | 120 | finish:: | 
|---|
 | 121 |  | 
|---|
 | 122 | ################################################### | 
|---|
 | 123 |  | 
|---|
 | 124 | Install:: | 
|---|
 | 125 |   @(case '$(MAKEFLAGS)' in *[ik]*) set +e;; esac; \ | 
|---|
 | 126 |   for i in $(SUBDIRS); do \ | 
|---|
 | 127 |   (cd $$i; echo  "installing" "(`pwd`)"; \ | 
|---|
 | 128 |   $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) DESTDIR=$(DESTDIR)  Install; \ | 
|---|
 | 129 |   exit $$?) || exit 1; \ | 
|---|
 | 130 |   done) | 
|---|
 | 131 |  | 
|---|
 | 132 | Depend:: | 
|---|
 | 133 |   @(case '$(MAKEFLAGS)' in *[ik]*) set +e;; esac; \ | 
|---|
 | 134 |   for i in $(SUBDIRS); do \ | 
|---|
 | 135 |   (cd $$i; echo  "Depending" "(`pwd`)"; \ | 
|---|
 | 136 |   $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) DESTDIR=$(DESTDIR)  Depend; \ | 
|---|
 | 137 |   exit $$?) || exit 1; \ | 
|---|
 | 138 |   done) | 
|---|
 | 139 |  | 
|---|
 | 140 | Clean:: | 
|---|
 | 141 |   @(case '$(MAKEFLAGS)' in *[ik]*) set +e;; esac; \ | 
|---|
 | 142 |   for i in $(SUBDIRS) $(EXTRASUBDIRS); do \ | 
|---|
 | 143 |   (cd $$i; echo  "cleaning" "(`pwd`)"; \ | 
|---|
 | 144 |   $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) DESTDIR=$(DESTDIR)  Clean; \ | 
|---|
 | 145 |   exit $$?) || exit 1; \ | 
|---|
 | 146 |   done) | 
|---|
 | 147 |  | 
|---|
 | 148 | CleanConfig:: | 
|---|
 | 149 |   rm -f shark/config/site.mcr config/site.mcr; exit $$? || exit 1; | 
|---|
 | 150 |  | 
|---|
 | 151 | # Ensures old directories (from previous release) are cleaned out | 
|---|
 | 152 | UninstallClean:: | 
|---|
 | 153 |   @(case '$(MAKEFLAGS)' in *[ik]*) set +e;; esac; \ | 
|---|
 | 154 |   for i in $(SUBDIRS) $(EXTRASUBDIRS) $(OLDSUBDIRS); do \ | 
|---|
 | 155 |   if [ -f $$i/makefile ]; then \ | 
|---|
 | 156 |   (cd $$i; echo  "cleaning" "(`pwd`)"; \ | 
|---|
 | 157 |   $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) DESTDIR=$(DESTDIR)  Clean; \ | 
|---|
 | 158 |   exit $$?) || exit 1; \ | 
|---|
 | 159 |   fi; \ | 
|---|
 | 160 |   done) | 
|---|
 | 161 |  | 
|---|
 | 162 | Makefiles:: | 
|---|
 | 163 |   @(case '$(MAKEFLAGS)' in *[ik]*) set +e;; esac; \ | 
|---|
 | 164 |   for i in $(SUBDIRS) $(EXTRASUBDIRS); do \ | 
|---|
 | 165 |   echo "Making Makefiles (`pwd`/$$i)"; \ | 
|---|
 | 166 |   $(MAKE) subdirMakefiles \ | 
|---|
 | 167 |   MAKE_SUBDIR=$$i; \ | 
|---|
 | 168 |   done) | 
|---|
 | 169 |  | 
|---|
 | 170 | subdirMakefiles: | 
|---|
 | 171 |   cd $(MAKE_SUBDIR); \ | 
|---|
 | 172 |   $(DOTDOTIMAKE_CMD); \ | 
|---|
 | 173 |   touch .depends; \ | 
|---|
 | 174 |   cat .depends >>makefile; \ | 
|---|
 | 175 |   $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) Makefiles | 
|---|
 | 176 |  | 
|---|
 | 177 | Headers:: | 
|---|
 | 178 |   @(case '$(MAKEFLAGS)' in *[ik]*) set +e;; esac; \ | 
|---|
 | 179 |   for i in $(SUBDIRS) $(EXTRASUBDIRS); do \ | 
|---|
 | 180 |   (cd $$i; echo  "installing header files" "(`pwd`)"; \ | 
|---|
 | 181 |   $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) DESTDIR=$(DESTDIR)  Headers; \ | 
|---|
 | 182 |   exit $$?) || exit 1; \ | 
|---|
 | 183 |   done) | 
|---|
 | 184 |  | 
|---|
 | 185 | Libs:: | 
|---|
 | 186 |   @(case '$(MAKEFLAGS)' in *[ik]*) set +e;; esac; \ | 
|---|
 | 187 |   for i in $(SUBDIRS) $(EXTRASUBDIRS); do \ | 
|---|
 | 188 |   (cd $$i; echo  "Make-Libraries-ing" "(`pwd`)"; \ | 
|---|
 | 189 |   $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) DESTDIR=$(DESTDIR)  Libs; \ | 
|---|
 | 190 |   exit $$?) || exit 1; \ | 
|---|
 | 191 |   done) | 
|---|
 | 192 |  | 
|---|
 | 193 | # Set up symlink for binding machine dependent module code  | 
|---|
 | 194 | # with machine independent mmfs object | 
|---|
 | 195 | Modules:: | 
|---|
 | 196 |   ln -fs $(LPPBIN)/mmfs $(DESTDIR)/bin ; \ | 
|---|
 | 197 |   if [ -e $(LPPBIN)/mmfs-i386r ]; then ln -fs $(LPPBIN)/mmfs-i386r $(DESTDIR)/bin; fi ; \ | 
|---|
 | 198 |   if [ -e $(LPPBIN)/mmfs-ppc64-rh4 ]; then ln -fs $(LPPBIN)/mmfs-ppc64-rh4 $(DESTDIR)/bin; fi | 
|---|
 | 199 |  | 
|---|
 | 200 | InstallLibs:: | 
|---|
 | 201 |   @(case '$(MAKEFLAGS)' in *[ik]*) set +e;; esac; \ | 
|---|
 | 202 |   for i in $(SUBDIRS) $(EXTRASUBDIRS); do \ | 
|---|
 | 203 |   (cd $$i; echo  "Make-Install-Libraries-ing" "(`pwd`)"; \ | 
|---|
 | 204 |   $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) DESTDIR=$(DESTDIR)  InstallLibs; \ | 
|---|
 | 205 |   exit $$?) || exit 1; \ | 
|---|
 | 206 |   done) | 
|---|
 | 207 |  | 
|---|
 | 208 | # RPM source build option to install images for gpl kernel modules | 
|---|
 | 209 | InstallImages:: | 
|---|
 | 210 |   cd gpl-linux; $(MAKE) InstallImages; | 
|---|
 | 211 |  | 
|---|
 | 212 | # Use screwy method to clean up residual stuff left over | 
|---|
 | 213 | # from a gpl source build (if neccessary) and avoid | 
|---|
 | 214 | # various gripes from rpm uninstall | 
|---|
 | 215 | SrcBuildClean:: | 
|---|
 | 216 |   @if [ -f gpl-linux/makefile ]; then make UninstallClean; fi; \ | 
|---|
 | 217 |   rm -f config/site.mcr; \ | 
|---|
 | 218 |   rm -f shark/config/site.mcr; \ | 
|---|
 | 219 |   rm -f shark/config/imake.tmpl; \ | 
|---|
 | 220 |   rm -f /usr/lpp/mmfs/bin/mmfslinux; \ | 
|---|
 | 221 |   rm -f /usr/lpp/mmfs/bin/tracedev; \ | 
|---|
 | 222 |   rm -f /usr/lpp/mmfs/bin/lxtrace; \ | 
|---|
 | 223 |   rm -f /usr/lpp/mmfs/bin/dumpconv; \ | 
|---|
 | 224 |   rm -f /usr/lpp/mmfs/bin/tracedev.BAK; \ | 
|---|
 | 225 |   if [ -d shark/config ]; then rmdir shark/config; fi; \ | 
|---|
 | 226 |   if [ -d shark ]; then rmdir shark; fi; \ | 
|---|
 | 227 |   if [ -d lib ]; then rmdir lib; fi; \ | 
|---|
 | 228 |   if [ -d bin ]; then rmdir bin; fi; \ | 
|---|
 | 229 |   if [ -d include ]; then rmdir include; fi; \ | 
|---|
 | 230 |   sh -c 'flist=$$(find ./ -name .depends); rm -f $$flist'; \ | 
|---|
 | 231 |   sh -c 'flist=$$(find ./ -name install.he); rm -f $$flist'; \ | 
|---|
 | 232 |   sh -c 'flist=$$(find ./ -name makefile.BAK); rm -f $$flist'; \ | 
|---|
 | 233 |   for i in $(OLDSUBDIRS); do \ | 
|---|
 | 234 |     if [ -d $$i ]; then rm -f $$i/makefile; fi; \ | 
|---|
 | 235 |   done; \ | 
|---|
 | 236 |   rm -f config/makefile gpl-linux/makefile gpl-linux/i386/makefile \ | 
|---|
 | 237 |         ibm-kxi/makefile ibm-linux/makefile misc/makefile \ | 
|---|
 | 238 |         gpl-linux/ia64/makefile gpl-linux/ppc64/makefile \ | 
|---|
 | 239 |         gpl-linux/x86_64/makefile; | 
|---|
 | 240 |  | 
|---|
 | 241 | ##### DEPENDENCY LINE - DO NOT DELETE ##### | 
|---|
 | 242 |  | 
|---|