I am trying to use autotools in my Yocto project. Working with another user I was able to get bitbake to recognize my autogen.sh
, configure.ac
and Makefile.am
. I am now getting the error
make: *** No rule to make target 'main.c', needed by 'main.o'. Stop.
My tree is as follows:
.
├── files
│ ├── MAIN_Application
│ │ ├── autogen.sh
│ │ ├── configure.ac
│ │ ├── include
│ │ │ ├── main.h
│ │ │ ├── scheduler.h
│ │ │ └── utilities
│ │ │ └── time_conversions.h
│ │ ├── Makefile.am
│ │ ├── project.yml
│ │ └── src
│ │ ├── main.c
│ │ ├── Makefile.am
│ │ ├── scheduler.c
│ │ └── utilities
| | ├── Makefile.am
│ │ └── time_conversions.c
│ └── services
│ └── mainapplication.service
└── mainapplication_0.0.bb
My makefile.am is as follows:
AUTOMAKE_OPTIONS = foreign
CFLAGS = -Wall -pedantic -O2
include_HEADERS = main.h
bin_PROGRAMS = MAIN_Application
MAIN_Application_SOURCES = main.c
I believe I need to add my other source files. What I am not sure is how to do so. Do I add them with MAIN_Application_SOURCES
or do I need to add a Makefile.am
in each subdirectory?
Edit: Adding link to previous question. Edit 2: I have added a makefile.am to each directory. In MAIN_Application I have:
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src
In src I have:
AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = MAIN_Application
EVCC_Application_SOURCES = main.c scheduler.c time_conversions.c
This gives a new error:
| Making all in src
| /bin/bash: line 20: cd: src: No such file or directory
| make: *** [Makefile:332: all-recursive] Error 1
| ERROR: oe_runmake failed
Edit 3: If I remove my src and include folders, place everything into one folder (top level) it all works. This is ugly and I hate it.
.
├── files
│ ├── MAIN_Application
│ │ ├── autogen.sh
│ │ ├── configure.ac
│ │ ├── main.c
│ │ ├── main.h
│ │ ├── Makefile.am
│ │ ├── project.yml
│ │ ├── scheduler.c
│ │ ├── scheduler.h
│ │ ├── time_conversions.c
│ │ └── time_conversions.h
│ └── services
│ └── mainapplication.service
└── mainapplication_0.0.bb
There has to be a way around this.
Edit 4: I am attempting to move all of my code into a src directory and use SUBDIR
in my makefile.am
.
├── files
│ ├── MAIN_Application
│ │ ├── autogen.sh
│ │ ├── configure.ac
│ │ ├── include
│ │ ├── Makefile.am
│ │ ├── project.yml
│ │ ├── src
│ │ │ ├── main.c
│ │ │ ├── main.h
│ │ │ ├── Makefile.am
│ │ │ ├── scheduler.c
│ │ │ ├── scheduler.h
│ │ │ ├── time_conversions.c
│ │ │ └── time_conversions.h
│ │ └── test
│ │ ├── test_scheduler.c
│ │ └── test_time_conversions.c
│ └── services
│ └── mainapplication.service
└── mainapplication_0.0.bb
This leads to the same error of src no such file or directory
.