Automake Libtool 'No rule to make target'

Jonathan Hatchett picture Jonathan Hatchett · Dec 8, 2011 · Viewed 9k times · Source

I've been trying to build to GLTools library that accompanies The OpenGL SuperBible into a libtool library with automake.

I've set up autoconf and automake but when it comes to actually build the library I get:

$ make
make: *** No rule to make target `GLBatch.lo', needed by `libgltools.la'.  Stop.

I've searched google as much as my sanity will let me and come up with nothing, I'm new to automake so I'm not quite sure what to be searching for. I'm sure it's either a tiny mistake or I've missed something fundamental.

Here is my Makefile.am:

ACLOCAL_AMFLAGS = -I m4

lib_LTLIBRARIES = libgltools.la
libgltools_la_SOURCES = GLBatch.cpp GLShaderManager.cpp GLTriangeBatch.cpp GLTools.cpp math3d.cpp glew.c
#libgltools_la_CFLAGS = 
libgltools_la_LIBADD = -lX11 -lglut -lGL -lGLU -lm

include_HEADERS = GLBatchBase.h GLBatch.h GLFrame.h GLFrustum.h GLGeometryTransform.h GLMatrixStack.h GLShaderManager.h GLTools.h GLTriangleBatch.h math3d.h StopWatch.h GL/glew.h GL/glxew.h GL/wglew.h

EXTRA_DIST = autogen.sh

And my configure.ac if it matters:

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.67])
AC_INIT([libgltools.la], [0.1], [[email protected]])
AM_INIT_AUTOMAKE([libgltools.la], [0.1])
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/])
AC_CONFIG_HEADERS([include/config.h])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lGL':
AC_CHECK_LIB([GL], [main])
# FIXME: Replace `main' with a function in `-lGLU':
AC_CHECK_LIB([GLU], [main])
# FIXME: Replace `main' with a function in `-lX11':
AC_CHECK_LIB([X11], [main])
# FIXME: Replace `main' with a function in `-lglut':
AC_CHECK_LIB([glut], [main])
# FIXME: Replace `main' with a function in `-lm':
AC_CHECK_LIB([m], [main])

# Checks for header files.
AC_PATH_X
AC_CHECK_HEADERS([inttypes.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT64_T
AC_CHECK_TYPES([ptrdiff_t])

# Checks for library functions.
AC_HEADER_MAJOR
AC_FUNC_MALLOC
AC_CHECK_FUNCS([gettimeofday sqrt strchr strstr])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

Thanks very much.

Answer

Mike Steinert picture Mike Steinert · Dec 8, 2011

It's hard to say based on your description but I would wager that you need to put your Makefile.am in the src directory and then create a Makefile.am in the GLTools directory that looks like this:

SUBDIRS = src
ACLOCAL_AMFLAGS = -I m4

It is also possible to do a non-recursive make but that requires some extra setup.

Here I did it for you:

https://github.com/msteinert/gltools