From eb9a2d93a951cfcf367d9e0ec8481b9e71b0d3d9 Mon Sep 17 00:00:00 2001 From: Antonin Descampe Date: Fri, 4 Mar 2011 10:53:27 +0000 Subject: [PATCH] updated autotools files to improve build and install procedures (credit to Vincent Torri) --- Makefile.am | 5 ++ codec/Makefile.am | 34 ++++----- libjp3dvm/Makefile.am | 167 ++++++++++++++++++++---------------------- 3 files changed, 98 insertions(+), 108 deletions(-) diff --git a/Makefile.am b/Makefile.am index dc3f81d6..422f235b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1 +1,6 @@ +MAINTAINERCLEANFILES = Makefile.in + SUBDIRS = libjp3dvm codec + +EXTRA_DIST = \ +CMakeLists.txt diff --git a/codec/Makefile.am b/codec/Makefile.am index 3f82c1b4..52811acf 100644 --- a/codec/Makefile.am +++ b/codec/Makefile.am @@ -1,27 +1,23 @@ -#jp3d/codec/ -USERLIBS = -INCLUDES = -I. -I../libjp3dvm -CFLAGS = -Wall $(INCLUDES) - -if with_sharedlibs -CFLAGS += -DOPJ_EXPORTS -else -CFLAGS += -DOPJ_STATIC -endif +MAINTAINERCLEANFILES = Makefile.in bin_PROGRAMS = jp3d_to_volume volume_to_jp3d LDADD = $(USERLIBS) ../libjp3dvm/libopenjp3dvm.la -jp3d_to_volume_SOURCES = getopt.c convert.c jp3d_to_volume.c +jp3d_to_volume_CPPFLAGS = +jp3d_to_volume_CFLAGS = +jp3d_to_volume_LDADD = $(top_builddir)/jp3d/libjp3dvm/libopenjp3dvm.la -lm +jp3d_to_volume_SOURCES = getopt.c convert.c jp3d_to_volume.c convert.h -volume_to_jp3d_SOURCES = getopt.c convert.c volume_to_jp3d.c +volume_to_jp3d_CPPFLAGS = +volume_to_jp3d_CFLAGS = +volume_to_jp3d_LDADD = $(top_builddir)/jp3d/libjp3dvm/libopenjp3dvm.la +volume_to_jp3d_SOURCES = getopt.c convert.c volume_to_jp3d.c convert.h -REPBIN=$(bin_PROGRAMS) +EXTRA_DIST = \ +CMakeLists.txt \ +windirent.h -all-local: - $(INSTALL) -d ../../bin - $(INSTALL) $(bin_PROGRAMS) ../../bin - @(for file in ${REPBIN} ; do \ - echo "Installing: ${prefix}/bin/$${file}" >> ../.report.txt ; \ - done) +install-data-hook: + @echo -e " (B)\t\t$(bindir)/jp3d_to_volume$(EXEEXT)" >> $(top_builddir)/report.txt + @echo -e " (B)\t\t$(bindir)/volume_to_jp3d$(EXEEXT)" >> $(top_builddir)/report.txt diff --git a/libjp3dvm/Makefile.am b/libjp3dvm/Makefile.am index 4b5c3b9c..d0bdba06 100644 --- a/libjp3dvm/Makefile.am +++ b/libjp3dvm/Makefile.am @@ -1,99 +1,88 @@ -#libjp3dvm -# -MAJOR = @JP3D_MAJOR_NR@ -MINOR = @JP3D_MINOR_NR@ -BUILD = @JP3D_BUILD_NR@ -CURRENT=`expr $(MAJOR) + $(MINOR)` +MAINTAINERCLEANFILES = Makefile.in lib_LTLIBRARIES = libopenjp3dvm.la -libopenjp3dvm_la_LDFLAGS = -no-undefined \ - -version-info $(CURRENT):$(BUILD):$(MINOR) +includesdir = ${includedir}/openjpeg3d-@JP3D_MAJOR_NR@.@JP3D_MINOR_NR@ +includes_HEADERS = openjpeg3d.h -SRCS = bio.c cio.c dwt.c event.c jp3d.c jp3d_lib.c volume.c mct.c mqc.c \ - openjpeg.c pi.c raw.c t1.c t1_3d.c t2.c tcd.c tgt.c +libopenjp3dvm_la_LDFLAGS = -no-undefined -version-info @lt_version@ -INCLS = t1_3d.h bio.h cio.h dwt.h event.h fix.h int.h jp3d.h jp3d_lib.h \ - volume.h mct.h mqc.h pi.h raw.h t1.h t2.h tcd.h tgt.h opj_includes.h +libopenjp3dvm_la_CPPFLAGS = \ +-I. \ +-I$(top_srcdir)/jp3d/libjp3dvm \ +-I$(top_builddir)/jp3d/libjp3dvm +libopenjp3dvm_la_CFLAGS = +libopenjp3dvm_la_LIBADD = -lm +libopenjp3dvm_la_SOURCES = \ +bio.c \ +cio.c \ +dwt.c \ +event.c \ +jp3d.c \ +jp3d_lib.c \ +volume.c \ +mct.c \ +mqc.c \ +openjpeg.c \ +pi.c \ +raw.c \ +t1.c \ +t1_3d.c \ +t2.c \ +tcd.c \ +tgt.c \ +bio.h \ +cio.h \ +dwt.h \ +event.h \ +fix.h \ +int.h \ +jp3d.h \ +jp3d_lib.h \ +mct.h \ +mqc.h \ +opj_includes.h \ +pi.h \ +raw.h \ +t1.h \ +t1_3d.h \ +t2.h \ +tcd.h \ +tgt.h \ +volume.h -libopenjp3dvm_la_SOURCES = $(SRCS) $(INCLS) - -includedir = ${prefix}/include/openjpeg3d-$(MAJOR).$(MINOR) -include_HEADERS = openjpeg3d.h - -# Converts cr/lf to just lf -DOS2UNIX = dos2unix - -dos2unix: - @$(DOS2UNIX) $(SRCS) $(INCLS) - -INCLUDES = -I../.. -I. -COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 - -if with_sharedlibs -COMPILERFLAGS += -DOPJ_EXPORTS -else -COMPILERFLAGS += -DOPJ_STATIC -libopenjp3dvm_la_LDFLAGS += -static -endif - -CFLAGS = $(COMPILERFLAGS) $(INCLUDES) -#CFLAGS += -DJP3D_VERSION="\"$(MAJOR).$(MINOR).$(BUILD)\"" - -headerdir = openjpeg3d-$(MAJOR).$(MINOR) - -all-local: - @$(INSTALL) -d ../../bin - @rm -rf .report_dir - @$(INSTALL) -d .report_dir -if build_so -if with_sharedlibs - @find .libs -type f -name "*\.so*" -exec cp -P {} .report_dir \; - @find .libs -type l -name "*\.so*" -exec cp -P {} .report_dir \; -else !with_sharedlibs - @find .libs -type f -name "*\.a" -exec cp -P {} .report_dir \; -endif !with_sharedlibs -endif -if build_dll -if with_sharedlibs - @find .libs -type f -name "*\.dll" -exec cp -P {} .report_dir \; - @find .libs -type f -name "*\.a" -exec cp -P {} .report_dir \; -else !with_sharedlibs - @find .libs -type f -name "*\.a" -exec cp -P {} .report_dir \; -endif !with_sharedlibs -endif -if build_dylib -if with_sharedlibs - @find .libs -type f -name "*\.dylib" -exec cp -P {} .report_dir \; -else !with_sharedlibs - @find .libs -type l -name "*\.a" -exec cp -P {} .report_dir \; -endif !with_sharedlibs -endif - @cp -a .report_dir/* ../../bin - @echo "" > ../.report.txt - @echo "Installing: ${prefix}/include/${headerdir}/" >> ../.report.txt - @echo "Installing: ${prefix}/include/${headerdir}/openjpeg3d.h" >> ../.report.txt - @echo "Installing: ${prefix}/lib/libopenjp3dvm.la" >> ../.report.txt - @(cd .report_dir; \ - for file in `ls *.dll 2> /dev/null` ; do \ - echo "Installing: ${prefix}/bin/$${file}" >> ../../.report.txt ; \ - done ; \ - for file in `ls *.a 2> /dev/null` ; do \ - echo "Installing: ${prefix}/lib/$${file}" >> ../../.report.txt ; \ - done ; \ - for file in `ls *.so* 2> /dev/null` ; do \ - echo "Installing: ${prefix}/lib/$${file}" >> ../../.report.txt ; \ - done ; \ - for file in `ls *.dylib 2> /dev/null` ; do \ - echo "Installing: ${prefix}/lib/$${file}" >> ../../.report.txt ; \ - done \ - ) - @rm -rf .report_dir +EXTRA_DIST = \ +CMakeLists.txt install-data-hook: - (cd $(DESTDIR)${prefix}/include && rm -f openjpeg3d.h) - (cd $(DESTDIR)${prefix}/include && \ - $(LN_S) ${headerdir}/openjpeg3d.h openjpeg3d.h) + cd $(DESTDIR)$(includedir) && \ + rm -f openjpeg3d.h && \ + $(LN_S) openjpeg3d-@JP3D_MAJOR_NR@.@JP3D_MINOR_NR@/openjpeg3d.h \ + openjpeg3d.h + @echo -e " (LA)\t$(libdir)/libopenjp3dvm.la" >> $(top_builddir)/report.txt + @( $(call solist) ) >> $(top_builddir)/report.txt + @echo -e " (A)\t\t$(base)/$(a)" >> $(top_builddir)/report.txt + @echo -e " (H)\t\t$(includedir)/openjpeg3d-$(MAJOR_NR).$(MINOR_NR)/openjpeg3d.h" >> $(top_builddir)/report.txt + @echo -e " (LN)\t$(includedir)/openjpeg3d.h" >> $(top_builddir)/report.txt uninstall-hook: - (cd $(DESTDIR)${prefix}/include && rm -rf openjpeg3d.h ${headerdir}) + rm -f $(DESTDIR)$(includedir)/openjpeg3d.h + +solist = $(foreach f, $(dll) $(so), echo -e ' $(SO_PREFIX)\t$(base)/$(f)' ;) +get_tok = $(shell grep -E "^$(1)=" $(lib_LTLIBRARIES) | cut -d "'" -f 2) +base = $(call get_tok,libdir) +so = $(call get_tok,library_names) +a = $(call get_tok,old_library) + +if HAVE_WIN32 +SO_PREFIX = (DLL) +dll = $(call get_tok,dlname) +else +if HAVE_DARWIN +SO_PREFIX = (DY) +dll = +else +SO_PREFIX = (SO) +dll = +endif +endif