Generated makefile keeps trying to compile file that doesn't exist

Viewed 56

Recently I started a project with both C and C++ sources. In my configure.ac file, I check for both languages, like so:

AC_PROG_CC
AC_PROG_CXX

This is my Makefile.am

lib_LTLIBRARIES = libfris.la

libfris_la_LDFLAGS = -module -avoid-version -shared
libfris_la_SOURCES = foo.cpp bar.c

When I say make, it complains that I don't have a file named bar.cpp (which I never mentioned). Why is this? I assume this is my own stupidity. Sorry for this question!

I have already seen this: http://gnu-automake.7480.n7.nabble.com/Mixing-C-and-C-td4676.html. It hasn't helped.

1 Answers

You aren't trying to set per-object flags here or anything else tricky, and my automake looks just like yours. Could this be a bug in very old automake?

With automake 1.16.1, autoconf 2.69 and libtool 2.4.6 I do not get any complaints about a missing bar.cpp:

My Makefile.am:

CLOCAL_AMFLAGS = "-Im4"
lib_LTLIBRARIES = libfris.la

libfris_la_LDFLAGS = -module -avoid-version -shared
libfris_la_SOURCES = foo.cpp bar.c

and my configure.ac

AC_PREREQ([2.69])

AC_INIT([stack-example], [0.1],)
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AM_SILENT_RULES([yes])

AM_PROG_AR
LT_INIT
AC_CONFIG_MACRO_DIRS([m4])

AC_PROG_CC
AC_PROG_CC_C_O
AC_PROG_CXX

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Related