compile_et: Don't overflow input file buffer
[openafs.git] / src / comerr / Makefile.in
index bb97ef7..b94f1c6 100644 (file)
@@ -6,84 +6,85 @@
 
 srcdir=@srcdir@
 include @TOP_OBJDIR@/src/config/Makefile.config
+include @TOP_OBJDIR@/src/config/Makefile.lwp
+include @TOP_OBJDIR@/src/config/Makefile.lwptool
 
-CFLAGS=${OPTMZ} -I${TOP_INCDIR} -I${TOP_OBJDIR}/src/config -I. -I${srcdir} ${XCFLAGS}
+LT_objs = error_msg.lo et_name.lo com_err.lo
+LT_deps = $(top_builddir)/src/opr/liboafs_opr.la
+LT_libs = $(LIB_roken) $(MT_LIBS)
 
-all: ukinstall compile_et ${TOP_INCDIR}/afs/com_err.h ${TOP_INCDIR}/afs/error_table.h ${TOP_INCDIR}/afs/mit-sipb-cr.h ${TOP_LIBDIR}/libcom_err.a
+all: compile_et ${TOP_INCDIR}/afs/com_err.h ${TOP_INCDIR}/afs/error_table.h \
+     ${TOP_INCDIR}/afs/mit-sipb-cr.h ${TOP_LIBDIR}/libafscom_err.a \
+     liboafs_comerr.la libcomerr_pic.la
 
-et_lex.lex.c: et_lex.lex.l
-       $(RM) -f et_lex.lex.c
-       $(LEX) -t $? > et_lex.lex.c
-
-compile_et:    compile_et.o error_table.o
-       case $(SYS_NAME) in \
-       *_linux* ) \
-       ${CC} ${CFLAGS} -o compile_et compile_et.o error_table.o -L${TOP_LIBDIR} -lafsutil;; \
-       * ) \
-       ${CC} ${CFLAGS} -o compile_et compile_et.o error_table.o -L${TOP_LIBDIR} -lafsutil -ll;; \
-       esac
-
-libcom_err.a: error_msg.o et_name.o com_err.o AFS_component_version_number.o
-       $(RM) -f $@
-       $(AR) crv $@ error_msg.o et_name.o com_err.o AFS_component_version_number.o
-       $(RANLIB) $@
-#
-# Installation targets
-#
-ukinstall: \
-       ${UKERNELDIR}/afs \
-       ${UKERNELDIR}/afs/com_err.c \
-       ${UKERNELDIR}/afs/com_err.h \
-       ${UKERNELDIR}/afs/error_msg.c \
-       ${UKERNELDIR}/afs/error_table.h \
-       ${UKERNELDIR}/afs/mit-sipb-cr.h \
-       ${UKERNELDIR}/afs/internal.h \
-       ${UKERNELDIR}/afs/et_name.c
+buildtools: compile_et
 
-install:  ${DESTDIR}${bindir}/compile_et ${DESTDIR}${includedir}/afs/com_err.h ${DESTDIR}${includedir}/afs/error_table.h ${DESTDIR}${includedir}/afs/mit-sipb-cr.h ${DESTDIR}${libdir}/afs/libcom_err.a
-
-${UKERNELDIR}/afs:
-       mkdir -p $@
-
-${UKERNELDIR}/afs/com_err.c: com_err.c
-       ${INSTALL} $? $@
-
-${UKERNELDIR}/afs/com_err.h: com_err.h
-       ${INSTALL} $? $@
+${TOP_INCDIR}/afs/com_err.h: com_err.h
+       ${INSTALL_DATA} $? $@
 
-${UKERNELDIR}/afs/error_msg.c: error_msg.c
-       ${INSTALL} $? $@
+${TOP_INCDIR}/afs/error_table.h: error_table.h
+       ${INSTALL_DATA} $? $@
 
-${UKERNELDIR}/afs/error_table.h: error_table.h
-       ${INSTALL} $? $@
+${TOP_INCDIR}/afs/mit-sipb-cr.h: mit-sipb-cr.h
+       ${INSTALL_DATA} $? $@
 
-${UKERNELDIR}/afs/mit-sipb-cr.h: mit-sipb-cr.h
-       ${INSTALL} $? $@
+${TOP_LIBDIR}/libafscom_err.a: libafscom_err.a
+       ${INSTALL_DATA} $? $@
 
-${UKERNELDIR}/afs/internal.h: internal.h
-       ${INSTALL} $? $@
+et_lex.lex.c: et_lex.lex.l
+       $(RM) -f et_lex.lex.c
+       $(LEX) -t $(srcdir)/et_lex.lex.l > et_lex.lex.c
 
-${UKERNELDIR}/afs/et_name.c: et_name.c
-       ${INSTALL} $? $@
+compile_et:    compile_et.o error_table.o
+       $(Q)case $(SYS_NAME) in \
+       *_linux* | *_umlinux* | *_darwin* ) \
+       $(LT_LDRULE_static_NOQ) compile_et.o error_table.o -L${TOP_LIBDIR} -lopr $(buildtool_roken) $(MT_LIBS);; \
+       * ) \
+       $(LT_LDRULE_static_NOQ) compile_et.o error_table.o -L${TOP_LIBDIR} -lopr -ll $(buildtool_roken) $(MT_LIBS);; \
+       esac
 
-${DEST}/bin/compile_et: compile_et
-       ${INSTALL} $? $@
+libafscom_err.a: $(LT_objs)
+       $(LT_LDLIB_lwp) $(LT_objs)
 
-${DEST}/include/afs/com_err.h: com_err.h
-       ${INSTALL} $? $@
+liboafs_comerr.la: $(LT_objs) $(LT_deps)
+       $(LT_LDLIB_shlib) $(LT_objs) $(LT_deps) $(LT_libs)
 
-${DEST}/include/afs/error_table.h: error_table.h 
-       ${INSTALL} $? $@
+libcomerr_pic.la: $(LT_objs)
+       $(LT_LDLIB_pic) $(LT_objs)
 
-${DEST}/include/afs/mit-sipb-cr.h: mit-sipb-cr.h
-       ${INSTALL} $? $@
+# When we build this file, we're using a .c file that's in the object directory,
+# so we need to add the source directory to the includes to pick up local headers.
+#
+CFLAGS_error_table.o= -I${srcdir} @CFLAGS_NOUNUSED@ @CFLAGS_NOOLDSTYLE@
 
-${DEST}/lib/afs/libcom_err.a: libcom_err.a
-       ${INSTALL} $? $@
+#
+# Installation targets
+#
+install: compile_et com_err.h error_table.h mit-sipb-cr.h libafscom_err.a \
+       liboafs_comerr.la
+       ${INSTALL} -d ${DESTDIR}${bindir}
+       ${INSTALL} -d ${DESTDIR}${includedir}/afs
+       ${INSTALL} -d ${DESTDIR}${libdir}/afs
+       ${INSTALL_PROGRAM} compile_et ${DESTDIR}${bindir}/afs_compile_et
+       ${INSTALL_DATA} ${srcdir}/com_err.h ${DESTDIR}${includedir}/afs/com_err.h
+       ${INSTALL_DATA} ${srcdir}/error_table.h ${DESTDIR}${includedir}/afs/error_table.h
+       ${INSTALL_DATA} ${srcdir}/mit-sipb-cr.h ${DESTDIR}${includedir}/afs/mit-sipb-cr.h
+       ${INSTALL_DATA} libafscom_err.a ${DESTDIR}${libdir}/afs/libafscom_err.a
+
+dest: compile_et com_err.h error_table.h mit-sipb-cr.h libafscom_err.a
+       ${INSTALL} -d ${DEST}/bin
+       ${INSTALL} -d ${DEST}/include/afs
+       ${INSTALL} -d ${DEST}/lib/afs
+       ${INSTALL_PROGRAM} compile_et ${DEST}/bin/afs_compile_et
+       ${INSTALL_DATA} ${srcdir}/com_err.h ${DEST}/include/afs/com_err.h
+       ${INSTALL_DATA} ${srcdir}/error_table.h ${DEST}/include/afs/error_table.h
+       ${INSTALL_DATA} ${srcdir}/mit-sipb-cr.h ${DEST}/include/afs/mit-sipb-cr.h
+       ${INSTALL_DATA} libafscom_err.a ${DEST}/lib/afs/libafscom_err.a
 
 clean:
+       $(LT_CLEAN)
        $(RM) -f *~ \#* *.bak *.otl *.aux *.toc *.PS *.dvi *.x9700 *.ps \
-               *.cp *.fn *.ky *.log *.pg *.tp *.vr *.o libcom_err.a \
+               *.cp *.fn *.ky *.log *.pg *.tp *.vr *.o libafscom_err.a \
                com_err.o compile_et et.ar TAGS y.tab.c lex.yy.c error_table.c \
                et_lex.lex.c test1.h test1.c test2.h test2.c \
                eddep makedep core AFS_component_version_number.c
@@ -92,35 +93,8 @@ test:
        cd test; $(MAKE)
 
 compile_et.o:  AFS_component_version_number.c
-error_table.o: et_lex.lex.c
+# specify yacc build product as a dependency so our .c.o rule will apply
+error_table.o: et_lex.lex.c error_table.c
+error_table.lo: et_lex.lex.c error_table.c
 
 include ../config/Makefile.version
-${DESTDIR}${bindir}/compile_et: compile_et
-       ${INSTALL} $? $@
-
-${DESTDIR}${includedir}/afs/com_err.h: com_err.h
-       ${INSTALL} $? $@
-
-${TOP_INCDIR}/afs/com_err.h: com_err.h
-       ${INSTALL} $? $@
-
-${DESTDIR}${includedir}/afs/error_table.h: error_table.h
-       ${INSTALL} $? $@
-
-${TOP_INCDIR}/afs/error_table.h: error_table.h
-       ${INSTALL} $? $@
-
-${DESTDIR}${includedir}/afs/mit-sipb-cr.h: mit-sipb-cr.h
-       ${INSTALL} $? $@
-
-${TOP_INCDIR}/afs/mit-sipb-cr.h: mit-sipb-cr.h
-       ${INSTALL} $? $@
-
-${DESTDIR}${libdir}/afs/libcom_err.a: libcom_err.a
-       ${INSTALL} $? $@
-
-${TOP_LIBDIR}/libcom_err.a: libcom_err.a
-       ${INSTALL} $? $@
-
-dest:  ${DEST}/bin/compile_et ${DEST}/include/afs/com_err.h ${DEST}/include/afs/error_table.h ${DEST}/include/afs/mit-sipb-cr.h ${DEST}/lib/afs/libcom_err.a
-