1

I am implementing CPPUTEST for my application along with Autotools, but the final makefile generated in subdirectories is not able to make the final build.

Folder Structure:

|
+- Build_output: holds executable for CPPUTEST
+- Configure : holds `configure.ac` and `Makefile.am`
+- Src: contains source files that contain functions and makefile.am
+- Test: contains test file
+- build: shell script for creating executables.

Snapshot added: build structure

build structure continue

Usually I see example of autotools every where configuration files is kept outside, not inside the configure folder.

Configure.ac inside configure folder:

AC_INIT([cpputest], [1.0], [])
AM_INIT_AUTOMAKE([
  -Wall -Werror foreign subdir-objects
])
AC_PROG_CXX
AC_CONFIG_FILES([
  Makefile
  ../src/Makefile
  ../test/Makefile
])
AC_OUTPUT

Makefile.am inside configure folder:

SUBDIRS = \
../src \
../test 

Shell script present outside "build"

#!/bin/sh
cd configure
autoreconf -i
./configure
make check

When I run my shell script, the make file is getting generated inside src and test folder but when I try make check it executes cd ../.. ---> screenshot attached ./build execution

Is there any other option needed to add in configure.ac or makefile.am ?

kebs
  • 6,387
  • 4
  • 41
  • 70
  • I edited format pretty deeply, please check I didn't misunderstand some things. – kebs Mar 02 '18 at 14:53
  • And removed c++ tag, has nothing to do with c++. – kebs Mar 02 '18 at 14:53
  • It's not entirely clear to me why what you're trying to do is not working, but It's also not clear to me why you are going to so much effort to try to put the `configure` script somewhere other than in the Autotools-standard location in the root of the project tree. You can easily direct it to put most of its auxiliary files in a subdirectory to keep the root clean(er), but I suggest keeping the `configure` script itself in the normal place. At least until you get the build working that way -- if you then want to try moving it, you will have eliminated most other potential issues. – John Bollinger Mar 10 '18 at 19:50
  • Thanks Kebs for reformatting my Comments and code. @John: if i put **configure** script in root of the project tree, all my compilation is working fine, but when i make separate folder for configure and all the generated files that condition i am getting stuck when autotools create makefile inside my **src** and **test** folder – Tanmay Middha Mar 12 '18 at 06:31
  • As I said, it's not clear to me why putting the `configure` script in a non-standard location is not working. Perhaps there's a bug in Automake or Autoconf, or perhaps there's something about your particular `Makefile.am` files that makes it fail. If you presented a *bona fide* [mcve] then I could probably discern between the two, and maybe help you fix it. But the fact remains that the easiest and most natural solution would be to put `configure` in its normal place. – John Bollinger Mar 12 '18 at 11:59
  • 1
    main purpose for using not as per standard, not putting configure.ac in root of project tree. require to generate all the Autoconf and Automake files in different folder, so the structure will always look simple to other user whenever he/she try to modify **src** folder: code support application **test** folder: code for test cases **Configure** folder: all the configure and generated files. All the object generated files will be present in respective folder – Tanmay Middha Mar 16 '18 at 07:23

0 Answers0