How to remove undefined symbols from a .o file - c

I have to build a shared library using another static library. In that static library there are some function calls that are undefined in nm output. I want to remove those symbols, by getting the object file. I cannot delete whole object file, as some part of it is used. Is there any way of doing that.
nm output
request.o:
U CLR_SECURE_MEM_START_ADDR //want to remove
U clrSMEMAlloc //want to remove
U clrSMEMCopy //want to remove
U clrSMEMFree //want to remove
U clrSMEMSet //want to remove
00000000 T copyBuffer
00000000 T copyParameter
00000000 T copyRequest
00000000 T freeParameter
00000000 T freeRequest
00000000 T getLinkFromRequest
U _gp_disp
00000000 T initializeRequest
00000000 T initializeRequestQueue
U isClrSMEMBuffer
00000000 T isParamInSharedMem
00000000 T isRequestInSharedMem
00000004 b RequestQueue
00000000 b RequestQueueHead
U strlen
00000000 T verifyParameter ////want to keep
00000000 T verifyParameterType
00000000 T verifyParameterTypes
00000000 T verifyRequestParameters
I don't have the source of this object file, so I don't know the prototype of the functions that I want to remove. If I had the source I could have written dummy definitions.
P.S
The library that I had was broken. Thats why I had undefined references.

According to Michael Walz's comment, I didn't needed to strip the .o file. I just had to create a file depend.c. Put a definition for those functions which were undefined. Then build it
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libdepend
LOCAL_SRC_FILES := src/depend.cpp
LOCAL_CFLAGS := -DCLR_INTERAPTIV_I7 -DCLR_INTERAPTIV -v
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../RIP/include/ $(LOCAL_PATH)/../../../hardware/libhardware/include/hardware $(LOCAL_PATH)/../../../hardware/libhardware/include $(LOCAL_PATH)/src $(LOCAL_PATH)/../../RIP/inc
LOCAL_SHARED_LIBRARIES = libsmem.sastra
LOCAL_LDFLAGS := -v -L$(ANDROID_PRODUCT_OUT)/system/lib -lsmem.$(TARGET_BOARD_PLATFORM) -L$(LOCAL_PATH)/../../RIP/library -llibrary -llog -lcutils -lipc.$(TARGET_BOARD_PLATFORM)
#this option will build executables instead of building library for android application.
include $(BUILD_EXECUTABLE)
Take the .o of this file from out folder.
Get all .os from the library.
now
ar -x library.a //get original object files
pack all .os in this library with depend.o by this command
ar r library.a *.o //put depend.o with other object files
Now build the shared library
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libRip
LOCAL_SRC_FILES := src/Rip_api.cpp src/Rip_crypto.cpp
LOCAL_CFLAGS := -DCLR_INTERAPTIV_I7 -DCLR_INTERAPTIV -v
#only include corelockr and rip headers
LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc/ $(LOCAL_PATH)/include/ $(LOCAL_PATH)/../../hardware/libhardware/include/hardware/
LOCAL_LDLIBS := -llog -L$(LOCAL_PATH)/library -llibrary
LOCAL_SHARED_LIBRARIES = libsmem.sastra
#test seqr library
#LOCAL_LDFLAGS := -v -L$(LOCAL_PATH)/library -llibrary
#this option will build static library
include $(BUILD_SHARED_LIBRARY)
Now shared library should build without any issues.
*******Its a workaround, not a real solution.*******

Related

How to extract function names from a library / binary

I have a library with debug symbols, and I do the following to extract function names:
$ objdump -S -D library_name.so > library_name.asm
$ grep -rn ">:" library_name.asm
This gives me what I want:
3101:0000000000002190 <memset#plt>:
3106:00000000000021a0 <close#plt>:
but seems a bit awkward ... Is there a better way to achieve this?
I think the utility you're looking for is nm:
It collects all the symbols, both static and dynamic, defined in a library or any ELF file.
The output looks like this:
000000ec T main
000003f0 a REG_HID0
000003f1 a REG_HID1
00000ec4 T RSA_bigint_add
000009e0 T RSA_bigint_clear
00000a0c T RSA_bigint_cmp
00000dd8 T RSA_bigint_gen
00000aa4 T RSA_bigint_get_bitlength
000010f4 T RSA_bigint_intmul
00000c20 T RSA_bigint_lshift
00001330 T RSA_bigint_mod
00001470 T RSA_bigint_modexp
0000142c T RSA_bigint_modmul
0000120c T RSA_bigint_mul
00000aec T RSA_bigint_rshift
00001024 T RSA_bigint_sub
00000238 T RSA_check_data_with_certificate
00000180 T RSA_check_signature
000002d0 T RSA_x509_get_field
000003a4 T RSA_x509_get_int
000008f8 T RSA_x509_parse_certificate
0000042c T RSA_x509_parse_PKI
000007d8 T RSA_x509_parse_signature
0000057c T RSA_x509_parse_tbscertificate

undefined reference to symbol 'xt_finalize' / error adding symbols: DSO missing from command line

I'm lost. This is the compile line (a huge one):
mpif90 -autodouble -I./ -I../src -I../modules -I../../messy/bmil -I../../messy/echam5/bmil -I../../messy/echam5/smil -I../../messy/smil -I../../messy/smcl -I../../mpiom/src -I../../mpiom/src_hamocc -I/gpfs/software/juwels/stages/2018a/software/netCDF-Fortran/4.4.4-ipsmpi-2018a/include -I/gpfs/software/juwels/stages/2018a/software/netCDF-Fortran/4.4.4-ipsmpi-2018a/include -I/gpfs/software/juwels/stages/2018a/software/YAXT/0.6.0-ipsmpi-2018a/include -I../include -g -traceback -debug all -check all -fpp -O0 -fp-model precise -fp-speculation=safe -fno-alias -no-ansi-alias -lpthread -save-temps -DMESSY -DLITTLE_ENDIAN -D_LINUX64 -DPNCREGRID -DMESSYTIMER -DMESSYGRID -DECHAM5 -DE5302 -DHAVE_LIBNETCDF64 -DFFT991 -DALBMELTHI -DMPIOM_13B -DHAVE_YAXT -DMECCA_TAG -c ../src/tf2.f90
mpif90 -Wl,-rpath,/gpfs/software/juwels/stages/2018a/software/YAXT/0.6.0-ipsmpi-2018a/lib -o ../../bin/echam5.exe auxhyb.o clsst.o clveg.o conteq.o control.o dyn.o ewd.o fftd.o ffti.o geopot.o gpc.o hdiff.o helmo.o inhysi.o inictl.o inidoc.o init_decomposition.o initemp.o initialize.o ioinitial.o iorestart.o labrun.o legtri.o ltd.o lti.o m_alloc_mods.o master.o maxwind.o messy_a2o_e5.o messy_aeropt_si.o messy_airsea_si.o messy_airtraf_e5.o messy_bioburn_si.o messy_bufly_e5.o messy_cam_aerocld_e5.o messy_cam_drydepo_e5.o messy_cam_e5.o messy_cam_sfflux_e5.o messy_ch4_si.o messy_chemglue_si.o messy_clams_si.o messy_clamsbmix_si.o messy_clamscirrus_si.o messy_clamsmix_si.o messy_clamsrdfrc_si.o messy_clamssedi_si.o messy_clamstraj_si.o messy_cloud_si.o messy_cloudj_si.o messy_cloudopt_si.o messy_contrail_si.o messy_convect_si.o messy_cvtrans_si.o messy_d14co_e5.o messy_ddep_si.o messy_dissoc_si.o messy_diumod_si.o messy_dradon_si.o messy_e4chem_si.o messy_e5vdiff_si.o messy_ec2cosmo_e5.o messy_gec_si.o messy_gmxe_si.o messy_gwave_si.o messy_h2o_e5.o messy_h2oiso_e5.o messy_hamocc_e5.o messy_hd_e5.o messy_jval_si.o messy_jvst_si.o messy_lnox_si.o messy_m7_si.o messy_made3_si.o messy_made_si.o messy_main_blather_bi.o messy_main_bmluse_bi.o messy_main_channel_bi.o messy_main_control_bi.o messy_main_data_bi.o messy_main_decomp_bi.o messy_main_grid_bi.o messy_main_grid_netcdf_bi.o messy_main_import_bi.o messy_main_import_grid_bi.o messy_main_import_grid_tools_bi.o messy_main_import_lt_bi.o messy_main_import_rgt_bi.o messy_main_import_ts_bi.o messy_main_mpi_bi.o messy_main_qtimer_bi.o messy_main_rnd_bi.o messy_main_switch_bi.o messy_main_tendency_bi.o messy_main_timer_bi.o messy_main_tools_bi.o messy_main_tracer_bi.o messy_main_tracer_family_bi.o messy_main_tracer_mem_bi.o messy_main_tracer_pdef_bi.o messy_main_transform_bi.o messy_mecca_aero_si.o messy_mecca_khet_si.o messy_mecca_mem_si.o messy_mecca_poly_si.o messy_mecca_si.o messy_mecca_tag_fcm_si.o messy_mecca_tag_si.o messy_megan_si.o messy_mlocean_e5.o messy_mmd2way_child_si.o messy_mmd2way_parent_si.o messy_mmd2way_si.o messy_mmforce_e5.o messy_mpiom_e5.o messy_mpiom_mem_e5.o messy_mpiom_tools_e5.o messy_msbm_si.o messy_mtskip_si.o messy_ncregrid_interface.o messy_ncregrid_tools_bi.o messy_o3orig_si.o messy_offemis_si.o messy_onemis_si.o messy_oracle_si.o messy_orbit_si.o messy_orogw_si.o messy_otphysc_e5.o messy_plumegas_si.o messy_ptrac_si.o messy_ptracini_si.o messy_qbo_si.o messy_rad_fubrad_si.o messy_rad_si.o messy_relax_e5.o messy_s4d_si.o messy_satsims_e5.o messy_scalc_si.o messy_scav_si.o messy_scout_si.o messy_sedi_si.o messy_sorbit_si.o messy_spacenox_e5.o messy_spe_e5.o messy_surface_si.o messy_tagging_si.o messy_tbudget_si.o messy_timepos_e5.o messy_tnudge_si.o messy_trexp_si.o messy_tropop_si.o messy_trsync_si.o messy_ubcnox_e5.o messy_vahr_e5.o messy_vaxtra_si.o messy_vertex_si.o messy_viso_si.o mo_advection.o mo_base_types.o mo_buffer_fft.o mo_call_trans.o mo_clim.o mo_constants.o mo_control.o mo_decomposition.o mo_diag_tendency.o mo_diff.o mo_doctor.o mo_exception.o mo_fft991.o mo_fft992.o mo_field.o mo_filename.o mo_forecast_switches.o mo_gaussgrid.o mo_geoloc.o mo_gl1.o mo_global_op.o mo_grib.o mo_hdiff.o mo_hyb.o mo_interpo.o mo_io.o mo_kind.o mo_legendre.o mo_linked_list.o mo_machine.o mo_memory_base.o mo_memory_f.o mo_memory_g1a.o mo_memory_g1b.o mo_memory_g2a.o mo_memory_g2b.o mo_memory_g3a.o mo_memory_g3b.o mo_memory_gl.o mo_memory_ls.o mo_memory_sp.o mo_memory_streams.o mo_mpi.o mo_namelist.o mo_netcdf.o mo_netcdfstream.o mo_nmi.o mo_nudging.o mo_nudging_buffer.o mo_nudging_constants.o mo_nudging_correl.o mo_nudging_init.o mo_nudging_io.o mo_nudging_pattern.o mo_nudging_sst.o mo_nudging_utils.o mo_parameters.o mo_parrrtm.o mo_port_test.o mo_real_timer.o mo_scan_buffer.o mo_semi_impl.o mo_semi_lagrangian.o mo_specfun.o mo_spectral.o mo_spitfire.o mo_sst.o mo_test_trans.o mo_time_base.o mo_time_control.o mo_time_conversion.o mo_time_event.o mo_time_manager.o mo_timer.o mo_timestamp.o mo_tmp_buffer.o mo_tpcore.o mo_tr_allgather.o mo_tr_gather.o mo_transpose.o mo_truncation.o mo_upper_sponge.o mo_util_string.o pgrad.o physc.o pres.o presf.o readfld.o scan1.o scan2.o sccd.o scctp.o setdyn.o si1.o si2.o stepon.o sudif.o sym1.o sym2.o tf1.o tf2.o mo_echam_yaxt.o -L../../lib -lmpiom -L../../lib -lsupport -L../lib -lmessy -lisorropia -lqhull -L/gpfs/software/juwels/stages/2018a/software/netCDF/4.6.1-ipsmpi-2018a/lib64 -lnetcdf -L/gpfs/software/juwels/stages/2018a/software/netCDF-Fortran/4.4.4-ipsmpi-2018a/lib -lnetcdff -L/gpfs/software/juwels/stages/2018a/software/YAXT/0.6.0-ipsmpi-2018a/lib -lyaxt -L../../lib -llapack -L../../lib -lblas
I tried changing the order of the libraries, adding extra -lyaxt before, after, etc. The library does contain the symbol:
19:16:00|cstao05#juwels09:[__LINUX64]> readelf -s /gpfs/software/juwels/stages/2018a/software/YAXT/0.6.0-ipsmpi-2018a/lib/libyaxt.so | grep xt_finalize
28: 0000000000000000 0 FUNC GLOBAL DEFAULT UND xt_finalized
45: 0000000000000000 0 FUNC GLOBAL DEFAULT UND xt_finalize
126: 000000000000c230 32 FUNC GLOBAL DEFAULT 13 xt_core_mp_xt_finalized_
671: 0000000000000000 0 FUNC GLOBAL DEFAULT UND xt_finalized
740: 0000000000000000 0 FUNC GLOBAL DEFAULT UND xt_finalize
947: 000000000000c230 32 FUNC GLOBAL DEFAULT 13 xt_core_mp_xt_finalized_
As well as
nm /gpfs/software/juwels/stages/2018a/software/YAXT/0.6.0-ipsmpi-2018a/lib/libyaxt.so | grep xt_finalize
000000000000c230 T xt_core_mp_xt_finalized_
U xt_finalize
U xt_finalized
I have read all the other answers here, and I still can't figure this one out.
The missing library was lyaxt_c (I missed the _c). Fixing the Makefile worked.

GCC Linker cannot locate library

I'm trying to compile the PCRE library into a testing executable.
The documentation states that running Make and then configure should generate the library.
In the PCRE source directory:
Make
./configure
gcc -o test test.c -L . -lpcre
However the following error returns:
/usr/bin/ld: cannot find -pcre
collect2: error: ld returned 1 exit status
Note: I've also tried flag -libpcre. I was able to sucessfully run this on MacOS (seperately compiled but same library source code and same testiing source code).
Directory Contents:
132html pcre16_globals.c
aclocal.m4 pcre16_jit_compile.c
AUTHORS pcre16_maketables.c
ChangeLog pcre16_newline.c
CheckMan pcre16_ord2utf16.c
CleanTxt pcre16_printint.c
cmake pcre16_refcount.c
CMakeLists.txt pcre16_string_utils.c
compile pcre16_study.c
config-cmake.h.in pcre16_tables.c
config.guess pcre16_ucd.c
config.h pcre16_utf16_utils.c
config.h.generic pcre16_valid_utf16.c
config.h.in pcre16_version.c
config.log pcre16_xclass.c
config.status pcre32_byte_order.c
config.sub pcre32_chartables.c
configure pcre32_compile.c
configure.ac pcre32_config.c
COPYING pcre32_dfa_exec.c
depcomp pcre32_exec.c
Detrail pcre32_fullinfo.c
dftables.c pcre32_get.c
doc pcre32_globals.c
HACKING pcre32_jit_compile.c
INSTALL pcre32_maketables.c
install-sh pcre32_newline.c
libpcre16.pc pcre32_ord2utf32.c
libpcre16.pc.in pcre32_printint.c
libpcre32.pc pcre32_refcount.c
libpcre32.pc.in pcre32_string_utils.c
libpcrecpp.la pcre32_study.c
libpcrecpp_la-pcrecpp.lo pcre32_tables.c
libpcrecpp_la-pcrecpp.o pcre32_ucd.c
libpcrecpp_la-pcre_scanner.lo pcre32_utf32_utils.c
libpcrecpp_la-pcre_scanner.o pcre32_valid_utf32.c
libpcrecpp_la-pcre_stringpiece.lo pcre32_version.c
libpcrecpp_la-pcre_stringpiece.o pcre32_xclass.c
libpcrecpp.pc pcre_byte_order.c
libpcrecpp.pc.in pcre_chartables.c
libpcre.la pcre_chartables.c.dist
libpcre_la-pcre_byte_order.lo pcre_compile.c
libpcre_la-pcre_byte_order.o pcre-config
libpcre_la-pcre_chartables.lo pcre_config.c
libpcre_la-pcre_chartables.o pcre-config.in
libpcre_la-pcre_compile.lo pcrecpparg.h
libpcre_la-pcre_compile.o pcrecpparg.h.in
libpcre_la-pcre_config.lo pcrecpp.cc
libpcre_la-pcre_config.o pcrecpp.h
libpcre_la-pcre_dfa_exec.lo pcrecpp_internal.h
libpcre_la-pcre_dfa_exec.o pcrecpp_unittest
libpcre_la-pcre_exec.lo pcrecpp_unittest.cc
libpcre_la-pcre_exec.o pcrecpp_unittest-pcrecpp_unittest.o
libpcre_la-pcre_fullinfo.lo pcredemo
libpcre_la-pcre_fullinfo.o pcredemo.c
libpcre_la-pcre_get.lo pcre_dfa_exec.c
libpcre_la-pcre_get.o pcre_exec.c
libpcre_la-pcre_globals.lo pcre_fullinfo.c
libpcre_la-pcre_globals.o pcre_get.c
libpcre_la-pcre_jit_compile.lo pcregexp.pas
libpcre_la-pcre_jit_compile.o pcre_globals.c
libpcre_la-pcre_maketables.lo pcregrep
libpcre_la-pcre_maketables.o pcregrep.c
libpcre_la-pcre_newline.lo pcregrep-pcregrep.o
libpcre_la-pcre_newline.o pcre.h
libpcre_la-pcre_ord2utf8.lo pcre.h.generic
libpcre_la-pcre_ord2utf8.o pcre.h.in
libpcre_la-pcre_refcount.lo pcre_internal.h
libpcre_la-pcre_refcount.o pcre_jit_compile.c
libpcre_la-pcre_string_utils.lo pcre_jit_test.c
libpcre_la-pcre_string_utils.o pcre_maketables.c
libpcre_la-pcre_study.lo pcre_newline.c
libpcre_la-pcre_study.o pcre_ord2utf8.c
libpcre_la-pcre_tables.lo pcreposix.c
libpcre_la-pcre_tables.o pcreposix.h
libpcre_la-pcre_ucd.lo pcre_printint.c
libpcre_la-pcre_ucd.o pcre_refcount.c
libpcre_la-pcre_valid_utf8.lo pcre_scanner.cc
libpcre_la-pcre_valid_utf8.o pcre_scanner.h
libpcre_la-pcre_version.lo pcre_scanner_unittest
libpcre_la-pcre_version.o pcre_scanner_unittest.cc
libpcre_la-pcre_xclass.lo pcre_scanner_unittest-pcre_scanner_unittest.o
libpcre_la-pcre_xclass.o pcre_stringpiece.cc
libpcre.pc pcre_stringpiece.h
libpcre.pc.in pcre_stringpiece.h.in
libpcreposix.la pcre_stringpiece_unittest
libpcreposix_la-pcreposix.lo pcre_stringpiece_unittest.cc
libpcreposix_la-pcreposix.o pcre_stringpiece_unittest-pcre_stringpiece_unittest.o
libpcreposix.pc pcre_string_utils.c
libpcreposix.pc.in pcre_study.c
libtool pcre_tables.c
LICENCE pcretest
ltmain.sh pcre_test.c
m4 pcretest.c
Makefile pcretest-pcre_printint.o
Makefile.am pcretest-pcretest.o
Makefile.in pcre_ucd.c
makevp.bat pcre_valid_utf8.c
makevp_c.txt pcre_version.c
makevp_l.txt pcre_xclass.c
missing perltest.pl
NEWS PrepareRelease
NON-AUTOTOOLS-BUILD README
NON-UNIX-USE RunGrepTest
pcre16_byte_order.c RunTest
pcre16_chartables.c RunTest.bat
pcre16_compile.c sljit
pcre16_config.c stamp-h1
pcre16_dfa_exec.c test.c
pcre16_exec.c testdata
pcre16_fullinfo.c ucp.h
pcre16_get.c
Try -lpcre not -libpcre when you link. -l assumes the lib prefix and takes the name of the lib so -lpcre looks for libpcre

How to compile in two steps using SCons?

I will like to compile files in the following steps using SCons:
.c -> .asm(assembly file) -> .o
I tried to define different builders for this.
I managed to do something like: .asm -> .o and .c -> .o
I don't know how to make SCons aware of the .asm files generated from .c files and then to use the object builder.
Is there any possibility to use current SCons implementation for this ?
EDIT: This is what I tried :
-> To define two builders: Builder 1 (c_to_asm) is intended to do .c -> .asm step
Builder 2 (asm_to_o) is intended to do .asm -> .o . After these two builders are executed for all the files defined in my SConscript I expect the Program builder to create the final executable.
SCons.Tool.createProgBuilder(env)
c_to_asm = SCons.Builder.Builder(action = {},
emitter = {},
prefix = '',
suffix = '.asm',
src_builder = '',
source_scanner = '',
single_source = 1)
c_to_asm_action = SCons.Action.Action('c to asm command line', 'Executing .c to .asm builder')
c_to_asm.add_action('.c', c_to_asm_action)
asm_to_o = SCons.Builder.Builder(action = {},
emitter = {},
prefix = '',
suffix = '.o',
src_builder = ['CTOASM'],
source_scanner = '',
single_source = 1)
asm_to_o_action = SCons.Action.Action('asm to o command line', 'Executing .asm to .o builder...')
asm_to_o.add_action('.asm', asm_to_o_action)
env['BUILDERS']['CTOASM'] = c_to_asm
env['BUILDERS']['Object'] = asm_to_o
I see the execution string for each builder but no command is executed.
I don't know how to establish in which order these builders execute actions and how to trigger this builders.
Your approach is a little complicated. From the top of my head I'd try something like this (untested, but hopefully gives you a direction to continue with):
import SCons.Action
import SCons.Builder
# Automatically inits "nasm" Tool, if it is in the $PATH
env = Environment()
c_to_asm_action = SCons.Action.Action('c to asm command line', 'Executing .c to .asm builder')
c_to_asm = SCons.Builder.Builder(action = c_to_asm_action,
suffix = '.asm',
single_source = 1)
env['BUILDERS']['CTOASM'] = c_to_asm
# Creates first.asm and second.asm
env.CTOASM(['first.c', 'second.c'])
# Compiles final program, finds the newly created ASM files via Glob
env.Program('foo', Glob('*.asm') + list_of_your_other_sources_and_libs)

Autotool automake output executable filename with version

I'm trying to add to the output executable filename of a autotool project the version number.
With libs is very simple: you can add -version-info option to Makefile.am
How can I do the same thing with bin_PROGRAMS
So far I tried:
HELLO_VERSION_CURRENT = 1
HELLO_VERSION_REVISION = 2
HELLO_VERSION_AGE = 1
bin_PROGRAMS = hello_${HELLO_VERSION_CURRENT}_${HELLO_VERSION_REVISION}_${HELLO_VERSION_AGE}
hello_SOURCES = hello.c
In this way it doesn't compile because of SOURCES must be: hello_1_2_1_SOURCES, but I don't know how to tell to automake that.
Another way could be to run a post-build script: how can I add post-build action to Makefile.am?
How about using some preset autoconf output variables in your Makefile.am:
bin_PROGRAMS = hello_#PACKAGE_VERSION#
hello_#PACKAGE_VERSION#_SOURCES = hello.c
The preceding works for me on Darwin with autoconf v2.69 and automake v1.15.
Using the PACKAGE_VERSION from within your source code is even easier: #include "config.h", that's where all the autoconf output variables are #defined. E.g.:
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
...
#define PACKAGE_VERSION "1.2.3-rc-whatever"
Reference:
https://www.gnu.org/software/autoconf/manual/autoconf#Output-Variable-Index
You can do it like this:
HELLO_VERSION_CURRENT = 1
HELLO_VERSION_REVISION = 2
HELLO_VERSION_AGE = 1
bin_PROGRAMS = hello_$(HELLO_VERSION_CURRENT)_$(HELLO_VERSION_REVISION)_$(HELLO_VERSION_AGE)
hello_$(HELLO_VERSION_CURRENT)_$(HELLO_VERSION_REVISION)_$(HELLO_VERSION_AGE)_SOURCES = hello.c
Although, in that case, I'd suggest making shorter variable names...
At the end I add the following to my Makefile.am
all:
cp ./.libs/hello ./.libs/hello_${HELLO_VERSION_CURRENT}_${HELLO_VERSION_REVISION}_${HELLO_VERSION_AGE}
EDIT
I found a new solution
HELLO_VERSION_CURRENT = 1
HELLO_VERSION_REVISION = 2
HELLO_VERSION_AGE = 1
bin_PROGRAMS = hello_$(HELLO_VERSION_CURRENT)_$(HELLO_VERSION_REVISION)_$(HELLO_VERSION_AGE)
hello___HELLO_VERSION_CURRENT____HELLO_VERSION_REVISION____HELLO_VERSION_AGE__SOURCES = hello.c
hello___HELLO_VERSION_CURRENT____HELLO_VERSION_REVISION____HELLO_VERSION_AGE__CFLAGS =
hello___HELLO_VERSION_CURRENT____HELLO_VERSION_REVISION____HELLO_VERSION_AGE__LDFLAGS =
AM_CFLAGS = #hello___HELLO_VERSION_CURRENT____HELLO_VERSION_REVISION____HELLO_VERSION_AGE__CFLAGS#
AM_LDFLAGS = #hello___HELLO_VERSION_CURRENT____HELLO_VERSION_REVISION____HELLO_VERSION_AGE__LDFLAGS#
CLEANFILES = *~

Resources