Commit 30e8e89b authored by Ricardo Calheiros de Miranda Cosme's avatar Ricardo Calheiros de Miranda Cosme
Browse files

[OPENBUS-904]

+ Versionamento do Tecmake 3.21 e 4.00.



git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/utils/tecmake@108617 ae0415b3-e90b-0410-900d-d0be9363c56b
parents
Tecmake License
-----------
Tecmake is licensed under the terms of the MIT license reproduced below.
This means that Tecmake is free software and can be used for both academic
and commercial purposes at absolutely no cost.
===============================================================================
Copyright (C) 1994-2010 Tecgraf, PUC-Rio.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================================================
(end of COPYRIGHT)
README for Tecmake
Tecmake is essentially a general GNU makefile with a series of predefined
targets and rules with the purpose of providing those in charge of developing
libraries and applications the necessary tools so that versions for different
platforms can be generated homogeneously. In other words, the tecmake user
does not need to create a complete makefile nor be concerned with the current
platform to create a library or application.
Installation instructions and usage are available in the Tecmake documentation.
For complete information, visit Tecmake's web site at http://www.tecgraf.puc-rio.br/tecmake
or access its documentation in the HTML folder.
(end of README)
#!/bin/sh
COMPILER=CC
. color-compiler
#!/bin/sh
COMPILER=gcc
. color-compiler
#!/bin/sh
COMPILER=CC
. color-compiler
#!/bin/sh
COMPILER=g++
. color-compiler
local FILE_SEP = "/"
local PACK_SEP = "."
local PATH_PAT = FILE_SEP.."$"
local Options = {
luapath = ".",
output = "out.loh",
prefix = "",
}
local Alias = {
l = "luapath",
o = "output",
p = "prefix",
}
function adjustpath(path)
if string.find(path, PATH_PAT)
then return path
else return path..FILE_SEP
end
end
function processargs(arg)
local i = 1
if not arg then
io.stderr:write("usage: luapre.lua [options] <scripts>")
end
while arg[i] do
local opt = string.match(arg[i], "^%-(.+)$")
if not opt then break end
opt = Alias[opt] or opt
local opkind = type(Options[opt])
if opkind == "boolean" then
Options[opt] = true
elseif opkind == "number" then
i = i + 1
Options[opt] = tonumber(arg[i])
elseif opkind == "string" then
i = i + 1
Options[opt] = arg[i]
elseif opkind == "table" then
i = i + 1
table.insert(Options[opt], arg[i])
else
io.stderr:write("unknown option ", opt)
end
i = i + 1
end
return i, table.getn(arg)
end
function getname(file)
local name = file:match("(.+)%..+")
if name:find("init$") then
name = name:sub(1, -6)
end
return name:gsub(FILE_SEP, PACK_SEP)
end
--------------------------------------------------------------------------------
local start, finish = processargs(arg)
Options.luapath = adjustpath(Options.luapath)
local output = assert(io.open(Options.output, "w"))
output:write([[
/* code automatically generated by luapre.lua -- DO NOT EDIT */
{
]])
for i = start, finish do local file = arg[i]
local bytecodes = string.dump(assert(loadfile(Options.luapath..file)))
output:write("/* ",file," */\n")
output:write("static const unsigned char B",i-start,"[]={\n")
for index = 1, string.len(bytecodes) do
output:write(string.format("%3u,", string.byte(bytecodes, index)))
if math.fmod(index, 20) == 0 then output:write("\n") end
end
output:write("\n};\n\n")
end
output:write([[
lua_getfield(L, LUA_GLOBALSINDEX, "package");
lua_getfield(L, -1, "preload");
]])
for index = start, finish do local file = arg[index]
local i = index - start
local module = Options.prefix..getname(file)
output:write([[
luaL_loadbuffer(L,(const char*)B]],i,[[,sizeof(B]],i,[[),"]],file,[[");
lua_setfield(L, -2, "]],module,[[");
]])
end
output:write([[
lua_pop(L, 2);
}
]])
output:close()
#!/bin/csh
# Parameters:
# 1 ... startup folder
# 2 ... makefile
# 3-n ... definitions
echo "Configuring Environment"
echo "... TeCGraf"
#source /home/t/tecgraf/bin/tecgraf_inst
source /home/skel/.cshrc
echo "... User"
source /home/skel/.login
cd $argv[1]
echo ""; echo "Starting Tecmake:"
if ( $#argv > 2 ) then
echo "parameters: $argv[3*]"
endif
echo ""
tecmake $argv[2*]
echo ""; echo "Press ENTER to close the window..."
echo $< >/dev/null
# ########################
# Tecmake Configuration
# ########################
export TECTOOLS_HOME=/home/tecgraf
export TECMAKE_HOME=/home/tecgraf/tecmake
export TECMAKE_MAKE=make
# ########################
# System Identification
# ########################
# Base Defintion
export TEC_SYSNAME=`uname -s`
export TEC_SYSVERSION=`uname -r|cut -f1 -d.`
export TEC_SYSMINOR=`uname -r|cut -f2 -d.`
export TEC_SYSARCH=`uname -m`
# Fixes
case $TEC_SYSNAME in
SunOS)
export TEC_SYSARCH=`uname -p`;;
IRIX)
export TEC_SYSARCH=`uname -p`;;
FreeBSD)
export TEC_SYSMINOR=`uname -r|cut -f2 -d.|cut -f1 -d-`;;
AIX)
export TEC_SYSVERSION=`uname -v`
export TEC_SYSMINOR=`uname -r`
export TEC_SYSARCH='ppc';;
Darwin)
export TEC_SYSARCH=`uname -p`;;
esac
if [ $TEC_SYSARCH == i686 ]; then
export TEC_SYSARCH='x86'
fi
if [ $TEC_SYSARCH == i386 ]; then
export TEC_SYSARCH='x86'
fi
if [ $TEC_SYSARCH == powerpc ]; then
export TEC_SYSARCH='ppc'
fi
if [ $TEC_SYSARCH == x86_64 ]; then
export TEC_SYSARCH='x64'
fi
# Compose
export TEC_SYSRELEASE=$TEC_SYSVERSION.$TEC_SYSMINOR
export TEC_UNAME=$TEC_SYSNAME$TEC_SYSVERSION$TEC_SYSMINOR
# Linux 2.4 and GCC 3.x
if [ $TEC_UNAME == Linux24 ]; then
GCCVER=`gcc -dumpversion|cut -f1 -d.`
if [ $GCCVER == 3 ]; then
export TEC_UNAME=$TEC_UNAME'g3'
fi
unset GCCVER
fi
# Linux 2.6 and GCC 4.x
if [ $TEC_UNAME == Linux26 ]; then
GCCVER=`gcc -dumpversion|cut -f1 -d.`
if [ $GCCVER == 4 ]; then
export TEC_UNAME=$TEC_UNAME'g4'
fi
unset GCCVER
fi
# Linux and PowerPC
if [ $TEC_SYSNAME == Linux ]; then
if [ $TEC_SYSARCH == ppc ]; then
export TEC_UNAME=$TEC_UNAME'ppc'
fi
fi
# 64-bits Linux
if [ $TEC_SYSARCH == x64 ]; then
export BUILD_64=Yes
export TEC_UNAME=$TEC_UNAME'_64'
fi
if [ $TEC_SYSARCH == ia64 ]; then
export BUILD_64=Yes
export TEC_UNAME=$TEC_UNAME'_ia64'
fi
# Solaris and Intel
if [ $TEC_SYSNAME == SunOS ]; then
if [ $TEC_SYSARCH == x86 ]; then
export TEC_UNAME=$TEC_UNAME'x86'
fi
fi
# Darwin and Intel
if [ $TEC_SYSNAME == Darwin ]; then
if [ $TEC_SYSARCH == x86 ]; then
export TEC_UNAME=$TEC_UNAME'x86'
fi
fi
# #####################
# Environment Variables
# #####################
for produto in cd im iup lua lua52 ; do
PROD=`echo $produto|tr \[a-z\] \[A-Z\]`
export $PROD=$TECTOOLS_HOME/$produto
unset PROD
done
export LUA51=$TECTOOLS_HOME/lua5.1
#If the Lua executables are not in the above folder tree
#export LUA_BIN=/usr/local/bin
export CDDIR=$CD/etc
#!/bin/csh
# ########################
# Tecmake Configuration
# ########################
setenv TECTOOLS_HOME /home/tecgraf
setenv TECMAKE_HOME /home/tecgraf/tecmake
setenv TECMAKE_MAKE make
# ########################
# System Identification
# ########################
# Base Defintion
setenv TEC_SYSNAME `uname -s`
setenv TEC_SYSVERSION `uname -r|cut -f1 -d.`
setenv TEC_SYSMINOR `uname -r|cut -f2 -d.`
setenv TEC_SYSARCH `uname -m`
# Fixes
switch ( $TEC_SYSNAME )
case SunOS:
setenv TEC_SYSARCH `uname -p`
breaksw
case IRIX:
setenv TEC_SYSARCH `uname -p`
breaksw
case FreeBSD:
setenv TEC_SYSMINOR `uname -r|cut -f2 -d.|cut -f1 -d-`
breaksw
case AIX:
setenv TEC_SYSVERSION `uname -v`
setenv TEC_SYSMINOR `uname -r`
setenv TEC_SYSARCH 'ppc'
breaksw
case Darwin:
setenv TEC_SYSARCH `uname -p`
breaksw
endsw
if ($TEC_SYSARCH == 'i686' || $TEC_SYSARCH == 'i386') then
setenv TEC_SYSARCH 'x86'
endif
if ($TEC_SYSARCH == 'powerpc') then
setenv TEC_SYSARCH 'ppc'
endif
if ($TEC_SYSARCH == 'x86_64') then
setenv TEC_SYSARCH 'x64'
endif
# Compose
setenv TEC_SYSRELEASE $TEC_SYSVERSION.$TEC_SYSMINOR
setenv TEC_UNAME $TEC_SYSNAME$TEC_SYSVERSION$TEC_SYSMINOR
# Linux 2.4 and GCC 3.x
if ($TEC_UNAME == 'Linux24') then
set GCCVER=`gcc -dumpversion|cut -f1 -d.`
if ($GCCVER == '3') then
setenv TEC_UNAME $TEC_UNAME'g3'
endif
unset GCCVER
endif
# Linux 2.6 and GCC 4.x
if ($TEC_UNAME == 'Linux26') then
set GCCVER=`gcc -dumpversion|cut -f1 -d.`
if ($GCCVER == '4') then
setenv TEC_UNAME $TEC_UNAME'g4'
endif
unset GCCVER
endif
# Linux and PowerPC
if ($TEC_SYSNAME == 'Linux') then
if ($TEC_SYSARCH == 'ppc') then
setenv TEC_UNAME $TEC_UNAME'ppc'
endif
endif
# 64-bits Linux
if ($TEC_SYSARCH == 'x64') then
setenv BUILD_64 Yes
setenv TEC_UNAME $TEC_UNAME'_64'
endif
if ($TEC_SYSARCH == 'ia64') then
setenv BUILD_64 Yes
setenv TEC_UNAME $TEC_UNAME'_ia64'
endif
# Solaris and Intel
if ($TEC_SYSNAME == 'SunOS') then
if ($TEC_SYSARCH == 'x86') then
setenv TEC_UNAME $TEC_UNAME'x86'
endif
endif
# Darwin and Intel
if ($TEC_SYSNAME == 'Darwin') then
if ($TEC_SYSARCH == 'x86') then
setenv TEC_UNAME $TEC_UNAME'x86'
endif
endif
# #####################
# Environment Variables
# #####################
foreach produto ( cd im iup lua lua52 )
set PROD=`echo $produto|tr \[a-z\] \[A-Z\]`
setenv $PROD $TECTOOLS_HOME/$produto
unset PROD
end
setenv LUA51 $TECTOOLS_HOME/lua5.1
#If the Lua executables are not in the above folder tree
#setenv LUA_BIN /usr/local/bin
setenv CDDIR $CD/etc
# Uncomment the following line to set the enviroment variables here
#.tec_uname
$TECMAKE_MAKE -f $TECMAKE_HOME/tecmake.mak $*
@echo off
REM Cygwin configuration
set MAKE_MODE=UNIX
REM *********************************************
REM Tecmake Configuration
REM Change the following lines to match your system installation
REM Use always "/" is paths, except for TECMAKE_PATH
REM Do NOT use long file names with spaces here.
REM Use the tool "shortpath" to display the
REM short name version of the current folder
REM or pass the folder as the first parameter.
REM OR create a link to the folder using a name without spaces.
REM OR create a copy of the folder using a name without spaces.
REM *********************************************
REM Used only in some scripts on Tecmake for Windows.
REM Not used inside the Makefile.
REM Must use Windows standard PATH separators "\".
set TECMAKE_PATH=c:\tecgraf\tecmake
REM Used only for RCS, can be ignored in Windows.
REM THis is the only place where a cygdrive path is used.
set TECMAKE_HOME=/cygdrive/c/tecgraf/tecmake
REM This must be the GNU make
set TECMAKE_MAKE=make
REM Change the paths you need to match your installation:
rem set VC6=c:/app/lng/vc6
rem set VC7=c:/progra~1/micros~1.net/vc7
rem set VC8=c:/progra~1/mid05a~1/vc
rem set VC9=c:/progra~2/micros~1.0/vc
REM If you have problems with Visual C++ make sure that
REM "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE"
REM is in your PATH.
REM Leave this commented out to use the SDK installed with the compiler.
rem set PLATSDK=c:/progra~1/mifd68~1
REM VC9 installs the Windows SDK in a separate directory,
REM usually is "C:\Program Files\Microsoft SDKs\Windows\v6.0A".
rem set VC9SDK=c:/progra~1/micros~3/windows/v6.0a
REM If PLATSDK is defined then VC9SDK i not used.
rem set OWC1=c:/app/lng/owc1
rem set BC55=c:/app/lng/bcc55
rem set BC56=c:/app/lng/CBuilderX
rem set MINGW3=c:/app/lng/mingw3
rem set MINGW4=c:/app/lng/mingw4
rem set GCC3=c:/cygwin15
rem set GCC4=c:/cygwin17
rem set GLUT=c:/app/lng/glut
rem set GTK=c:/app/lng/gtk
REM Uncomment the variables you need
rem set TECTOOLS_HOME=c:/tecgraf
rem set CD=%TECTOOLS_HOME%/cd
rem set IM=%TECTOOLS_HOME%/im
rem set IUP=%TECTOOLS_HOME%/iup
rem set LUA=%TECTOOLS_HOME%/lua
rem set LUA5=%TECTOOLS_HOME%/lua5
rem set LUA50=%TECTOOLS_HOME%/lua50
rem set LUA51=%TECTOOLS_HOME%/lua5.1
rem set CDDIR=%CD%/etc
REM Must edit or set this for your Windows system
rem set TEC_SYSVERSION=5
rem set TEC_SYSMINOR=1
rem set TEC_SYSRELEASE=%TEC_SYSVERSION%.%TEC_SYSMINOR%
REM TEC_SYSRELEASE will be defined as a variable when compiling code only for gcc
REM *********************************************
if "%1"=="" goto default
if "%1"=="all" goto all
if "%1"=="all-dll" goto all-dll
if "%1"=="gcc3" goto make
if "%1"=="gcc4" goto make
if "%1"=="mingw3" goto make
if "%1"=="mingw4" goto make
if "%1"=="cygw15" goto make
if "%1"=="cygw17" goto make
if "%1"=="vc7" goto make
if "%1"=="vc6" goto make
if "%1"=="vc8" goto make
if "%1"=="vc8_64" goto make
if "%1"=="vc9" goto make
if "%1"=="vc9_64" goto make
if "%1"=="owc1" goto make
if "%1"=="bc55" goto make
if "%1"=="bc56" goto make
if "%1"=="dll" goto make
if "%1"=="dll7" goto make
if "%1"=="dll8" goto make
if "%1"=="dll8_64" goto make
if "%1"=="dll9" goto make
if "%1"=="dll9_64" goto make
if "%1"=="dllw4" goto make
if "%1"=="dllg4" goto make
goto error
:all
FOR %%u IN (vc9_64 vc9 vc8_64 vc8 vc7 vc6 owc1 bc56 gcc3 mingw3) DO call %TECMAKE_PATH%\tecmakewin.bat %%u %2 %3 %4 %5 %6 %7 %8 %9
goto end
:all-dll
FOR %%u IN (vc9_64 vc9 vc8_64 vc8 vc7 vc6 owc1 bc56 gcc3 mingw3 dll dll7 dll8 dll8_64 dll9 dll9_64) DO call %TECMAKE_PATH%\tecmakewin.bat %%u %2 %3 %4 %5 %6 %7 %8 %9
goto end
:make
call %TECMAKE_PATH%\tecmakewin.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end
:default
call %TECMAKE_PATH%\tecmakewin.bat vc9
goto end
:error
echo Invalid parameter.
:end
INCDIR = ../include
TARGETDIR = ../bin/$(TEC_UNAME)
OBJDIR = ../obj/$(TEC_UNAME)
## Compilation Parameters
WARNINGS =
DEFS := -DTEC_UNAME=$(TEC_UNAME) -DTEC_SYSNAME=$(TEC_SYSNAME) -D$(TEC_SYSNAME)=$(TEC_SYSRELEASE) -DFUNCPROTO=15 $(DEFINES)
CFLAGS = $(FLAGS) $(WARNINGS) $(INCLUDES) $(DEFS)
CXXFLAGS = $(CPPFLAGS) $(WARNINGS) $(INCLUDES) $(DEFS)
## Generic Main Rules
application: $(TARGETDIR)/$(TARGETNAME)
dynamic: $(TARGETDIR)/lib$(TARGETNAME).so
static: $(TARGETDIR)/lib$(TARGETNAME).a
libs: static dynamic
$(TARGETDIR)/$(TARGETNAME) : $(TARGETDIR) $(OBJS)
$(LINKER) -o $@ $(OBJS) $(SLIB) $(LFLAGS)
@if [ ! -z "$(STRIP)" ]; then \
echo "Striping debug information" ;\
strip $@ ;\
fi
@echo 'Application Done.'
$(TARGETDIR)/lib$(TARGETNAME).so : $(OBJS)
geraso $(TARGETDIR) $(TARGETNAME) $(OBJS)
@echo 'Dynamic Library Done.'
$(TARGETDIR)/lib$(TARGETNAME).a : $(OBJS)
ar r $@ $?
-ranlib $@
@echo 'Static Library Done.'
$(TARGETDIR): ;
mkdir $@
## Implicit Rules
.c.o:
$(CC) -c $(CFLAGS) -o $@ $<
.cpp.o:
$(CC) -c $(CXXFLAGS) -o $@ $<
clean:
rm -fr *.o so_locations
clean-all:
rm -fr *.o $(TARGETDIR)/$(TARGETNAME) $(TARGETDIR)/lib$(TARGETNAME).* so_locations
This diff is collapsed.
This diff is collapsed.