|
From: <kin...@us...> - 2025-08-30 01:38:15
|
Revision: 7337
http://sourceforge.net/p/teem/code/7337
Author: kindlmann
Date: 2025-08-30 01:38:13 +0000 (Sat, 30 Aug 2025)
Log Message:
-----------
more descriptive comments, changed some variable names
Modified Paths:
--------------
teem/trunk/src/GNUmakefile
teem/trunk/src/make/externals.mk
Modified: teem/trunk/src/GNUmakefile
===================================================================
--- teem/trunk/src/GNUmakefile 2025-08-29 22:19:26 UTC (rev 7336)
+++ teem/trunk/src/GNUmakefile 2025-08-30 01:38:13 UTC (rev 7337)
@@ -28,7 +28,7 @@
#### 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 uses it.
+#### 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
@@ -283,20 +283,8 @@
maybe.prefixen = $(if $(2),$(foreach P,$(2),$(1)$(P)))
Externs.dashI = $(call maybe.prefixen,-I,$(strip $(call evallist,$(call forExtern,$(1),TEEM_XXX_IPATH))))
Externs.dashL = $(call maybe.prefixen,-L,$(strip $(call evallist,$(call forExtern,$(1),TEEM_XXX_LPATH))))
-Externs.llink = $(call evallist,$(call forExtern,$(1),XXX.llink))
+Externs.llink = $(call maybe.prefixen,-l,$(strip $(call evallist,$(call forExtern,$(1),TEEM_XXX_LNAME))))
-## DEBUG
-#X = PNG
-#$(warning wantsExtern($(X))=$(call wantsExtern,$(X)))
-#$(warning Externs=$(Externs))
-#$(warning forExtern(nrrd ten air tijk,-DTEEM_XXX=1): $(call forExtern,nrrd ten air tijk,-DTEEM_XXX=1))
-#L = ten
-#$(warning Externs.dashI($(L)): $(call Externs.dashI,$(L)))
-#$(warning Externs.dashL($(L)): $(call Externs.dashL,$(L)))
-#$(warning Externs.llink($(L)): $(call Externs.llink,$(L)))
-#$(error STOPPING)
-# TEEM_PTHREAD= TEEM_PNG= TEEM_LEVMAR=1 make --warn-undefined-variables
-
#######################################
## Create missing directories as needed
Modified: teem/trunk/src/make/externals.mk
===================================================================
--- teem/trunk/src/make/externals.mk 2025-08-29 22:19:26 UTC (rev 7336)
+++ teem/trunk/src/make/externals.mk 2025-08-30 01:38:13 UTC (rev 7337)
@@ -17,73 +17,100 @@
# along with this library; if not, see <https://www.gnu.org/licenses/>.
#
-## AllExterns: list of all the identifiers for the various external libraries that we can
+AllExterns := PNG ZLIB BZIP2 PTHREAD LEVMAR FFTW3
+
+## 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 xterns below HAS TO reflect the ordering on the
-## link line (so PNG preceeds ZLIB)
+## explicitly, but the ordering of the externals in AllExterns above HAS TO reflect the
+## ordering on the link line (so PNG preceeds ZLIB)
##
-## External EXT is enabled during make by setting the shell variable TEEM_EXT (just set
-## it, to anything EXCEPT "0"), either by "export TEEM_EXT; ...; make" or by
-## "TEEM_EXT= make" or "TEEM_EXT=1 make"
+## 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:
+## 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.
##
+## 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
+##
+## 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
+##
## TeemV2 renamed moved the variables describing each external to here (since there are
-## no longer multiple architectures to simultaneously support). The TEEM_EXT_IPATH and
-## TEEM_EXT_LPATH variables have kept their name, but now their names are accurate: you
-## no longer start TEEM_EXT_IPATH with "-I" or TEEM_EXT_LPATH with "-L". They really just
-## just be the path; 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.
-##
-AllExterns = PNG ZLIB BZIP2 PTHREAD LEVMAR FFTW3
+## no longer multiple architectures to simultaneously support). For each 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!
+## You no longer start TEEM_EXT_IPATH with "-I" or TEEM_EXT_LPATH with "-L".
+## 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_LNAME: the lib in "-llib" option to link with the library. Usually doesn't
+## have to change, but you may have to be change if the library depends on other libraries
+## e.g. TEEM_LEVMAR_LNAME ?= levmar 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_IPATH ?=
+TEEM_PNG_LPATH ?=
## Header file is <png.h>
-PNG.llink = -lpng
+TEEM_PNG_LNAME ?= png
nrrd.Externs += PNG
-TEEM_PNG_IPATH ?=
-TEEM_PNG_LPATH ?=
## ZLIB: for the zlib library (in gzip and PNG image format) from https://zlib.net/
## Using zlib enables the "gzip" nrrd data encoding
## Header file is <zlib.h>.
-ZLIB.llink = -lz
-nrrd.Externs += ZLIB
TEEM_ZLIB_IPATH ?=
TEEM_ZLIB_LPATH ?=
+TEEM_ZLIB_LNAME ?= z
+nrrd.Externs += ZLIB
## BZIP2: for the bzip2 compression library, from https://sourceware.org/bzip2/
## Using bzip2 enables the "bzip2" nrrd data encoding.
+TEEM_BZIP2_IPATH ?=
+TEEM_BZIP2_LPATH ?=
## Header file is <bzlib.h>.
-BZIP2.llink = -lbz2
+TEEM_BZIP2_LNAME ?= bz2
nrrd.Externs += BZIP2
-TEEM_BZIP2_IPATH ?=
-TEEM_BZIP2_LPATH ?=
## 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 ?=
## Header file is <pthread.h>
-PTHREAD.llink = -lpthread
+TEEM_PTHREAD_LNAME ?= pthread
air.Externs += PTHREAD
-TEEM_PTHREAD_IPATH ?=
-TEEM_PTHREAD_LPATH ?=
## LEVMAR: Levenberg-Marquardt from https://users.ics.forth.gr/~lourakis/levmar/
+TEEM_LEVMAR_IPATH ?=
+TEEM_LEVMAR_LPATH ?=
## Header file is <levmar.h>
-LEVMAR.llink = -llevmar
+TEEM_LEVMAR_LNAME ?= levmar
ten.Externs += LEVMAR
elf.Externs += LEVMAR
-TEEM_LEVMAR_IPATH ?=
-TEEM_LEVMAR_LPATH ?=
## FFTW3: FFTW version 3 from https://www.fftw.org/
+TEEM_FFTW3_IPATH ?=
+TEEM_FFTW3_LPATH ?=
## Header file is <fftw3.h>
-FFTW3.llink = -lfftw3
+TEEM_FFTW3_LNAME ?= fftw3
nrrd.Externs += FFTW3
-TEEM_FFTW3_IPATH ?=
-TEEM_FFTW3_LPATH ?=
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|