0
votes

I am trying to run automake and autoconf in my project. However when I run make, I get an error "no rules to make inz.c required by inz.o". However I don't have inz.c in my project. I guess it might by an error in configuration, but it is my first time using autoconf/automake, so I'd like to kindly ask for assistance. I am running under Linux The sturcture is as following:

inz (main folder)
-configure.ac
-inz.cbp
-inz.depend
-inz.layout
-Makefile.am
--src\main.cpp
--src\main.hpp
--src\packetcapture.cpp
--src\packetcapture.hpp
--src\packetprocess.cpp
--src\packetprocess.hpp
--src\Makefile.am

configure.ac:

AC_INIT([inz], 1.0)
AC_CONFIG_AUX_DIR([build])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT

Makefile.am:

SUBDIRS = src
dist_doc_DATA = README.md

src\Makefile.am:

bin_PROGRAMS = inz
inz_sources = main.cpp packetcapture.cpp packetprocess.cpp
include_HEADERS = main.hpp packetcapture.hpp packetprocess.hpp

commands to compile the project itself: (it also uses -lndpi -lpthread and -lpcap)

g++ -Wall -std=c++0x -Wunused -g -Wno-deprecated-declarations -Iinclude -I./ -c /inz/src/main.cpp -o obj/Debug/src/main.o
g++ -Wall -std=c++0x -Wunused -g -Wno-deprecated-declarations -Iinclude -I./ -c /inz/src/packetcapture.cpp -o obj/Debug/src/packetcapture.o

commands I run to confiugre automake/autoconf (from the main folder):

autoreconf --install
cd build
../configure
make
1
wag: x\y should be x\\y; or better yet x/y -- most msdos programs know the proper path separator. - mevets
it is under linux - Tom2020
Sounds like automake might be confused - If you change bin_PROGRAMS = inz to bin_PROGRAMS = test, does it fail with "no rules to make test.c required by test.o" ?. It could have something to do with the fact that you have a file in your root dir starting with inz. - zrrbite
Yes, that is the exact fail error when I change bin_PROGRAMS. Maybe the problem is with the cbp file generated by Code::Blocks? It is not the cbp issue, I tried - Tom2020

1 Answers

1
votes

You need to be careful with variable names because they are case sensitive.

You're declaring inz_sources, but that's not a special variable for automake. inz_SOURCES would be.

Without a special _SOURCES variable, automake will go on to assume that inz is built from inz.c. But you don't have that file so it fails.