0

How can I tell lib/Makefile.am to produce non-.o targets out of certain input files (here .txt) and tell it to do this before compiling regular C source files?

Background: I have a bunch of text files (.txt) as input along with other C source files. I would like to process them with xxd to produce an C array initializer list which gets included by one of the C source files. Thus, text file processing should happen before compiling .c files.

In the C file I would include the processed .inc file:

#include "data.inc"

I get this far:

SUFFIXES = .txt
.txt.$(OBJEXT):
    $(XXD) -i $< @top_builddir@/include/$*.inc

The problem is that the makefile assumes a .o file being generated out of the rule (.txt --> .o) which is not what I need. I need to tell it that .inc is the final form and that it lives in the top_builddir. What would be the preferred way to do this?

ritter
  • 7,447
  • 7
  • 51
  • 84
  • 1
    http://www.gnu.org/software/automake/manual/automake.html#Sources Also, if you don't want it to think you want a `.txt.o`, Don't state that as a goal. – Hasturkun Mar 24 '13 at 15:37
  • This would generate the `.inc` file in the `/lib` directory where the `#include` statement does not find it. How can it be placed into the `/include` directory? – ritter Mar 24 '13 at 16:01

0 Answers0