Search code examples
automakeobjcopy

Automake: embedding text files in binary target


I need to embed several text files in a binary. It's currently done with two lines added in configure.in script that do "clean" and perform objcopy to the $target.o files. Don't ask WHY it's required, in this app, it just is.

What I want to do is write some automake (Makefile.am) difinitions that would list those text files as source and tell make to objcopy them into *.o files I need to link with the final target. I could also add them to CLEANFILES, which I want.

Now, I know I say final_LDADD, but I can't find the way to tell automake/configure to do that trick.

Help...


Solution

  • Something like:

    libxxx.a : text1.o text2.o
        $(AR) cru $@ $^
    
    text1.o : text1.txt
        $(OBJCOPY) $< $@
    text2.o : text2.txt
        $(OBJCOPY) $< $@
    
    ...
    
    final_LDADD = libxxx.a
    
    ...
    
    CLEANFILES += libxxx.a text1.o text2.o