Sponsored Content
Top Forums Programming Genrate lib (.a) and binary file (exec) in the same Makefile Post 302859243 by shamrock on Wednesday 2nd of October 2013 03:43:31 PM
Old 10-02-2013
Yes...the makefile process is very powerful and flexible and can be customized in as many ways the programmer wants...I'd suggest reading up on makefile generation to get an idea of what it can do...
 

10 More Discussions You Might Find Interesting

1. Solaris

compiled binary file gives "cannot execute binary file"

Hi, I have two Solaris machines. 1. SunOS X 5.8 Generic_108528-29 sun4u sparc SUNW,Sun-Blade-1500 2. SunOS Y 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-60 I am trying to buiild a project on both these machines. The Binary output file compiled on machine 2 runs on both the machines. Where... (0 Replies)
Discussion started by: scgupta
0 Replies

2. UNIX for Advanced & Expert Users

Makefile problem - How to run module load in a Makefile

Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error: make: module: command not found Why is this? Is there any way to run this command in a Makefile? NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Discussion started by: hernandinho
2 Replies

3. Red Hat

ls: /lib/libattr.so.1: no version information available (required by /lib/libacl.so.1)

Hello, I'm experimenting a problem on my rh server. Red Hat Enterprise Linux AS release 3 (Taroon Update 8) 2.4.21-47.ELsmp #1 SMP i686 i686 i386 GNU/Linux It started with a segmentation fault on #id root To resolve it, I've installed coreutils-4.5.3-28.4.i386.rpm But, I... (6 Replies)
Discussion started by: gogol_bordello
6 Replies

4. Homework & Coursework Questions

Help with Simple Multi-Level Makefile (Extremely New at Makefile)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies

5. UNIX for Advanced & Expert Users

Solved: Missing whatis file from my /usr/shar/lib directory...

My whatis file is missing from my /usr/share/lib directory. I know I can recreate it by using catman -w command. My question is, why do all of my other servers have it and this one doesn't. Maybe due to a recent move of old to new servers and it just wasn't copied over. Unlikely, 'cause all... (0 Replies)
Discussion started by: zixzix01
0 Replies

6. Red Hat

insmod Error inserting `/lib/raid456.ko` -1 File Exist

hi every one , Wondering if any of you experienced this During "Centos5.6" Boot .. ! 1)NOT USING MMCONFIG 2)insmod Error inserting `/lib/raid456.ko` -1 File Exist Dell PowerEdge T110 with 4sata Controllers with Centos2.6.18-238.9.1.el5xen installed . /boot on /dev/md0 / on ... (18 Replies)
Discussion started by: Saed
18 Replies

7. Solaris

Gtar Lib file not found.

Hello All, I am preparing a script to view or Extract contents of a tape drive using gtar.But facing a strange issue while trying to extract files using gtar. If running script using sudo the getting the below error. ################ /usr/local/lib /usr/X11/lib /usr/X11R6/lib... (1 Reply)
Discussion started by: ajaincv
1 Replies

8. Shell Programming and Scripting

Shared File system- lib access issue

I have a C++ binary executable installed in a file system which is shared across multiple solaris boxes. When I start this executable from one of the boxes,I am able to start only 4 parallel instances and from the 5th instance onwards I am getting the following error. fatal: libdb2.so.1:... (2 Replies)
Discussion started by: prasperl
2 Replies

9. Shell Programming and Scripting

Script Variables Inquiry, Values Okay in Standalone Exec, No-Show in Cron Exec

I have the following bash script lines in a file named test.sh. #!/bin/bash # # Write Date to cron.log # echo "Begin SSI Load $(date +%d%b%y_%T)" # # Get the latest rates file for processing. # d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1) filename=$d export filename... (3 Replies)
Discussion started by: ginowms
3 Replies

10. Shell Programming and Scripting

Convert binary file to csv and then back to the binary format

Hello *nix specialists, Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Discussion started by: digidax
7 Replies
CRUNCHGEN(1)						    BSD General Commands Manual 					      CRUNCHGEN(1)

NAME
crunchgen -- generates build environment for a crunched binary SYNOPSIS
crunchgen [-foql] [-h makefile-header-name] [-m makefile-name] [-p obj-prefix] [-c c-file-name] [-e exec-file-name] [conf-file] DESCRIPTION
A crunched binary is a program made up of many other programs linked together into a single executable. The crunched binary main() function determines which component program to run by the contents of argv[0]. The main reason to crunch programs together is for fitting as many programs as possible onto an installation or system recovery floppy. The crunchgen utility reads in the specifications in conf-file for a crunched binary, and generates a Makefile and accompanying top-level C source file that when built creates the crunched executable file from the component programs. For each component program, crunchgen can optionally attempt to determine the object (.o) files that make up the program from its source directory Makefile. This information is cached between runs. The crunchgen utility uses the companion program crunchide(1) to eliminate link-time conflicts between the component programs by hiding all unnecessary symbols. The crunchgen utility places specific requirements on package Makefiles which make it unsuitable for use with non-BSD sources. In particu- lar, the Makefile must contain the target depend, and it must define all object files in the variable OBJS. In some cases, you can use a fake Makefile: before looking for Makefile in the source directory foo, crunchgen looks for the file Makefile.foo in the current directory. After crunchgen is run, the crunched binary can be built by running ``make -f <conf-name>.mk''. The component programs' object files must already be built. An objs target, included in the output makefile, will run make(1) in each component program's source dir to build the object files for the user. This is not done automatically since in release engineering circumstances it is generally not desirable to be modifying objects in other directories. The options are as follows: -c c-file-name Set output C file name to c-file-name. The default name is <conf-name>.c. -e exec-file-name Set crunched binary executable file name to exec-file-name. The default name is <conf-name>. -f Flush cache. Forces the recalculation of cached parameters. -l List names. Lists the names this binary will respond to. -h makefile-header-name Set the name of a file to be included at the beginning of the Makefiles generated by crunchgen. This is useful to define some make variables such as RELEASE_CRUNCH or similar, which might affect the behavior of make(1) and are annoying to pass through environment variables. -m makefile-name Set output Makefile name to makefile-name. The default name is <conf-name>.mk. -o Add ``make obj'' rules to each program make target. -p obj-prefix Set the pathname to be prepended to the srcdir when computing the objdir. If this option is not present, then the prefix used is the content of the MAKEOBJDIRPREFIX environment variable, or /usr/obj. -q Quiet operation. Status messages are suppressed. CRUNCHGEN CONFIGURATION FILE COMMANDS
The crunchgen utility reads specifications from the conf-file that describe the components of the crunched binary. In its simplest use, the component program names are merely listed along with the top-level source directories in which their sources can be found. The crunchgen utility then calculates (via the source makefiles) and caches the list of object files and their locations. For more specialized situations, the user can specify by hand all the parameters that crunchgen needs. The conf-file commands are as follows: srcdirs dirname ... A list of source trees in which the source directories of the component programs can be found. These dirs are searched using the BSD ``<source-dir>/<progname>/'' convention. Multiple srcdirs lines can be specified. The directories are searched in the order they are given. progs progname ... A list of programs that make up the crunched binary. Multiple progs lines can be specified. libs libspec ... A list of library specifications to be included in the crunched binary link. Multiple libs lines can be specified. libs_so libspec ... A list of library specifications to be dynamically linked in the crunched binary. These libraries will need to be made available via the run-time link-editor rtld(1) when the component program that requires them is executed from the crunched binary. Multiple libs_so lines can be specified. The libs_so directive overrides a library specified gratuitously on a libs line. buildopts buildopts ... A list of build options to be added to every make target. ln progname linkname Causes the crunched binary to invoke progname whenever linkname appears in argv[0]. This allows programs that change their behavior when run under different names to operate correctly. To handle specialized situations, such as when the source is not available or not built via a conventional Makefile, the following special commands can be used to set crunchgen parameters for a component program. special progname srcdir pathname Set the source directory for progname. This is normally calculated by searching the specified srcdirs for a directory named progname. special progname objdir pathname Set the obj directory for progname. The obj directory is normally calculated by looking for a directory whose name is that of the source directory prepended by one of the following components, in order of priority: the -p argument passed to the command line; or, the value of the MAKEOBJDIRPREFIX environment variable, or /usr/obj. If the directory is not found, the srcdir itself becomes the objdir. special progname buildopts buildopts Define a set of build options that should be added to make(1) targets in addition to those specified using buildopts when processing progname. special progname objs object-file-name ... Set the list of object files for program progname. This is normally calculated by constructing a temporary makefile that includes ``srcdir/Makefile'' and outputs the value of $(OBJS). special progname objpaths full-pathname-to-object-file ... Sets the pathnames of the object files for program progname. This is normally calculated by prepending the objdir pathname to each file in the objs list. special progname objvar variable_name Sets the name of the make(1) variable which holds the list of object files for program progname. This is normally OBJS but some Makefiles might like to use other conventions or prepend the program's name to the variable, e.g. SSHD_OBJS. special progname lib library-name ... Specifies libraries to be linked with object files to produce progname.lo. This can be useful with libraries which redefine routines in the standard libraries, or poorly written libraries which reference symbols in the object files. special progname keep symbol-name ... Add specified list of symbols to the keep list for program progname. An underscore ('_') is prepended to each symbol and it becomes the argument to a -k option for the crunchide(1) phase. This option is to be used as a last resort as its use can cause a symbol conflict, however in certain instances it may be the only way to have a symbol resolve. special progname ident identifier Set the Makefile/C identifier for progname. This is normally generated from a progname, mapping '-' to '_' and ignoring all other non-identifier characters. This leads to programs named "foo.bar" and "foobar" to map to the same identifier. Only the objpaths parameter is actually needed by crunchgen, but it is calculated from objdir and objs, which are in turn calculated from srcdir, so is sometimes convenient to specify the earlier parameters and let crunchgen calculate forward from there if it can. The makefile produced by crunchgen contains an optional objs target that will build the object files for each component program by running make(1) inside that program's source directory. For this to work the srcdir and objs parameters must also be valid. If they are not valid for a particular program, that program is skipped in the objs target. EXAMPLES
Here is an example crunchgen input conf file, named ``kcopy.conf'': srcdirs /usr/src/bin /usr/src/sbin progs test cp echo sh fsck halt init mount umount myinstall progs anotherprog ln test [ # test can be invoked via [ ln sh -sh # init invokes the shell with "-sh" in argv[0] special myprog objpaths /homes/leroy/src/myinstall.o # no sources special anotherprog -DNO_FOO WITHOUT_BAR=YES libs -lutil -lcrypt This conf file specifies a small crunched binary consisting of some basic system utilities plus a homegrown install program ``myinstall'', for which no source directory is specified, but its object file is specified directly with the special line. Additionally when ``anotherprog'' is built the arguments -DNO_FOO WITHOUT_BAR=YES are added to all build targets. The crunched binary ``kcopy'' can be built as follows: % crunchgen -m Makefile kcopy.conf # gen Makefile and kcopy.c % make objs # build the component programs' .o files % make # build the crunched binary kcopy % kcopy sh # test that this invokes a sh shell $ # it works! At this point the binary ``kcopy'' can be copied onto an install floppy and hard-linked to the names of the component programs. Note that if the libs_so command had been used, copies of the libraries so named would also need to be copied to the install floppy. SEE ALSO
crunchide(1), make(1), rtld(1) AUTHORS
The crunchgen utility was written by James da Silva <jds@cs.umd.edu>. Copyright (c) 1994 University of Maryland. All Rights Reserved. The libs_so keyword was added in 2005 by Adrian Steinmann <ast@marabu.ch> and Ceri Davies <ceri@FreeBSD.org>. CAVEATS
While crunchgen takes care to eliminate link conflicts between the component programs of a crunched binary, conflicts are still possible between the libraries that are linked in. Some shuffling in the order of libraries may be required, and in some rare cases two libraries may have an unresolvable conflict and thus cannot be crunched together. Some versions of the BSD build environment do not by default build the intermediate object file for single-source file programs. The ``make objs'' must then be used to get those object files built, or some other arrangements made. BSD
December 23, 2005 BSD
All times are GMT -4. The time now is 10:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy