Creating a server project and configuring Make support for it
For example, we assume that:
you have a directory called
grid_server
containing a file called
grid.idl
.
template.Makefile
file from your
SNIFF_DIR/config
directory to
your
grid_server
directory and rename it
Makefile.server.
This is your server Makefile.
You will now create a project for the server.
Start SNiFF+.
In the Launch Pad, select Project > New Project... > with Defaults...
In the Directory dialog that appears, navigate to the
grid_server
directory.
Press Open and then Select.
The Attributes of New Project dialog appears.
In the Attributes of a New Project dialog
Select the General > Advanced node.
In the Advanced view > Generated Files Directory field, enter
.sniffdir_server
.
Select the Build Options node.
In the Build Options view, enter a Make command in the Make Command field, so that
Make uses the project Makefile
Makefile.server
instead of the default Makefile.
Example:
make -f Makefile.server
Select the Build Options > Project Targets node.
In the Executable field, enter the executable target name (e.g.,
grid_server
)
In the +Libraries Linked field (below the Executable field), enter
$(IDL_SERVER_LIB).
Select the File Types node.
In the File Types view, select the Make file type (by single-clicking it) and delete the entry
in the General tab > Signatures field. Then enter
Makefile.server
in this field.
Press the Show All button to see all the file types.
For each of the following file types, select the file type (in the order given) and then press
the Add File Type button:
- IDL Interface
- IDL Header
- IDL Server Implementation
- IDL Server Object
Now, files of this file type will be added to the grid_server project during project creation.
Press OK to create the project.
In the dialog that appears asking if you want to generate cross reference information,
press No.
Add server source files to the project by copying these files to the
grid_server
directory
and then choosing Project > Add/Remove Files to/from grid_server.shared... in
the Project Editor. Remove client source files from the project and make sure that only
server files are part of the project.
You are now ready to edit and then run the Makefile for your server project.
Edit
Makefile.server
.
The following example shows part of your Makefile. The IDL-specific commands are
highlighted in boldface. Make sure that these commands are in your Makefile. If they are
not, please add them:
# Project makefile
# Location of make support files
SNIFF_MAKEDIR = .sniffdir_server
# Include the generated make support files
include $(SNIFF_MAKEDIR)/macros.incl
# The following macros are defined in the Make view of the
project attributes
# Include directive(s)
$(SNIFF_INCLUDE) += -I$(IDL_INCDIR)
# Executable target
LINK_TARGET = $(SNIFF_LINK_TARGET)
# Relinkable object target
RELINK_TARGET = $(SNIFF_RELINK_TARGET)
# Library target
LIB_TARGET = $(SNIFF_LIB_TARGET)
# Libraries received from subprojects.
# Linked to executable and relinkable object target.
SUB_LIBS = $(SNIFF_SUB_LIBS)
# Relinkable objects received from subprojects.
# Linked to executable, relinkable object and library
target.
SUB_RELINK_OFILES = $(SNIFF_SUB_RELINK_OFILES)
# Other libraries linked to executable target
OTHER_LIBS = $(SNIFF_OTHER_LIBS)
# Other libraries linked to relinkable object target
RELINK_OTHER_LIBS = $(SNIFF_RELINK_OTHER_LIBS)
# Recursive make directories
SUBDIRS = $(SNIFF_SUBDIRS)
# you can define the following additional flags here
#
#OTHER_OFILES = <other object files>
#OTHER_CFLAGS = <other C compiler flags>
#OTHER_CXXFLAGS = <other C++ compiler flags>
#OTHER_YACCFLAGS = <other yacc compiler flags>
#OTHER_LEXFLAGS = <other lex flags>
# IDL-specific macros
OTHER_IDLFLAGS = -B
#OTHER_FFLAGS = <other fortran compiler flags>
OTHER_LDFLAGS = -L$(IDL_LIBDIR)
# PRE_TARGETS is currently used only for IDL make support.
# The PRE_TARGETS macro is needed, since it is not possible
to
# create a simple implicit rule to compile the IDL files
PRE_TARGETS = $(SNIFF_PRE_TARGETS)
# IDL-specific macro
# "S" stands for server and "C" for client
IDL_CFILE_TYPE_SPEC = S
# Common makefile definitions
include $(SNIFF_DIR)/make_support/general.mk
# Include the generated dependencies file
include $(SNIFF_MAKEDIR)/dependencies.incl
In the Project Editor
In the Project Tree, double-click on
grid_server.proj
.
The Project Attributes dialog appears.
In the Project Attributes dialog, select the Build Options > Directives node.
In the Directives view, press the Generate... button to the right of the Include Directive(s)
field.
The include directives for this project are now generated and appear in the Include
Directive(s) field.
In the Project Editor, choose Target > Update Makefiles... to update the generated Make
support files.
Press Yes in the dialog that appears.
Choose Target > Make... > grid_server to build the project's target.
gridS.cc
and
grid.hh
will be created by the IDL compiler and then
gridS.o
will
be created by the C++ compiler.
Make sure that
grid_server.proj
is selected in the Project Tree and choose
Project > Reload Project... > In Current Working Environment.
You should now see the
gridS.cc
and
grid.hh
files in the Project Editor's File List.
You have just completed configuring Make support for the server project. You will now have to create the client project and configure Make support for it.