Home > Archive > Unix Programming > July 2007 > help with make system.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
help with make system.
|
|
| Readon Shaw 2007-07-26, 7:07 pm |
| i am using automake to generate Makefile, but there are three
questions.
1. i create several directories such as src, lib, data, etc. the
binary file under src/ need linking static library in lib/, how could
i add the dependency which make sure lib/ dir is compiled before src/
dir?
2.the two dir src/ and lib/ would be compiled seperately, but
linking stage of src/ dir requires dynamic link params(-lpthread, -lm,
etc) for lib/ dir. how to make the tools add the required dynamic link
params for src/ compilation automatically?
3. the dir data/ contains the data files needed by final release,
and it must be placed in the same dir of binary files. for example,
bin/data directory. how to wrtie Makefile.am?
the files i want to modified are configure.in and Makefile.am.Any
help would be appreciated.
| |
| William Pursell 2007-07-26, 7:07 pm |
| On Jul 26, 6:34 pm, Readon Shaw <xydarc...@163.com> wrote:
> i am using automake to generate Makefile, but there are three
> questions.
> 1. i create several directories such as src, lib, data, etc. the
> binary file under src/ need linking static library in lib/, how could
> i add the dependency which make sure lib/ dir is compiled before src/
> dir?
In the SUBDIRS line of Makefile.am, list lib before src. Automake
will construct the Makefile so that make will be invoked in
subdirectories in the order listed.
> 2.the two dir src/ and lib/ would be compiled seperately, but
> linking stage of src/ dir requires dynamic link params(-lpthread, -lm,
> etc) for lib/ dir. how to make the tools add the required dynamic link
> params for src/ compilation automatically?
One (incorrect) way to do this is specify
main_LDADD = -lbar
AM_LDFLAGS = -L../lib
in src/Makefile.am (where libbar is the library in lib and
main is the executable being built).
IMO, the correct way to do this is to put your library in
a completely seperate package and install it.
> 3. the dir data/ contains the data files needed by final release,
> and it must be placed in the same dir of binary files. for example,
> bin/data directory. how to wrtie Makefile.am?
In data/Makefile.am, put:
datadir = ${bindir}
data_DATA = data_file
EXTRA_DIST = data_file
|
|
|
|
|