Windows GTK Makefile


Summary
This topic provides a template Windows GTK Makefile for developers to use as a starting point.

# Example Makefile for ArcEngine C++ Programming with GTK on Windows
#
# The PROGRAM macro defines the name of the program or project.  It
# allows the program name to be changed by editing in only one
# location
#
PROGRAM = GTK_sample
#
# The GTKDIR macro defines the location of the GTK installation.
#
GTKDIR = C:\GTK
#
# The INCLUDEDIRS macro contains a list of include directories
# to pass to the compiler so it can find necessary header files.
#
# The LIBDIRS macro contains a list of library directories
# to pass to the linker so it can find necessary libraries.
#
# The LIBS macro contains a list of libraries that the the
# executable must be linked against.
#
INCLUDEDIRS = \
 /I "C:\Program Files\ArcGIS\DeveloperKit10.0\include\CPPAPI" \
 /I "C:\Program Files\ArcGIS\Engine10.0\com" \
 /I $(GTKDIR)\include\gtk-2.0 \
 /I $(GTKDIR)\include\glib-2.0 \
 /I $(GTKDIR)\include\pango-1.0 \
 /I $(GTKDIR)\include\atk-1.0 \
 /I $(GTKDIR)\lib\glib-2.0\include \
 /I $(GTKDIR)\lib\gtk-2.0\include
LIBDIRS = \
 /LIBPATH:"C:\Program Files\ArcGIS\DeveloperKit10.0\lib" \
 /LIBPATH:$(GTKDIR)\lib
LIBS = \
 gtkctl.lib aoctl.lib \
 gtk-win32-2.0.lib gobject-2.0.lib glib-2.0.lib
#
# The CPPSOURCES macro contains a list of source files.
#
# The CPPOBJECTS macro converts the CPPSOURCES macro into a list
# of object files.
#
# The CPPFLAGS macro contains a list of options to be passed to
# the compiler.  Adding "-g" to this line will cause the compiler
# to add debugging information to the executable.
#
# The CPP macro defines the C++ compiler.
#
# The LINKFLAGS macro contains all of the library and library
# directory information to be passed to the linker.
#
CPPSOURCES = gtk_sample.cpp
CPPOBJECTS = $(CPPSOURCES:.cpp=.obj)
CPPOPT = /EHsc /D_CRT_SECURE_NO_DEPRECATE
CPPFLAGS = -DESRI_UNIX $(INCLUDEDIRS) $(CPPOPT)
CPP = cl.exe
LINKFLAGS = $(LIBDIRS) $(LIBS)
#
# Default target: the first target is the default target.
# Just type "nmake -f Makefile.WindowsGTK" to build it.
#
all: $(PROGRAM)
#
# Link target: automatically builds its object dependencies before
# executing its link command.
#
$(PROGRAM): $(CPPOBJECTS)
 link.exe /out:$(PROGRAM) $(CPPOBJECTS) $(LINKFLAGS)
#
# Object targets: rules that define objects, their dependencies, and
# a list of commands for compilation.
#
gtk_sample.obj: gtk_sample.cpp gtk_sample.h
 $(CPP) $(CPPFLAGS) /c gtk_sample.cpp
#
# Clean target: "nmake -f Makefile.WindowsGTK clean" to remove unwanted objects and executables.
#
clean:
 del -f $(CPPOBJECTS) $(PROGRAM)
#
# Run target: "nmake -f Makefile.WindowsGTK run" to execute the application
#
run:
 $(PROGRAM)