1. Purpose of this project
A purpose of this project (GAST) is to support getting preprocessed
- source codes (.i file) automatically which corresponds directly to a
+ source codes (.i file) automatically which corresponds directly to a
generated object file (.o file), If you want.
-
+
2. Product contents
This project provides three tools (=bash scripts) at present.
compiler ('gcc','cc', etc...).
In build process, these alias names must be found before real
compile in command path search, so those directory path must be
- set PATH environment at least before of real compiler's command
+ set PATH environment at least before of real compiler's command
path.
-
+
When this script is executed (by alias name), do below processes:
1) Analisys of command line arguments. If arguments are for
- compiling C language source file, this script executes real
+ compiling C language source file, this script executes real
compiler (same as alias name) with these arguments addittionaly
'-save-temps' option.
If arguments are not for compiling C language source file,
- this script executes real compiler (same as alias name) only
+ this script executes real compiler (same as alias name) only
with these arguments and then exit.
2) After compiling C language source file, preprocessed source
file (.i extension, called 'temporary file') is there.
- If directory for preserving temporary file is specified (by
+ If directory for preserving temporary file is specified (by
environment variable), temporary file is moved to that directory.
3) Delete temporary file for assembler (.s extension).
Before using this script, you have to set some environment variables
- to control 'gast' action. For more information, see "6. Environment
+ to control 'gast' action. For more information, see "6. Environment
variables to control 'gast'".
[ NOTICE ]
If C source file compiling is done under 'make' process, you perhaps
need support by 'gast_make' script (below).
-
+
- gast_make : wrapper script for make command
This script must be executed by alias name which is same as real
In build process, these alias names must be found before real make
utility in command path search, so those directory path must be set
PATH environment at least before of real make-utility command path.
-
+
When this script is executed (by alias name), do below processes:
1) Analisys of command line arguments. If arguments has '-j <n>'
or '--jobs=<n>' option, this script force number of jobs <n> to
- set 1 and execute real make-utility (same as alias name) with
+ set 1 and execute real make-utility (same as alias name) with
these arguments.
If arguments does not have '-j <n>' or '--jobs=<n>', this script
executes real make-utility (same as alias name) with given
directory. If GNU make utility runs simultaneously by specified
'-j|--jobs' option, and one C source file is compiled simultaneously
for respective purpose, build process maybe failed because temporary
- files are in conflict. So this script support you to set simultaneous
+ files are in conflict. So this script support you to set simultaneous
job number to 1 by force.
- gast_rpmbuild : wrapper script for rpmbuild command
Additional option '--save-temps-dir' is abailable to specify
directory name for preserving temporary files.
- In build process, these alias names must be found before real
+ In build process, these alias names must be found before real
rpmbuild in command path search, so those directory path must be set
PATH environment at least before of real rpmbuild command path.
-
+
When this script is executed (by alias name), do below processes:
1) Analisys of command line arguments. If arguments contains
'--save-temps-dir' option, followed argument is recognized
- as directory name for preserving temporary files and set to
+ as directory name for preserving temporary files and set to
environment variable for controling 'gast'.
- 2) Set some other environment variables (contains PATH) for
+ 2) Set some other environment variables (contains PATH) for
preserving temporary files.
3) Executes real rpmbuild command with arguments given to this
- script, except for '--save-temps-dir' and followed directory
+ script, except for '--save-temps-dir' and followed directory
name argument.
3. Environment to be needed
・perl
- * If perl is not vailable, bash script processes text-filtering
+ * If perl is not vailable, bash script processes text-filtering
all by itself, but processing speed became more slowly.
4. Install & setup
gast-0.1.0/README.ja_JP.UTF-8
[ setup ]
- Change a working directory to an extracted directory, and execte
+ Change a working directory to an extracted directory, and execte
each scripts with no argument.
Symbolic link file are created at same directory.
- gast, gast_make, gast_rpmbuild must be in same directory.
Don't move these scripts in several directories separately.
- - gast, gast_make, gast_rpmbuild must not be in same directory as
+ - gast, gast_make, gast_rpmbuild must not be in same directory as
real commands/utilities. (gcc,cc,make,gmake,rpmbuild,...)
I recommended using these tools as in extracted directory.
- Of course, build process spends more time. perhaps spends 1.2 to 3
times as long as usually.
-
+
5. How to use
=======================================================================
+------------------------------------------------------------------
Option arguments for real rpmbuild are all available .
- additiona option '--save-temps-dir' are available to specifiy
+ additiona option '--save-temps-dir' are available to specifiy
preserving temporary files. (in above example, /home/foo/tmp)
If you need, you define GAST_CONTENT_WITHOUT_H, GAST_CONTENT_UNIQUE
|$ export GAST_CONTENT_UNIQUE=
+------------------------------------------------------------------
see "6. Environment variables to control 'gast'".
-
=======================================================================
Seen B) to build a configure/make/make install/ style product.
see "6. Environment variables to control 'gast'".
[ NOTICE ]
- I recommend that changing PATH environment variable must be
- temporary. So in above example, setting PATH environment variable
+ I recommend that changing PATH environment variable must be
+ temporary. So in above example, setting PATH environment variable
is specified at the top of build command line.
If you finished, delete environment variables.
6. Environment variables to control 'gast'
- If you want to get temporary (=preprocessed) file using 'gast', you
- must specify some environment variables to control 'gast' before
+ If you want to get temporary (=preprocessed) file using 'gast', you
+ must specify some environment variables to control 'gast' before
compileing/building your target source/product.
GAST_ENABLE
- When this environment variable is defined (however excludes its
+ When this environment variable is defined (however excludes its
value is "no"), gast works to generate compiler's temporary file
(.i file) automatically, and preserve it.
When this environment variable is not defined, gast behaves
[ CAUTION!! ]
I strongly recommend to define GAST_SAVE_DIR environment variable.
- If you don't define GAST_SAVE_DIR environment variable, temporary
- files (.i file) are created in current/working directory, but
+ If you don't define GAST_SAVE_DIR environment variable, temporary
+ files (.i file) are created in current/working directory, but
filename of these temporary files are changed as below:
Example) test.i ---> test.0.i
- Why do I change filename? Because there is a case that the C source
+ Why do I change filename? Because there is a case that the C source
file is compiled any number of times with different compile options.
When temporary files are created in 'current/working' directory and
compiled any number of times, older temporary files are overwritten,
- so I assume that case and prevent to be overwritten , I rename
+ so I assume that case and prevent to be overwritten , I rename
original temporary filename with adding '.0'.
GAST_SOURCE_DIR=<DIR>
- When this environment variable is defined and its value can be
- recognized a directory name, gast tries to obtain a relative
- path-name from a source file path-name by removing a directory
- name which this environment means. And that relative path-name
- applies under the GAST_SAVE_DIR directory to moved a temporary
+ When this environment variable is defined and its value can be
+ recognized a directory name, gast tries to obtain a relative
+ path-name from a source file path-name by removing a directory
+ name which this environment means. And that relative path-name
+ applies under the GAST_SAVE_DIR directory to moved a temporary
file (.i file).
When this environment variable is not defined or the value does
- not match a header of source file path-name, gast obtain a
- relative path-name by removing "/" from a top of source file
+ not match a header of source file path-name, gast obtain a
+ relative path-name by removing "/" from a top of source file
path-name.
[ NOTICE ]
GAST_SOURCE_DIR automatically with a value of RPM_BUILD_DIR.
GAST_CONTENT_WITHOUT_H
- When this environment variable is defined (however excludes its
+ When this environment variable is defined (however excludes its
value is "no"), created temporary file (.i file) is modified.
Most of all the contents form header files are removed.
When this environment variable is defined (however excludes its
value is "no"), If compile options are different but content of
- current temporary file is same as one of the preserved files,
+ current temporary file is same as one of the preserved files,
gast does not preserve current temporary file.
7. Use case
- 1) Assistance for researching source code (to understand macro
+ 1) Assistance for researching source code (to understand macro
expanding).
- 2) To gather error messages not from C source file but from temporary
+ 2) To gather error messages not from C source file but from temporary
files.
3) ...