开发者

Custom command to generate object(.o) from binary file using autoconf

We have a project (c++) and it needs to include a binary file into shared library. This is done on windows by referencing the binary file from a resource file. On Linux it can be achieved by using objcopy as shown here

The question is how can this be automated this using autoconf/automake? There exists Makefile.am and configure.ac files. Is this going to be a manual task?

(Maybe this question needs to be开发者_Python百科 on the unix stack exchange site?)


Does your binary file have a distinctive extension? If so, refer to the Suffixes chapter of the manual:

.bin.o:
        bin2o -o $@ $<

And you then list foo.bin in your foo_SOURCES variable.

If you don't have a distinctive extension, try something like this:

foo_SOURCES = foo.c bar.c baz.c
foo_LDADD = foobin$(OBJEXT)

foobin$(OBJEXT): foobin
        bin2o -o $@ $<
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜