next up previous contents
Next: Compilation when using cmake Up: Compilation Previous: Compilation   Contents

Compilation when using Makefiles

When using Makefiles, the easiest way to compile a program using DIET with all necessary flags and link it with the proper libraries is to trust the Makefile.inc available in include_dir/include by including it at the beginning of the program makefile.

The Makefile.inc defines the variables:

The doc/ExternalExample directory contains an example of such a user Makefile, which goes:
# The following inclusion provides convenient make variables for compiling
# and linking against the DIET library (DIET_HOME is an environment variable
# containing the path to a DIET installation directory):
include ${DIET_HOME}/include/Makefile.inc

all: simple_client simple_server

simple_client: simple_client.c $(DIET_CLIENT_PREREQ)
        $(CXX) -g $(CXXFLAGS_DIET) $< $(DIET_CLIENT_LIBS) -o $@
simple_server: simple_server.c  $(DIET_SERVER_PREREQ)
        $(CC) -g $(CCFLAGS_DIET) $< $(DIET_SERVER_LIBS) -o $@
clean:
        rm -f simple_client simple_server

Since the doc/ExternalExample directory also contains the cited simple_server.c and simple_client.c, one can easily test this Makefile.


next up previous contents
Next: Compilation when using cmake Up: Compilation Previous: Compilation   Contents
DIET Team - 2008-07-17