kdump-build-cleanup-1-20040515
[openafs.git] / src / venus / Makefile.in
index c0bddbb..971c047 100644 (file)
@@ -41,14 +41,7 @@ CMLIBS=${TOP_LIBDIR}/libsys.a \
 
 LIBS = ${FSLIBS} 
 
-#
-# In order not to rebuild kdump* again and again we use
-# AFS_SYSNAME dependent targets (generated by configure)
-#
-KDUMP=@KDUMP@
-KDUMP64=@KDUMP64@
-
-all: fs up fstrace cmdebug livesys ${KDUMP} ${KDUMP64}
+all: fs up fstrace cmdebug livesys kdump-build
 
 #
 # Build targets
@@ -73,43 +66,6 @@ ${DEST}/etc/fstrace: fstrace
 ${DEST}/bin/cmdebug: cmdebug
        ${INSTALL} -s $? $@
 
-${DEST}/etc/${KDUMP}: ${KDUMP}
-       -set -x; \
-       case ${SYS_NAME} in \
-       sgi_6? ) \
-               ${INSTALLex} -f ${srcdir}/kdump.sh.sgi_ipnos ${DEST}/etc/kdump; \
-               ln -fs kdump ${DEST}/etc/kdump32; \
-               ln -fs kdump.IP20 ${DEST}/etc/kdump.IP22; \
-               ln -fs kdump.IP20 ${DEST}/etc/kdump.IP32; \
-               for f in kdump.IP??; \
-                       do ${INSTALL} -s $$f ${DEST}/etc/$$f || exit $$? ; \
-               done ;; \
-       sun*_5[789] ) \
-               ${INSTALLex} -f ${srcdir}/kdump.sh.solaris7 ${DEST}/etc/kdump; \
-               ${INSTALL} -s -f $? $@;; \
-       *alpha_linux* ) \
-               ${INSTALLex} -f ${srcdir}/kdump.sh.linux ${DEST}/etc/kdump; \
-               ${INSTALL} -s kdump-alpha_linux-${LINUX_VERSION} $@ ;; \
-       *linux* ) \
-               ${INSTALLex} -f ${srcdir}/kdump.sh.linux ${DEST}/etc/kdump; \
-               ${INSTALL} -s kdump-linux-${LINUX_VERSION} $@ ;; \
-       hp_ux11* ) \
-               ${INSTALLex} -f ${srcdir}/kdump.sh.hp_ux11 ${DEST}/etc/kdump; \
-               ${INSTALL} -s -f $? $@;; \
-       *nbsd*) \
-               ;; \
-       *) \
-               ${INSTALL} -s $? $@ ;; \
-       esac
-
-${DEST}/etc/${KDUMP64}: ${KDUMP64}
-       -set -x; \
-       case ${SYS_NAME} in \
-       sun4x_5[789] | hp_ux11* |sunx86_5[789] ) \
-               ${INSTALL} -s $? $@ ;;\
-       * ) \
-               echo skipping kdump64 for ${SYS_NAME} ;; \
-       esac
 
 
 up.o: up.c AFS_component_version_number.c
@@ -167,43 +123,69 @@ cmdebug.o: cmdebug.c ${INCLS} AFS_component_version_number.c
 cmdebug: cmdebug.o ${CMLIBS}
        $(CC) -o cmdebug cmdebug.o ${CFLAGS} ${CMLIBS} ${XLIBS}
 
+
+
 #
 # Kernel info dumper - these are done with submakes so that
 # the build process does not attempt to rebuild them every time it runs.
 #
 
-# *linux* - Builds kdump-X.Y.Z according to kernel version
-kdump-linux-@LINUX_VERSION@.o: kdump.c ${INCLS} AFS_component_version_number.c
-       ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs \
-               -I${TOP_OBJDIR}/src \
-               -I${TOP_OBJDIR}/src/afs/${MKAFS_OSTYPE} \
-               -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs \
-               -I${TOP_SRCDIR} -I${TOP_SRCDIR}/afs/${MKAFS_OSTYPE} \
-               -I${TOP_INCDIR} ${XCFLAGS} -o kdump-linux-${LINUX_VERSION}.o \
-               -c ${srcdir}/kdump.c
-
-kdump-linux-@LINUX_VERSION@: kdump-linux-@LINUX_VERSION@.o
-       ${CC} ${KERN_DBG} ${KERN_OPTMZ} -o kdump-linux-${LINUX_VERSION} kdump-linux-${LINUX_VERSION}.o \
-               ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS}
+#
+# Branching target, run the actual build depending on sysname
+#
+kdump-build: kdump.c ${INCLS} AFS_component_version_number.c
+       $(MAKE) kdump kdump64
+       touch kdump-build
+       
+#
+# Build targets - one for each type of kdump build process we have
+#
+kdump:
+       -set -x; \
+       case ${SYS_NAME} in \
+       sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_54 | sun4c_54 | sun4m_54 | sunx86_5? ) \
+               ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a /usr/lib/libkvm.a -lelf ${XLIBS} ;; \
+       sun*_5? ) \
+               ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a  ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
+       sgi_6? ) \
+               for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
+               do      IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
+                       CPU_KDEFS=`sed 's/-mips.//' $$f`; \
+                       echo IP = $$IP; \
+                       echo CPU_KDEFS = $$CPU_KDEFS; \
+                       case $$CPU_KDEFS in \
+                       *-64*)  ${CC} ${XCFLAGS64} \
+                                       $$CPU_KDEFS \
+                                       -o kdump.$$IP kdump.$$IP.o \
+                                       ${TOP_LIBDIR}/libcmd64.a -lelf \
+                               ;; \
+                       *)      ${CC} ${XCFLAGS} \
+                                       $$CPU_KDEFS \
+                                       -o kdump.$$IP kdump.$$IP.o \
+                                       ${TOP_LIBDIR}/libcmd.a -lelf \
+                               ;; \
+                       esac || exit $$? ; \
+               done ;; \
+       *alpha_linux* ) \
+               $(MAKE) kdump-alpha_linux-@LINUX_VERSION@ ;; \
+       *linux* ) \
+               $(MAKE) kdump-linux-@LINUX_VERSION@ ;; \
+       alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux??) \
+               ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a ${XLIBS} -ll -lmld;; \
+       ncrx86_* ) ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a -lelf ${XLIBS} ;; \
+       *nbsd*) touch kdump ;; \
+       * )     ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a ${XLIBS} ;; \
+       esac
 
-# *alpha_linux* - Builds kdump-X.Y.Z according to kernel version
-kdump-alpha_linux-@LINUX_VERSION@.o: kdump.c ${INCLS} AFS_component_version_number.c
-       ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs \
-               -I${TOP_OBJDIR}/src \
-               -I${TOP_OBJDIR}/src/afs/${MKAFS_OSTYPE} \
-               -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs \
-               -I${TOP_SRCDIR} -I${TOP_SRCDIR}/afs/${MKAFS_OSTYPE} \
-               -I${TOP_INCDIR} ${XCFLAGS} -mno-fp-regs -ffixed-8 \
-               -o kdump-alpha_linux-${LINUX_VERSION}.o -c ${srcdir}/kdump.c ;; \
+kdump64: 
+       -set -x; \
+       case ${SYS_NAME} in \
+       sun4x_5[789] | hp_ux11* |sunx86_5[789] )  \
+               ${CC} ${XCFLAGS64} -o ${KDUMP64} ${KDUMP64}.o ${TOP_LIBDIR}/libcmd64.a ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
+       esac
 
-kdump-alpha_linux-@LINUX_VERSION@: kdump-alpha_linux-@LINUX_VERSION@.o
-       ${CC} ${KERN_DBG} ${KERN_OPTMZ} -o kdump-alpha_linux-${LINUX_VERSION} kdump-alpha_linux-${LINUX_VERSION}.o \
-               ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS}
 
-#
-# Default target
-#
-${KDUMP}.o: kdump.c ${INCLS} AFS_component_version_number.c
+kdump.o: kdump.c ${INCLS} AFS_component_version_number.c
        -set -x; \
        case ${SYS_NAME} in \
                alpha_linux* ) \
@@ -239,61 +221,85 @@ ${KDUMP}.o: kdump.c ${INCLS} AFS_component_version_number.c
                *nbsd*) \
                        touch kdump.o ;; \
                *) \
-                       ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_SRCDIR} -I${TOP_INCDIR}/afs -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS} -o ${KDUMP}.o -c ${srcdir}/kdump.c ;; \
+                       ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_SRCDIR} -I${TOP_INCDIR}/afs \
+                       -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS} \
+                       -o kdump.o -c ${srcdir}/kdump.c ;; \
        esac ;
 
-${KDUMP64}.o : kdump.c ${INCLS} AFS_component_version_number.c
+kdump64.o : kdump.c ${INCLS} AFS_component_version_number.c
        -set -x; \
        case ${SYS_NAME} in \
        sun4x_5[789] | hp_ux11* |sunx86_5[789] ) \
-               ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_SRCDIR} -I${TOP_INCDIR}/afs -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS64} -o ${KDUMP64}.o -c ${srcdir}/kdump.c ;; \
+               ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_SRCDIR} -I${TOP_INCDIR}/afs \
+               -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS64} \
+               -o kdump64.o -c ${srcdir}/kdump.c ;; \
        esac
 
-${KDUMP}:  ${KDUMP}.o
+# *linux* - Builds kdump-X.Y.Z according to kernel version
+kdump-linux-@LINUX_VERSION@.o: kdump.c ${INCLS} AFS_component_version_number.c
+       ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs \
+               -I${TOP_OBJDIR}/src \
+               -I${TOP_OBJDIR}/src/afs/${MKAFS_OSTYPE} \
+               -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs \
+               -I${TOP_SRCDIR} -I${TOP_SRCDIR}/afs/${MKAFS_OSTYPE} \
+               -I${TOP_INCDIR} ${XCFLAGS} -o kdump-linux-${LINUX_VERSION}.o \
+               -c ${srcdir}/kdump.c
+
+kdump-linux-@LINUX_VERSION@: kdump-linux-@LINUX_VERSION@.o
+       ${CC} ${KERN_DBG} ${KERN_OPTMZ} -o kdump-linux-${LINUX_VERSION} kdump-linux-${LINUX_VERSION}.o \
+               ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS}
+
+# *alpha_linux* - Builds kdump-X.Y.Z according to kernel version
+kdump-alpha_linux-@LINUX_VERSION@.o: kdump.c ${INCLS} AFS_component_version_number.c
+       ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs \
+               -I${TOP_OBJDIR}/src \
+               -I${TOP_OBJDIR}/src/afs/${MKAFS_OSTYPE} \
+               -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs \
+               -I${TOP_SRCDIR} -I${TOP_SRCDIR}/afs/${MKAFS_OSTYPE} \
+               -I${TOP_INCDIR} ${XCFLAGS} -mno-fp-regs -ffixed-8 \
+               -o kdump-alpha_linux-${LINUX_VERSION}.o -c ${srcdir}/kdump.c ;; \
+
+kdump-alpha_linux-@LINUX_VERSION@: kdump-alpha_linux-@LINUX_VERSION@.o
+       ${CC} ${KERN_DBG} ${KERN_OPTMZ} -o kdump-alpha_linux-${LINUX_VERSION} kdump-alpha_linux-${LINUX_VERSION}.o \
+               ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS}
+
+#
+# kdump install targets
+#
+${DEST}/etc/kdump: kdump-build
        -set -x; \
        case ${SYS_NAME} in \
-       sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_54 | sun4c_54 | sun4m_54 | sunx86_5? ) \
-               ${CC} -o ${KDUMP} ${KDUMP}.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a /usr/lib/libkvm.a -lelf ${XLIBS} ;; \
-       sun*_5? ) \
-               ${CC} -o ${KDUMP} ${KDUMP}.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a  ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
        sgi_6? ) \
-               for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
-               do      IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
-                       CPU_KDEFS=`sed 's/-mips.//' $$f`; \
-                       echo IP = $$IP; \
-                       echo CPU_KDEFS = $$CPU_KDEFS; \
-                       case $$CPU_KDEFS in \
-                       *-64*)  ${CC} ${XCFLAGS64} \
-                                       $$CPU_KDEFS \
-                                       -o kdump.$$IP kdump.$$IP.o \
-                                       ${TOP_LIBDIR}/libcmd64.a -lelf \
-                               ;; \
-                       *)      ${CC} ${XCFLAGS} \
-                                       $$CPU_KDEFS \
-                                       -o kdump.$$IP kdump.$$IP.o \
-                                       ${TOP_LIBDIR}/libcmd.a -lelf \
-                               ;; \
-                       esac || exit $$? ; \
+               ${INSTALLex} -f ${srcdir}/kdump.sh.sgi_ipnos ${DEST}/etc/kdump; \
+               ln -fs kdump ${DEST}/etc/kdump32; \
+               ln -fs kdump.IP20 ${DEST}/etc/kdump.IP22; \
+               ln -fs kdump.IP20 ${DEST}/etc/kdump.IP32; \
+               for f in kdump.IP??; \
+                       do ${INSTALL} -s $$f ${DEST}/etc/$$f || exit $$? ; \
                done ;; \
+       sun*_5[789] ) \
+               ${INSTALLex} -f ${srcdir}/kdump.sh.solaris7 ${DEST}/etc/kdump; \
+               ${INSTALL} -s -f $? $@;; \
        *alpha_linux* ) \
-               $(MAKE) kdump-alpha_linux-@LINUX_VERSION@ ;; \
+               ${INSTALLex} -f ${srcdir}/kdump.sh.linux ${DEST}/etc/kdump; \
+               ${INSTALL} -s kdump-alpha_linux-${LINUX_VERSION} $@ ;; \
        *linux* ) \
-               $(MAKE) kdump-linux-@LINUX_VERSION@ ;; \
-       alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux??) \
-               ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a ${XLIBS} -ll -lmld;; \
-       ncrx86_* ) ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a -lelf ${XLIBS} ;; \
-       *nbsd*) touch kdump ;; \
-       * )     ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/util.a ${XLIBS} ;; \
+               ${INSTALLex} -f ${srcdir}/kdump.sh.linux ${DEST}/etc/kdump; \
+               ${INSTALL} -s kdump-linux-${LINUX_VERSION} $@ ;; \
+       hp_ux11* ) \
+               ${INSTALLex} -f ${srcdir}/kdump.sh.hp_ux11 ${DEST}/etc/kdump; \
+               ${INSTALL} -s -f $? $@;; \
+       *nbsd*) \
+               ;; \
+       *) \
+               ${INSTALL} -s $? $@ ;; \
        esac
 
-## kdump to read from 64 bit kernel dumps
+${DEST}/etc/kdump64: kdump-build
+       if [ -e kdump64 ]; then \
+               ${INSTALL} -s kdump64 $@; \
+       fi
 
-${KDUMP64}: ${KDUMP64}.o
-       -set -x; \
-       case ${SYS_NAME} in \
-       sun4x_5[789] | hp_ux11* |sunx86_5[789] )  \
-               ${CC} ${XCFLAGS64} -o ${KDUMP64} ${KDUMP64}.o ${TOP_LIBDIR}/libcmd64.a ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
-       esac
 
 #
 # Install targets
@@ -305,8 +311,8 @@ install: \
        ${DESTDIR}${bindir}/up \
        ${DESTDIR}${sbindir}/fstrace \
        ${DESTDIR}${bindir}/cmdebug \
-       ${DESTDIR}${sbindir}/${KDUMP} \
-       ${DESTDIR}${sbindir}/${KDUMP64}
+       ${DESTDIR}${sbindir}/kdump \
+       ${DESTDIR}${sbindir}/kdump62
 
 #
 # Misc targets
@@ -338,7 +344,7 @@ ${DESTDIR}${sbindir}/fstrace: fstrace
 ${DESTDIR}${bindir}/cmdebug: cmdebug
        ${INSTALL} -s $? $@
 
-${DESTDIR}${sbindir}/${KDUMP}: ${KDUMP}
+${DESTDIR}${sbindir}/kdump: kdump-build
        -set -x; \
        case ${SYS_NAME} in \
        sgi_6? ) \
@@ -362,14 +368,10 @@ ${DESTDIR}${sbindir}/${KDUMP}: ${KDUMP}
                ${INSTALL} -s $? $@ ;; \
        esac
 
-${DESTDIR}${sbindir}/kdump64: kdump64
-       -set -x; \
-       case ${SYS_NAME} in \
-       sun4x_5[789] | hp_ux11* ) \
-               ${INSTALL} -s $? $@ ;;\
-       * ) \
-               echo skipping kdump64 for ${SYS_NAME} ;; \
-       esac
+${DESTDIR}${sbindir}/kdump64: kdump-build
+       if [ -e kdump64 ]; then \
+               ${INSTALL} -s kdump64 $@; \
+       fi
 
 dest: \
        ${DEST}/bin/fs \
@@ -378,6 +380,6 @@ dest: \
        ${DEST}/bin/up \
        ${DEST}/etc/fstrace \
        ${DEST}/bin/cmdebug \
-       ${DEST}/etc/${KDUMP} \
-       ${DEST}/etc/${KDUMP64}
+       ${DEST}/etc/kdump \
+       ${DEST}/etc/kdump64