home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
mkmktmpl.tcl
< prev
next >
Wrap
Text File
|
1997-10-10
|
5KB
|
166 lines
#---------------------------------------------------------------------------
#
# Copyright (c) 1997 by Cayenne Software Inc.
#
# This software is furnished under a license and may be used only in
# accordance with the terms of such license and with the inclusion of
# the above copyright notice. This software or any other copies thereof
# may not be provided or otherwise made available to any other person.
# No title to and ownership of the software is hereby transferred.
#
# The information in this software is subject to change without notice
# and should not be construed as a commitment by Cayenne Software Inc.
#
#---------------------------------------------------------------------------
#
# File : @(#)mkmktmpl.tcl /main/titanic/11 11 Jun 1997
# Description : Make template generator
#
#---------------------------------------------------------------------------
#
require caynutil.tcl
set classLibProcs {}
require_all_module_files mkmkinc.tcl
proc makeMakefileTemplate {section} {
if {[info commands getLinkCommand] == ""} {
return
}
set suffixSect [TextSection new]
set libSect [TextSection new]
set inclSect [TextSection new]
set defineSect [TextSection new]
set targetSect [TextSection new]
set ruleSect [TextSection new]
set dependSect [TextSection new]
$suffixSect append ".SUFFIXES:"
$libSect append "LIBS ="
$inclSect append "INCS ="
if {[info commands getIncludePrefix] != ""} {
$inclSect append "~\[foreach sys \[\[\$clientContext currentPhase\] systemVersions\] "
$inclSect append "\{\$current_section append \" [getIncludePrefix]"
$inclSect append "\[location .. \[\[\$sys system\] name\]\]\" \} \]"
}
expand_text $targetSect {
# (default:) make all executables and libraries
all: \~[mm_files executable] \~[mm_files library]
# make all targets
system: \~[mm_files]
# install all executables and libraries
install: \~[mm_files executable install_] \~[mm_files library install_]
# clean all
clean: \~[mm_files $TGT_TYPES clean_] clean_depend
# clobber all
clobber: \~[mm_files $TGT_TYPES clobber_]
#
# filetype "executable"
#
\~[mm_foreach_target executable {
\~[mm_obj_name] = \~[mm_dependencies - .$OBJ_EXT "\\\\\\n\\t"]
\~[mm_tgt_path]: $(\~[mm_obj_name]) \~[mm_dependencies library .$LIB_EXT]
~[$current_section append [getLinkCommand]]
install_\~[mm_tgt_path]: \~[mm_tgt_path]
\~$CP_CMND \~[mm_tgt_path] \~[mm_install_path $target]
clean_\~[mm_tgt_path]:
\~$RMF_CMND $(\~[mm_obj_name])
clobber_\~[mm_tgt_path]: clean_\~[mm_tgt_path]
\~$RMF_CMND \~[mm_tgt_path]
}]
#
# filetype "library"
#
\~[mm_foreach_target library {
\~[mm_obj_name] = \~[mm_dependencies - .$OBJ_EXT "\\\\\\n\\t"]
\~[mm_tgt_path]: $(\~[mm_obj_name])
~[$current_section append [getArCommand]]
\~[mm_process_lib [mm_tgt_path]]
install_\~[mm_tgt_path]: \~[mm_tgt_path]
\~$CP_CMND \~[mm_tgt_path] \~[mm_install_path $target]
\~[mm_process_lib [mm_install_path $target]]
clean_\~[mm_tgt_path]:
\~$RMF_CMND $(\~[mm_obj_name])
clobber_\~[mm_tgt_path]: clean_\~[mm_tgt_path]
\~$RMF_CMND \~[mm_tgt_path]
}]
}
set lastCmd ""
foreach cmd [lsort $classLibProcs] {
if {$cmd != $lastCmd} {
set lastCmd $cmd
if {[info commands $cmd] != ""} {
eval {$cmd $suffixSect $libSect $inclSect \
$defineSect $ruleSect $dependSect}
}
}
}
if {[info commands persistentMakefileTemplate] != ""} {
persistentMakefileTemplate $suffixSect $libSect $inclSect \
$defineSect $ruleSect $dependSect
}
if {[info commands compilerMakefileTemplate] != ""} {
compilerMakefileTemplate $suffixSect $libSect $inclSect \
$defineSect $ruleSect $dependSect
}
$section append "\n"
$section append "SHELL = /bin/sh\n\n"
$section append ".SUFFIXES:\n"
$section appendSect $suffixSect
$section append "\n\n"
$section appendSect $inclSect
$section append "\n"
$section appendSect $defineSect
$section appendSect $libSect
$section append "\n\n"
$section appendSect $targetSect
$section append "\n"
$section appendSect $ruleSect
$section append "\n"
$section appendSect $dependSect
$section append "\n"
}
proc do_makefile {} {
set makefileSect [TextSection new]
makeMakefileTemplate $makefileSect
set tmpName [BasicFS::tmpFile]
BasicFS::writeFile $tmpName [$makefileSect contents]
set cc [ClientContext::global]
set currentConfig [$cc currentConfig]
if {![$currentConfig isNil]} {
set cfv [$currentConfig searchCustomFileVersion maketmpl maketmpl]
if [$cfv isNil] {
set cfv [$currentConfig createCustomFileVersion maketmpl maketmpl]
}
$cfv lockForWrite "Create new makefile template"
$cfv upLoad $tmpName
$cfv quit
} else {
puts "Must be at configuration or lower level"
}
BasicFS::removeFile $tmpName
}