# Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net) # # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ---------------------------------------------------------------------- | | | This README referes to Unix type systems which use make for building | | SAGA. Windows user (i.e. non-cygwin Windows user) can use the MS | | Developers Studio build environment. | | | ---------------------------------------------------------------------- saga-a uses a gnu-make based build system. It includes a number of makefiles throughout the source tree, and in the $SAGA_ROOT/make/ directory. All these make includes get installed into $SAGA_LOCATION/share/saga/make/. If SAGA_ROOT is set in a Makefile, the make includes from the referred saga source tree are used. If it is not set, the make includes are used from the installation tree in SAGA_LCOATION, which defaults to /usr/local. The following Makefile stub should provide a good starting point for building SAGA applications. The example uses the saga-a engine, and the file API package. ---------------------------------------------------------------------- | | | # tell make that we want to use the SAGA make system | | SAGA_MAKE = 1 | | | | SAGA_SRC = $(wildcard *.cpp) | | SAGA_BIN = $(SRC:%.cpp=%) | | | | include $(SAGA_LOCATION)/make/saga.engine.mk | | include $(SAGA_LOCATION)/make/saga.package.file.mk | | | ---------------------------------------------------------------------- This stub loads the make rules etc. needed to build the application. If the application needs additional include directories or libraries, use the following syntax _after_ the make includes: ---------------------------------------------------------------------- | | | SAGA_CXXFLAGS += -I/opt/super/include | | SAGA_LDFLAGS += -L/opt/super/lib -lsuper | | | ---------------------------------------------------------------------- Of course it is possible to build SAGA applications with custom Makefiles. The includes can, however, be used to obtain the saga-a specific compiler and linker flags: ---------------------------------------------------------------------- | | | # Do NOT set SAGA_MAKE in your Makefile! | | | | SRC = $(wildcard *.cpp) | | OBJ = $(SRC:%.cpp=%.o) | | BIN = $(SRC:%.cpp=%) | | | | CXX = gcc | | CXXFLAGS = -c -O3 -pthreads -I/opt/mpi/include | | | | LD = $(CXX) | | LDFLAGS = -L/opt/mpi/lib/ -lmpi | | | | include $(SAGA_LOCATION)/make/saga.engine.mk | | include $(SAGA_LOCATION)/make/saga.package.file.mk | | | | | | .default: $(BIN) | | | | $(BIN): % : %.cpp | | | | $(OBJ): %.o : %.cpp | | $(CXX) $(CXXFLAGS) $(SAGA_CXXFLAGS) -o $@ $< | | | | $(BIN): % : %.o | | $(LD) $(LDFLAGS) $(SAGA_LDFLAGS) -o $@ $< | | | ---------------------------------------------------------------------- SAGA_CXXFLAGS and SAGA_LDFLAGS contain only those options and settings which are absolutely required to use saga-a. You may want to use 'make -n' to print what the resulting make commands are, in order to debug eventual incompatibilities between SAGA compiler and linker flags, and your own ones.