|
From: <kin...@us...> - 2025-08-30 15:08:55
|
Revision: 7341
http://sourceforge.net/p/teem/code/7341
Author: kindlmann
Date: 2025-08-30 15:08:40 +0000 (Sat, 30 Aug 2025)
Log Message:
-----------
tweaking explanatory comments
Modified Paths:
--------------
teem/trunk/src/GNUmakefile
teem/trunk/src/make/externals.mk
Modified: teem/trunk/src/GNUmakefile
===================================================================
--- teem/trunk/src/GNUmakefile 2025-08-30 02:17:24 UTC (rev 7340)
+++ teem/trunk/src/GNUmakefile 2025-08-30 15:08:40 UTC (rev 7341)
@@ -17,54 +17,55 @@
# along with this library; if not, see <https://www.gnu.org/licenses/>.
#
-####
-#### top-level GNUmakefile: Master makefile for teem
-####
-#### NOTE: You should probably be using CMake instead of this GNU Makefile! CMake builds
-#### Teem by creating one monolithic library (libteem) and the executables (e.g. unu)
-#### that link with that, which is very likely what you want.
-####
-#### This GNUmakefile logic was first written by GLK in ~2001, before CMake was useful or
-#### popular. It builds Teem one library at a time (not a single monolithic library like
-#### from CMake), and handles the per-library "test" programs (distinct from the nascent
-#### efforts at using CTest). Because this remains useful for debugging and developing
-#### Teem, it persists, and GLK relies on it.
-####
-#### For TeemV2, all the GNUMakefile machinery was simplified to remove any notion of
-#### "architecture" and the environment variable "TEEM_ARCH" that declared it. It was
-#### never exactly the CPU architecture, but rather some mix of the architecture and the
-#### OS around it. And, it only made sense for settings where one (network) file system
-#### was being used on a variety of different machines. This was the case in where Teem
-#### was first developed at University of Utah (Scientific Computing and Imaging group):
-#### SGI, Linux (32-bit x86, ia64 and amd64), and Solaris hosts all talked on the same
-#### filesystem. Development builds needed to put binaries in different places depending
-#### on platform, and this was determined by environment variable TEEM_ARCH, which in
-#### turn chose an architecture-specific subdirectory of teem/src/arch to put things
-#### in. Even if these kinds of heterogeneous environments still exist, Teem development
-#### no longer happens there. Also in the interests of simplicity: everything about
-#### shared libraries was dropped. The only shared library that matters is libteem.so or
-#### libteem.dylib, and making that is better handled by CMake than by anything here.
-####
-#### This simplification meant removing:
-#### (from everywhere)
-#### env var TEEM_ARCH
-#### env var TEEM_DEST (because now any "install" should be done via CMake)
-#### make vars ARCH, SUBARCH
-#### everything about shared libraries: TEEM_LINK_SHARED, SHEXT
-####
-#### file errorCheck.mk gone (so simple, nothing left to error check)
-#### make var KNOWN_ARCH
-#### make funcs checkArchSet, checkArchValid,
-#### checkArchLinux, checkArchLinux64, checkArchNetbsd64, checkArchDarwin
-####
-#### With this simplification, these files in make/ stopped being used:
-#### aix.mk cygwin.mk darwin.mk irix6.mk linux.mk netbsd.mk solaris.mk win32.mk
-#### and are thus removed. Instead, a new single make/arch.mk contains the
-#### information that used to be there, or at least variables from which to hang
-#### this info.
-#### Analogously, the results of building are no longer put into a per-architecture
-#### subdirectory of teem/arch. teem/arch is gone. Instead the results of building are
-#### put into teem/built, with its include/, lib/ and bin/ subdirectories.
+##
+## top-level GNUmakefile: Master makefile for teem
+##
+## NOTE: You should probably be using CMake instead of this GNU Makefile! CMake builds
+## Teem by creating one monolithic library (libteem) and the executables (e.g. unu)
+## that link with that, which is very likely what you want.
+##
+## This GNUmakefile logic was first written by GLK in ~2001, before CMake was useful or
+## popular. It builds Teem one library at a time (first air, then biff, hest, nrrd, etc),
+## and handles the per-library "test" programs (distinct from the nascent efforts at
+## using CTest). Because this remains useful for debugging and developing Teem, it
+## persists, and GLK relies on it.
+##
+## For TeemV2, all the GNUMakefile machinery was re-written and simplified. The main
+## change was to remove any notion of "architecture" and the environment variable
+## "TEEM_ARCH" that declared it. It was never exactly the CPU architecture, but rather
+## some mix of the architecture and the OS around it. And, it only made sense for
+## settings where one (network) file system was being used on a variety of different
+## machines. This was the case in where Teem was first developed at University of Utah
+## (Scientific Computing and Imaging group): SGI, Linux (32-bit x86, ia64 and amd64), and
+## Solaris hosts all talked on the same filesystem. Development builds needed to put
+## binaries in different places depending on platform, and this was determined by
+## environment variable TEEM_ARCH, which in turn chose an architecture-specific
+## subdirectory of teem/src/arch to put things in. Even if these kinds of heterogeneous
+## environments still exist, Teem development no longer happens there. Also in the
+## interests of simplicity: everything about shared libraries was dropped. The only
+## shared library that matters is libteem.so or libteem.dylib, and making that is better
+## handled by CMake than by anything here.
+##
+## This simplification meant removing:
+## (from everywhere)
+## env var TEEM_ARCH
+## env var TEEM_DEST (because now any "install" should be done via CMake)
+## make vars ARCH, SUBARCH
+## everything about shared libraries: TEEM_LINK_SHARED, SHEXT
+##
+## file errorCheck.mk gone (so simple, nothing left to error check)
+## make var KNOWN_ARCH
+## make funcs checkArchSet, checkArchValid,
+## checkArchLinux, checkArchLinux64, checkArchNetbsd64, checkArchDarwin
+##
+## With this simplification, these files in make/ stopped being used:
+## aix.mk cygwin.mk darwin.mk irix6.mk linux.mk netbsd.mk solaris.mk win32.mk
+## and are thus removed. Instead, a new single make/arch.mk contains the information
+## that used to be there, or offers variables from which to hang that info.
+## Analogously, the results of building are no longer put into one of the pointlessly
+## numerous per-architecture subdirectories of teem/arch. teem/arch is gone. Instead the
+## results of building are put into teem/built, with its include/, lib/ and bin/
+## subdirectories.
ifndef Top.Included
Top.Included := yes
@@ -96,7 +97,7 @@
## Now that CMake-based compilation is the default, the (GNUmake) non-CMake building has
## accomodate: this extra -DTEEM_NON_CMAKE flag says to $(CC) "we're not building with
-## cmake" (so e.g. don't look for teem/airExistsConf.h)
+## cmake" (so e.g. don't look for the teem/airExistsConf.h created by CMake configure)
CFLAGS += -DTEEM_NON_CMAKE
## information about optional external libraries to link with
@@ -245,26 +246,27 @@
## Read make/externals.mk for context and full list AllExterns
##
## These two reflect the circumstances of running make, not any library:
-## wantsExtern(X): returns X if TEEM_<X> has been set (as a shell variable,
-## but not set to "0"), otherwise nothing
+## wantsExtern(X): returns X if TEEM_<X> has been set (as an environment variable, but
+## not set to "0"), otherwise returns empty string
## Externs: list of all wanted externs (a subset of AllExterns)
-## forExtern(libs,patt): for all external X in Externs,
-## and for all L in libraries $(libs) that benefit from external X,
-## replace "XXX" in $(patt) with X
-## Externs.dashD: the compile-time -D flags needed to enable external
-## library X when compiling objects in libraries $(libs)
+##
+## Functions used for communicating to the compiler/linker about the externals:
+## forExtern(libs,patt): for all external X in Externs, and for all L in libraries
+## $(libs) that benefit from external X, replace "XXX" in $(patt) with X
+## Externs.dashD: the compile-time -D flags needed to enable external library X when
+## compiling objects in libraries $(libs)
## evallist(list): utility to evaluate each element of list as a variable
## (in the following, $(libs) which should probably be MeNeed(L) for some lib L)
-## Externs.dashI(libs): the external-specific -I flags needed for compiling
-## objects in libraries $(libs)
+## Externs.dashI(libs): the external-specific -I flags needed for
+## compiling objects in libraries $(libs)
## (using the X.dashI set in make/externals.mk for external X)
-## Externs.dashL(libs): the external-specific -L flags needed for compiling
-## executables that uses libraries $(libs)
+## Externs.dashL(libs): the external-specific -L flags needed for
+## compiling executables that use libraries $(libs)
## (using the X.dashL set in make/externals.mk for external X)
## Externs.llink(libs): the external-specific -l flags needed to link an
## executable that uses libraries $(libs)
## (using the X.llink set in make/externals.mk for external X)
-##
+
# if TEEM_X is undefined, then nothing, else if 0 matches TEEM_X then nothing, else X
wantsExtern = $(if $(findstring undefined,$(origin TEEM_$(1))),\
,\
@@ -309,8 +311,8 @@
## was just read.
##
## Unfortunate trickiness: Lsave preserves the value of L, in case we're being included
-## from a lower-level GNUmakefile which set a value for L. If we didn't put L back the
-## way it was, L would have to be set twice in the lower level.
+## from a lower-level GNUmakefile which already set a value for L. If we didn't put L
+## back the way it was, L would have to be set twice in the lower level.
##
ifdef L
ifndef Lsave
Modified: teem/trunk/src/make/externals.mk
===================================================================
--- teem/trunk/src/make/externals.mk 2025-08-30 02:17:24 UTC (rev 7340)
+++ teem/trunk/src/make/externals.mk 2025-08-30 15:08:40 UTC (rev 7341)
@@ -17,43 +17,66 @@
# along with this library; if not, see <https://www.gnu.org/licenses/>.
#
-AllExterns := PNG ZLIB BZIP2 PTHREAD LEVMAR FFTW3
+AllExterns := PNG ZLIB BZIP2 LEVMAR FFTW3 PTHREAD
-## In Teem, an "external" is a non-Teem library (external) libraries that Teem can
-## _optionally_ link against. Teem has no notion of depending on these in the makefile
-## sense. Teem doesn't try to represent inter-external dependencies (e.g. PNG on ZLIB)
-## explicitly, but the ordering of the externals in AllExterns above HAS TO reflect the
-## ordering on the link line (so PNG preceeds ZLIB)
+## In Teem, an "external" is a non-Teem library that Teem can _optionally_ link with to
+## increase its functionality. They are listed in AllExterns above. Teem doesn't
+## represent inter-external dependencies explicitly, but the ordering in AllExterns above
+## MUST match the ordering on the compile link line: PNG precedes ZLIB because libpng
+## depends on zlib. In the following "EXT" stands for one of the external names above.
##
-## There is no configure-time setting of what externals to use (as in CMake). External
-## EXT is enabled during *make* by setting the shell variable TEEM_EXT (just set it, to
-## anything EXCEPT "0"), either by:
+## In the bigger world externals are often called "dependencies", but we don't use that
+## word here in the realm of makefiles, because Teem doesn't "depend" on the externals in
+## the sense of a target depending on pre-requisites in a make rule. Also in the bigger
+## world, the externals are things that are chosen and resolved prior to running make, at
+## configure time. Teem's GNUmakefiles have no notion of configuration or configure-time.
+##
+## Instead, Teem externals are selected and "configured" through the environment (in the
+## unix sense) during compile-time. External EXT is enabled during "make" by setting the
+## environment variable TEEM_EXT (just set it, to anything EXCEPT "0"), either by:
## export TEEM_EXT; ...; make
## or:
## TEEM_EXT= make
## or:
## TEEM_EXT=1 make
-## (but not: "TEEM_EXT=0 make", which leaves EXT disabled).
-## If external EXT is enabled during make, then *preprocessor symbol* TEEM_EXT will be
-## effectively #define'd as "1" during source file compilation.
+## or TEEM_EXT=yesplease or any non-empty string *except* "0": "TEEM_EXT=0" leaves EXT
+## disabled. If external EXT is enabled during make, then the *preprocessor symbol*
+## "TEEM_EXT" will be #define'd as "1" during source file compilation, and then Teem code
+## that can benefit from EXT, guarded by "#if TEEM_EXT", will be compiled in.
##
-## NOTE: make can only remember what was built when, not how it was built, so if you are
-## using externals, and your build process is split over multiple invocations of "make",
-## then the same externals have to be used each time (e.g. making "unu" will need to
-## -llib link again the external libraries, so that "make" has to know about the same
-## externals used by the compiled code in libnrrd.a
+## NOTE: "make" can only remember what was built when, not how it was built, so if you
+## are using externals, and your build process is split over multiple invocations of
+## "make", then the same externals have to be used each time. For example, making "unu"
+## will need to -llib link against both Teem libraries like nrrd and the external
+## libraries nrrd depends on, so "make"ing of unu has to know about the exact same
+## externals as were part of the earlier "make"ing of libnrrd.a (and this fussiness is
+## part of why configuration is a thing).
##
-## Here is one example how one might compile with PNG and ZLIB:
-## TEEM_PNG= \
-## TEEM_PNG_IPATH=/opt/homebrew/Cellar/libpng/1.6.50/include \
-## TEEM_PNG_LPATH=/opt/homebrew/Cellar/libpng/1.6.50/lib \
-## TEEM_ZLIB= \
-## TEEM_ZLIB_IPATH=/opt/homebrew/opt/zlib/include \
-## TEEM_ZLIB_LPATH=/opt/homebrew/opt/zlib/lib \
-## make
+## To ensure externals are set the same for every "make": FEEL FREE TO MODIFY THIS FILE
+## to change the variable settings below; they are read in every time make runs for Teem.
+## Or, source a little shell script that sets the TEEM_ environment variables for you.
+## Or, construct an elaborate alias that you use for Teem work, such as GLK's
+## alias tmake="TEEM_PTHREAD= \
+## TEEM_PNG= \
+## TEEM_PNG_IPATH=/opt/homebrew/Cellar/libpng/1.6.50/include \
+## TEEM_PNG_LPATH=/opt/homebrew/Cellar/libpng/1.6.50/lib \
+## TEEM_ZLIB= \
+## TEEM_ZLIB_IPATH=/opt/homebrew/opt/zlib/include \
+## TEEM_ZLIB_LPATH=/opt/homebrew/opt/zlib/lib \
+## TEEM_FFTW3= \
+## TEEM_FFTW3_IPATH=/opt/homebrew/Cellar/fftw/3.3.10_2/include \
+## TEEM_FFTW3_LPATH=/opt/homebrew/Cellar/fftw/3.3.10_2/lib \
+## TEEM_LEVMAR= \
+## TEEM_LEVMAR_IPATH=/Users/me/src/levmar-2.6 \
+## TEEM_LEVMAR_LPATH=/Users/me/src/levmar-2.6 \
+## TEEM_LEVMAR_LMORE=lapack\ blas \
+## make"
##
-## TeemV2 renamed moved the variables describing each external to here (since there are
-## no longer multiple architectures to simultaneously support). For each EXT:
+## How Teem uses externals has been in place since ~2001, but for TeemV2 all the
+## GNUmakefiles were re-written. TeemV2 moved the variables describing each external to
+## here (since there are no longer multiple architectures to simultaneously support).
+## For each external EXT:
+## TEEM_EXT: set (here or in your environment) to enable EXT
## TEEM_EXT_IPATH, TEEM_EXT_LPATH: You very likely have to set these!
## These variables have their same name from early Teem,
## BUT NOTE: Now their names are accurate!
@@ -61,15 +84,18 @@
## They are really just the path to where the header or library file is; it is the job
## of the functions Externs.dashD and Externs.dashI (defined in ../GNUmakefile and
## used in template.mk) to add the -I and -L to each path as needed
+## TEEM_EXT_LMORE: if the lib named in EXT.lname (below) is not the only library that
+## has to linked with to make a complete executable, than name here whatever more
+## libraries are needed for linking e.g:
+## TEEM_LEVMAR_LMORE ?= lapack blas
## EXT.lname: (NOT TO BE MESSED WITH) link with library lib with -llib
-## TEEM_EXT_LMORE: if the lib named in EXT.lname is not the only library that has to
-## linked with to make a complete executable, than name here whatever more libraries
-## are needed for linking e.g. TEEM_LEVMAR_LMORE ?= lapack blas
## lib.Externs: (NOT TO BE MESSED WITH) how we declare to the build system which Teem
## library lib needs to know about the extern for the sake of its compilation flags
## PNG: for PNG images, from https://www.libpng.org/pub/png/libpng.html
## Using PNG enables the "png" nrrd format.
+##
+# TEEM_PNG ?= # uncomment to enable
TEEM_PNG_IPATH ?=
TEEM_PNG_LPATH ?=
TEEM_PNG_LMORE ?=
@@ -79,6 +105,8 @@
## ZLIB: for the zlib library (in gzip and PNG image format) from https://zlib.net/
## Using zlib enables the "gzip" nrrd data encoding
+##
+TEEM_ZLIB ?= # uncomment to enable
TEEM_ZLIB_IPATH ?=
TEEM_ZLIB_LPATH ?=
TEEM_ZLIB_LMORE ?=
@@ -88,36 +116,46 @@
## BZIP2: for the bzip2 compression library, from https://sourceware.org/bzip2/
## Using bzip2 enables the "bzip2" nrrd data encoding.
+##
+# TEEM_BZIP2 ?= # uncomment to enable
TEEM_BZIP2_IPATH ?=
TEEM_BZIP2_LPATH ?=
TEEM_BZIP2_LMORE ?=
-## Header file is <bzlib.h>.
+# Header file is <bzlib.h>.
BZIP2.lname := bz2
nrrd.Externs += BZIP2
-## PTHREAD: use pthread-based multi-threading in airThreads. Note that Windows has its
-## own multithreading capabilities, which is used in airThread if !TEEM_PTHREAD, and we
-## are on Windows.
-TEEM_PTHREAD_IPATH ?=
-TEEM_PTHREAD_LPATH ?=
-TEEM_PTHREAD_LMORE ?=
-## Header file is <pthread.h>
-PTHREAD.lname := pthread
-air.Externs += PTHREAD
-
## LEVMAR: Levenberg-Marquardt from https://users.ics.forth.gr/~lourakis/levmar/
+## Used for non-linear fitting in some diffusion model estimation
+##
+# TEEM_LEVMAR ?= # uncomment to enable
TEEM_LEVMAR_IPATH ?=
TEEM_LEVMAR_LPATH ?=
TEEM_LEVMAR_LMORE ?=
-## Header file is <levmar.h>
+# may want: TEEM_LEVMAR_LMORE ?= lapack blas
+# Header file is <levmar.h>
LEVMAR.lname := levmar
ten.Externs += LEVMAR
elf.Externs += LEVMAR
## FFTW3: FFTW version 3 from https://www.fftw.org/
+## Powers nrrdFFT() and "unu fft"
+# TEEM_FFTW3 ?= # uncomment to enable
TEEM_FFTW3_IPATH ?=
TEEM_FFTW3_LPATH ?=
TEEM_FFTW3_LMORE ?=
-## Header file is <fftw3.h>
+# Header file is <fftw3.h>
FFTW3.lname := fftw3
nrrd.Externs += FFTW3
+
+## PTHREAD: use pthread-based multi-threading in airThreads, which enables multi-threaded
+## volume rendering and other things. Note that Windows has its own multithreading
+## capabilities, which are used in airThread if !TEEM_PTHREAD and we are compiling on
+## Windows.
+# TEEM_PTHREAD ?= # uncomment to enable
+TEEM_PTHREAD_IPATH ?=
+TEEM_PTHREAD_LPATH ?=
+TEEM_PTHREAD_LMORE ?=
+# Header file is <pthread.h>
+PTHREAD.lname := pthread
+air.Externs += PTHREAD
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|