source tree refactor and build system (to be completed)

This commit is contained in:
John Doe 2021-05-11 22:44:13 +02:00
parent cc79dd5152
commit bbc0309591
121 changed files with 259 additions and 290 deletions

115
.gitignore vendored
View File

@ -1,19 +1,18 @@
lib/*.o build
lib/t
lib/*.fimg
lib/*.png
lib/*.gif
# src/lib/*.o
src/lib/t
src/lib/*.fimg
src/lib/*.png
src/lib/*.gif
*.o
*.a *.a
gmon.out gmon.out
*.pnm *.pnm
*.fimg *.fimg
essai
MANIFEST
tarball
*/*.ps */*.ps
doc/*.toc doc/*.toc
@ -26,62 +25,62 @@ doc/*.ind
doc/co*.tex doc/co*.tex
doc/foo.html doc/foo.html
funcs/t src/funcs/t
funcs/*.o src/funcs/*.o
funcs/*.png src/funcs/*.png
funcs/V/* src/funcs/V/*
funcs/*.gif src/src/funcs/*.gif
funcs/*.fits src/funcs/*.fits
funcs/*.tiff src/funcs/*.tiff
funcs/toto src/funcs/toto
scripts/*.fimg scripts/*.fimg
scripts/*.pnm scripts/*.pnm
scripts/*.gif scripts/*.gif
v4l2/t src/v4l2/t
v4l2/capture src/v4l2/capture
v4l2/grabvidseq src/v4l2/grabvidseq
v4l2/*.o src/v4l2/*.o
v4l2/*.ppm src/v4l2/*.ppm
v4l2/*.png src/v4l2/*.png
v4l2/*.fits src/v4l2/*.fits
v4l2/*.tiff src/v4l2/*.tiff
v4l2/video-infos src/v4l2/video-infos
v4l2/nc-camcontrol src/v4l2/nc-camcontrol
tools/fimg2png # tools/fimg2png
tools/fimg2pnm # tools/fimg2pnm
tools/fimg2tiff # tools/fimg2tiff
tools/fimg2fits # tools/fimg2fits
tools/fimg2text # tools/fimg2text
tools/fimgstats # tools/fimgstats
tools/fimghalfsize # tools/fimghalfsize
tools/mkfimg # tools/mkfimg
tools/png2fimg # tools/png2fimg
tools/addtga2fimg # tools/addtga2fimg
tools/addpnm2fimg # tools/addpnm2fimg
tools/cumulfimgs # tools/cumulfimgs
tools/fimgops # tools/fimgops
tools/fimgfx # tools/fimgfx
tools/*.png src/tools/*.png
tools/*.tiff src/tools/*.tiff
Fonderie/*.o extras/Fonderie/*.o
Fonderie/*.png extras/Fonderie/*.png
Fonderie/*.pnm extras/Fonderie/*.pnm
Fonderie/*.gif extras/Fonderie/*.gif
Fonderie/*.fimg extras/Fonderie/*.fimg
Fonderie/fonderie extras/extras/Fonderie/fonderie
Fonderie/interpolator extras/Fonderie/interpolator
Fonderie/t extras/Fonderie/t
Fonderie/singlepass extras/Fonderie/singlepass
Fonderie/crapdef.h extras/Fonderie/crapdef.h
Fonderie/crapstr.h extras/Fonderie/crapstr.h
experiment/assemblage extras/experiment/assemblage
experiment/extracteur extras/experiment/extracteur
experiment/*.fimg extras/experiment/*.fimg
experiment/*.pnm extras/experiment/*.pnm
experiment/*.o extras/experiment/*.o

View File

@ -1,6 +0,0 @@
#
# This file is the 'grandmasta' of the compilation process.
# for now, this is juste a wip idea.
#

View File

@ -1,34 +1,72 @@
#################################################### # CC_OPTS = -Wall -fpic -g -pg -no-pie -DDEBUG_LEVEL=0
# Before running make, you must have # # LD_OPTS = libfloatimg.a -pg -lm
# a look to the 'build.sh' script ! #
####################################################
COPT = -Wall -fpic -g -pg -no-pie -DDEBUG_LEVEL=0 LIB_DIR = build/lib
LDOPT = libfloatimg.a -pg -lm
all: essai OBJ_DIR = build/obj
#--------------------------------------------------------------- STATIC_LIB = $(LIB_DIR)/libfloatimg-lib.a
essai: essai.c libfloatimg.a floatimg.h Makefile DYN_LIB = $(LIB_DIR)/libfloatimg.so
gcc $(COPT) $< $(LDOPT) -lpnglite -lz -o $@
#--------------------------------------------------------------- VERBOSITY = 0
TOTAR = *.[ch] Makefile *.sh *.md \ all: lib funcs tools
doc/the*.tex doc/mk*.sh doc/*.txt \
funcs/*.[ch] funcs/Makefile \
tools/*.[ch] tools/*.sh tools/README.md tools/Makefile \
v4l2/*.[ch] v4l2/Makefile \
scripts/*.sh scripts/README.md \
lib/*.[ch] lib/Makefile
lines: $(TOTAR) # shared: $(DYN_LIB)
@wc $(TOTAR) | sort -n
tarball: $(TOTAR) # $(DYN_LIB): lib funcs
date > tarball
ls $(TOTAR) | sed 's/^/FloatImg\//' > MANIFEST lib:
( cd .. ; tar zcvf floatimg.tar.gz `cat FloatImg/MANIFEST` ) $(MAKE) -C src/lib all
funcs: lib
$(MAKE) -C src/funcs
# link lib & funcs for shared library
echo "int verbosity = $(VERBOSITY);" > $(OBJ_DIR)/verbosity.c
gcc -c $(OBJ_DIR)/verbosity.c -o $(OBJ_DIR)/verbosity.o
gcc -shared $(OBJ_DIR)/*.o -lnetpbm -lpnglite -lcfitsio -ltiff -lz -lm -o $(DYN_LIB)
tools:
mkdir -p build/bin
$(MAKE) -C src/tools
clean:
$(MAKE) -C src/lib clean
$(MAKE) -C src/funcs clean
$(MAKE) -C src/tools clean
rm -rf "./build"
install: all
cp src/floatimg.h /usr/local/include
cp build/lib/* /usr/local/lib
cp build/bin/* /usr/local/bin
# all: essai
# #---------------------------------------------------------------
# essai: essai.c libfloatimg.a floatimg.h Makefile
# gcc $(COPT) $< $(LDOPT) -lpnglite -lz -o $@
# #---------------------------------------------------------------
# TOTAR = *.[ch] Makefile *.sh *.md \
# doc/the*.tex doc/mk*.sh doc/*.txt \
# funcs/*.[ch] funcs/Makefile \
# tools/*.[ch] tools/*.sh tools/README.md tools/Makefile \
# v4l2/*.[ch] v4l2/Makefile \
# scripts/*.sh scripts/README.md \
# lib/*.[ch] lib/Makefile
# lines: $(TOTAR)
# @wc $(TOTAR) | sort -n
# tarball: $(TOTAR)
# date > tarball
# ls $(TOTAR) | sed 's/^/FloatImg\//' > MANIFEST
# ( cd .. ; tar zcvf floatimg.tar.gz `cat FloatImg/MANIFEST` )
# #---------------------------------------------------------------
#---------------------------------------------------------------

View File

@ -1,3 +1,14 @@
# FloatImg4PythonBinding
Un fork de la galactique bibliothèque FloatImg de tTh, réaménagé pour permettre une utilisation depuis Python avec l'embryonnaire binding https://git.tetalab.org/Mutah/python-FloatImg/ (seulement sur la branche develop pour le moment)
Pas de révolution mais :
- production d'une bibliothèque partagée
- arborescence remanié : les meubles ont changés de place : les sources sont dans `src`, les expérimentations dans `extra` et les binaires sont produits dans `build`
- build system : un Makefile racine avec des cibles générales : `all` pour tout builder, `lib` pour la bibliothèque de base, `funcs`
# Traitement des images en virgule flottante. # Traitement des images en virgule flottante.
C'est d"abord un ensemble de fonctions pour traiter des images avec une énorme dynamique C'est d"abord un ensemble de fonctions pour traiter des images avec une énorme dynamique
@ -30,15 +41,17 @@ Bien entendu, avant tout, il faut installer quelques outils et
dépendances. Je vais tenter de les lister dans le plus grand dépendances. Je vais tenter de les lister dans le plus grand
désordre (à la sauce Debian) : désordre (à la sauce Debian) :
```bash
sudo apt install libtiff-dev libpnglite-dev liblo-dev libv4l2-dev libcfitsio-dev libnetpbm-dev
``` ```
apt install libtiff-dev
apt install libpnglite-dev Sauce Ubuntu :
apt install liblo-dev
apt install libv4l2-dev ```bash
apt install libcfitsio-dev sudo apt install libtiff-dev libpnglite-dev liblo-dev libv4l-dev libcfitsio-dev libnetpbm10-dev libncurses5-dev
apt install libnetpbm-dev
``` ```
Certains outils externes sont aussi utiles : Certains outils externes sont aussi utiles :
- gnuplot - gnuplot

View File

@ -1,39 +0,0 @@
#!/bin/bash
# ------------------------------------------------------------------
function build
{
echo ============= $1 ==============
curdir=${PWD}
cd $1
make
error=$?
cd ${curdir}
if [ ${error} -ne 0 ]
then
echo === error on $1 = ${error}
exit 1
fi
}
# ------------------------------------------------------------------
build lib
build funcs
build tools
build v4l2
build Fonderie
# ------------------------------------------------------------------
make
# ------------------------------------------------------------------

View File

@ -2,8 +2,16 @@
# Please, use the 'Gloabl.makefile' system ! # Please, use the 'Gloabl.makefile' system !
LIB_DIR = ../../build/lib
OBJ_DIR = ../../build/obj
STATIC_LIB = $(LIB_DIR)/libfloatimg.a
DYN_OBJ = $(OBJ_DIR)/libfloatimg-funcs.o
COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0 COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0
DEPS = ../floatimg.h Makefile DEPS = ../floatimg.h Makefile
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \ OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
@ -14,6 +22,8 @@ OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
displacement.o dithering.o plasmas.o incrustator.o \ displacement.o dithering.o plasmas.o incrustator.o \
recurse.o recurse.o
all: $(OBJS) $(STATIC_LIB) $(DYN_OBJ)
#--------------------------------------------------------------- #---------------------------------------------------------------
t: t.c $(DEPS) ../libfloatimg.a tests.o t: t.c $(DEPS) ../libfloatimg.a tests.o
@ -31,10 +41,16 @@ tests.o: tests.c tests.h $(DEPS)
#--------------------------------------------------------------- #---------------------------------------------------------------
# upper-level functions # upper-level functions
../libfloatimg.a: $(OBJS) $(STATIC_LIB): $(OBJS)
$(AR) r $@ $? $(AR) r $@ $?
# ###
$(DYN_OBJ): $(OBJS)
mkdir -p $(OBJ_DIR)
ld -Ur -o $@ $?
clean:
rm -rf $(OBJS) $(STATIC_LIB) $(DYN_OBJ)
recurse.o: recurse.c $(DEPS) recurse.o: recurse.c $(DEPS)
gcc $(COPT) -c $< gcc $(COPT) -c $<

View File

@ -2,6 +2,14 @@
# building the base library # building the base library
# #
LIB_DIR = ../../build/lib
STATIC_LIB = $(LIB_DIR)/libfloatimg.a
OBJ_DIR = ../../build/obj
DYN_OBJ = $(OBJ_DIR)/libfloatimg-lib.o
COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0 COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0
OBJS = fimg-core.o fimg-pnm.o fimg-file.o fimg-math.o \ OBJS = fimg-core.o fimg-pnm.o fimg-file.o fimg-math.o \
@ -13,16 +21,24 @@ DEPS = Makefile ../floatimg.h
# modify it 'as you like' # modify it 'as you like'
AR=ar AR=ar
all: $(OBJS) ../libfloatimg.a all: $(OBJS) $(STATIC_LIB) $(DYN_OBJ)
t: t.c ../libfloatimg.a $(DEPS) # t: t.c ../libfloatimg.a $(DEPS)
gcc $(COPT) $< ../libfloatimg.a -lpnglite -lz -lm -o $@ # gcc $(COPT) $< ../libfloatimg.a -lpnglite -lz -lm -o $@
clean:
rm -rf $(OBJS) $(STATIC_LIB) $(DYN_OBJ)
# -------------------------------------------- # --------------------------------------------
../libfloatimg.a: $(OBJS) $(STATIC_LIB): $(OBJS)
mkdir -p $(LIB_DIR)
$(AR) r $@ $? $(AR) r $@ $?
$(DYN_OBJ): $(OBJS) # verbosity.o
mkdir -p $(OBJ_DIR)
ld -Ur -o $@ $?
fimg-core.o: fimg-core.c $(DEPS) fimg-core.o: fimg-core.c $(DEPS)
gcc $(COPT) -c $< gcc $(COPT) -c $<

81
src/tools/Makefile Normal file
View File

@ -0,0 +1,81 @@
#
# makefile for floatimg tools
# use with caution
#
# PLEASE ! update to the 'Global.makefile' concept !
#
COPT = -Wall -fpic -g -DDEBUG_LEVEL=0
LD_OPTS = -lm
STATIC_LIB = ../../build/lib/libfloatimg.a
DEPS = ../floatimg.h $(STATIC_LIB) Makefile
BIN_DIR = ../../build/bin
EXECUTABLES = $(BIN_DIR)/fimg2pnm $(BIN_DIR)/mkfimg $(BIN_DIR)/png2fimg \
$(BIN_DIR)/fimgstats $(BIN_DIR)/fimg2png $(BIN_DIR)/fimg2tiff \
$(BIN_DIR)/fimg2text $(BIN_DIR)/fimg2fits $(BIN_DIR)/addpnm2fimg \
$(BIN_DIR)/cumulfimgs $(BIN_DIR)/fimgops $(BIN_DIR)/fimgfx \
$(BIN_DIR)/fimghalfsize
# ----------
all: fimg2pnm mkfimg png2fimg fimgstats fimg2png \
fimg2tiff fimg2text fimg2fits \
addpnm2fimg cumulfimgs fimgops fimgfx \
fimghalfsize
clean:
rm -rf $(EXECUTABLES)
fimgstats: fimgstats.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
cumulfimgs: cumulfimgs.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
mkfimg: mkfimg.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
fimgops: fimgops.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
fimgfx: fimgfx.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
fimghalfsize: fimghalfsize.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
fimg2pnm: fimg2pnm.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
fimg2fits: fimg2fits.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -lcfitsio -o $(BIN_DIR)/$@ $(LD_OPTS)
fimg2png: fimg2png.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -lpnglite -lz -o $(BIN_DIR)/$@ $(LD_OPTS)
fimg2text: fimg2text.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
fimg2tiff: fimg2tiff.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -ltiff -o $(BIN_DIR)/$@ $(LD_OPTS)
#
# this tool require an external library
# http://la.buvette.org/devel/libimage/libimage.html
#
addtga2fimg: addtga2fimg.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -limageSO -o $(BIN_DIR)/$@ $(LD_OPTS)
addpnm2fimg: addpnm2fimg.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
# if "undefined reference to crc32" then "use -lz"
png2fimg: png2fimg.c $(DEPS)
gcc $(COPT) $< $(STATIC_LIB) -lpnglite -lz -o $(BIN_DIR)/$@ $(LD_OPTS)

Some files were not shown because too many files have changed in this diff Show More