Example Makefile for a program: Difference between revisions

From VrlWiki
Jump to navigation Jump to search
Jadrian Miles (talk | contribs)
m moved Program to Example Makefile for a program: Terrible page name. wtf?
Jadrian Miles (talk | contribs)
No edit summary
 
Line 1: Line 1:
== Example of a Makefile for a simple program ==
<pre>
<pre>
# G_COMPILER settings are optional, but can be used to designate a preferred compiler.
# G_COMPILER settings are optional, but can be used to designate a preferred compiler.

Latest revision as of 23:14, 17 January 2013

# G_COMPILER settings are optional, but can be used to designate a preferred compiler.
# If they are set here you won't need to set them outside the Makefile.
#
ifeq ($(GARCH),linux)
    G_COMPILER ?= gcc4
endif
ifeq ($(GARCH),WIN32)
    G_COMPILER ?= cl9
endif


# The project name is used to create directory names.  For consistency
# make this the same name as the top level directory for the project.
#
PROJECT = marklar


# For a project with subdirectories the PROJECT_HOME variable is the path
# of the top level directory in the project.  In a simple project there
# is only the top level directory and this setting is not needed.
#
PROJECT_HOME = $(realpath ./)


# This is the name of the generated executable file.
# There can be more than one program listed per directory.
#
PROGRAM = myProgram


# For each program with C++ sources set a variable using the program name.
# By convention the source file containing the "main" entry point has the
# same name as the program.
#
CXXmyProgram = myProgram.cpp   mySubroutine.cpp


# For each program with C sources set a variable using the program name.
#
CmyProgram = myUtility.c


# The libraries g3d, vrg3d, and cg have preset declarations to make them
# easy to set up.
#
G_USE = vrg3d


# If you want to link with libraries built using the G Build make files
# use the LDLIB_VER variable.  This ensures you will link against the
# version that was built with the same compiler as your program.
#
LDLIB_VER = is3d  mri   nr


# If you want to add some targets other than the defaults
# use raw make commands.  Note that if you want to make a program
# installable you need to declare and install target as shown.
#
all:  directory

allclean:  clean

install:  installprog


# This brings in the G Build make files and is required.
#
include  $(G)/common/build/make/directory.make