开发者

Troubles making simple autoconf setup for distributing a shared library

开发者 https://www.devze.com 2023-02-19 20:47 出处:网络
After having trouble extending a standard makefile for having (examples, clean, (un) install, etc) I decided to try autoconf.

After having trouble extending a standard makefile for having (examples, clean, (un) install, etc) I decided to try autoconf.

The only documentation I could find is how to supply a file to be compiled and install开发者_开发技巧ed, but not a file that will be linked and installed in to a library location.

An example a tutorial gives me:

# what flags you want to pass to the C compiler & linker
CFLAGS = --pedantic -Wall -std=c99 -O2
LDFLAGS =

# this lists the binaries to produce, the (non-PHONY, binary) targets in
# the previous manual Makefile
bin_PROGRAMS = targetbinary1 targetbinary2 [...] targetbinaryN
targetbinary1_SOURCES = targetbinary1.c myheader.h [...]
targetbinary2_SOURCES = targetbinary2.c
.
.
targetbinaryN_SOURCES = targetbinaryN.c

Of course this seems a bit limiting as it does not expose where the Cflags (or LDFLAGS in the case I wish to have) go or if they are automatically applied.

bin_PROGRAMS can be a few other options but they only seem to be for including libraries (.la) rather than compiling one, or installing the compiled shared library to system.

Am I being a bit silly packaging my library so it can be ./configured and alike? Are there any base line guides for GNU make with this sort of packaging or informal conventions that would be easier doing this? I am looking forward to researching all my options.


I found the answer by using libtool with automake, this makes a lot more sense than handling platform-specific flags and such on my own.

0

精彩评论

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