[Home]

Summary:ASTERISK-14402: [patch] No way to pass CFLAGS to non-module objects
Reporter:Tzafrir Cohen (tzafrir)Labels:
Date Opened:2009-06-30 05:44:00Date Closed:2017-12-13 13:47:33.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/BuildSystem
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) obj_deps.diff
Description:When building an object that is not the main object in a module, extra CFLAGS are not applied.

E.g. if I don't have support for PRI, I expect sig_pri not to build at all. If we do have ti, it should use the PRI CFLAGS.

Terminology (could be improved):

module: something that can be "loaded" in Asterisk at run-time. E.g. chan_dahdi, config, pbx_ael .

object: Built from a single C/C++ source file. E.g. chan_dahdi.so is built from chan_dahdi.c, sig_analog.c and sig_pri.c .

module object: chan_dahdi.c in the case of the module chan_dahdi.

****** ADDITIONAL INFORMATION ******

tzafrir@sweetmorn:~/Proj/Asterisk/Git/asterisk$ LANG=C make NOISY_BUILD=1
 [snip]
make[1]: Leaving directory `/home/tzafrir/Proj/Asterisk/Git/asterisk/cdr'
make[1]: Entering directory `/home/tzafrir/Proj/Asterisk/Git/asterisk/cel'
gcc -o cel_pgsql.i -E cel_pgsql.c -pthread -I/home/tzafrir/Proj/Asterisk/Git/asterisk/include  -I/usr/include/libxml2 -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -Werror -Wunused -Wdeclaration-after-statement -D_FORTIFY_SOURCE=2 -Wundef  -Wmissing-format-attribute -Wformat=2 -march=k8  -fPIC -DAST_MODULE=\"cel_pgsql\"   -MD -MT cel_pgsql.i -MF .cel_pgsql.i.d -MP
cel_pgsql.c:48:22: error: libpq-fe.h: No such file or directory
make[1]: *** [cel_pgsql.i] Error 1
make[1]: Leaving directory `/home/tzafrir/Proj/Asterisk/Git/asterisk/cel'
make: *** [cel] Error 2

asterisk$ grep PG makeopts
PGSQL_INCLUDE=-I/usr/include/postgresql
PGSQL_LIB=-L/usr/lib -lpq -lz
Comments:By: Tzafrir Cohen (tzafrir) 2009-07-13 05:33:18

Attached a patch to the makefile to allow using MODULEINFO sections in every .c / .cc file.

An example section to fix the specific issue I have encountered is part of the patch as well.

Note that currently the makefile does not extract this information to the menuselect-tree . I did not add that part as I don't use menuselect anyway.

By: Tzafrir Cohen (tzafrir) 2009-10-25 08:17:09

Demoted status to "acknowledged" as the patch did not work.

* Fixed patch to apply to current trunk
* Removed sample module change (is one needed) ?

However the problem is that the information about the module is not passed around through menuselect. It seems that the information tree only includes e.g. channels/chan_*.c rather than channels/*.c .

As a workaround for testing, you can use dummy-select to re-create menuselect.makedeps appropriately:

 ./menuselect/contrib/dummy-select -c


By: Corey Farrell (coreyfarrell) 2017-12-13 13:47:33.558-0600

This was resolved by the addition of MOD_ADD_C / MOD_ADD_CC Makefile macros.