I have been compiling all Unix platform variations using shell scripts. I know I should be using make but its syntax drives me crazy.
Before you look at the scripts, you should also understand the assumed directory structure of the Future Lab GPL software.
Starting in GPL package version 1.2-2000.05.03, the scripts have undergone major changes. Instead of hard coding the directories involved, I have started using environment variables to represent the various required directories. At the top of each script, there is a dot execute of two, what I call include scripts. The first is generic and applies to all compile/link scripts. The second is specific to the target platform. Before reading the scripts, take a look at the two include scripts called include.generic and include.linux.
The scripts that I use to build Future Lab GPL software are documented here:
# Generic variable defines that apply # to all compilations. # Apr/2000, Rick Smereka # # base directory to all source, object # and executable files DIRBASE="/home/rsmereka" # # multiuser defines # (not always used) MULTI="-DIPC_TCP -DMULTIUSER"
# Linux compile variables. # Apr/2000, Rick Smereka # # compilation command COMP="gcc" # # pre-processor defines DEFS="-DOS_UNIX -DOS_UNIX_REDHAT_LINUX -DSUB_PLATFORM_STRING" # # sub platform string PLAT="\"Red Hat Linux\""
# Compile only (using GNU) # . include.generic . include.linux # $COMP $DEFS="$PLAT" -I$DIRBASE/include -c $1.c
This script will compile the supplied source file and place the object code in the current directory.
# Compile all clib source modules # to Linux object files. # Jan/99, Rick Smereka # # Modified to use environment # vars. Apr/2000, Rick Smereka # # Added file 'ip.c' # Jul/2000, Rick Smereka # . include.generic # cd $DIRBASE/clib # c fio c ipclient c ipcomm c ipconfig c ipcsrv c logger c parse c slogcode c sys_log c ip
This script will compile all the Future Lab GPL library modules.
# Compile all dbeng source modules # to Linux object files. # Jan/99, Rick Smereka # # Modified to use environment # vars. Apr/2000, Rick Smereka # . include.generic # cd $DIRBASE/dbeng # c dbeng c dblocal c dbcs c dbiocode c dbengcfg c dblocfg c dbcscfg
This script will compile all the database modules.
# Compile and link a Linux program # with the C library. # Jan/99, Rick Smereka # # Removed the 'sys_log', 'ipcomm' # and 'ipconfig' object files. # Added environment vars. # Apr/2000, Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" \ -I$DIRBASE/include -o$DIRBASE/bin/$1 $1.c \ $DIRBASE/clib/fio.o \ $DIRBASE/clib/parse.o $DIRBASE/clib/logger.o
This script will compile a source file and link with the GPL library.
# Compile all socloc source modules # to Linux object files. # Jan/99, Rick Smereka # # Added 'sconnect', Feb/2000 # Rick Smereka # # Modified to use environment # vars. Apr/2000, Rick Smereka # . include.generic # cd $DIRBASE/socloc c slconfig c sliocode c sloc c sconnect
This script will compile (only) all socloc source modules.
# Compile all 'clib' and 'dbeng' modules # and make all applications. Feb/99, Rick Smereka # Changed name of c/s database stress program. # Sep/99, Rick Smereka # Added 'socloc' builds. Dec/99, Rick Smereka echo '***compile clib primatives' cclib echo '***compile dbeng primatives' cdbeng echo '***compile socloc primatives' csocloc echo '***make stand-alone database command line program' mkdb echo '***make c/s database command line program' mkdbm echo '***make new database server' mkdbsrv echo '***make stand-alone database stress program' mkdbstress echo '***make c/s database stress program' mkdbstresm echo '***make system log server' mksys_log echo '***make socloc server' mksocloc echo '***make dumsocks server' mkdumsocks echo '***make dumsocks client' mkdumsockc echo '***make sockc client' mksockc echo '***make iresolve' mkiresolve
This script will build all current Future Lab GPL software including GPL library, database modules, socloc modules, TCP servers, client programs and stand-alone programs.
# Compile and link the 'db' # stand-alone database command line. # Jan/99, Rick Smereka # # Added config modules. Mar/99, Rick Smereka # # Added 'socloc' API object files. Modified to # use environment vars. Removed 'ipconfig' # library file. Apr/2000, Rick Smereka # # Added new 'clib' object file 'ip.o' # Jul/2000, Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" -I$DIRBASE/include -o$DIRBASE/bin/db db.c \ $DIRBASE/clib/fio.o $DIRBASE/clib/ip.o \ $DIRBASE/clib/parse.o $DIRBASE/clib/logger.o \ $DIRBASE/clib/ipcomm.o $DIRBASE/clib/sys_log.o \ $DIRBASE/clib/slogcode.o $DIRBASE/dbeng/dbeng.c \ $DIRBASE/dbeng/dblocal.c $DIRBASE/dbeng/dbiocode.c \ $DIRBASE/dbeng/dbengcfg.c $DIRBASE/dbeng/dblocfg.c \ $DIRBASE/socloc/sloc.o $DIRBASE/socloc/slconfig.o \ $DIRBASE/socloc/sliocode.o $DIRBASE/socloc/sconnect.o
This script will build (compile and link) the db stand-alone, database command line program.
# Compile and link the 'dbm' # c/s database command line. # Jan/99, Rick Smereka # # Added 'socloc' API object files # and modified to use environment # vars. Removed library file # 'ipconfig'. Apr/2000, Rick Smereka # # Added new 'clib' object file 'ip.o'. # Jul/2000, Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" $MULTI -I$DIRBASE/include -o$DIRBASE/bin/dbm db.c \ $DIRBASE/clib/fio.o $DIRBASE/clib/ip.o \ $DIRBASE/clib/parse.o $DIRBASE/clib/logger.o \ $DIRBASE/clib/ipcomm.o \ $DIRBASE/clib/sys_log.o \ $DIRBASE/clib/slogcode.o \ $DIRBASE/dbeng/dbcs.c $DIRBASE/dbeng/dbiocode.c \ $DIRBASE/dbeng/dbcscfg.c $DIRBASE/socloc/sloc.o \ $DIRBASE/socloc/slconfig.o $DIRBASE/socloc/sliocode.o \ $DIRBASE/socloc/sconnect.o
This script will build (compile and link) the dbm client/server database command line program. Notice the define MULTIUSER passed on the gcc compile line.
# Compile and link the 'dbsrv' # TCP server program. # Jan/99, Rick Smereka # # Added 'socloc' API files and # removed the library file # 'ipconfig' as it is no longer # used. Modified to use # environment vars. # Apr/2000, Rick Smereka # # Added 'clib' object file # 'ip.o'. Jul/2000, # Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" $MULTI -I$DIRBASE/include -o$DIRBASE/bin/dbsrv \ dbsrv.c $DIRBASE/clib/fio.o $DIRBASE/clib/ip.o \ $DIRBASE/clib/parse.o $DIRBASE/clib/logger.o \ $DIRBASE/clib/ipcsrv.o $DIRBASE/clib/ipcomm.o \ $DIRBASE/clib/sys_log.o $DIRBASE/clib/slogcode.o \ $DIRBASE/dbeng/dbeng.c $DIRBASE/dbeng/dblocal.c \ $DIRBASE/dbeng/dbiocode.c $DIRBASE/dbeng/dbengcfg.c \ $DIRBASE/dbeng/dblocfg.c $DIRBASE/socloc/sloc.o \ $DIRBASE/socloc/slconfig.o $DIRBASE/socloc/sliocode.o \ $DIRBASE/socloc/sconnect.o
This script will build (compile and link) the dbsrv TCP database server. Notice the define MULTIUSER passed on the gcc command line.
# Compile and link the 'dbstress' # stand-alone database stress program. # Jan/99, Rick Smereka # # Added 'socloc' API object files # and changed 'Bbuuzzb' file to use # source code instead of object code. # Modified to use environment vars. # Removed library file 'ipconfig'. # Apr/2000, Rick Smereka # # Added new 'clib' object file 'ip.o'. # Jul/2000, Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" -I$DIRBASE/include -o$DIRBASE/bin/dbstress dbstress.c \ $DIRBASE/clib/fio.o $DIRBASE/clib/ip.o \ $DIRBASE/clib/parse.o $DIRBASE/clib/logger.o \ $DIRBASE/clib/ipcomm.o \ $DIRBASE/clib/sys_log.o \ $DIRBASE/clib/slogcode.o $DIRBASE/dbeng/dbeng.c \ $DIRBASE/dbeng/dblocal.c $DIRBASE/dbeng/dbiocode.c \ $DIRBASE/dbeng/dbengcfg.c $DIRBASE/dbeng/dblocfg.c \ $DIRBASE/socloc/sloc.o $DIRBASE/socloc/slconfig.o \ $DIRBASE/socloc/sliocode.o $DIRBASE/socloc/sconnect.o
This script will build (compile and link) the dbstress stand-alone database stress program.
# Compile and link the 'dbstresm' # c/s database stress program. # Jan/99, Rick Smereka # # Changed name to 'dbstresm'. # Sep/99, Rick Smereka # # Added 'socloc' API object files # and changed 'Bbuuzzb' files to # use source instead of object # code. Modified to use environment # vars. Removed library file 'ipconfig'. # Apr/2000, Rick Smereka # # Added new 'clib' object file 'ip.o'. # Jul/2000, Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" $MULTI -I$DIRBASE/include \ -o$DIRBASE/bin/dbstresm dbstress.c \ $DIRBASE/clib/fio.o $DIRBASE/clib/ip.o \ $DIRBASE/clib/parse.o $DIRBASE/clib/logger.o \ $DIRBASE/clib/ipcomm.o \ $DIRBASE/clib/sys_log.o \ $DIRBASE/clib/slogcode.o \ $DIRBASE/dbeng/dbcs.c $DIRBASE/dbeng/dbiocode.c \ $DIRBASE/dbeng/dbcscfg.c $DIRBASE/socloc/sloc.o \ $DIRBASE/socloc/slconfig.o $DIRBASE/socloc/sliocode.o \ $DIRBASE/socloc/sconnect.o
This script will build (compile and link) the dbstresm client/server database stress program.
# Compile and link the 'dumsockc' # client program for Linux. # Feb/2000, Rick Smereka # # Modified to use environment # vars. Apr/2000 # # Added new 'clib' object file 'ip.o'. # Jul/2000, Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" $MULTI -I$DIRBASE/include -o$DIRBASE/bin/dumsockc \ dumsockc.c $DIRBASE/clib/fio.o $DIRBASE/clib/ip.o \ $DIRBASE/clib/parse.o $DIRBASE/clib/logger.o \ $DIRBASE/clib/ipclient.o $DIRBASE/clib/ipcomm.o \ $DIRBASE/socloc/sloc.o $DIRBASE/socloc/slconfig.o \ $DIRBASE/socloc/sliocode.o $DIRBASE/socloc/sconnect.o
This script will build (compile and link) the dumsockc client application.
# Compile and link the 'dumsocks' # TCP server program for Linux. # Dec/99, Rick Smereka # # Added 'sconnect', Feb/2000 # Rick Smereka # # Modified to use environment # vars. Apr/2000, Rick Smereka # # Added 'clib' object file # 'ip.o'. Jul/2000, # Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" $MULTI -I$DIRBASE/include -o$DIRBASE/bin/dumsocks \ dumsocks.c $DIRBASE/clib/fio.o $DIRBASE/clib/ip.o \ $DIRBASE/clib/parse.o $DIRBASE/clib/logger.o \ $DIRBASE/clib/ipcsrv.o $DIRBASE/clib/ipcomm.o \ $DIRBASE/socloc/sloc.o $DIRBASE/socloc/slconfig.o \ $DIRBASE/socloc/sliocode.o $DIRBASE/socloc/sconnect.o
This script will build (compile and link) the dumsocks TCP server application.
# Build the 'iresolve' program for # Linux. Apr/2000, Rick Smereka # # Added new 'clib' object file 'ip.o'. # Jul/2000, Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" $MULTI -I$DIRBASE/include \ -o$DIRBASE/bin/iresolve iresolve.c \ $DIRBASE/clib/fio.o $DIRBASE/clib/parse.o \ $DIRBASE/clib/logger.o $DIRBASE/clib/ip.o
This script will build (compile and link) the iresolve application.
# Compile and link the 'sockc' # client program for Linux. # Feb/2000, Rick Smereka # # Modified to use environment # vars. Apr/2000, Rick Smereka # # Added new 'clib' object file 'ip.o' # Jul/2000, Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" $MULTI -I$DIRBASE/include -o$DIRBASE/bin/sockc sockc.c \ $DIRBASE/clib/fio.o \ $DIRBASE/clib/parse.o $DIRBASE/clib/logger.o \ $DIRBASE/clib/ip.o \ $DIRBASE/clib/ipclient.o $DIRBASE/clib/ipcomm.o \ $DIRBASE/socloc/sloc.o $DIRBASE/socloc/slconfig.o \ $DIRBASE/socloc/sliocode.o $DIRBASE/socloc/sconnect.o
This script will build (compile and link) the sockc client application.
# Compile and link the 'socloc' # TCP server program. # Dec/99, Rick Smereka # # Added 'sconnect', Feb/2000 # Rick Smereka # # Modified to use environment # vars. Apr/2000, Rick Smereka # # Added 'clib' object file # 'ip.o'. Jul/2000, # Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" $MULTI -I$DIRBASE/include -o$DIRBASE/bin/socloc socloc.c \ $DIRBASE/clib/fio.o $DIRBASE/clib/ip.o \ $DIRBASE/clib/parse.o $DIRBASE/clib/logger.o \ $DIRBASE/clib/ipcsrv.o $DIRBASE/clib/ipcomm.o \ $DIRBASE/socloc/sloc.o $DIRBASE/socloc/slconfig.o \ $DIRBASE/socloc/sliocode.o $DIRBASE/socloc/sconnect.o
This script will build (compile and link) the socloc TCP server application.
# Compile and link the 'sys_log' # TCP server program for Linux. # Jan/99, Rick Smereka # # Modified to use environment # vars. Apr/2000, Rick Smereka # # Added 'clib' object file # 'ip.o'. Jul/2000, # Rick Smereka # . include.generic . include.linux # cd $DIRBASE/source $COMP $DEFS="$PLAT" $MULTI -I$DIRBASE/include -o$DIRBASE/bin/sys_log \ sys_log.c $DIRBASE/clib/fio.o $DIRBASE/clib/ip.o \ $DIRBASE/clib/parse.o $DIRBASE/clib/logger.o \ $DIRBASE/clib/ipcsrv.o $DIRBASE/clib/ipcomm.o \ $DIRBASE/clib/slogcode.o $DIRBASE/socloc/sloc.o \ $DIRBASE/socloc/slconfig.o $DIRBASE/socloc/sliocode.o \ $DIRBASE/socloc/sconnect.o
This script will build (compile and link) the sys_log TCP system log server.