|
From: <kin...@us...> - 2025-08-30 02:17:27
|
Revision: 7340
http://sourceforge.net/p/teem/code/7340
Author: kindlmann
Date: 2025-08-30 02:17:24 +0000 (Sat, 30 Aug 2025)
Log Message:
-----------
fixing more bugs with handling externals
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:16:11 UTC (rev 7339)
+++ teem/trunk/src/GNUmakefile 2025-08-30 02:17:24 UTC (rev 7340)
@@ -279,11 +279,22 @@
$(if $(filter $(X),$($(L).Externs)),\
$(subst XXX,$(X),$(2)))))))
Externs.dashD = $(call forExtern,$(1),-DTEEM_XXX=1)
+# evallist: maps $() over list
evallist = $(foreach var,$(1),$($(var)))
-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 maybe.prefixen,-l,$(strip $(call evallist,$(call forExtern,$(1),TEEM_XXX_LNAME))))
+# prefixen(P,list) prefixes elements of list with P
+prefixen = $(foreach wut,$(2),$(1)$(wut))
+# https://stackoverflow.com/questions/16144115/makefile-remove-duplicate-words-without-sorting
+uniq = $(if $(1), \
+ $(firstword $(1)) \
+ $(call uniq,$(filter-out $(firstword $(1)),$(1))) \
+ )
+# lplp: utility for Processing a List of Per-Library info
+# why use uniq: if multiple Teem libraries use the same external, we don't want the
+# command-line manifestation of the per-library externals to be duplicated
+lplp = $(strip $(call evallist,$(call uniq,$(call forExtern,$(1),$(2)))))
+Externs.dashI = $(call prefixen,-I,$(call lplp,$(1),TEEM_XXX_IPATH))
+Externs.dashL = $(call prefixen,-L,$(call lplp,$(1),TEEM_XXX_LPATH))
+Externs.llink = $(call prefixen,-l,$(call lplp,$(1),XXX.lname TEEM_XXX_LMORE))
#######################################
Modified: teem/trunk/src/make/externals.mk
===================================================================
--- teem/trunk/src/make/externals.mk 2025-08-30 02:16:11 UTC (rev 7339)
+++ teem/trunk/src/make/externals.mk 2025-08-30 02:17:24 UTC (rev 7340)
@@ -61,10 +61,11 @@
## 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
+## 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
@@ -71,16 +72,18 @@
## Using PNG enables the "png" nrrd format.
TEEM_PNG_IPATH ?=
TEEM_PNG_LPATH ?=
+TEEM_PNG_LMORE ?=
## Header file is <png.h>
-TEEM_PNG_LNAME ?= png
+PNG.lname := png
nrrd.Externs += PNG
## 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>.
TEEM_ZLIB_IPATH ?=
TEEM_ZLIB_LPATH ?=
-TEEM_ZLIB_LNAME ?= z
+TEEM_ZLIB_LMORE ?=
+## Header file is <zlib.h>.
+ZLIB.lname := z
nrrd.Externs += ZLIB
## BZIP2: for the bzip2 compression library, from https://sourceware.org/bzip2/
@@ -87,8 +90,9 @@
## Using bzip2 enables the "bzip2" nrrd data encoding.
TEEM_BZIP2_IPATH ?=
TEEM_BZIP2_LPATH ?=
+TEEM_BZIP2_LMORE ?=
## Header file is <bzlib.h>.
-TEEM_BZIP2_LNAME ?= bz2
+BZIP2.lname := bz2
nrrd.Externs += BZIP2
## PTHREAD: use pthread-based multi-threading in airThreads. Note that Windows has its
@@ -96,15 +100,17 @@
## are on Windows.
TEEM_PTHREAD_IPATH ?=
TEEM_PTHREAD_LPATH ?=
+TEEM_PTHREAD_LMORE ?=
## Header file is <pthread.h>
-TEEM_PTHREAD_LNAME ?= pthread
+PTHREAD.lname := pthread
air.Externs += PTHREAD
## LEVMAR: Levenberg-Marquardt from https://users.ics.forth.gr/~lourakis/levmar/
TEEM_LEVMAR_IPATH ?=
TEEM_LEVMAR_LPATH ?=
+TEEM_LEVMAR_LMORE ?=
## Header file is <levmar.h>
-TEEM_LEVMAR_LNAME ?= levmar
+LEVMAR.lname := levmar
ten.Externs += LEVMAR
elf.Externs += LEVMAR
@@ -111,6 +117,7 @@
## FFTW3: FFTW version 3 from https://www.fftw.org/
TEEM_FFTW3_IPATH ?=
TEEM_FFTW3_LPATH ?=
+TEEM_FFTW3_LMORE ?=
## Header file is <fftw3.h>
-TEEM_FFTW3_LNAME ?= fftw3
+FFTW3.lname := fftw3
nrrd.Externs += FFTW3
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|