Guide
Usage
Tecmake usage is quite simple. Just call "tecmake" in the folder that contains the "config.mak" file. If your
configuration file has a different name, then you should call:
tecmake MF=myconf
In Windows, to add any parameter you must first add the platform, i.e. "tecmake rebuild" must be "tecmake vc7
rebuild" even if vc7 is the default platform. Also in Windows to add a definition you must enclose it with quotes, for
ex:
tecmake vc7 "MF=myconf"
Parameters
- MF=<file>
- Name of the user's configuration file. Default name is "config". The extension ".mak" will be
added. Must be present in the folder "src". A distribution file name will also be used, "config.dist" as default.
- build (default target)
- Compiles to the current platform. It is the target executed when no target is passed in the command line. In this
order: it creates the required folders, compiles, generates links to exported files, and generates scripts/batches for
applications in order to run them without the need to change the current folder.
- In UNIX it also generates a script to call the depurator with the application executable as parameter. One can
edit the scripts or create "app.env" or "debug.env" files to be loaded by the respective scripts.
- <platform> (not supported in Compact)
- Compiles to the specified platform. In UNIX it is the system's TEC_UNAME.
In Windows it is the compiler's TEC_UNAME - in this case, the use of this
parameter is required for other parameters to work.
- compile-all (all) (not supported in Compact)
- Compiles for all known platforms. In UNIX each compilation starts in a different xterm - therefore, to use this
option, one needs to be at a X11 client. The windows are viewed with black background and LightBlue letters, with the
name of the respective library displayed in the title. In Windows the platforms will be executed one at a time and it
does not include the generation of DLLs (for such, use "all-dll").
- depend
- Builds the list of dependencies among source files (.c and .cpp) and inclusion files (.h). If the gcc compiler is
not installed, tecmake will not be able to execute this option, informing this to the user. The list is stored
in a file with the name specified in APPNAME or LIBNAME with extension ".dep". It is dependent on the file config.mak
- therefore, every time the latter is changed, the former will be updated.
- clean-ALLDIR (not supported in Compact)
- Deletes all generated folders and their contents.
- clean-lohs
- Deletes all generated Lua object files.
- clean-exp (not supported in Compact)
- Deletes all links to exported files.
- clean-obj
- Deletes all object files generated in the given platform.
- clean-all-obj (not supported in Compact)
- Deletes all object files generated in all platforms.
- clean-target
- Deletes the library or executable generated in the given platform.
- clean-all-target (not supported in Compact)
- Deletes the library or executable generated (in all platforms).
- clean
- Deletes the object files, library or executable generated in the given platform.
- clean-all (not supported in Compact)
- Deletes everything the makefile generates: the contents of folders obj, lib, inc and lua, temporary files, and
files that are not locked by RCS (ir RCS is activated).
- rebuild
- Deletes all generated files and recompiles only for the given platform.
- rebuild-all (UNIX Only) (not supported in Compact)
- Deletes all generated files and recompiles for all platforms.
- relink
- Deletes generated files except object files and recompiles only for the given platform.
- relink-all (UNIX Only) (not supported in Compact)
- Deletes generated files except object files and recompiles for all platforms.
- dist (UNIX Only - but includes all source files) (not
supported in Compact)
- Generates a LIB/APPNAME.tar.Z file containing the whole source code. For UNIX we have included a standard
makefile in order to allow compiling the library in environments outside Tecgraf (tecmake uses the GNU
make, which is guaranteed to be a standard only in Linux). The file RCS is not included in this file. This rule can
use the file config.dist if it exists in the current folder; it can contain user parameters to be included in the
standard makefile.
- makefile (UNIX Only) (not supported in Compact)
- Generates only the standard makefile. In order to use it, one must first execute "make inst" to update some
internal variables.
- inst (UNIX Only - but also includes binaries for Windows)
(not supported in Compact)
- Generates a .tar file with already precompiled binaries, ready to be installed. Apart from the libraries and
applications themselves, it also includes exported inclusion files (associated to the variable EXPINC), Lua
files (associated to the variable EXPLUA) and data folders (variable DIR). Only binaries that are
already generated are included.
- locked (not supported in Compact)
- Lists the files that are currently locked in RCS, showing the name of the user responsible for the lock. Changed
files are marked "(modified)".
- check-out (co) (not supported in Compact)
- Extracts from RCS the last versions of source files (associated to the variables SRC and INC). Works only if
USE_RCS is defined.
- version
- Informs the current version of tecmake.
Concerning the folder structure, all tecmake needs to run is a folder where the source files will be placed.
The diagram below illustrates the folder structure used:
Folders include, obj and lib are created automatically, as well as the subfolders related to the
platforms. The folder src is the one from which tecmake must be executed (note: this folder does not need
to have this name). Folder include will contain the exported inclusion files associated to the variable EXPINC.
This folder will contain only links to the files in folder src. Similarly, the folder lua will exist only
when the variable EXPLUA is defined and will also only contain links to files in the src folder.
tecmake was designed to have folder src as reference in the hierarchy presented above, that is, the
user will have to work with the current file being src, from where s/he can easily access the product's source
files.
These are the compiler parameters used internally by Tecmake.
GCC
-Wall (always)
-g (DBG)
-O2 (OPT)
-m64 -fPIC (BUILD_64)
-bundle -undefined dynamic_lookup (for shared code libraries in MacOS X)
-dynamiclib -install_name lib$(TARGETNAME).dylib (for dynamic libraries in MacOS X when BUILD_DYLIB=Yes)
Open Watcom
-od -w4 -5r -bt=nt -mf -e25 -zq (always)
-d2 (DBG)
-ot (OPT)
-b -c -n -q -p=512 (libraries)
-bm -br (USE_DLL)
Borland
-v -N -x -xp (DBG)
-O2 (OPT)
-tWDMR (USE_DLL)
Visual C++
-W3 -GX (always)
-O2 -GL -LTCG (OPT)
-Z7 -Od -GZ (DBG)
-ML
-MLd (DBG)
-MD (USE_DLL)
-MDd (USE_DLL+DBG)
-MT (USE_MT)
-MTd (USE_MT+DBG)
O2 = Maximize Speed
Z7 = C7 Compatible
Gd (default) = cdecl calling convention
GZ = Run-Time Error Checks
LTCG, GL = Whole Program Optimization
M* = Run-Time Library (options are mutually exclusive)
(There is no single thread in VC8 or VC9, USE_MT=Yes is always set)
_CRT_SECURE_NO_DEPRECATE is defined for VC8 and VC9.
To enable automatic manifest file generation and embedding in VC8 or VC9 use GEN_MANIFEST=Yes.
To enable C++ additional definitions for RTL functions in VC8 or VC9 use CPP_NARROW_INLINES=Yes.
In UNIX, Tecmake has a file that can be distributed together with the source code with no
need for an addtional installation. Simply copy the file "tecmake_compact.mak"
to your source code and rename it to "Makefile".
To build the target simply do "make" on the command line. The Tecmake
parameters can be used simply as doing "make clean". But notice that not all
parameters are available (see note bellow).
To build several targets, keep the original name and create a new file called
"Makefile" with contents similar to the following:
all: target1 target2 target3
target1:
@$(MAKE) --no-print-directory -f tecmake_compact.mak #(to let Tecmake use "config.mak")
target2:
@$(MAKE) --no-print-directory -f tecmake_compact.mak MF=target2 #(to make Tecmake use "target2.mak")
target3:
@$(MAKE) --no-print-directory -f tecmake_compact.mak MF=target3 #(to make Tecmake use "target3.mak")
Then you can use your own parameters to build different targets.
As a general rule the following are not supported in the compact version: the
"*-all" parameters, remote build, EXP* variables, dist and inst rules, COLOR_CC
and RCS.
If you are building a library or application that depends on a Tecgraf
library like IUP, CD or IM, then define the TECTOOLS_HOME variable inside your
"config.mak". It points to the base path where those libraries are installed. It
can be a relative path like "../..".
The compact version is know NOT to work on the systems: FreeBSD54, AIX43,
IRIX6465 and IRIX65. There are unsolved syntax problems on those systems when
using the "($shell uname)" command.
Here is a small tutorial on how to setup a minimum Windows build system to
use Tecmake and Microsoft Visual C++ 2008.
- Install Windows and its updates from Windows Updates. We tested in a
Windows XP with Service Pack 3 and all other updates installed.
- Unpack "tecmake.zip" on a folder, let's say "c:\tecgraf\tecmake".
- Download Cygwin setup (http://www.cygwin.com/)
executable. Run it, and unmark all selected items. This is easier to do in
Partial mode view. Then select only "make", it will automatically select
other packages that "make" depends on.
- Change PATH in Control Panel / System / Advanced / Environment
Variables, and add "c:\tecgraf\tecmake;c:\cygwin\bin;".
- Install Windows SDK (http://msdn.microsoft.com).
You can also unmark everything except "Developer Tools" (Samples and
Documentations are huge).
- Run "shortpath" to find out the short names. Usually the result is:
shortpath "C:\Program Files\Microsoft SDKs\Windows\v6.1"
C:\PROGRA~1\MICROS~2\Windows\v6.1
shortpath "C:\Program Files\Microsoft Visual Studio 9.0\VC"
C:\PROGRA~1\MICROS~1.0\VC
- Then edit "tecmake.bat" to contain the correct folders (notice we switch the bars in path):
set TECMAKE_PATH=c:\tecgraf\tecmake
set TECMAKE_HOME=/cygdrive/c/tecgraf/tecmake
set VC9=C:/PROGRA~1/MICROS~1.0/VC
set VC9SDK=C:/PROGRA~1/MICROS~2/Windows/v6.1
The simplest way to use it is to run the "CMD Shell" item in the "Microsoft
Windows SDK v6.1" start menu folder. Then at the folder of your project with the
"config.mak" file type in the command line:
tecmake vc9
Notice that Visual C++ Express 2008 is not installed, the Windows SDK already
includes the necessary command line compilers. But if it is installed will be
placed in the same folders of the Windows SDK compilers. On the other hand the
Windows SDK does not includes the Visual Studio.
This minimum installation considers that no dependencies are necessary and
USE_NODEPEND is set at "config.mak". If you need dependencies then run the
Cygwin setup again and mark the "gcc/g++", "sed" and "which" items.
Here is a small tutorial on how to setup a minimum Windows build system to
use Tecmake and MingW.
- Same as Visual C++, but stop before "Install Windows SDK".
- Install MingW (http://www.mingw.org/).
Use the "Automated MinGW Installer" and include the g++
installation. MingW
is also available inside Cygwin but it is more complicated to use it from
there.
- Then edit "tecmake.bat" to contain correct folders (notice we switch the bars in path):
set TECMAKE_PATH=c:\tecgraf\tecmake
set TECMAKE_HOME=/cygdrive/c/tecgraf/tecmake
set MINGW3=c:/mingw
Start a command line with "cmd", then at the folder of your project with the
"config.mak" file type in the command line:
tecmake mingw3
A very minimum MingW installation can be done without installing Cygwin. Only
install MingW and set PATH to its bin folder.