Ide/Make Facility

From wiki.visual-prolog.com

Jump to: navigation, search
IDE

The Make facility builds the project by generating the resources, constant files, updating the source code sections for the code experts, compiling and linking all the modules. The Make facility checks the file time stamps to see which files need to be compiled or recompiled. A file needs to be recompiled if the .OBJ file is older than either the source file or any of its include files or does not exist.

The Make facility gets the required information, from the project file (ProjectName.prj6 ). This includes the set of source files and the Build scripts. Build scripts consist from the following parts:

  1. The main Build script - describes how to build the final target.
  2. Rules - determine how to compile files with given extensions.
  3. Symbols – symbolic names that can be used in the build script and in built rules.

The Project Settings generates the default Build scripts that can be modified and extended by the programmer.

The settings for the Make facility should be specified in the Project Settings (Project | Settings), the finally generated Build scripts can be viewed in the Script Preview dialog (Build | Script Preview).

Contents

Build Symbols

The Build scripts can refer to Symbols. The syntax used in the scripts to refer to a defined symbol is: $(Symbol). These symbols can be either:

  • Symbols defined and automatically handled by the IDE, for example, PROJECT_OBJ, PROJECT_LIB, *, **, etc. (which are handled automatically and cannot be directly modified by the programmer).
  • Symbols initially defined by the IDE (generated by theProject Settings, but which then can be modified by the programmer, for example, IncDir, ExeDir, ObjDir. The programmer can activate the Project Settings and then edit/set these symbols from the Directories tab (use command Project | Settings).

The search for the value of a given symbol will be in the reverse of the above order in such a way that if the user specifies a symbol directly (symbols displayed in the Project Settings Directories tab dialog), the system will just use that. Otherwise, the Make facility checks whether the IDE has such a pre-defined symbol. If this also fails, a warning will be given.

Remark: A symbol identifies as a macro, and is - with respect to syntax and semantics - roughly equivalent to that found in a standard make utility, such as Microsoft’s nmake and Borland's make.

The make script symbols defined by the IDE are:

Symbol Name Handled Explanation
PROJECT_OBJ Automatically The list of object files (with .OBJ extension) both generated from the source files of the project modules and explicitly registered as project modules
PROJECT_LIB Automatically The list of .LIB files explicitly registered as project modules
PROJECT_RES Automatically The .RES files, which are explicitly registered in the project window. (You can manually add this symbol to the Build script.)
PROJECT_DEF Automatically The .DEF files, which are explicitly registered in the project window. (You can manually add this symbol to the Build script.)
ObjDir Can be edit by the user Location of the Intermediate directory (as it is set from the Project Settings Directories dialog tab)
ExeDir Can be set by the user Location of the Final directory (as it is set from the Project Settings Directories dialog tab)
ProDir Automatically Location of Visual Prolog's root directory Prolog Root (as it is set from the Project Settings Directories dialog tab)
LibDir Can be set by the user Location of the Import Library directory where should be generated import library (as it is set from the Project Settings Directories dialog tab). This script symbol is enabled only when the Target Type (in the Project Settings General tab) of the project is set to DLL
IncDir Can be set by the user The project Include Directories list (as it is set from the Project Settings Directories dialog tab). Only in these directories the compiler will search for files specified in include directives
MSLinker Can be set by the user The optional Microsoft C Linker (as it is set for the MS Linker in the Miscellaneous tab of the Environment Options dialog). This symbol is pre-defined by the IDE if MS Linker is selected as the Linker Name in the Project Settings.
* Automatically The name of the current target file for the executed command (extension removed). For example, this can be the name of the project target file in the linker command or names of OBJ files that should be generated by the compiler
** Automatically The same as '*', but with the path relative to the root directory of the loaded project. Since the path to the file is obtained by the standard PFC predicate fileName::reduce/2; therefore, in some cases this can be an absolute path
'+' Automatically Instead of every '+' sign (plus surrounded by single quotation marks) the IDE substitutes +<CR><LF> combination (plus followed by Carriage Return and Linefeed characters) into the final build script (command line). If '+' is used together with a reference to a symbol $'+'(Symbol) then the IDE will add +<CR><LF> combination after every name substituted from the Symbol

Make Rules

The Make Rules provide some default rules for how to compile files. The syntax for Make Rules is:

InputExtension -> OutputExtension : CommandLine

Each line is the command CommandLine needed to convert a file with one extension InputExtension to a file with the other extension OutputExtension.

pro->obj:"$(ProDir)Bin\VipCompiler.exe" /L:R /L:I $(IncDir) "$**.pro" /OBJECTFILE:"$(ObjDir)$*.obj"
pack->obj:"$(ProDir)Bin\VipCompiler.exe" /L:R /L:I $(IncDir) "$**.pack" /OBJECTFILE:"$(ObjDir)$*.obj"

As an example, you can see that to compile of a .PRO file to an .OBJ file, the following command must be executed:

"$(ProDir)Bin\VipCompiler.exe" /L:R /L:I $(IncDir) "$**.pro" /OBJECTFILE:"$(ObjDir)$*.obj"

Where $* will be replaced by the name of the actual file and $** by the name of the actual file qualified with the path relative to the project root directory. See also the command line compiler options.

A special note to those familiar with other make utilities: The rules specified here are roughly equivalent to what is known as implicit rules. In difference to the IDE in Visual Prolog v. 5, it is not possible to specify explicit rules (local rules) in the current version of the IDE.

It is possible to specify rules that execute batch files.

You can view/edit defined in the project Make Rules in the Project Settings Build Options.

Build Script

The Build Script is the main command describing how to build the project target file.

"$(ProDir)Bin\VIP6Link.exe" -F<< -E_VIPStartUp@0 -d -TPE -SGUI -o"$(ExeDir)$*.exe"
  -M"$(ObjDir)$*.map" $(PROJECT_OBJ) "$(ObjDir)$*.res" $(PROJECT_LIB)<<

The <<TEXT<< syntax means: put the TEXT into a temporary file, and substitute the text with the name of the temporary file.

You can view/edit the defined in the project Build Script in the Project Settings Build Options tab.

See also the command line linker options.

Build Commands

Compile

This command attempts to compile the module (compilation unit) containing the selected file. Notice that IDE cannot compile a file that is not a part of the opened project; instead of this file IDE will compile the module selected in the project window.

Build

This command builds a currently chosen platform of a project.

If any resources have been modified since last build, the code experts might update some sections in the source files before the build.

This command will build the project by checking the time stamps of all the source files in the project, so if any source files (or files they include) are more new than the dependent .OBJ files, then the corresponding project modules will be recompiled.

The Build will also build resource files.

The project is then linked to produce the target module (executable program or DLL).

Build All Platforms

This command applies Build command for all platforms which are defined for a project.

Rebuild All

This command operates the same as the Build | Build, except that all files will be regenerated or recompiled and linked irrespectively of file time stamps.

Rebuild All Platforms

This command applies Rebuild All command for all platforms which are defined for a project.

Stop Building

This command is used to stop the compilation/linking.

Execute

If necessary, this command will first do the Build | Build, and then the generated executable will be started.

Run in Window

The Run in Window command is enabled for console applications only. It attempts to execute the target module of the current project in the specially created text mode window. If necessary, this command will first do the Build | Build (to generate an executable), then creates and displays the text mode window. In this window the pause DOS command is executed and the programmer is asked "Press any key to continue ...". After the programmer press any key, the generated executable will be started.

32bit Platform

Sets 32bit platform (if any) of a project as current for building, executing, etc.

64bit Platform

Sets 64bit platform (if any) of a project as current for building, executing, etc.

Personal tools